Skip to content

About

A collection of system maintanence bash scripts for slackware

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

21 Commits

Folders and files

Repository files navigation

sysmaint-scripts-slackware

Automated system maintenance scripts for Slackware-current: unattended package update downloads via slapt-get, multilib update checks, and the helpers they share. Installing the downloaded updates is a separate, manual step (UpdateAll).


What is in this repo

File in repo Install to Purpose
etc/cron.daily/121-slaptgetupdate /etc/cron.daily/ Downloads available system updates with slapt-get
etc/cron.daily/120-mulitlibsupdate /etc/cron.daily/ Checks the Alien multilib mirror for updates
etc/crontimerloop.sh /etc/crontimerloop.sh Retry-with-timeout helper, sourced by 120 and 121
etc/windowlabelandmove.sh /etc/windowlabelandmove.sh Opens the download folder in a file manager for the logged-in user
var/slapt-get/UpdateAll your slapt-get WORKINGDIR Manual script: installs the downloaded updates
var/slapt-get/OrphanDeps your slapt-get WORKINGDIR Manual script: finds and offers to remove packages dropped from -current
customtoolsrootloc/sbin/upgradepkg/upgradepkg ${customtoolsrootloc}/sbin/upgradepkg Customised upgradepkg, restored after a pkgtools update

WORKINGDIR is the value set in /etc/slapt-get/slapt-getrc (for example /var/slapt-get).


Prerequisites

Required

  • slapt-get: Slackware package manager extension for dependency handling and updates. Installation and info: https://github.com/jaos/slapt-get
  • lftp: used by 120-mulitlibsupdate to mirror the multilib repository.
  • wget: used by OrphanDeps to fetch the Slackware-current ChangeLog.
  • timeout (coreutils), runuser (util-linux) and xdg-open (xdg-utils).
  • bash: all scripts, including the helper when sourced, expect bash.

Optional / Recommended


Scripts

1. System updates (121-slaptgetupdate)

Run daily by cron. It downloads updates only; nothing is installed.

  • Runs slapt-get --update (600 second timeout, 3 attempts), then slapt-get --upgrade --ignore-dep --download-only (1800 second timeout, 3 attempts) into WORKINGDIR.
  • Handles:
    • Sources that fail to update: they are disabled in slapt-getrc for the run, the update is retried, then they are re-enabled.
    • MD5 mismatches: the offending source is disabled for the run.
    • HTTP download errors: the package is excluded for the run and the upgrade is retried.
    • Timeouts: sources and exclusions are restored and the script exits 1.
  • After downloading it checks for a new pkgtools and, if one is installed, puts your customised upgradepkg back. It also removes an openjdk download that is not newer than the installed Java, and prints a note when a newer mozjs is available.
  • Writes FileList and opens WORKINGDIR in the file manager (see windowlabelandmove.sh) when there is something to install.

Warning: at the start of every run the script empties WORKINGDIR, keeping only UpdateAll, OrphanDeps and 32multi. Use a directory dedicated to slapt-get. The script refuses to run if WORKINGDIR is missing, empty, or /.

User variables at the top of the script:

customtoolsrootloc="/SETAPATH_NO_TRAILING_SLASH"   # where your custom sbin/upgradepkg lives
windowtomoveto="4"                                  # workspace number, counting from 1

2. Multilib updates (120-mulitlibsupdate)

Run daily by cron, before 121.

  • Mirrors https://slackware.nl/people/alien/multilib/ (current) into WORKINGDIR/32multi/ with lftp (1200 second timeout, 3 attempts).
  • Compares current/PACKAGES.TXT with the previous copy (PACKAGES-OLD.TXT). If it changed, it creates /tmp/multilib_updates, opens the file manager and prints "Multilib updates to install".
  • WORKINGDIR/32multi/current/PACKAGES.TXT must already exist, so seed it with one manual mirror run before the first cron run.

3. Retry helper (crontimerloop.sh)

Sourced by 120 and 121. Provides:

ctl-fn_timeoutloop <name> <timeout_seconds> <max_attempts> <command...>
  • Runs the command under timeout, streaming its output while also capturing it.
  • Exit codes: 0 success, 124 timed out on every attempt, anything else is the command's own exit code (no retry).
  • Prints ERROR: <name> ... to stderr on failure. A caller that handles the failure itself should capture stderr (2>&1), as 121 does.
  • Optional hooks, called if you define them: on_timeout and on_failure.

4. File manager launcher (windowlabelandmove.sh)

Sourced by 120 and 121. Call it with windowtomoveto and wintomv set:

windowtomoveto="4"
wintomv="/path/to/package/dir"
. /etc/windowlabelandmove.sh
wlm-fn_windowlabelandmove
  • Safe mode (default, unsafemode=0): opens wintomv with xdg-open as each logged-in user. It does not move the window.
  • Unsafe mode (unsafemode=1): opens the window as root and moves it to workspace windowtomoveto with wmctrl. This puts root-owned windows on users' desktops, so only enable it if you accept that.
  • Needs a running X session. It fails silently if there is none.

5. Installing the updates (UpdateAll)

Run manually as root from WORKINGDIR after cron has downloaded updates.

  • Upgrades the packages in 32multi, moves everything else downloaded into slackware64/, and installs it with upgradepkg -ir.
  • Then runs ./OrphanDeps, and needrestart -r a if needrestart is installed.

6. Removed packages (OrphanDeps)

Run manually (also called by UpdateAll). Interactive.

  • Downloads the Slackware-current ChangeLog.txt and lists installed packages that it marks as removed.
  • Asks [y/N] before removing anything, using slapt-get --remove.
  • Packages named in EXCLUDE_LIST (package name only, no version or build) are never removed:
EXCLUDE_LIST=(
  "exluded-pkg1"
  "exluded-pkg2"
)

7. Custom upgradepkg

A customised copy of Slackware's upgradepkg with quality-of-life changes the stock version does not have. A pkgtools update replaces /sbin/upgradepkg with the stock one, so when 121 installs one it saves the new file as ${customtoolsrootloc}/sbin/upgradepkg-new and copies your custom ${customtoolsrootloc}/sbin/upgradepkg over /sbin/upgradepkg.


Notes

  • 120 and 121 are designed for unattended cron use. The window and workspace behaviour needs a running X server.
  • 121 temporarily edits /etc/slapt-get/slapt-getrc (SOURCE= and EXCLUDE= lines) and restores it at the end. If a run is killed part way through, check the file for leftover #DISABLED= lines or an extended EXCLUDE=.
  • The scripts use set -euo pipefail, so an unexpected failure stops the run.

Change note

2026-10-31

  • README rewritten to match the files actually in this repo. Removed the perthings and pipthings sections and the Perl, pip and xdotool prerequisites (those scripts are not included). Added documentation for 120, the helper, windowlabelandmove.sh, UpdateAll, OrphanDeps and the custom upgradepkg. Corrected the wmctrl description (unsafe mode only).
  • etc/crontimerloop.sh restored to the retry helper (it had been overwritten by an unrelated drive-check script).
  • 121-slaptgetupdate: refuses an empty, missing or / WORKINGDIR; no longer aborts when UpdateAll, OrphanDeps or 32multi are absent; timeouts now stop the run and restore slapt-getrc instead of being ignored.

License

MIT License. See the LICENSE file for details.

About

A collection of system maintanence bash scripts for slackware

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages