Compare commits
5 Commits
bbec26f438
...
e4e6f51bdb
Author | SHA1 | Date | |
---|---|---|---|
e4e6f51bdb | |||
0db312e8a0 | |||
2fff3ce2a2 | |||
b7a2dc89be | |||
afab665ca6 |
13
README.md
13
README.md
@ -1,14 +1,10 @@
|
|||||||
# Update
|
# Update
|
||||||
|
|
||||||
Update script written in Bash for Arch Linux only. Keeps all your pacman and aur packages as well as your flatpaks up to date with one simple script. It also backups a list of all your pacman and aur packages and flatpaks.
|
Update script written in Bash for Arch Linux only. Keeps all your official, aur packages and your flatpaks up to date with one simple script. It also backups a list of all your installed packages and flatpaks.
|
||||||
|
|
||||||
## Requirements
|
## Requirements
|
||||||
|
|
||||||
Here is what is required.
|
It requires sudo, but if you use something else, then just create a softlink for this script to work.
|
||||||
```bash
|
|
||||||
pacman -S just
|
|
||||||
```
|
|
||||||
It also technically requires sudo, but if you use something else, then just create a softlink for this script to work.<br/>
|
|
||||||
Doing that would look like this.
|
Doing that would look like this.
|
||||||
```bash
|
```bash
|
||||||
ln -s /usr/bin/your_program /usr/bin/sudo
|
ln -s /usr/bin/your_program /usr/bin/sudo
|
||||||
@ -20,10 +16,10 @@ ln -s /usr/bin/your_program /usr/bin/sudo
|
|||||||
git clone https://gitea.hopeless-cloud.xyz/AustrianToast/update.git && cd update
|
git clone https://gitea.hopeless-cloud.xyz/AustrianToast/update.git && cd update
|
||||||
```
|
```
|
||||||
|
|
||||||
Before installing, please edit the config and configure it to your liking.<br/>
|
Before installing, please edit the config and configure it to your liking.
|
||||||
Then install using
|
Then install using
|
||||||
```bash
|
```bash
|
||||||
just install
|
make
|
||||||
```
|
```
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
@ -45,5 +41,4 @@ no flag same as -p
|
|||||||
```
|
```
|
||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
|
|
||||||
Contributions are always welcome!
|
Contributions are always welcome!
|
||||||
|
33
update
33
update
@ -1,9 +1,6 @@
|
|||||||
#!/usr/bin/bash
|
#!/usr/bin/bash
|
||||||
|
|
||||||
source "$HOME"/.config/update.conf || exit 1
|
VERSION="2.1.1"
|
||||||
[[ ! -d $BACKUP_LOCATION ]] && mkdir --parents "$BACKUP_LOCATION"
|
|
||||||
|
|
||||||
VERSION="2.1.0"
|
|
||||||
IGREEN="\033[0;92m" # Intense Green
|
IGREEN="\033[0;92m" # Intense Green
|
||||||
IYELLOW="\033[0;93m" # Intense Yellow
|
IYELLOW="\033[0;93m" # Intense Yellow
|
||||||
NO_COLOR="\033[0m" # Text Reset
|
NO_COLOR="\033[0m" # Text Reset
|
||||||
@ -11,6 +8,30 @@ TMP="/tmp/update"
|
|||||||
DATE="$(date +"%Y-%m-%dT%H:%M:%S%:z")" # RFC 3339 date-time https://datatracker.ietf.org/doc/html/rfc3339#section-5.6
|
DATE="$(date +"%Y-%m-%dT%H:%M:%S%:z")" # RFC 3339 date-time https://datatracker.ietf.org/doc/html/rfc3339#section-5.6
|
||||||
FINAL_COMMAND="true"
|
FINAL_COMMAND="true"
|
||||||
|
|
||||||
|
source "$HOME"/.config/update.conf || exit 1
|
||||||
|
|
||||||
|
if [ ! -d $BACKUP_LOCATION ]; then
|
||||||
|
echo -e "${IYELLOW}Backup location doesn't exist${NO_COLOR}"
|
||||||
|
read -p "Do you want to create the path and continue? [y/N]" input
|
||||||
|
case $input in
|
||||||
|
[Yy]) mkdir --parents "$BACKUP_LOCATION" ;;
|
||||||
|
[Nn]) exit 0;;
|
||||||
|
* ) exit 0 ;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $SECONDARY_BACKUP_LOCATION ]; then
|
||||||
|
if [ ! -d $SECONDARY_BACKUP_LOCATION ]; then
|
||||||
|
echo -e "${IYELLOW}Secondary Backup location doesn't exist${NO_COLOR}"
|
||||||
|
read -p "Do you want to create the path and continue? [y/N]" input
|
||||||
|
case $input in
|
||||||
|
[Yy]) mkdir --parents "$SECONDARY_BACKUP_LOCATION" ;;
|
||||||
|
[Nn]) exit 0;;
|
||||||
|
* ) exit 0 ;;
|
||||||
|
esac
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
trap interrupt_function INT
|
trap interrupt_function INT
|
||||||
|
|
||||||
interrupt_function() {
|
interrupt_function() {
|
||||||
@ -62,6 +83,7 @@ before_backup() {
|
|||||||
|
|
||||||
tar --create --zstd --file "$TMP"/before-backup_"$DATE".tar.zst.new "$TMP"/before-backup_"$DATE" /var/lib/pacman/local > /dev/null 2>&1 # for some reason it needs the output suppresion
|
tar --create --zstd --file "$TMP"/before-backup_"$DATE".tar.zst.new "$TMP"/before-backup_"$DATE" /var/lib/pacman/local > /dev/null 2>&1 # for some reason it needs the output suppresion
|
||||||
mv "$TMP"/before-backup_"$DATE".tar.zst.new "$BACKUP_LOCATION"
|
mv "$TMP"/before-backup_"$DATE".tar.zst.new "$BACKUP_LOCATION"
|
||||||
|
[[ $SECONDARY_BACKUP_LOCATION ]] && mv "$TMP"/before-backup_"$DATE".tar.zst.new "$SECONDARY_BACKUP_LOCATION"
|
||||||
|
|
||||||
sudo rm --force /var/lib/pacman/db.lck
|
sudo rm --force /var/lib/pacman/db.lck
|
||||||
}
|
}
|
||||||
@ -72,11 +94,14 @@ after_backup() {
|
|||||||
tar --create --zstd --file "$TMP"/after-backup_"$DATE".tar.zst.new "$TMP"/after-backup_"$DATE" > /dev/null 2>&1
|
tar --create --zstd --file "$TMP"/after-backup_"$DATE".tar.zst.new "$TMP"/after-backup_"$DATE" > /dev/null 2>&1
|
||||||
|
|
||||||
mv "$TMP"/after-backup_"$DATE".tar.zst.new "$BACKUP_LOCATION"
|
mv "$TMP"/after-backup_"$DATE".tar.zst.new "$BACKUP_LOCATION"
|
||||||
|
[[ $SECONDARY_BACKUP_LOCATION ]] && mv "$TMP"/before-backup_"$DATE".tar.zst.new "$SECONDARY_BACKUP_LOCATION"
|
||||||
delete_oldest_backup after-backup
|
delete_oldest_backup after-backup
|
||||||
mv "$BACKUP_LOCATION"/after-backup_"$DATE".tar.zst.new "$BACKUP_LOCATION"/after-backup_"$DATE".tar.zst
|
mv "$BACKUP_LOCATION"/after-backup_"$DATE".tar.zst.new "$BACKUP_LOCATION"/after-backup_"$DATE".tar.zst
|
||||||
|
[[ $SECONDARY_BACKUP_LOCATION ]] && mv "$SECONDARY_BACKUP_LOCATION"/after-backup_"$DATE".tar.zst.new "$SECONDARY_BACKUP_LOCATION"/after-backup_"$DATE".tar.zst
|
||||||
|
|
||||||
delete_oldest_backup before-backup
|
delete_oldest_backup before-backup
|
||||||
mv "$BACKUP_LOCATION"/before-backup_"$DATE".tar.zst.new "$BACKUP_LOCATION"/before-backup_"$DATE".tar.zst
|
mv "$BACKUP_LOCATION"/before-backup_"$DATE".tar.zst.new "$BACKUP_LOCATION"/before-backup_"$DATE".tar.zst
|
||||||
|
[[ $SECONDARY_BACKUP_LOCATION ]] && mv "$SECONDARY_BACKUP_LOCATION"/before-backup_"$DATE".tar.zst.new "$SECONDARY_BACKUP_LOCATION"/before-backup_"$DATE".tar.zst
|
||||||
|
|
||||||
rm --recursive --force "$TMP"
|
rm --recursive --force "$TMP"
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
# Backup to this folder
|
# backup to this folder
|
||||||
BACKUP_LOCATION=~/
|
BACKUP_LOCATION=~/
|
||||||
|
|
||||||
|
# optional secondary backup loaction
|
||||||
|
#SECONDARY_BACKUP_LOCATION=~/
|
||||||
|
|
||||||
# use this pacman-wrapper
|
# use this pacman-wrapper
|
||||||
PACMAN_WRAPPER=yay
|
PACMAN_WRAPPER=yay
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user