Created
May 3, 2020 04:23
-
-
Save flying-sausages/a77c871952ece23fe58fb48bbb6f9a95 to your computer and use it in GitHub Desktop.
Making apt installs safe in non-interactive scripts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
packages="zsh htop" | |
logfile="~/apt.log" | |
touch "$logfile" | |
for package in packages; do | |
DEBIAN_FRONTEND=noninteractive apt-get install -qy -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" "$package" >>"${logfile}" 2>&1 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
make sure to check the logfile in case new config versions were installed on the side, and alert user about this