feature/os-debian-no-aptitude #1
1 changed files with 21 additions and 17 deletions
|
@ -42,6 +42,8 @@ if [[ ! -d "trusted.gpg.d" ]]; then
|
|||
fi
|
||||
|
||||
TMPDIR="\$(mktemp -d -t restore-XXXX)"
|
||||
bold="$(tput bold)"
|
||||
normal="$(tput sgr0)"
|
||||
|
||||
cleanup() {
|
||||
[[ -n "\$TMPDIR" && -d "\$TMPDIR" ]] && rm -rf "\$TMPDIR"
|
||||
|
@ -54,7 +56,7 @@ trap cleanup EXIT
|
|||
|
||||
install=""
|
||||
|
||||
echo " * Installing required packages"
|
||||
echo "\${bold} * Installing required packages\${normal}"
|
||||
dpkg-query -s 'rsync' &>/dev/null || install+=" rsync"
|
||||
#dpkg-query -s 'borgbackup' &>/dev/null || install+=" borgbackup"
|
||||
#dpkg-query -s 'borgmatic' &>/dev/null || install+=" borgmatic"
|
||||
|
@ -64,18 +66,25 @@ if [[ -n "\$install" ]]; then
|
|||
apt -y install \$install
|
||||
fi
|
||||
|
||||
echo " * Enabling 32-bit packages"
|
||||
echo "\${bold} * Enabling 32-bit packages\${normal}"
|
||||
grep ':i386' InstallOnly.list &>/dev/null && dpkg --add-architecture i386
|
||||
|
||||
echo " * Checking for flatpak"
|
||||
echo "\${bold} * Checking for flatpak\${normal}"
|
||||
flatpak=0
|
||||
grep 'flatpak' InstallOnly.list &>/dev/null && flatpak=1
|
||||
if [[ "\$flatpak" -eq 1 ]]; then
|
||||
echo " * Adding flatpak repo: Flathub"
|
||||
flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo
|
||||
fi
|
||||
|
||||
if [[ -r "sources.list" ]]; then
|
||||
echo
|
||||
echo "\${bold}"
|
||||
echo "=============================="
|
||||
echo "INSTALL REPOS"
|
||||
echo "=============================="
|
||||
echo
|
||||
read -p "Do you want to continue to install backup repositories? [Y/n] " -n 1 -sr promptRepos
|
||||
echo "\${normal}
|
||||
|
||||
read -p "\${bold}Do you want to continue to install backup repositories? [Y/n]\${normal} " -n 1 -sr promptRepos
|
||||
if [[ "\$promptRepos" =~ ^[Yy]$ ]]; then
|
||||
echo "Yes"
|
||||
cp -a sources.list /etc/apt/sources.list
|
||||
|
@ -88,18 +97,12 @@ if [[ -r "sources.list" ]]; then
|
|||
fi
|
||||
fi
|
||||
|
||||
flatpak=0
|
||||
grep 'flatpak' InstallOnly.list &>/dev/null && flatpak=1
|
||||
if [[ "\$flatpak" -eq 1 ]]; then
|
||||
echo " * Adding flatpak repo: Flathub"
|
||||
flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo
|
||||
fi
|
||||
|
||||
echo
|
||||
echo "\${bold}"
|
||||
echo "=============================="
|
||||
echo "INSTALL PACKAGES"
|
||||
echo "=============================="
|
||||
echo
|
||||
echo "\${normal}"
|
||||
|
||||
read -p "About to install the system packages per the backup. Do you want to continue? [Y/n] " -n 1 -sr promptPkgs
|
||||
if [[ "\$promptPkgs" =~ ^[Yy] ]]; then
|
||||
echo "Yes"
|
||||
|
@ -111,8 +114,9 @@ if [[ "\$promptPkgs" =~ ^[Yy] ]]; then
|
|||
echo "Packages that were omitted because they could not be found:"
|
||||
cat "\${TMPDIR}/diff.fail" | tr '\n' ' ' | fold -s
|
||||
echo
|
||||
echo
|
||||
|
||||
read -p "Did everything above look okay and do you want to proceed? [Y/n] " -n 1 -sr promptPkgsDo
|
||||
read -p "\${bold}Did everything above look okay and do you want to proceed? [Y/n]\${normal} " -n 1 -sr promptPkgsDo
|
||||
if [[ "\$promptPkgsDo" =~ ^[Yy] ]]; then
|
||||
comm --nocheck-order -23 "\${TMPDIR}/diff.list" "\${TMPDIR}/diff.fail" | xargs apt-get install
|
||||
else
|
||||
|
@ -122,7 +126,7 @@ else
|
|||
echo -e "Cancelled\n"
|
||||
fi
|
||||
|
||||
echo "Packages that failed to schedule for install:"
|
||||
echo "\${bold}Packages that failed to schedule for install:\${normal}"
|
||||
cat "\${TMPDIR}/diff.fail" | tr '\n' ' ' | fold -s
|
||||
EOF
|
||||
chmod ug+rx restore.sh
|
||||
|
|
Loading…
Reference in a new issue