Created
May 3, 2024 03:56
-
-
Save yozachar/4938b4b4a95693582afe476dd92063b7 to your computer and use it in GitHub Desktop.
Update your ArchLinux with a single click
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Desktop Entry] | |
Version=1.0 | |
Name=System Update | |
Comment=Update your system | |
Exec=bash -c "~/.local/bin/sysu koe" | |
Icon=software-update-available | |
Terminal=true | |
Type=Application | |
Categories=Application; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# # Colors | |
RESET='\033[0m' # Reset color | |
# Regular Colors | |
# BLACK='\033[0;30m' # Black | |
RED='\033[0;31m' # Red | |
GREEN='\033[0;32m' # Green | |
YELLOW='\033[0;33m' # Yellow | |
GRAY='\033[0;37m' # Gray | |
# BLUE='\033[0;34m' # Blue | |
# PURPLE='\033[0;35m' # Purple | |
CYAN='\033[0;36m' # Cyan | |
# WHITE='\033[0;37m' # White | |
function run_update { | |
echo -e "\n${CYAN}Fetching ${YELLOW}flatpak${CYAN} updates ...${RESET}\n" | |
flatpak update -y | |
local flatpak_exit_code=$? | |
echo -e "\n${CYAN}Fetching ${YELLOW}pacman${CYAN} updates ...${RESET}\n" | |
pkexec pacman -Syu --noconfirm | |
local pacman_exit_code=$? | |
return "$([[ $flatpak_exit_code -gt $pacman_exit_code ]] && echo $flatpak_exit_code || echo $pacman_exit_code)" | |
} | |
run_update | |
exit_code=$? | |
if [[ $exit_code -eq 0 ]]; then | |
echo -e "\n🚀 ${GREEN}Updates complete.${RESET}\n" | |
else | |
echo -e "\n🤧 ${RED}Updates failed! ${RESET}" | |
fi | |
# kill-on-enter | |
if [[ $1 == "koe" ]]; then | |
echo -e "\n${GRAY}You may now close this window.${RESET}" | |
# echo -e "\n${BLUE}Hit any key to exit${RESET}" | |
# read -r | |
# kill window here (wayland?) | |
fi | |
exit $exit_code | |
# https://stackoverflow.com/questions/5947742/how-to-change-the-output-color-of-echo-in-linux |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment