Artix Linux Forum

Artix Linux => Software development => Topic started by: Hitman on 12 May 2022, 14:10:02

Title: Utilities shell script
Post by: Hitman on 12 May 2022, 14:10:02
This is a project i've worked on for the past year and a half, it started off as a tool for personal needs, but after adding setup tools, option selectors and a custom menu, the result is a very user friendly utility.
It includes a service manager for our alternative init systems and more!

Any suggestions are welcome, have fun!
https://gitlab.com/Hitman_47/utilities.sh
Title: Re: Utilities shell script
Post by: cat herders of linux on 12 May 2022, 21:57:26
Cant wait to dive in!

But ill have to until my pc comes next week.
Title: Re: Utilities shell script
Post by: Hitman on 21 May 2022, 23:20:25
V4 released, i added a USB manager, fixed bugs and optimized the shell functions  :)
Title: Re: Utilities shell script
Post by: Hitman on 21 May 2022, 23:32:22
Self refreshing custom menu in terminal mode:

(https://qu.ax/Sgu.gif)

GUI menu in Qarma-qt5

(https://i.postimg.cc/1zCPkcm5/image.png)

GUI menu in plain gtk3 zenity. In the future i will also add KDialog compatibility

(https://i.postimg.cc/ZYdPqJ94/screen.jpg)
Title: Re: Utilities shell script
Post by: cat herders of linux on 22 May 2022, 03:31:43
Playing with it now.  I had a message about optional dependencies.  Good to know.  Will install some of them also.
TY for making this.
Title: Re: Utilities shell script
Post by: cat herders of linux on 22 May 2022, 03:34:18
Code: [Select]
nohup: redirecting stderr to stdout
nohup: failed to run command './Utilities.sh': Permission denied
hp-i7:[catherdersoflinux]:~/Downloads/Utilities/utilities.sh-main$

tried to run it in gui mode.  i had to run it as sh ./Utilities.sh
Title: Re: Utilities shell script
Post by: cat herders of linux on 22 May 2022, 03:42:15
Code: [Select]
brisk-menu 1:0.6.2-1
etcher-bin 1.7.9-1
gtk-theme-material-black 1.8.8-1
hypnotix-git 2.6.r3.g8a74209-1
linux-libre 5.17.3-1
linux-libre-headers 5.17.3-1
mintstick-git r225.c7dd0bc-1
python-pyparted 3.11.7-1
themix-export-spotify-git 1.2.5.r4.g4c09ec3-1
themix-full-git 1.14-1
themix-gui-git 1.14.r45.g1ca70eb2-1
themix-icons-archdroid-git 1.0.2.r1.g775b8c2c0-1
themix-icons-gnome-colors-git 5.5.5.r0.gcd8b05a-2
themix-icons-numix-git 21.10.31.r12.g10898a1dd-1
themix-icons-papirus-git 20220302.r44.gbd9c1565cd-1
themix-icons-suru-plus-aspromauros-git 3.0.r0.gd43a8ec4-1
themix-icons-suru-plus-git 30.0.r2.g9bd895f32-1
themix-import-images-git 1.14.r45.g1ca70eb2-1
themix-plugin-base16-git 1.3.1.r4.g85f85c4-1
themix-theme-materia-git 20210322.r50.gaf63425f-1
themix-theme-oomox-git 1.12.2.r3.gaff8b363-1
trousers 0.3.15-2
ttf-opendyslexic 1-3
vboot-utils 100.14526-1
woeusb 5.2.4-1
Press any key to continue..

my aur packages
Title: Re: Utilities shell script
Post by: Hitman on 22 May 2022, 09:58:00
Glad you like it, enjoy!
About the gui mode not opening from terminal, did you chmod +x the script? It depends on that. i should add a check to do this automatically, or a workaround to execute with sh like you did.
///
Didn't know about the Themix icon themes, i should give them a try. Here's my aur packages
Code: [Select]
7-zip 21.07-6
audacium 1.0.0-3
czkawka-gui 4.1.0-1
dooble 2022.04.04-1
gajim-plugin-omemo 2.7.15-1
gputest 0.7.0-1
icewm-extra-themes 1.2-5
it87-dkms-git 161.77abcbe-1
mprime 307b9-2
mystiq 20.03.23-1
ncurses5-compat-libs 6.3-1
nodejs-localtunnel 2.0.2-1
nspr-hg 4.26-1
nss-hg 3.73.0r16027.4b8ce9641338-1
ocenaudio-bin 3.11.11-1
olive-git continuous.r1621.g41a49c488-1
p7zip-gui 16.02-5
paru 1.10.0-1
qarma-git 85.6ee1a72-1
qdirstat 1.8-1
qjoypad 4.3.1-1
rpcs3-bin 0.0.22-3
uasm 2.55-1
unixbench 5.1.3-4
xnconvert 1.95.0-1
xnviewmp 1.00-1
zenmonitor 1.4.2-2
zenpower-dkms 0.1.12-2
Title: Re: Utilities shell script
Post by: cat herders of linux on 22 May 2022, 15:47:50
i didnt see an instruction for chmod.  is it chmod a+x something something?
Title: Re: Utilities shell script
Post by: Hitman on 23 May 2022, 00:33:52
Yeah. In gui file managers you just mark as executable, like with anything else
It makes me think of people packing elf binaries or scripts in .tar.xyz archives just to have the attributes already set, hehe

V5 coming soon with a disk space analyzer tool, i'll add a check to do chmod +x automatically.
Title: Re: Utilities shell script
Post by: Hitman on 30 May 2022, 05:54:29
V5 released, added the execute permission check, added a brand new disk space analyzer and improved the pacman commands. Enjoy!
Title: Re: Utilities shell script
Post by: Hitman on 30 May 2022, 19:26:17
A preview of some of the functions  :)
(https://i.postimg.cc/QNYwGqKZ/screen.jpg)
Title: Re: Utilities shell script
Post by: cat herders of linux on 30 May 2022, 21:08:27
grep: /etc/sudoers.d/utilities: No such file or directory


what is lsattr?
Title: Re: Utilities shell script
Post by: Hitman on 31 May 2022, 05:42:14
grep: /etc/sudoers.d/utilities: No such file or directory
yeah i forgot the file check, it's for the sudoers password bypass rule, it asks you in the gui, and it creates that file. The error is just cosmetic, i will patch it today.

also for the sudoers rule to check the immutable attribute, it's more "secure" (an overused word, i know)
Title: Re: Utilities shell script
Post by: Hitman on 31 May 2022, 21:04:45
All right, patches are done, in the meantime i found more things that could be improved to make it more robust. So robust in fact that it has a new party piece:

From a root TTY it can open the gui on the user's running session  :D

https://files.catbox.moe/r9e48h.mp4 (https://files.catbox.moe/r9e48h.mp4)
Title: Re: Utilities shell script
Post by: Hitman on 06 June 2022, 23:00:13
New version released V5.2, fixed even more bugs, added ability to work without a running session, added smart service detection and a startup manager (for now only for OpenRC). Enjoy.

(https://i.ibb.co/7gssLTR/2022-06-06-23-52.png) (https://ibb.co/Q8yytqC)
Title: Re: Utilities shell script
Post by: Hitman on 11 June 2022, 22:30:13
V5.5:
added s6-init and fixed runit
added dxvk installer in wine menu
added proper titles in terminal mode with ASCII graphics (plain block characters for now, i need to learn how to do fancy graphics)
improved the script's appearance for easier modifications
further fixed bugs and further optimized the shell

This is a recommended update, not much in features but in overall quality

(https://snipboard.io/ZsiH07.jpg)
Title: Re: Utilities shell script
Post by: Hitman on 20 June 2022, 18:02:17
V5.7:
added settings menu
added ALSA audio device info menu that can launch alsamixer on a selected device
added an option to start a x0vncserver (for now you need to have the passwd file in ~/.vnc/passwd for the option to show)
added an option to terminate running wine programs/server under the wine manager
support for more terminal emulators, Terminator is now considered optional since it's only needed for the tilling terminals under system monitor
some commands that can fill up the screen in terminal mode are now ran through 'less' for scrollback
other small improvements

(https://i.postimg.cc/4dmf2cLy/image.png)

LE: Known bug: Downloaders section broke, will fix it soon
Title: Re: Utilities shell script
Post by: cat herders of linux on 20 June 2022, 23:39:30
sweet!
Title: Re: Utilities shell script
Post by: Hitman on 22 June 2022, 18:50:53
Thanks
i fixed what broke last time

V5.8:
fixed downloaders and cleaned up some of it's functions
added more filtering options in pacman search
further optimized the terminal option selector to reduce/sometimes eliminate flickering in some terminals, also changed the color to yellow/orange for better visibility

TODO: i want to try and port it in the near future, to different shells like zsh, or even to python

if there are more features you would like to add, let me know!
Title: Re: Utilities shell script
Post by: Hitman on 30 June 2022, 17:22:37
V6:

decluttering of the option lists, adding/modifying menus should now be easier
added kdialog support (some misc menus remain zenity only for now)
the separator is now dynamic in the terminal
more paths added in cleanup option
some more consolidations to avoid problems

I've started to port the script to zsh, if everything goes fine it should be ready soon with complete feature parity.

As always, enjoy!

(https://i.postimg.cc/QMmM96Tt/screen05.jpg)
Title: Re: Utilities shell script
Post by: cat herders of linux on 30 June 2022, 19:45:59
looking good
Title: Re: Utilities shell script
Post by: Hitman on 12 July 2022, 00:37:29
V7:

-Initial zsh port! it was quite easy since the syntax is pretty close, so the bulk was just swapping some commands around, it still took a while to get right. i'm not taking full advantage yet of some zsh native features that can bring some big optimizations, expect the structure to change a bit later. Some more testing is of course needed to see if there are any problems, but so far works fine. Give it a try :)

-Navigating in the terminal mode in zsh version you use the right arrow instead of enter to select an option, the read -k/vared of zsh doesn't quite behave like read -n in ba-/sh. For continuity i also ported right arrow alongside enter in the posix-y bash version.

-the service manager and a few other functions are faster to load

-Almost every dynamic function (notably Mount tools, USB manager, Fan control, Settings, ALSA devices) is now auto-refreshing in terminal.

-the menu structure is even easier to understand and modify with dynamic menus. For the posix-y bash version it's createarray <<<, and for the zsh version even easier, just create the array like in a normal menu but with local IFS=$'\n'; in the front. Embed that in a function for autorefresh.
Zsh is also easier to use overall since you barely have to worry about quoting, and where you need splitting just issue command "local setopt sh_word_split" or encapsulate the variable ${=var}, depending on the case. In the future i will remove the unnecessary quotes from my port.

-an option to turn off the autorefresh was added

-tweaked the ansi escape codes in terminal option selector, for bold and more visible text and hidden cursor. Limited max number of array elements to 200 when in the terminal option selector to avoid scrollback issues. The title border is now also dynamic. For this i had to scrap the fancy block characters, they were screwing up the rendering in some terminals anyway.

-zenity --text-info, --question and --warning get kdialog support, what's left are --file-selection, --entry and --scale. Konsole gets proper tab name if used.

-the root GUI options couldn't start without the sudoers rule, i have no idea why, possibly new "security" crap somewhere in coreutils. For now as a workaround they will run in terminal mode. Nothing changes if you use sudoers rule.
with this i also have to investigate Wayland support, but i don't hurry with it, Xorg is here to stay and i'll use it for many years to come.

-fixed cosmetic bugs that creeped in the previous versions

-other misc. improvements

(https://forum.artixlinux.org/index.php?action=dlattach;topic=4030.0;attach=2007;image)
Title: Re: Utilities shell script
Post by: cat herders of linux on 12 July 2022, 03:40:35
cool!
Title: Re: Utilities shell script
Post by: Hitman on 12 July 2022, 16:35:39
:)

hmm, interesting that zsh read complains of invalid option at that line. Can you navigate the menus?
Title: Re: Utilities shell script
Post by: cat herders of linux on 12 July 2022, 22:04:26
:)

hmm, interesting that zsh read complains of invalid option at that line. Can you navigate the menus?
nope.

still it's cool though.

sh works as intended...  is zsh something i need to install?
Title: Re: Utilities shell script
Post by: Hitman on 13 July 2022, 00:29:03
yeah the zsh version is made for zsh shell, it needs it.

curious how it started well with bash, it seemed to ignore the different syntax.

just for posterity, i will continue the zsh and (posix-y) bash versions alongside each other, one day i may even add a python version and do all three.

however at one point i will recommend the zsh version once i manage to do some big optimizations with it's native features. bash is really stripped down compared to zsh, it was just made as replacement for posix shell a while back and it stuck until very recently :)
Title: Re: Utilities shell script
Post by: cat herders of linux on 13 July 2022, 03:32:08
i installed zsh but i think i need to reboot.
Title: Re: Utilities shell script
Post by: Hitman on 18 July 2022, 12:40:10
V7.1
Fixed gui question and some more cosmetic bugs
Fixed installing aur package (bug was introduced in last ~ 2 versions)
Added yaourtix support
Variables get filled in automatically to make the utconfig file more readable
Improved filtering of garbage/irrelevant values in sensors view and improved readability
ZSH: native array substraction and compare used in service manager, even more performance improvement
ZSH: fixed OpenRC startup manager

Enjoy!
Title: Re: Utilities shell script
Post by: Hitman on 20 July 2022, 14:18:02
V7.3
Added Dinit to the startup manager and simplified some operations on dinitctl
More options get hidden automatically if the particular deps. are not present
Solved the launching of root gui options without sudoers rule
Investigated the behavior of root gui options under Wayland, they appear to work fine! the display timeout option will get hidden on it as that didn't work.
Other small optimizations
Fixed cosmetic bugs in kdialog and question/warn messages
ZSH: aur terminal mode and services gui mode broke in the last version, fixed them
The script now runs in /tmp by default always, in file chooser was added an option to point it to the home directory

This is a recommended update, since there are no more outstanding problems. For now i'm thinking about what new utilities to introduce, but consider it be feature complete. :)

Title: Re: Utilities shell script
Post by: cat herders of linux on 20 July 2022, 17:26:25
Woot!  Let me try this out!
Title: Re: Utilities shell script
Post by: Hitman on 30 July 2022, 01:49:37
i ended up with a lot more ideas than anticipated :)

V8:

-Added scrollback in terminal mode! No more limitations on array length, and looks way better on longer menus.
-Added Kernel tools (info about kernels and modules, GRUB and DKMS config updater, kernel module manager load/unload/add to startup)
-Added cdrom /dev/sr0 support in Mount tools (i started using optical media again after 10 years :) )
-Added a fix filesystem option in Mount tools for ext4/xfs (with this occasion now calling it Mount and filesystem tools)
-Added an option to set TearFree in X
-Added mprime and unixbench in diagnostics/benchmark
-Added device name to ALSA devices menu
-tidied up the boot commands, if you use them please review, some hacky ones were removed
-minor cosmetic fix: some redundant case items were removed and some potential path issues in root mode were fixed
-minor cosmetic fix: autodetermine runlevels in OpenRC startup options
-minor cosmetic fix: in menus list, a better check if a space is empty
Title: Re: Utilities shell script
Post by: Hitman on 02 August 2022, 13:36:29
V8.0.5:

-Added an option to disable the scrollback in terminal mode (i only did my testing in Alacritty which is gpu accelerated, when i tested later on a slower pc with normal terminal it got a bit laggy when there was lots of text)
-Disabled text wrapping when scrollback is enabled to avoid overflowing lines
-Got rid of the subshell in dynamic menus (in zsh the other elements can be quoted and moved inside the array, in posix-y bash the createarray function can be fed directly). This improves the script's aspect further and is probably a small performance benefit
-More redundancies cleaned up in the selector arguments function
-More small issues fixed in zsh version (recommended update if you use it)
-Updated readme
Title: Re: Utilities shell script
Post by: Hitman on 13 August 2022, 23:00:19
V8.1:

This version is focused on solving some left over UX hiccups

- no more need to restart the script when changing preferred terminal emulator
- in the submenu of Mount tools only the relevant and/or supported options appear + drive info was added + doesn't longer hang after opening file manager
- downloaders are (mostly) ported to terminal mode + the target download directory has now free space indicated next to it
- in the main menu, the remaining options that require gui or display (-wine, -xvnc/tf/disp) are now hidden in terminal mode to avoid confusion
- help text now shows in the non root mode too on invalid argument
- display timeout option, show the current setting in the main menu
- terminal, renamed the text for some options where it said "click ..." in both modes, or when it was missing the space before inputting the value
- archiving tools no longer exits the entire script + checks valid directory + fixed some hiccups
- if 2 or more consecutive fields are empty in the terminal option selector, skip to a valid option as expected
- more small optimizations in regards to some recent changes (autorefreshing in terminal) and for uniformization of certain workarounds

enjoy  :)
Title: Re: Utilities shell script
Post by: Hitman on 02 September 2022, 22:16:20
Good evening!

V9:

- "System - Cleanup" was moved into a new Maintenance menu which has added defrag (for ext4/xfs) and fstrim commands
- Kernel tools - added an option to view and set kernel parameters
- The option for vncserver will ask to create the passwd file if it doesn't exist, making it always available
- The option to set TearFree in X11 now toggles between on and off
- Implemented searching in terminal menus! Press the Insert key, enter a query and it will skip to the first matching option
- Allow pressing any key to continue in terminal sleep mode, like in the old versions but this time working fully
- Fixes in some status/warning messages and clarified some comments
- ZSH - removed most of the unneeded double quotes since the shell doesn't word split, more native feature use coming


screenshot-7dc00e1c.jpg

To do:
Fix some ugly text problem in Kernel tools status when having multiple kernels
Improve Dinit startup manager to not be confusing to use

Title: Re: Utilities shell script
Post by: Hitman on 17 September 2022, 23:46:02
V10:

-fixed the above noted issues, plus:
-IPSets and Hosts: added Nftables support! Very big for futureproofing and much better filtering of ip classes than legacy iptables
-IPSets and Hosts: keep existing rules in the /etc/hosts file
-Pacman commands: added bulk install/uninstall from a text file, useful on a fresh system
-Pacman commands: added an option to refresh keys
-Disk space analyzer: added options to find temporary and large files, and the chmod command will now run as root if it fails
-improved some functions
-fixed "grep: warning: stray \ before white space" in new versions of grep


A screenshot with recent features:

(LE: now i see most of the earlier screenshots are missing, damn image hosting sites, if i knew the forum can attach files :) )

(https://forum.artixlinux.org/index.php?action=dlattach;attach=2165;image)
Title: Re: Utilities shell script
Post by: Hitman on 03 November 2022, 19:36:24
V12:

Update is recommended if on a recent system base

- Extended the summary in the main menu with cpu average, network route/number of connections, and free space/cpu warnings (all under 10ms extra processing time);
- System cleanup: added more paths (incl. for new mozilla versions) and improved the existing ones;
- amdgpu utility: some fixes, toggle for every pstate, power profiles and preliminary navi support;
- Btrfs support added on volume repair and defrag (V11);
- Pacman commands: added database manager and cleaned up naming and menus (V11);
- Nftables backend for ipsets&hosts now properly filters ipv6 addresses (V11);
- The script now logs the error output for every menu to /tmp/utilities.log;
- Worked around some new possible exceptions in some programs, concerning ps/pgrep (where it hangs because of glibc, simple timeout added in front), watch (where it doesn't see amount of columns, replaced with while loop), cp (it started to demand more explicit paths);
- Kernel tools: make the command to get available kernels simpler and more robust, to fix a potential cosmetic bug;
- Extended the summary in sensors view with cpu/ram totals;
- Improved terminal, kernel module and package searching with case insensitive and simpler regex support (for kernel module searching i removed the regex in favour of native globbing in find, simpler to use and faster);
- Parralelize a few more commands, terminal navigation should be even faster;
- A number of small cleanups and improvements across menus;
- Regression: terminal searching will be only available in the zsh version, due to a change in variable behavior of bash shell that broke it a few weeks ago. (A fix would be to to implement associative arrays, but this would limit gui support to kdialog only and make menus more complex)
Title: Re: Utilities shell script
Post by: Hitman on 07 November 2022, 23:03:31
New minor release and Zsh ver. is on latest revision, enjoy!

Todo in the future when free time will allow me:

-Simple Nftables firewall (separate from ipsets&hosts) with important features like opening ports or certain packet types, changing a route, blocking traffic from an interface or allowing/blocking a custom address
-FFmpeg media converter, possibly also including mpv for it's shaders processing (drifting a bit away from my original idea of just system utilities, will release that as a standalone script too)
-Wait until the ps/pgrep and watch bugs are solved to remove the workarounds i've put in place
Title: Re: Utilities shell script
Post by: Hitman on 05 January 2023, 16:58:26
Best wishes for the new year, I've polished up and finished testing on V13:

- Firewall manager (nftables and xtables-untested). For now the commands are: open a port tcp/udp, blacklist/whitelist connections to an IPv4/6 address, and (nftables only) kill switch, exporting config, clearing config.
- Custom nftables chain names are also used for ipsets&hosts now, to avoid conflicts with any external rule that might be translated from xtables, and for -fw to take precedence.
- Switched to full RGB color mode for the terminal title bar and selection text (all compatibility is retained incl. in plain tty). Also added some more text formatting to create more of an elegant and easy to read theme.
- Extended KDialog support with file choosing/saving, text input
- Improved the appearance of service listings by putting status at the front
- More grep improvements, including in dinit service listing (new grep didn't like escaped '}' very much), in the command to check for executable attr. and in some unnecessary usage of 'grep -P'.
- Downloaders - disable preallocation in aria2, something that it recently made default.
- Logging system improvements, including simplifying it to just 1 redirection, quieting down some typical log spam, fixed the regression in zsh ver.  and fixed a potential issue in root mode.
- Fixed cosmetic bugs when selecting on some header messages or warnings
- Delete the exclude file if it's empty (-arc), and delete the fio benchmark file once finished (-diags)
- Addressed the watch workaround. The timeout workaround I've decided to leave permanent since I was already using it for the root detection, has a few ms of overhead but improves reliability. With this occasion I've added it in a few more places too.
- Big optimizations in -iomons by using customized ps command instead of top
- Added cumulated disk i/o in -iomons, useful in case there is no root access for iotop
- Other numerous small fixes, cleanups and optimizations
Title: Re: Utilities shell script
Post by: Hitman on 26 January 2023, 22:22:49
With V13.5, I have reworked the code of the service manager and Wine version manager, simplifying them by a lot, reducing the size with up to 50%. Almost nothing changes for the end user, apart from improvements listed below:

- Service manager:
* a more tidy header text that also shows number of services hidden, with a menu to display them;
* detailed information directly in the front menu;
* adding multiple runlevels in OpenRC startup services;
* more robust detection of Dinit startup services (actually follows the dependency cycle of 'boot' now);
* formal removal of suite66 support
- Wine manager:
* setting wine prefix for all the options actually works since they'll use the detection mechanism now
* easier to read description

- Kernel manager: Grub installation will work in more cases now
- Added power limit setting in the AMDGPU menu
- Created a safety system for the loop menus and improved error code handling in some of them Spoiler (click to show/hide)
- Simplified the logging system further, it now splits the log file when the script runs as root; this fixes the remaining access issues for good.
- Other minor cosmetic adjustments and fixes in some menus, and some more small optimizations
Title: Re: Utilities shell script
Post by: Hitman on 04 April 2023, 01:30:20
Arrived to some interesting recent developments per some personal needs or to fix left over annoyances. Update is recommended if you use some of the functions below:

As always, enjoy!

V14.5:
- Terminal: searching is back in all versions;
- Followed some more shellcheck recommendations and enabled basic compatibility in busybox distros, without affecting or complicating existing code;
- reworked the package mgr. menus, adding support for Alpine, an audit option, and extended searching for both installed and available pkg's;
- Some completions and fixes in Firewall mgr., Kernel mgr., amdgpu menu, -mnt, -wpstreams and a few others;
- Hardening and reliability tweaks in IPSets&Hosts, comprehensive regex now used to process ip's, simpler mechanism to process hosts, custom_hosts file support added (like custom_ips but in full format rather than raw).
- Improvements around many variables, redundancies and strings across the script. The overall look is further improved to increase readability;

V14:
- Added X11 tools menu, moving previous options from the main menu (timeout, vnc server, tearfree, etc), and adding 'Set display resolution', choosing from the available xrandr modes. The main menu is more tidy now; some options have been reordered with this occasion.
- Added Wireplumber stream stats/volume control, supporting PW, Pulse and JACK streams.
- Wine manager: DXVK will get manually placed/registered as their script is not longer included in their archives (it has been removed starting v2.1); there will be no backup support but everything else works fine, tested extensively in my prefixes.
Support for adding variables was also removed since recent Wine isolates parts of the environment; for now I manually added some of the variables that I use in the script, they should not affect stability/compatibility for general usage.
- IPSets & Hosts - A custom list of IP's to block (raw format) can now be added in the "custom_ips" file next placed to the script. On first usage the script will set immutable attribute, to modify the file later run "chattr -i custom_ips". The fetch functions were simplified with this occasion, with some improvements in sorting, filtering and restoring also.
- Service manager: most services that were hidden will now show up again in the front menu as "[Running - only restartable]". A few small robustness changes and optimizations were also done in a few functions.
- Downloaders - Small refactors in stream downloader and in "[wget] Download files listed on a website" - will work in more cases now, and the result will be cleaner;
- Disk space analyzer - A few optimizations, safety improvements and some more utilities added under Deletion options;
- More typical log spam quieted down;
- Added support for left arrow to go back/cancel in the terminal mode, kind of like how closing does in the gui mode.
- For now removed kdialog slider support as it was causing issues;
- Minor fixes (mainly zsh), a few cleanups and completions (mainly subfunctions, documentation, some displays).

UX improvements as of previous version:
Spoiler (click to show/hide)
Title: Re: Utilities shell script
Post by: Hitman on 05 May 2023, 01:15:57
After some testing I'm delighted to present V15:

- Terminal mode:
 *An elegant ticker-like info bar with system info will show in autorefreshing menus;
 *Refactored drawing with further usage of ANSI escape sequences - eliminating any flickering, improving padding at any tty size, further increasing performance when navigating and more! The section is now entirely documented;
- Added a menu to execute custom quick commands, they can be added one per line in custom_commands file, placed like usual next to the script :-);
- KDialog directory and slider are added again, they have been fixed with the recent kde updates;
- Added host/connect iperf under Benchmarks;
- Further small improvements and consolidations under Maintenance - Cleanup and IPSets&Hosts;
- Added support for two more common terminal emulators;
- Improve shortcut checking and listing in some DE's;
- More misc. compatibility improvements;
- A few other touch ups in some strings + as of last few versions, removed practically every redundancy in the ZSH version.

* Note: 'excluded' file when creating tar backups is now called '.excluded', please rename if used.

Title: Re: Utilities shell script
Post by: purpleleaf on 16 July 2023, 21:42:00
Text disappears on urxvt (tabbed)
Dinit init


(https://qu.ax/kWWM.png)
Title: Re: Utilities shell script
Post by: Hitman on 17 July 2023, 00:13:23
Can confirm, urxvt doesn't like something in the clearing of rows. Strangely other standard vt's like xterm and fbdev are fine.

I can probably address it, was working on and off on a new version this past month so hoping to finish it soon.

PS. Found a workaround for now:
line 1200, replace
Code: [Select]
echo -e '\e[1K\e[H\e[1;3J
with
Code: [Select]
echo -e '\e[1K\e[H\e[J
This removes the flicker-free partial cleanup for a full one, equivalent to the clear command. It can potentially be the fault of urxvt, not completely sure atm.
Title: Re: Utilities shell script
Post by: Hitman on 05 August 2023, 01:29:41
V16-pre:

A beta for the next major version of my beloved swiss army knife :). It has a lot of fixes and new stuff but also a few known issues where some testing will be needed, so if you want to wait for the final one, along with ZSH, they will be complete by sometime next month.

As a second "milestone" from V7,  the script is now feature complete for basic remote work!
Enjoy!

- Revision of the argument systems:
*There are now 3 argument categories: args_all(new, runs both as root and user), args_rootonly, args_useronly. writeconf will run more smartly thanks in part to this;
*The main menu will now show up when running as root (terminal mode only), adding new options to specify the normal user and launch the script/add sudoers rule for it;
*Added an option to disable GUI;
*The terminal emulator will attempt to run as root in some cases when option is launched outside of a terminal and under root. Disabling GUI also turns this off. X11 only;

- Added a file manager! (terminal mode only, meant for usage over ssh). It is used internally for file/folder selection, and standalone to browse, edit, rename or delete files.

- Added CPU freq. and bat.% to term. footer;

- Added a menu to change CPU min/max and governor (in it was also merged my legacy zenstates thing to clean up a bit);

- Added user, host(if connected over ssh) and weekday/time to term. titlebar;

- Better separator size determiner, done for the GUI mode but also looks better in terminal mode;


-More completions in:
*Disk space analyzer - has been rebased off the file manager "API" so was made aswell terminal only to use the hotkeys F3/F4/Del, also extended finding large+temp files with more depth ability;
*Improved main menu option in submenus. F2 hotkey also added as override from anywhere, useful from root. F1 now shows help+stats+debug anywhere;
*Logging system - added ability to write info messages, duplicates are prevented;
*runfromroot - more ways to determine xauthority;
*help text - also print summary info and debug of all variables;
*completed a bit more the busybox checking (gnu awk/sed, ps/pgrep) to reduce more potential annoyances;
*-swp - also drop caches when clearing /tmp;
*package mgr. - the two sections are clearly defined and some bugs were fixed;
*-wpstreams - partly redid the processing of wpctl output to be less confusing;
*-fw - added port limit options and a safety feature for the nftables kill switch;

-Revised:
*better method of obtaining normal user in root mode, script can run with none e.g. just root.
*footer now shows always, when not autorefreshing it will show some static os release summary;
*Archiving and backup tools - adding homedir backup shortcuts, safety system for extracting and some fixes;
*method of obtaining partitions/drives - no more false positives and faster;
*faster method of obtaining init;
*shortcut replacement is more resilient;
*disk i/o under -iomons does both read and write now, can ctrl+c out of -iomons without exiting.
*system cleanup and -swp(when clearing /tmp): keep the *auth* files from /tmp, workaround for recent change which breaks DE's.
*disabling scrollback in terminal also disables flicker-free refresh, workaround for *rxvt. @purpleleaf
*many more I probably overlooked, mostly layout related.
Title: Re: Utilities shell script
Post by: Hitman on 03 December 2023, 21:33:07
Yeah it's been a few months I know... Hobby project has to wait when life becomes weird. :)
V16 series was mostly OK in the meantime.

V16.5:
-ZSH has been fully rebased, with function createarray brought to it to make the variants more similar;
-Support for user services in Dinit (dependency search still needs tuning);
-Removed timeout safety for lsblk as it caused issues, the one for ps/pgrep remains for now;
-Streamlined normal user validation in root mode, fixing change in shell not making some variables change within a function;
-More potential error situations caught and correct error code shown where applicable;
-Various little fixes or adjustments in -iomons, -kern parameter display, -fancontrol saves all running fans right away, -arc, xdg path fallback under -cle and -down, more header redundancies cleared;
-Terminal searching now works completely again when under scrollback (a bug is introduced in long menus where you need to press up/down to see the result, maybe fixable later).
Title: Re: Utilities shell script
Post by: Hitman on 27 January 2024, 15:36:53
V17:

Main changes:
-ZSH:
*Use native array match when searching, fixing above mentioned search bug;
*A bit more native feature usage to replace dirname/basename where worth it;
*Few more cosmetic fixes;
*Match 1, 3 and 4 byte keys separately, which means:
   *Enter key to select now works!
   *Function keys now work in most terminals
   *F5 hotkey was added for refresh (F6+ can be used too if needed)
   *PgUp/PgDn hotkey is back and working correctly
   *Key selection is more correct (prevents stuck selections completely)
-ALSA and Wireplumber stats/volume control are merged into one menu, simplified stream status by showing just 'running';
-pkg. manager: reunified the menu to show all options, it's easier to navigate;
-Removed hosts processing from IPSets&Hosts (many personal reasons, plus it was a bit hacky). The IP blocking component was moved to the firewall mgr., first option 'Run IP filter';
-Removed the -boot argument, some of the functions were added to -wgvpn (second argument 'reconnect'), and to -fw (second argument 'ipfilter'), with their meaning as described.

Others:
-Archiving tools - when 7z binary is used, it will ask to list the contents of that file first (main feature of the 7zip gui really);
-Some more simplification and renaming in the main menu, added 2 extra low latency stats and some regrouped args;
-Use inet family in nftables instead of ip&ip6 for a bit more debloating and ease of viewing;
-Custom command runner - automatically parse from .desktop entries and from recent commands in shell history (supports fish and most simple *sh_history in homedir); this makes the option always available;
-Kernel tools - some adjustments;
-Mount and filesystem tools: if a remount fails try to unmount+mount, workaround sometimes needed for e.g. gvfs;
-maintenance: added an option to run fstrim on all mounted drives, split cleanup into a second option for the extra stuff that can affect running programs;
-If the script is launched with a root only argument it will try to run it regardless of environment (if sudoers rule is present);
-A few more misc. fixes.

*Info - I'm putting the zsh version first this time around since it's much easier to work with, for now trying to see if a fish port is possible, then the regular bash version will come. :)

(https://forum.artixlinux.org/index.php?action=dlattach;topic=4030.0;attach=2927;image)
Title: Re: Utilities shell script
Post by: Hitman on 13 March 2024, 02:42:50
V18:
-custom command launcher: visual adjustments, added finding launcher scripts/appimages in the user's home directory;
-fw: now integrates a basic wireguard connection support for simple connections (reverse engineering of wg-quick in ~20 lines with added dns override and portable disconnection support), so the requirement for wg-quick has been removed along with it's menu.
*Note: -wg reconnect is replaced by passing variable wg_file=/path/ at runtime;
-mount tools: automount option to mount nonsystem drives, with extra options in the third argument to override the defaults e.g. "-mnt automount ro,noatime";
-pkg: added support for opkg, forced overwrites on updates are now used by default, small redundancies removed for pacman support;
-logfile unified by default, only if writing fails it is split again;
-other small adjustments in -iomons, -wine and a few others, cleaned up a few more checks and functions, simpler and fuller line clearing routine in console option selector (shouldn't be any slower);

V17.5:
-Actually support Dinit user services with turnstile for any user. This extends the feature matrix a lot so i changed some naming around to avoid confusion. For now inactivated services are limited to the single target user. My surprise that dinitctl is very smart, it can manage nonroot services while running as root as long as you specify socket/turnstile's path, like a true systemd replacement but much slimmer. For total feature completeness I need to finish some functions, also waiting for turnstile to be developed more and this (https://forum.artixlinux.org/index.php/topic,1439.msg35135.html#msg35135) needs a better workaround;
-Some more listing improvements of Dinit display and also Runit received some love along with startup management, hopefully works fine;
-iomons - use autorefreshing terminal option selector as display, this replaces both the watch command which still had bugs and mostly the terminator gui config (you can bring that back if you wish);
-Made file_browser display correctly again the filenames with newline/special characters, also slimmed it down in the process;
-Last zsh bugs resolved (some expanded variables);
-Added a few more sources in the ip filter for extra ipv6 addresses;
-Reduced usage of 2>/dev/null to mostly spam only;
-Added date string to logs written from arg.;
-Made some variables more resilient and added following in readme:
Spoiler (click to show/hide)
Title: Re: Utilities shell script
Post by: Hitman on 20 June 2024, 18:35:06
V18.5:

Until further notice I will continue on just the ZSH version since it's a lot more intuitive to use.
Spoiler (click to show/hide)

-Service manager:
   * Resolve new Artix /sbin/init;
   * Layout improvements and simplifications, enabled service count in front menu, much fewer kept on the "hidden" list;
   * Dinit support: Dependency/dependant relations in startup list (only system and 1 level deep for now), user services are listed with own naming scheme which removes most limitations to the target user, also fixed some unwanted deduplications that their listings had;
-Main menu: addressed redundancies, moved connection stats to the header under -fw, added wireplumber streams number, added a (quicker) shortcut to directly run as root for the now more universal arguments potentially needing it;
-gpu: added basic Navi freq/voltage curve adjustments and an option to reset the table, some visual improvements;
-Improvements in -iomons with better row scaling, highlights and refresh rate, replaced iotop with native per process i/o view using zsh arrays (bit hacky but much better, simpler, no dependency, can run without root for user's i/o);
-console mode: custom RGB theming support from the preferences menu with additional hexcode parsing;
-Added sysbench shortcut under benchmarks and toned down the missing warnings;
-Some more annoyances/bugs fixed in the disk related tools, less spam, maintenance util. has added better browsers/webview profile detection;
-Misc. additions and other small layout improvements, debugging improvements, some optimizations, cleanups, a few more.

Enjoy!
Title: Re: Utilities shell script
Post by: Hitman on 30 August 2024, 00:08:25
V19:

-Added QEMU VM deploy menu with easily accessible options for console and gui connections;
-The menus to set cpu and gpu frequencies have been merged into Parameters, adding I/O scheduler toggle for every disk and improving status;
-Console menu: Quick search by keyword (with up to 3 characters, just type into the keyboard)! With this occasion some escape code features have been revized, F5 key works in most terminals and refreshing works for most menus even without autorefresh, footer is now pinned to the bottom in some occasions which looks better;


-Better variable initialization, safer and less buggy, settings are refreshed from the utconfig file upon returning to the main menu, system fans in -fancontrol have a simpler and better saving scheme;
-Dinit service manager - some dependency lookup optimizations and fixes, still not complete but the enabled user services have gained a dependency query;
-Swap menu gets options to create zram swap volumes, completely independently from zramen, including a bootup argument which creates a a multi volume setup;
-System cleanup fixes, some syntax was wrong (thankfully safe, it was finding less files rather than more), another was poorly described, also removed the dependency on lsof with the help of zsh native arrays iterating over the /proc/ file descriptors;
-Archive manager gets one more quick packing function and some more fixes;
-Sensors and I/O monitors menu gets more optimizations and added per disk & per network interface speed monitoring! Also removed dependency on radeontop with native polling of amdgpu driver files;
-Fixed user and homedir determination in some cases;
-Support for doas as an escalator command if sudo is missing;
-Partition info under -mnt and some image mounting and checking bugs fixed, added an option to Open file manager at mount point which works from the terminal too, simplified automount and removed it's parralleling to avoind early bootup mounting bugs;
-fw has better port and connection number listings;
-Pacman overview tools have added an option to view packages without dependants (e.g. unofficial 'orphans' in some cases);
-Structural changes to fix some more bugs or to increase reliability, script looks better and some initial checking functions for the script + main menu, file manager & a few others are (sometimes much) faster with this occasion, reduced subshells etc;

Customary image with highlights, you need to see the rest of the smaller features for yourself! :)
I will prepare a new series of gifs showcasing features soon, also updated bash version coming by the end of the year Lord willing.

(https://forum.artixlinux.org/index.php?action=dlattach;topic=4030.0;attach=3286;image)
Title: Re: Utilities shell script
Post by: Hitman on 23 May 2025, 14:59:17
Few more months (well, 9) have passed without an update here, in the meantime i made some adjustments to the Victorinox such as...

...Extra embedded distro support :D (look top left)

ss.png

Some wayland desktop tools

ss2.png

Other highlights:

-swp: added option for zram volume with custom compr., simple zswap toggle with stats in main menu;
-kern: added an option to flag next boot for uefi firmware settings;
-hwp: better cpu stats display, more reliable amdgpu-Navi clock settings, added display brightness setting;
-usb: added hub control and more granular usb subsystem restart;
-srv: added OpenRC user service support; partial rewrite for more reliable display, easier to read script's text and much less overhead on ZSH ver.;
-customcomm: renamed to misc. tools - gains custom menu options alongside the raw commands that go in custom_commands file, for "pretty" entries (both static+dynamic possible);
-Better filesystem type detection under -mnt mounting routine, specifically uid/gid under any exfat volume;
-wine manager: dedicated mode setting (run .exe, run winecfg, run control panel, install dxvk in a prefix), making it completely portable, updated text to reflect WoW64 builds, parralel extraction of wine builds;
-Added F7 shortcut to deploy the script to a remote machine, done only with ssh (copies script, then runs in a duplicate session in terminal);
...many more in the changelog.