Skip to content

Commit

Permalink
New simplified minimal UI
Browse files Browse the repository at this point in the history
  • Loading branch information
cerebrux committed Nov 16, 2024
1 parent 3b4d692 commit 7065d35
Showing 1 changed file with 27 additions and 52 deletions.
79 changes: 27 additions & 52 deletions ucaresystem-core
Original file line number Diff line number Diff line change
Expand Up @@ -96,18 +96,13 @@ function WELCOME_SCREEN {
function MAINTENANCE {
echo
echo
echo "#########################"
echo " Started"
echo "#########################"
echo
echo "====== Started ======"
sleep 1
echo
echo "#######################################"
echo "Checking Disk before System Maintenance"
echo "#######################################"
echo "====== Checking Disk usage before System Maintenance ======"
echo
df_output=$(df -h / | awk 'NR==2 {print "Percentage of disk space used:", $5, "\nFree space available:", $4}')
echo "Here is the disk space before cleaning"
echo ""
echo "$df_output"
echo
sleep 1
Expand All @@ -120,7 +115,7 @@ function MAINTENANCE {
echo
fi
## Updates package lists
echo "Updating package lists..."
echo "====== Updating package lists ======"
echo
# Update package lists and filter out warnings
sudo apt update 2> >(sed 's/^WARNING.*//') |
Expand All @@ -130,29 +125,24 @@ function MAINTENANCE {
sleep 1
sudo apt list --upgradable;
echo
echo "###############################"
echo "Finished updating package lists"
echo "###############################"
echo "====== Finished updating package lists ======"
sleep 1
echo

## Updates packages and libraries
sudo apt full-upgrade -V -y;
echo
echo "###############################################"
echo "Finished updating packages and system libraries"
echo "###############################################"
echo "====== Finished upgrading system packages and libraries ======"
sleep 1
echo

## Removes unneeded packages
sudo apt autoremove -y --purge;
echo
echo "###################################"
echo "Finished removing unneeded packages"
echo "###################################"
echo "====== Finished removing unneeded packages ======"
sleep 1
echo
echo "Checking for Snap and Flatpak updates and removing unused revisions..."
echo "====== Checking for Snap and Flatpak updates ======"
echo
# Check if Snap is installed
if command -v snap &> /dev/null; then
Expand All @@ -178,7 +168,8 @@ function MAINTENANCE {

# Remove old revisions of Snap packages
echo
echo "Removing old revisions of Snap packages..."
echo "===== Removing old revisions of Snap packages ====="
echo
LANG=C sudo snap list --all | awk '/disabled/{print $1, $3}' |
while read snapname revision; do
sudo snap remove --purge "$snapname" --revision="$revision"
Expand All @@ -203,23 +194,23 @@ function MAINTENANCE {
fi
# Check if flatpak is installed then start maintenance
if command -v flatpak &>/dev/null; then
echo "Updating Flatpak packages..."
echo ""
echo "===== Updating Flatpak packages ====="
sleep 1
sudo flatpak update -y
echo
echo "Removing unused Flatpak packages..."
echo ""
echo "===== Removing unused Flatpak packages ====="
sudo flatpak uninstall --unused -y
sleep 1
echo
else
echo
echo ""
echo "===== Updating Flatpak packages ====="
echo "Flatpak is not available on this system. Skipping."
sleep 1
fi
echo
echo "################################################"
echo "Finished refreshing of Snap and Flatpak packages"
echo "################################################"
echo "===== Finished refreshing Snap and Flatpak packages ====="
sleep 1
echo

Expand Down Expand Up @@ -261,35 +252,25 @@ function MAINTENANCE {
sudo apt $APT_OPTS remove -y --purge $PURGE;

echo
echo "###################################"
echo "Finished removing old kernels"
echo "###################################"
echo "===== Finished removing old kernels ====="
sleep 1
echo
## Removes unused config files of uninstalled packages
dpkg --get-selections | grep deinstall | cut -f1 | xargs sudo apt autoremove -y --purge;
echo
echo "######################################################"
echo "Finished removing config files of uninstalled packages"
echo "######################################################"
echo "===== Finished removing the config files of uninstalled packages ====="
sleep 1
echo

## Removes package files that can no longer be downloaded and everything except
# the lock file in /var/cache/apt/archives, including directories.
sudo apt -y autoclean; sudo apt -y clean;
echo
echo "######################################"
echo " Cleaned downloaded temporary packages"
echo "######################################"
echo
echo "===== Finished cleaning up downloaded packages ====="
sleep 1

echo
echo "#########################################"
echo " Checking to see if a reboot is required"
echo "#########################################"
echo
echo "===== Checking to see if a reboot is required ====="
## Check to see if a reboot is required
if [ -f /var/run/reboot-required ]; then
echo
Expand All @@ -315,9 +296,7 @@ function MAINTENANCE {
fi
sleep 1
echo
echo "######################################"
echo "Checking Disk after System Maintenance"
echo "######################################"
echo "===== checking Disk usage after System Maintenance ====="
echo
df_output=$(df -h / | awk 'NR==2 {print "Percentage of disk space used:", $5, "\nFree space available:", $4}')
echo "$df_output"
Expand Down Expand Up @@ -436,11 +415,9 @@ function SHUT_DOWN {
sleep 1
echo
echo
echo "##############################"
echo "Shutting down as you requested"
echo "##############################"
echo "===== Shutting down as you requested ====="
echo
MESSAGE="Shutting down"
MESSAGE="Shutting down..."
COUNTDOWN $duration
if command -v systemctl &> /dev/null; then
sudo systemctl poweroff
Expand All @@ -453,11 +430,9 @@ function RE_BOOT {
sleep 1
echo
echo
echo "##########################"
echo "Rebooting as you requested"
echo "##########################"
echo "===== Rebooting as you requested ====="
echo
MESSAGE="Rebooting"
MESSAGE="Rebooting..."
COUNTDOWN $duration
if command -v systemctl &> /dev/null; then
sudo systemctl reboot
Expand Down

0 comments on commit 7065d35

Please sign in to comment.