36 lines
730 B
Plaintext
36 lines
730 B
Plaintext
|
#!/bin/bash
|
||
|
|
||
|
# Apply updates to the system
|
||
|
|
||
|
# Function to update the system
|
||
|
function update_system() {
|
||
|
# Define CHROOT
|
||
|
CHROOT=$(mount | grep proc | grep calamares | awk '{print $3}' | sed -e "s#/proc##g")
|
||
|
|
||
|
# Verifying CHROOT
|
||
|
if [ -z "$CHROOT" ]; then
|
||
|
echo "Error: CHROOT is not set."
|
||
|
exit 1
|
||
|
fi
|
||
|
|
||
|
echo "Updating the system..."
|
||
|
|
||
|
# Update the package list
|
||
|
chroot $CHROOT /usr/bin/apt update
|
||
|
|
||
|
# Update installed packages
|
||
|
chroot $CHROOT /usr/bin/apt upgrade -y
|
||
|
|
||
|
# Remove unnecessary packages
|
||
|
chroot $CHROOT /usr/bin/apt autoremove -y
|
||
|
|
||
|
# Clean the APT cache
|
||
|
chroot $CHROOT /usr/bin/apt clean
|
||
|
|
||
|
echo "System successfully updated!"
|
||
|
}
|
||
|
|
||
|
# Run the function to update the system
|
||
|
update_system
|
||
|
|