Update os agent to also run flatpak if flatpak exists.
This commit is contained in:
parent
3073d18f0b
commit
e4880cde6f
3 changed files with 47 additions and 3 deletions
|
@ -18,9 +18,44 @@ if [[ ! -f "flatpaks.lst" ]]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
which flatpak || exit 0
|
# Removal uninstalled packages:
|
||||||
xargs flatpak install -y < flatpaks.lst
|
echo
|
||||||
|
echo "=============================="
|
||||||
|
echo "INSTALL FLATPAK PACKAGES"
|
||||||
|
echo "=============================="
|
||||||
|
echo
|
||||||
|
echo "The following flatpak packages are listed to be installed:"
|
||||||
|
cat flatpaks.lst
|
||||||
|
echo
|
||||||
|
read -p "Do you want to proceed? [Y/n] " -n 1 -sr promptFlatpak
|
||||||
|
if [[ "\$promptFlatpak" =~ ^[Yy]$ ]]; then
|
||||||
|
# Do the thing
|
||||||
|
echo "Yes"
|
||||||
|
|
||||||
|
read -p "Do you want to omit any packages or cancel? [N, y, c] " -n 1 -sr promptFlatpakVerify
|
||||||
|
if [[ "\$promptFlatpakVerify" =~ ^[Yy]$ ]]; then
|
||||||
|
echo
|
||||||
|
read -p "What do you want to omit, seperated by spaces? " -r promptFlatpakOmit
|
||||||
|
omitfp="\$(echo "\$promptFlatpakOmit" | tr ' ' '|')"
|
||||||
|
echo
|
||||||
|
elif [[ "\$promptFlatpakVerify" =~ ^[Cc]$ ]]; then
|
||||||
|
echo -e "Cancelled\n"
|
||||||
|
omitfp="CANCEL"
|
||||||
|
else
|
||||||
|
omitfp=""
|
||||||
|
echo
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ "\$omitfp" != "CANCEL" ]]; then
|
||||||
|
egrep -v "(\$omitfp)" flatpaks.lst | xargs flatpak install -y
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo -e "Cancelled\n"
|
||||||
|
fi
|
||||||
EOF
|
EOF
|
||||||
|
#which flatpak || exit 0
|
||||||
|
#xargs flatpak install -y < flatpaks.lst
|
||||||
|
#EOF
|
||||||
|
|
||||||
popd || exit 2
|
popd || exit 2
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,6 +24,11 @@ checkOS() {
|
||||||
elif [[ "$kernel" == "Linux" ]]; then
|
elif [[ "$kernel" == "Linux" ]]; then
|
||||||
if [[ -f /etc/os-release ]]; then
|
if [[ -f /etc/os-release ]]; then
|
||||||
source /etc/os-release
|
source /etc/os-release
|
||||||
|
DISTRO="$ID"
|
||||||
|
DISTRO_CURRENT="$DISTRO"
|
||||||
|
if [[ -n "$ID_LIKE" ]]; then
|
||||||
|
DISTRO="$ID_LIKE"
|
||||||
|
fi
|
||||||
return 0
|
return 0
|
||||||
else
|
else
|
||||||
echo "Unknown Linux Distribution"
|
echo "Unknown Linux Distribution"
|
||||||
|
@ -39,7 +44,7 @@ runOsHook() {
|
||||||
if [[ "$kernel" == "Darwin" ]]; then
|
if [[ "$kernel" == "Darwin" ]]; then
|
||||||
"${scriptPath}/os_macos" "$hook"
|
"${scriptPath}/os_macos" "$hook"
|
||||||
elif [[ "$kernel" == "Linux" ]]; then
|
elif [[ "$kernel" == "Linux" ]]; then
|
||||||
case "$ID" in
|
case "$DISTRO" in
|
||||||
debian) "${scriptPath}/os_debian" "$hook";;
|
debian) "${scriptPath}/os_debian" "$hook";;
|
||||||
fedora) "${scriptPath}/os_fedora" "$hook";;
|
fedora) "${scriptPath}/os_fedora" "$hook";;
|
||||||
garuda) "${scriptPath}/os_garuda" "$hook";;
|
garuda) "${scriptPath}/os_garuda" "$hook";;
|
||||||
|
@ -47,6 +52,8 @@ runOsHook() {
|
||||||
opensuse-leap) "${scriptPath}/os_suse" "$hook";;
|
opensuse-leap) "${scriptPath}/os_suse" "$hook";;
|
||||||
opensuse-tumbleweed) "${scriptPath}/os_suse" "$hook";;
|
opensuse-tumbleweed) "${scriptPath}/os_suse" "$hook";;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
command -v flatpak &>/dev/null && "${scriptPath}/flatpak" "$hook"
|
||||||
fi
|
fi
|
||||||
return $?
|
return $?
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,8 @@ hook_before() {
|
||||||
|
|
||||||
rpm -qa | sort > Package.versions.list
|
rpm -qa | sort > Package.versions.list
|
||||||
rpm -qa --queryformat '%{NAME}.%{ARCH}\n' | sort > Package.list
|
rpm -qa --queryformat '%{NAME}.%{ARCH}\n' | sort > Package.list
|
||||||
|
#FIXME Need to put this to use for explicitely installed packages.
|
||||||
|
dnf repoquery --userinstalled > Package.userinstalled.list
|
||||||
|
|
||||||
cat > restore.sh <<EOF
|
cat > restore.sh <<EOF
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
Loading…
Reference in a new issue