Should work properly now
This commit is contained in:
parent
9b66f59fc2
commit
b587f13ed2
29
update
29
update
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
source "$HOME"/.config/update.conf
|
source "$HOME"/.config/update.conf
|
||||||
|
|
||||||
VER="1.9"
|
VER="2.0.0"
|
||||||
IGREEN="\033[0;92m" # Intense Green
|
IGREEN="\033[0;92m" # Intense Green
|
||||||
IYELLOW="\033[0;93m" # Intense Red
|
IYELLOW="\033[0;93m" # Intense Red
|
||||||
NC="\033[0m" # Text Reset
|
NC="\033[0m" # Text Reset
|
||||||
@ -27,11 +27,12 @@ Help() {
|
|||||||
echo "-g shutdowns the computer afterwards"
|
echo "-g shutdowns the computer afterwards"
|
||||||
echo "-r reboots the computer afterwards"
|
echo "-r reboots the computer afterwards"
|
||||||
echo "--help displays this message"
|
echo "--help displays this message"
|
||||||
echo "-P, --preview shows a preview of which pkg's can be updated"
|
echo "--preview shows a preview of which pkg's can be updated"
|
||||||
|
echo "--version prints out the version number"
|
||||||
}
|
}
|
||||||
|
|
||||||
check_for_dblck() {
|
check_for_dblck() {
|
||||||
while [ -f /var/lib/pacman/db.lck ]; do {
|
if [ -f /var/lib/pacman/db.lck ]; do {
|
||||||
echo -e "${IYELLOW}->${NC} /var/lib/pacman/db.lck exists"
|
echo -e "${IYELLOW}->${NC} /var/lib/pacman/db.lck exists"
|
||||||
echo -e "${IYELLOW}->${NC} there might be another instance of pacman running. exiting..."
|
echo -e "${IYELLOW}->${NC} there might be another instance of pacman running. exiting..."
|
||||||
exit 1
|
exit 1
|
||||||
@ -65,13 +66,12 @@ after_backup() {
|
|||||||
tar -cJf "$TMP"/after-backup_"$DATE".tar.xz.new "$TMP"/after-backup_"$DATE" &> /dev/null
|
tar -cJf "$TMP"/after-backup_"$DATE".tar.xz.new "$TMP"/after-backup_"$DATE" &> /dev/null
|
||||||
cp "$TMP"/after-backup_"$DATE".tar.xz.new "$BACKUP_LOCATION"
|
cp "$TMP"/after-backup_"$DATE".tar.xz.new "$BACKUP_LOCATION"
|
||||||
rename after-backup_"$DATE".tar.xz.new after-backup_"$DATE".tar.xz "$BACKUP_LOCATION"/after-backup_"$DATE".tar.xz.new
|
rename after-backup_"$DATE".tar.xz.new after-backup_"$DATE".tar.xz "$BACKUP_LOCATION"/after-backup_"$DATE".tar.xz.new
|
||||||
|
[[ $FINAL_COMMAND ]] && sleep 3s && $FINAL_COMMAND && exit 0
|
||||||
}
|
}
|
||||||
|
|
||||||
update_with_pacman_wrapper() {
|
update_with_pacman_wrapper() {
|
||||||
before_backup && echo -e "${IGREEN}pre-backup complete${NC}"
|
|
||||||
"$PACMAN_WRAPPER"
|
"$PACMAN_WRAPPER"
|
||||||
pacman -Q > "$TMP"/after-backup_"$DATE"/pacman-after.txt
|
pacman -Q > "$TMP"/after-backup_"$DATE"/pacman-after.txt
|
||||||
after_backup && echo -e "${IGREEN}after-backup complete${NC}"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
update_with_flatpak() {
|
update_with_flatpak() {
|
||||||
@ -86,12 +86,7 @@ interrupt_function() {
|
|||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
final() {
|
[[ $1 ]] || before_backup && echo -e "${IGREEN}pre-backup complete${NC}" && update_with_pacman_wrapper
|
||||||
rm -r "$TMP" &> /dev/null
|
|
||||||
[[ $FINAL_COMMAND ]] && sleep 3s && $FINAL_COMMAND && exit 0
|
|
||||||
}
|
|
||||||
|
|
||||||
[[ $1 ]] || update_with_pacman_wrapper
|
|
||||||
if [[ ${1:0:2} = -- ]]; then
|
if [[ ${1:0:2} = -- ]]; then
|
||||||
case "${1:2}" in
|
case "${1:2}" in
|
||||||
help)
|
help)
|
||||||
@ -104,30 +99,26 @@ if [[ ${1:0:2} = -- ]]; then
|
|||||||
Help && exit 1;;
|
Help && exit 1;;
|
||||||
esac
|
esac
|
||||||
else
|
else
|
||||||
|
before_backup && echo -e "${IGREEN}pre-backup complete${NC}"
|
||||||
|
|
||||||
while getopts 'fpagr' OPTIONS; do
|
while getopts 'fpagr' OPTIONS; do
|
||||||
case $OPTIONS in
|
case $OPTIONS in
|
||||||
P)
|
|
||||||
sudo pacman -Sy &> /dev/null && sudo pacman -Qu && exit 0;;
|
|
||||||
f)
|
f)
|
||||||
update_with_flatpak;;
|
update_with_flatpak;;
|
||||||
p)
|
p)
|
||||||
update_with_pacman_wrapper ;;
|
update_with_pacman_wrapper ;;
|
||||||
a)
|
a)
|
||||||
update_with_flatpak; update_with_pacman_wrapper ;;
|
update_with_pacman_wrapper; update_with_flatpak ;;
|
||||||
g)
|
g)
|
||||||
[[ $1 = -g ]] && update_with_pacman_wrapper
|
[[ $1 = -g ]] && update_with_pacman_wrapper
|
||||||
FINAL_COMMAND="shutdown now" ;;
|
FINAL_COMMAND="shutdown now" ;;
|
||||||
r)
|
r)
|
||||||
[[ $1 = -r ]] && update_with_pacman_wrapper
|
[[ $1 = -r ]] && update_with_pacman_wrapper
|
||||||
FINAL_COMMAND="reboot" ;;
|
FINAL_COMMAND="reboot" ;;
|
||||||
h)
|
|
||||||
Help && exit 0;;
|
|
||||||
V)
|
|
||||||
echo "$VER" && exit 0;;
|
|
||||||
?)
|
?)
|
||||||
Help && exit 1;;
|
Help && exit 1;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
final
|
after_backup && echo -e "${IGREEN}after-backup complete${NC}"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user