You are not logged in.
On the wiki I saw that I should consider holding list of installed packages in case of disaster: wiki page
And so I created small script to push list of packages to my github, I plan to put it to cron
Maybe someone will find it helpful.
Also, I am not good with bash so I am open for suggestion
#!/usr/bin/bash
cd ~
git clone https://PERSONAL-ACCESS-TOKEN@github.com/USER/REPO
cd REPO
git pull origin main
FILE_NAME=$(date +"pkg-list-%Y.%m.%d-%T")
touch ./lists/$FILE_NAME.txt
yay -Qqe >> ./lists/$FILE_NAME.txt
FILE_COUNT=$(ls -1 ./lists | wc -l)
if [ $FILE_COUNT -gt 1200 ]; then
OLDEST_FILE=$(ls -1tr ./lists | head -n 1)
rm ./lists/$OLDEST_FILE
fi
git add .
git commit -m "Auto-commit: Package list on $FILE_NAME"
git push -u origin main
I wonder if making backup of other things will be beneficial, maybe /etc or ~/.*
Offline
Hi, a backup of all your data will be beneficial in case of a disaster :-)
To minimize the data volume, you could make 3 batches of prio:
prio1 data : e.g. important personal files, emails, backup every day
prio2 data : e.g. program settings, once a week
prio3 data : backup the whole hard-disk including operating system, once a month
Line out your personal backup strategy, deploy it, use it regular, test the theoretical disaster case : could you read and restore all data ?
Offline
Mod note: moving to Community Contributions
Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD
Making lemonade from lemons since 2015.
Offline
Do not use yay, especially when there is no need to use it. pacman is your package manager and gives you a list of installed packages.
Offline
That script makes no sense. Why not just use a single file containing the package list and over-write it every time? Git itself will keep track of the old files anyway.
Note that parsing ls is generally a bad idea, although it won't cause problems in this particular example.
EDIT: just for the record: you can place the files in an array to count them:
files=(.list/*)
echo "${#files[@]}" # returns number of files
Determining the oldest without parsing ls is trickier though, perhaps try something like the `stat` suggestions here.
Last edited by Head_on_a_Stick (2024-01-06 22:17:13)
Jin, Jiyan, Azadî
Offline