2626# ======================================================================================================================
2727set -o nounset # Treat unset variables as an error
2828
29- __ScriptVersion=" 2026.01.15 "
29+ __ScriptVersion=" 2026.01.22 "
3030__ScriptName=" bootstrap-salt.sh"
3131
3232__ScriptFullName=" $0 "
@@ -6107,7 +6107,14 @@ install_arch_linux_git_deps() {
61076107}
61086108
61096109install_arch_linux_onedir_deps () {
6110+ echodebug " install_arch_linux_onedir_deps() entry"
6111+
6112+ # Basic tooling for download/verify/extract
6113+ pacman -Sy --noconfirm --needed wget tar gzip gnupg ca-certificates || return 1
6114+
6115+ # Reuse stable deps for python-yaml etc. if you want config_salt() parity
61106116 install_arch_linux_stable_deps || return 1
6117+ return 0
61116118}
61126119
61136120install_arch_linux_stable () {
@@ -6122,7 +6129,73 @@ install_arch_linux_stable() {
61226129 pacman -S --noconfirm --needed bash || return 1
61236130 pacman -Su --noconfirm || return 1
61246131 # We can now resume regular salt update
6125- pacman -Syu --noconfirm salt || return 1
6132+ # Except that this hasn't been in arch repos for years;
6133+ # so we have to build from AUR
6134+ # We use "buildgirl" because Eve demanded it.
6135+ build_user=${build_user:- buildgirl}
6136+ userdel " $build_user " || true
6137+ useradd -M -r -s /usr/bin/nologin " $build_user "
6138+ echo " $build_user ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/" $build_user "
6139+ rm -rf /tmp/yay-bin || true
6140+
6141+ git clone https://aur.archlinux.org/salt.git /tmp/yay-bin
6142+ chown -R " $build_user " :" $build_user " /tmp/yay-bin
6143+ sudo -u " $build_user " env -i \
6144+ HOME=/tmp \
6145+ PATH=/usr/bin:/bin:/usr/sbin:/sbin \
6146+ MAKEFLAGS=" -j$( nproc) " \
6147+ LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 \
6148+ makepkg -CcsiD /tmp/yay-bin \
6149+ --noconfirm --needed \
6150+ --noprogressbar || return 1
6151+
6152+ rm -f /etc/sudoers.d/" $build_user "
6153+ rm -rf /tmp/yay-bin
6154+ userdel " $build_user "
6155+ return 0
6156+ }
6157+
6158+ install_arch_linux_onedir () {
6159+ echodebug " install_arch_linux_onedir() entry"
6160+
6161+ version=" ${ONEDIR_REV:- latest} "
6162+ arch=" x86_64"
6163+ [ " $( uname -m) " = " aarch64" ] && arch=" aarch64"
6164+
6165+ # Resolve "latest" to actual version
6166+ if [ " $version " = " latest" ]; then
6167+ version=$( wget -qO- https://api.github.com/repos/saltstack/salt/releases/latest \
6168+ | grep -Eo ' "tag_name": *"v[0-9.]+"' \
6169+ | sed ' s/"tag_name": *"v//;s/"//' ) || return 1
6170+ fi
6171+
6172+ tarball=" salt-${version} -onedir-linux-${arch} .tar.xz"
6173+ url=" https://github.com/saltstack/salt/releases/download/v${version} /${tarball} "
6174+ extractdir=" /tmp/salt-${version} -onedir-linux-${arch} "
6175+
6176+ echoinfo " Downloading Salt onedir: $url "
6177+ wget -q " $url " -O " /tmp/${tarball} " || return 1
6178+
6179+ # Validate tarball
6180+ if ! tar -tf " /tmp/${tarball} " > /dev/null 2>&1 ; then
6181+ echoerror " Invalid or corrupt onedir tarball"
6182+ return 1
6183+ fi
6184+
6185+ # Prepare extraction
6186+ rm -rf " $extractdir " || true
6187+ rm -rf /opt/saltstack/salt || true
6188+ mkdir -p " $extractdir "
6189+
6190+ # Extract and flatten (remove leading 'salt/' directory)
6191+ # /tmp/salt-${version}-onedir-linux-${arch}
6192+ tar --strip-components=1 -xf " /tmp/${tarball} " -C " $extractdir "
6193+
6194+ # Place into /opt
6195+ mkdir -p /opt/saltstack/salt
6196+ mv " $extractdir " /* /opt/saltstack/salt/ || return 1
6197+ chmod -R 755 /opt/saltstack/salt
6198+
61266199 return 0
61276200}
61286201
@@ -6260,17 +6333,48 @@ install_arch_check_services() {
62606333 return 0
62616334}
62626335
6263- install_arch_linux_onedir () {
6264- install_arch_linux_stable || return 1
62656336
6266- return 0
6267- }
62686337
62696338install_arch_linux_onedir_post () {
6270- install_arch_linux_post || return 1
6339+ echodebug " install_arch_linux_onedir_post() entry"
6340+
6341+ # Disable any distro/AUR salt units
6342+ systemctl disable --now salt-minion.service 2> /dev/null || true
6343+ systemctl disable --now salt-master.service 2> /dev/null || true
6344+
6345+ # Drop a clean unit, same pattern as Debian/Ubuntu onedir
6346+ cat > /etc/systemd/system/salt-minion.service << 'EOF '
6347+ [Unit]
6348+ Description=Salt Minion (onedir)
6349+ After=network-online.target
6350+ Wants=network-online.target
6351+
6352+ [Service]
6353+ Type=simple
6354+ ExecStart=/opt/saltstack/salt/salt-minion -c /etc/salt
6355+ Restart=always
6356+ LimitNOFILE=100000
62716357
6272- return 0
6358+ [Install]
6359+ WantedBy=multi-user.target
6360+ EOF
6361+
6362+ systemctl daemon-reload
6363+
6364+ # Add onedir paths system-wide
6365+ cat > /etc/profile.d/saltstack.sh << 'EOF '
6366+ export PATH=/opt/saltstack/salt:/opt/saltstack/salt/bin:$PATH
6367+ EOF
6368+
6369+ chmod 644 /etc/profile.d/saltstack.sh
6370+
6371+ if [ " $_START_DAEMONS " -eq $BS_TRUE ]; then
6372+ systemctl enable --now salt-minion.service
6373+ fi
6374+
6375+ return 0
62736376}
6377+
62746378#
62756379# Ended Arch Install Functions
62766380#
0 commit comments