random/makepkglist

27 lines
767 B
Text
Raw Normal View History

2022-06-15 01:31:28 -05:00
#!/bin/sh
2022-06-15 01:33:42 -05:00
# this script lists all packages installed in my system and saves them
# such that it's easy to install packages in case of a system reset
# force script to run as specific user
if [ "$(id -u)" -eq 0 ]; then
exec sudo -H -u sintan $0 "$@"
fi
2022-06-15 01:31:28 -05:00
# define location for output
DIR=/home/sintan/Documents/Backup/pkglists
# make sure that the folder exists
mkdir -p $DIR
# list and save system packages
command -v pacman &> /dev/null && pacman -Qq > $DIR/pacman
2022-09-17 22:09:43 -05:00
command -v dnf &> /dev/null && dnf list installed > $DIR/dnf
2022-06-15 01:31:28 -05:00
# list and save pip packages
command -v pip &> /dev/null && pip list | awk '{print $1}' | tail -n +3 > $DIR/pip
# list and save pipx packages
command -v pipx &> /dev/null && pipx list | grep package | awk '{print $2}' > $DIR/pipx