mirror of
https://github.com/Snigdha-OS/snigdhaos-pkgbuilds.git
synced 2025-09-21 03:55:02 +02:00
⚡️ perf: psot upgrade made better
This commit is contained in:
@@ -1,160 +1,130 @@
|
|||||||
post_install(){
|
#!/bin/bash
|
||||||
tput setaf 3;
|
|
||||||
echo
|
# Function to display a warning message
|
||||||
echo "[WARNING] WARNING!"
|
warn() {
|
||||||
echo
|
tput setaf 3
|
||||||
echo "If you are on Grub, please install the following package..."
|
echo "[WARNING] $1"
|
||||||
echo "sudo pacman -S snigdhaos-bootloader-grub"
|
tput sgr0
|
||||||
echo
|
}
|
||||||
echo "If you are using systemd-boot then isntall the following package..."
|
|
||||||
echo "sudo pacman -S snigdhaos-bootloader-systemd"
|
# Function to display an informational message
|
||||||
echo
|
info() {
|
||||||
echo "[WARNING] WARNING!"
|
tput setaf 2
|
||||||
echo
|
echo "$1"
|
||||||
tput setaf 2;
|
tput sgr0
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to display a success message
|
||||||
|
success() {
|
||||||
|
tput setaf 6
|
||||||
|
echo "$1"
|
||||||
|
tput sgr0
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to display an error message
|
||||||
|
error() {
|
||||||
|
tput setaf 1
|
||||||
|
echo "[ERROR] $1"
|
||||||
|
tput sgr0
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to check if a package is installed
|
||||||
|
package_installed() {
|
||||||
|
if pacman -Qi "$1" &> /dev/null; then
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to handle package installation confirmation
|
||||||
|
confirm_package_installed() {
|
||||||
|
local package=$1
|
||||||
|
if package_installed "$package"; then
|
||||||
|
success "$package found!"
|
||||||
|
info "Bootloader is safe!"
|
||||||
|
else
|
||||||
|
error "$package not found!"
|
||||||
|
warn "Install the package for your safety!"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Function to handle post-install tasks
|
||||||
|
post_install() {
|
||||||
|
warn "If you are on Grub, please install the following package..."
|
||||||
|
info "sudo pacman -S snigdhaos-bootloader-grub"
|
||||||
|
warn "If you are using systemd-boot then install the following package..."
|
||||||
|
info "sudo pacman -S snigdhaos-bootloader-systemd"
|
||||||
|
|
||||||
bootloader=$(bootctl status | grep "Product" | awk '{print $2}')
|
bootloader=$(bootctl status | grep "Product" | awk '{print $2}')
|
||||||
|
|
||||||
if [ "$bootloader" = "systemd-boot" ]; then
|
if [ "$bootloader" = "systemd-boot" ]; then
|
||||||
echo
|
info "systemd-bootloader found!"
|
||||||
echo "systemd-bootloader found!"
|
info "Install the following package for your safety!"
|
||||||
echo "Install the following package for your safety!"
|
info "sudo pacman -S snigdhaos-bootloader-systemd"
|
||||||
echo
|
info "It has all the pacman-hooks which are essentials."
|
||||||
echo "sudo pacman -S snigdhaos-bootloader-systemd"
|
elif [ "$bootloader" = "GRUB" ]; then
|
||||||
echo "It has all the pacman-hooks which are essentials."
|
info "GRUB bootloader found!"
|
||||||
echo
|
info "Install the following package for your safety!"
|
||||||
elif [ $bootloader = "GRUB" ]; then
|
info "sudo pacman -S snigdhaos-bootloader-grub"
|
||||||
echo
|
info "It has all the pacman-hooks which are essentials."
|
||||||
echo "GRUB bootloader found!"
|
|
||||||
echo "Install the following package for your safety!"
|
|
||||||
echo
|
|
||||||
echo "sudo pacman -S snigdhaos-bootloader-grub"
|
|
||||||
echo "It has all the pacman-hooks which are essentials."
|
|
||||||
echo
|
|
||||||
fi
|
fi
|
||||||
tput sgr0
|
|
||||||
|
|
||||||
# Confirmation for package installation
|
confirm_package_installed "snigdhaos-bootloader-grub"
|
||||||
package_installed(){
|
confirm_package_installed "snigdhaos-bootloader-systemd"
|
||||||
if pacman -Qi "$1" &> /dev/null; then
|
|
||||||
return 0
|
|
||||||
else
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
tput setaf 6;
|
if ! package_installed "snigdhaos-bootloader-systemd" && ! package_installed "snigdhaos-bootloader-grub"; then
|
||||||
if package_installed snigdhaos-bootloader-grub; then
|
error "snigdhaos-bootloader-systemd or snigdhaos-bootloader-grub not found!"
|
||||||
echo
|
warn "Install the package for systemd or grub!"
|
||||||
echo "snigdhaos-bootloader-grub found!"
|
|
||||||
echo "Bootloader is safe!"
|
|
||||||
echo
|
|
||||||
fi
|
fi
|
||||||
tput sgr0
|
|
||||||
|
|
||||||
tput setaf 6;
|
|
||||||
if package_installed snigdhaos-bootloader-systemd; then
|
|
||||||
echo
|
|
||||||
echo "snigdhaos-bootloader-systemd found!"
|
|
||||||
echo "Bootloader is safe!"
|
|
||||||
echo
|
|
||||||
fi
|
|
||||||
tput sgr0
|
|
||||||
|
|
||||||
tput setaf 1;
|
|
||||||
if ! package_installed snigdhaos-bootloader-systemd && ! package_installed snigdhaos-bootloader-grub; then
|
|
||||||
echo
|
|
||||||
echo "snigdhaos-bootloader-systemd or snigdhaos-bootloader-grub not found!"
|
|
||||||
echo "[WARNING] WARNING!"
|
|
||||||
echo "Install the package for systemd or grub!"
|
|
||||||
echo
|
|
||||||
fi
|
|
||||||
tput sgr0
|
|
||||||
|
|
||||||
if systemctl --all --type service | grep -q "virtual-machine-check"; then
|
if systemctl --all --type service | grep -q "virtual-machine-check"; then
|
||||||
systemctl disable virtual-machine-check.service
|
systemctl disable virtual-machine-check.service
|
||||||
fi
|
fi
|
||||||
|
|
||||||
sh /usr/local/bin/snigdhaos-lsb-release
|
sh /usr/local/bin/snigdhaos-lsb-release
|
||||||
sh /usr/local/bin/snigdhaos-os-release
|
sh /usr/local/bin/snigdhaos-os-release
|
||||||
}
|
}
|
||||||
|
|
||||||
post_upgrade(){
|
# Function to handle post-upgrade tasks
|
||||||
tput setaf 3;
|
post_upgrade() {
|
||||||
echo
|
warn "If you are on Grub, please install the following package..."
|
||||||
echo "[WARNING] WARNING!"
|
info "sudo pacman -S snigdhaos-bootloader-grub"
|
||||||
echo
|
warn "If you are using systemd-boot then install the following package..."
|
||||||
echo "If you are on Grub, please install the following package..."
|
info "sudo pacman -S snigdhaos-bootloader-systemd"
|
||||||
echo "sudo pacman -S snigdhaos-bootloader-grub"
|
|
||||||
echo
|
|
||||||
echo "If you are using systemd-boot then isntall the following package..."
|
|
||||||
echo "sudo pacman -S snigdhaos-bootloader-systemd"
|
|
||||||
echo
|
|
||||||
echo "[WARNING] WARNING!"
|
|
||||||
echo
|
|
||||||
tput setaf 2;
|
|
||||||
bootloader=$(bootctl status | grep "Product" | awk '{print $2}')
|
bootloader=$(bootctl status | grep "Product" | awk '{print $2}')
|
||||||
|
|
||||||
if [ "$bootloader" = "systemd-boot" ]; then
|
if [ "$bootloader" = "systemd-boot" ]; then
|
||||||
echo
|
info "systemd-bootloader found!"
|
||||||
echo "systemd-bootloader found!"
|
info "Install the following package for your safety!"
|
||||||
echo "Install the following package for your safety!"
|
info "sudo pacman -S snigdhaos-bootloader-systemd"
|
||||||
echo
|
info "It has all the pacman-hooks which are essentials."
|
||||||
echo "sudo pacman -S snigdhaos-bootloader-systemd"
|
elif [ "$bootloader" = "GRUB" ]; then
|
||||||
echo "It has all the pacman-hooks which are essentials."
|
info "GRUB bootloader found!"
|
||||||
echo
|
info "Install the following package for your safety!"
|
||||||
elif [ $bootloader = "GRUB" ]; then
|
info "sudo pacman -S snigdhaos-bootloader-grub"
|
||||||
echo
|
info "It has all the pacman-hooks which are essentials."
|
||||||
echo "GRUB bootloader found!"
|
|
||||||
echo "Install the following package for your safety!"
|
|
||||||
echo
|
|
||||||
echo "sudo pacman -S snigdhaos-bootloader-grub"
|
|
||||||
echo "It has all the pacman-hooks which are essentials."
|
|
||||||
echo
|
|
||||||
fi
|
fi
|
||||||
tput sgr0
|
|
||||||
|
|
||||||
# Confirmation for package installation
|
confirm_package_installed "snigdhaos-bootloader-grub"
|
||||||
package_installed(){
|
confirm_package_installed "snigdhaos-bootloader-systemd"
|
||||||
if pacman -Qi "$1" &> /dev/null; then
|
|
||||||
return 0
|
|
||||||
else
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
tput setaf 6;
|
if ! package_installed "snigdhaos-bootloader-systemd" && ! package_installed "snigdhaos-bootloader-grub"; then
|
||||||
if package_installed snigdhaos-bootloader-grub; then
|
error "snigdhaos-bootloader-systemd or snigdhaos-bootloader-grub not found!"
|
||||||
echo
|
warn "Install the package for systemd or grub!"
|
||||||
echo "snigdhaos-bootloader-grub found!"
|
|
||||||
echo "Bootloader is safe!"
|
|
||||||
echo
|
|
||||||
fi
|
fi
|
||||||
tput sgr0
|
|
||||||
|
|
||||||
tput setaf 6;
|
|
||||||
if package_installed snigdhaos-bootloader-systemd; then
|
|
||||||
echo
|
|
||||||
echo "snigdhaos-bootloader-systemd found!"
|
|
||||||
echo "Bootloader is safe!"
|
|
||||||
echo
|
|
||||||
fi
|
|
||||||
tput sgr0
|
|
||||||
|
|
||||||
tput setaf 1;
|
|
||||||
if ! package_installed snigdhaos-bootloader-systemd && ! package_installed snigdhaos-bootloader-grub; then
|
|
||||||
echo
|
|
||||||
echo "snigdhaos-bootloader-systemd or snigdhaos-bootloader-grub not found!"
|
|
||||||
echo "[WARNING] WARNING!"
|
|
||||||
echo "Install the package for systemd or grub!"
|
|
||||||
echo
|
|
||||||
fi
|
|
||||||
tput sgr0
|
|
||||||
|
|
||||||
if systemctl --all --type service | grep -q "virtual-machine-check"; then
|
if systemctl --all --type service | grep -q "virtual-machine-check"; then
|
||||||
systemctl disable virtual-machine-check.service
|
systemctl disable virtual-machine-check.service
|
||||||
fi
|
fi
|
||||||
|
|
||||||
sh /usr/local/bin/snigdhaos-lsb-release
|
sh /usr/local/bin/snigdhaos-lsb-release
|
||||||
sh /usr/local/bin/snigdhaos-os-release
|
sh /usr/local/bin/snigdhaos-os-release
|
||||||
}
|
}
|
||||||
|
|
||||||
pre_remove(){
|
# Function to handle pre-remove tasks
|
||||||
|
pre_remove() {
|
||||||
if systemctl --all --type service | grep -q "virtual-machine-check"; then
|
if systemctl --all --type service | grep -q "virtual-machine-check"; then
|
||||||
systemctl disable virtual-machine-check.service
|
systemctl disable virtual-machine-check.service
|
||||||
fi
|
fi
|
||||||
|
Reference in New Issue
Block a user