Added PostUpgrade tasks for Debian 13 and Alpine 3.23, refactored Type Detection of scripts tageting one system
This commit is contained in:
41
functions.sh
41
functions.sh
@@ -180,6 +180,8 @@ UpgradeRelease () {
|
||||
$INSTCALL -- sh -c "DEBIAN_FRONTEND=noninteractive apt full-upgrade -y -o Dpkg::Options::="--force-confold""
|
||||
$INSTCALL -- apt autoremove -y
|
||||
DOREBOOT=true
|
||||
# Post release cleanup if required
|
||||
if [ "${NewDebianVersion}" = "trixie" ]; then PostDebianTrixieTasks; fi
|
||||
else
|
||||
echo "Notice: Skiped, already up-to-date"
|
||||
fi
|
||||
@@ -199,6 +201,8 @@ UpgradeRelease () {
|
||||
$INSTCALL -- apk add --upgrade apk-tools
|
||||
$INSTCALL -- apk upgrade --available
|
||||
DOREBOOT=true
|
||||
# Post release cleanup if required
|
||||
if [ "${NewAlpineVersion}" = "3.23" ]; then PostAlpine323Tasks; fi
|
||||
else
|
||||
echo "Notice: Skiped, already up-to-date"
|
||||
fi
|
||||
@@ -231,8 +235,7 @@ UpgradeRelease () {
|
||||
fi
|
||||
}
|
||||
|
||||
ParseOSRelease()
|
||||
{
|
||||
ParseOSRelease () {
|
||||
if [ ! -z "$OSRELEASE" ]; then
|
||||
DISTRO=$(printf "$OSRELEASE" | awk -F= '$1=="ID" { print $2 ;}' |tr -d '"')
|
||||
VERSION=$(printf "$OSRELEASE" | awk -F= '$1=="VERSION_ID" { print $2 ;}' |tr -d '"')
|
||||
@@ -248,4 +251,38 @@ ParseOSRelease()
|
||||
if [ -z ${VERSION+x} ]; then local VERSION=N/A;fi
|
||||
fi
|
||||
echo "$TYPE,$ID,$NAME,$STATUS,$DISTRO,$VERSION" | tee -a $InventoryFile
|
||||
}
|
||||
|
||||
#Steps required after upgrade for certain distros and releases
|
||||
|
||||
PostDebianTrixieTasks () {
|
||||
#Modernize apt sources
|
||||
$INSTCALL -- apt modernize-sources -y
|
||||
$INSTCALL -- rm -f /etc/apt/sources.list.bak
|
||||
$INSTCALL -- rm -f /etc/apt/sources.list.d/*.bak
|
||||
|
||||
# Disable unwanted mounts
|
||||
$INSTCALL -- systemctl mask dev-mqueue.mount
|
||||
$INSTCALL -- systemctl mask run-lock.mount
|
||||
$INSTCALL -- systemctl mask sys-kernel-config.mount
|
||||
$INSTCALL -- systemctl mask sys-kernel-debug.mount
|
||||
$INSTCALL -- systemctl mask tmp.mount
|
||||
}
|
||||
|
||||
PostAlpine323Tasks () {
|
||||
$INSTCALL -- apk add merge-usr
|
||||
$INSTCALL -- merge-usr --dryrun
|
||||
while true; do
|
||||
read -p "Are any errors are printed out? -> yes/no?" yn
|
||||
case $yn in
|
||||
[Nn]* )
|
||||
$INSTCALL -- merge-usr
|
||||
$INSTCALL -- apk del merge-usr
|
||||
;;
|
||||
[Yy]* )
|
||||
echo "Migrating /bin to /usr/bin skiped due to an error, please investigate and complete manualy"
|
||||
;;
|
||||
* ) echo "Choose yes or no.";;
|
||||
esac
|
||||
done
|
||||
}
|
||||
Reference in New Issue
Block a user