Remove sudo usage
All checks were successful
Publish Master Push Event / Publish master push (push) Successful in 1s

This commit is contained in:
Zachary Hall 2024-10-20 16:55:58 -07:00
parent f2fc6d1af4
commit 3ad3201073
3 changed files with 5 additions and 5 deletions

View file

@ -29,7 +29,7 @@ fi
log "Updating APT package list..." log "Updating APT package list..."
if [[ -z "$(find -H /var/lib/apt/lists -maxdepth 0 -mmin -5)" ]]; then if [[ -z "$(find -H /var/lib/apt/lists -maxdepth 0 -mmin -5)" ]]; then
sudo apt-fast update > /dev/null apt-fast update > /dev/null
log "done" log "done"
else else
log "skipped (fresh within at least 5 minutes)" log "skipped (fresh within at least 5 minutes)"
@ -62,7 +62,7 @@ install_log_filepath="${cache_dir}/install.log"
log "Clean installing ${package_count} packages..." log "Clean installing ${package_count} packages..."
# Zero interaction while installing or upgrading the system via apt. # Zero interaction while installing or upgrading the system via apt.
sudo DEBIAN_FRONTEND=noninteractive apt-fast --yes install ${packages} > "${install_log_filepath}" DEBIAN_FRONTEND=noninteractive apt-fast --yes install ${packages} > "${install_log_filepath}"
log "done" log "done"
log "Installation log written to ${install_log_filepath}" log "Installation log written to ${install_log_filepath}"
@ -94,7 +94,7 @@ for installed_package in ${installed_packages}; do
while IFS= read -r f; do test -f "${f}" -o -L "${f}" && get_tar_relpath "${f}"; done | while IFS= read -r f; do test -f "${f}" -o -L "${f}" && get_tar_relpath "${f}"; done |
# Single quotes ensure literals like backslash get captured. Use \0 to avoid field separation. # Single quotes ensure literals like backslash get captured. Use \0 to avoid field separation.
awk -F"\0" '{print "\x27"$1"\x27"}' | awk -F"\0" '{print "\x27"$1"\x27"}' |
sudo xargs tar -cf "${cache_filepath}" -C / xargs tar -cf "${cache_filepath}" -C /
log " done (compressed size $(du -h "${cache_filepath}" | cut -f1))." log " done (compressed size $(du -h "${cache_filepath}" | cut -f1))."
fi fi

2
lib.sh
View file

@ -24,7 +24,7 @@ function execute_install_script {
log "- Executing ${install_script_filepath}..." log "- Executing ${install_script_filepath}..."
# Don't abort on errors; dpkg-trigger will error normally since it is # Don't abort on errors; dpkg-trigger will error normally since it is
# outside its run environment. # outside its run environment.
sudo sh -x ${install_script_filepath} ${4} || true sh -x ${install_script_filepath} ${4} || true
log " done" log " done"
fi fi
} }

View file

@ -47,7 +47,7 @@ log "Restoring ${cached_filecount} packages from cache..."
for cached_filepath in ${cached_filepaths}; do for cached_filepath in ${cached_filepaths}; do
log "- $(basename "${cached_filepath}") restoring..." log "- $(basename "${cached_filepath}") restoring..."
sudo tar -xf "${cached_filepath}" -C "${cache_restore_root}" > /dev/null
log " done" log " done"
# Execute install scripts if available. # Execute install scripts if available.