File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 99 # The libs directory is always at the same location relative to this entry point
1010 linuxtoys_dir = os .path .dirname (os .path .abspath (__file__ ))
1111 os .environ ['SCRIPT_DIR' ] = linuxtoys_dir
12+
13+ # UPD_SERVICE runs from a headless systemd unit and must follow the CLI path.
14+ if os .environ .get ('UPD_SERVICE' ) == '1' :
15+ os .environ ['EASY_CLI' ] = '1'
1216
1317 # --- VERIFY LIBRARIES EXIST ---
1418 # Safeguard: ensure the lib directory is present
Original file line number Diff line number Diff line change 77
88source " $SCRIPT_DIR /libs/linuxtoys.lib"
99_lang_
10+ sudo_rq
1011
1112needs_reboot () {
1213 if is_fedora; then
@@ -57,10 +58,16 @@ elif is_debian || is_ubuntu; then
5758 fi
5859 fi
5960elif is_arch || is_cachy; then
60- sudo pacman -Rns $( pacman -Qdtq) --noconfirm || fatal " Failed to remove orphaned packages"
61+ orphaned_packages=$( pacman -Qdtq 2> /dev/null || true)
62+ if [[ -n " $orphaned_packages " ]]; then
63+ sudo pacman -Rns --noconfirm $orphaned_packages || fatal " Failed to remove orphaned packages"
64+ fi
6165 sudo pacman -Syu --noconfirm || fatal " Failed to upgrade packages"
6266elif is_suse; then
63- sudo zypper rm --clean-deps $( zypper packages --unneeded | awk ' /^i/{print $5}' ) -y || fatal " Failed to remove orphaned packages"
67+ orphaned_packages=$( zypper packages --unneeded | awk ' /^i/{print $5}' )
68+ if [[ -n " $orphaned_packages " ]]; then
69+ sudo zypper rm --clean-deps $orphaned_packages -y || fatal " Failed to remove orphaned packages"
70+ fi
6471 sudo zypper dup -y || fatal " Failed to upgrade packages"
6572elif is_solus; then
6673 sudo eopkg rmo -y || fatal " Failed to remove orphaned packages"
@@ -74,4 +81,4 @@ if needs_reboot; then
7481 { [ " $UPD_SERVICE " = " 1" ] && notify-send " $sysup_rebootreq " --icon=system-reboot --urgency=critical --app-name=" LinuxToys Update" ; } || zeninf " $sysup_rebootreq "
7582else
7683 { [ " $UPD_SERVICE " = " 1" ] && echo " $sysup_completed " ; } || zeninf " $sysup_completed "
77- fi
84+ fi
Original file line number Diff line number Diff line change @@ -4,4 +4,4 @@ After=network.target
44
55[Service]
66Type =oneshot
7- ExecStart =/usr/bin/env UPD_SERVICE =1 linuxtoys
7+ ExecStart =/usr/bin/env EASY_CLI =1 UPD_SERVICE =1 linuxtoys
You can’t perform that action at this time.
0 commit comments