mirror of
https://github.com/Oxbian/PackageSaver.git
synced 2025-06-01 00:08:12 +02:00
Adding content & readme
This commit is contained in:
parent
f0d2a8f0bd
commit
817623fcba
33
README.md
Normal file
33
README.md
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
# Package Saver
|
||||||
|
-------------
|
||||||
|
|
||||||
|

|
||||||
|

|
||||||
|

|
||||||
|

|
||||||
|

|
||||||
|
|
||||||
|
## Package Saver what is it ?
|
||||||
|
|
||||||
|
It's a tools to save the package you want to keep for your reinstallation. They are all in a txt file, just need paste them after your reinstallation to have it back
|
||||||
|
|
||||||
|
## What is automated ?
|
||||||
|
|
||||||
|
Currently the only automed thing is the detection and the parsing of your package manager (for the moment only pacman and apk are parsed and working). Later I will work on a GUI and a way to just use this programs to reinstall package from a list of packages.
|
||||||
|
|
||||||
|
## How to use it ?
|
||||||
|
|
||||||
|
1) Make sure you have the correct permission to use it
|
||||||
|
|
||||||
|
> chmod 777 packageManager.sh
|
||||||
|
|
||||||
|
2) Just run it and say yes or no if you want to keep this package (by default it's no so just need to write Y or y if you want to keep it)
|
||||||
|
|
||||||
|
> ./packageManager.sh
|
||||||
|
|
||||||
|
## How to contribute ?
|
||||||
|
|
||||||
|
Everyone is free to contribute, just clone the project, make your modification and make a pull request with an explanaition of your changes
|
||||||
|
|
||||||
|
## Licence:
|
||||||
|
This project is under the GNU GPL v3.0 licence, basically you are free to copy this project, modify it
|
99
packageManager.sh
Executable file
99
packageManager.sh
Executable file
@ -0,0 +1,99 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
echo -e "
|
||||||
|
|
||||||
|
██████╗ ██╗ ██╗ ██████╗ ███████╗ █████╗ ██╗ ██╗███████╗██████╗
|
||||||
|
██╔══██╗██║ ██╔╝██╔════╝ ██╔════╝██╔══██╗██║ ██║██╔════╝██╔══██╗
|
||||||
|
██████╔╝█████╔╝ ██║ ███╗███████╗███████║██║ ██║█████╗ ██████╔╝
|
||||||
|
██╔═══╝ ██╔═██╗ ██║ ██║╚════██║██╔══██║╚██╗ ██╔╝██╔══╝ ██╔══██╗
|
||||||
|
██║ ██║ ██╗╚██████╔╝███████║██║ ██║ ╚████╔╝ ███████╗██║ ██║
|
||||||
|
╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚══════╝╚═╝ ╚═╝
|
||||||
|
|
||||||
|
"
|
||||||
|
|
||||||
|
echo -e " Welcome to the Package Saver\n It will allow you to have a list of package to reinstall to your new OS setup\n"
|
||||||
|
|
||||||
|
|
||||||
|
# Checking the package Manager
|
||||||
|
case "$(command -v apk apt-get dkpg dnf zypper pacman rpm snap flatpak)" in
|
||||||
|
|
||||||
|
# If the Package Manager is apk
|
||||||
|
*apk*) pkgCount=$(apk info | wc -l)
|
||||||
|
pkgManager="apk"
|
||||||
|
;;
|
||||||
|
|
||||||
|
# If the Package Manager is apt
|
||||||
|
*apt-get*) pkgCount=$(apt list --installed | wc -l)
|
||||||
|
pkgMan="apt"
|
||||||
|
;;
|
||||||
|
|
||||||
|
# If the Package Manager is dkpg
|
||||||
|
*dkpg*) pkgCount=$(dpkg -l | wc -l)
|
||||||
|
pkgMan="dpkg"
|
||||||
|
;;
|
||||||
|
|
||||||
|
# If the Package Manager is dnf
|
||||||
|
*dnf*) pkgCount=$(dnf list installed | wc -l)
|
||||||
|
pkgMan="dnf"
|
||||||
|
;;
|
||||||
|
|
||||||
|
# If the Package Manager is zypper
|
||||||
|
*zypper*) pkgCount=$(zypper se --installed-only | wc -l)
|
||||||
|
pkgMan="zypper"
|
||||||
|
;;
|
||||||
|
|
||||||
|
# If the Package Manager is pacman
|
||||||
|
*pacman*) pkgCount=$(pacman -Q | wc -l)
|
||||||
|
pkgMan="pacman"
|
||||||
|
;;
|
||||||
|
|
||||||
|
# If the Package Manager is rpm
|
||||||
|
*rpm*) pkgCount=$(rpm -qa | wc -l)
|
||||||
|
pkgMan="rpm"
|
||||||
|
;;
|
||||||
|
|
||||||
|
# If the Package Manager is snap
|
||||||
|
*snap*) pkgCount=$(snap list | wc -l)
|
||||||
|
pkgMan="snap"
|
||||||
|
;;
|
||||||
|
|
||||||
|
# If the Package Manager is flatpak
|
||||||
|
*flatpak*) pkgCount=$(flatpak list --app | wc -l)
|
||||||
|
pkgMan="flatpak"
|
||||||
|
|
||||||
|
;;
|
||||||
|
|
||||||
|
*) echo "FAILED TO FOUND PACKAGES: Package manager not found. You must install one of the basics package manager"
|
||||||
|
|
||||||
|
;;
|
||||||
|
|
||||||
|
esac
|
||||||
|
|
||||||
|
echo -e "NUMBER OF PACKAGES: $pkgCount\nPackage Manager: $pkgMan\n"
|
||||||
|
|
||||||
|
# Asking if you want to keep this package and adding it to the file
|
||||||
|
for (( pkgI=1; pkgI<=pkgCount; pkgI++ ))
|
||||||
|
do
|
||||||
|
|
||||||
|
#Parse the package name, different for each package manager
|
||||||
|
case "$pkgMan" in
|
||||||
|
#Apk is the package manager
|
||||||
|
apk) currPkg=$(apk info | sed -n "${pkgI}p")
|
||||||
|
;;
|
||||||
|
|
||||||
|
#Pacman is the package manager
|
||||||
|
pacman) currPkg=$(pacman -Q | sed -n "${pkgI}p" | cut -d" " -f1)
|
||||||
|
;;
|
||||||
|
|
||||||
|
esac
|
||||||
|
|
||||||
|
read -p "Do you want to keep $currPkg? [y/N] " input
|
||||||
|
#If we input y or Y
|
||||||
|
if [ ${#input} -gt 0 ] && [ ${input,,} == "y" ];
|
||||||
|
then
|
||||||
|
printf "%s " $currPkg >> "packageToKeep.txt"
|
||||||
|
echo "[V] Added" #DEBUG
|
||||||
|
else
|
||||||
|
echo "[X] Not added" #DEBUG
|
||||||
|
fi
|
||||||
|
done
|
Loading…
x
Reference in New Issue
Block a user