-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from Serede/master
Refactored and simplified for consistency
- Loading branch information
Showing
8 changed files
with
111 additions
and
175 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,14 @@ | ||
pkgbase = pacmanity | ||
pkgdesc = Saves the list of packages installed via pacman and yaourt to your Github gist | ||
pkgver = 0.1 | ||
pkgrel = 1 | ||
url = https://github.com/DerekTBrown/pacmanity | ||
arch = x86_64 | ||
arch = i686 | ||
license = GPL | ||
makedepends = git | ||
depends = pacman>=5.0 | ||
depends = gist-git>=4.5.0 | ||
source = pacmanity::git+https://github.com/DerekTBrown/pacmanity.git | ||
md5sums = SKIP | ||
|
||
pkgname = pacmanity | ||
|
||
pkgdesc = Keeps a list of installed packages in a Gist at your GitHub account | ||
pkgver = 3.0 | ||
pkgrel = 1 | ||
url = https://github.com/DerekTBrown/pacmanity | ||
arch = x86_64 | ||
arch = i686 | ||
license = GPL | ||
makedepends = git | ||
depends = pacman>=5.0 | ||
depends = gist>=4.5.0 | ||
source = pacmanity::git+https://github.com/DerekTBrown/pacmanity.git | ||
md5sums = SKIP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,31 @@ | ||
pkgname=pacmanity | ||
pkgver=0.1 | ||
pkgver=3.0 | ||
pkgrel=1 | ||
pkgdesc="Saves the list of packages installed via pacman and yaourt to your Github gist" | ||
url="https://github.com/DerekTBrown/pacmanity" | ||
pkgdesc="Keeps a list of installed packages in a Gist at your GitHub account" | ||
url="https://github.com/DerekTBrown/$pkgname" | ||
arch=('x86_64' 'i686') | ||
license=('GPL') | ||
depends=('pacman>=5.0' 'gist-git>=4.5.0') | ||
makedepends=('git') | ||
source=("$pkgname::git+https://github.com/DerekTBrown/pacmanity.git") | ||
depends=('pacman>=5.0' 'gist>=4.5.0') | ||
source=("$pkgname::git+https://github.com/DerekTBrown/$pkgname.git") | ||
md5sums=('SKIP') | ||
|
||
package() { | ||
|
||
# Install and save file | ||
mkdir -p $pkgdir/etc/ | ||
touch $pkgdir/etc/pacmanity | ||
touch $pkgdir/etc/pacmanity_aur | ||
|
||
# Install script | ||
mkdir -p $pkgdir/usr/lib/pacmanity | ||
cp $srcdir/pacmanity/src/pacmanity.sh $pkgdir/usr/lib/pacmanity/pacmanity.sh | ||
cp $srcdir/pacmanity.sh $pkgdir/usr/lib/pacmanity/pacmanity.sh | ||
chmod +x $pkgdir/usr/lib/pacmanity/pacmanity.sh | ||
cp $srcdir/pacmanity/src/pacmanity_aur.sh $pkgdir/usr/lib/pacmanity/pacmanity_aur.sh | ||
chmod +x $pkgdir/usr/lib/pacmanity/pacmanity_aur.sh | ||
|
||
# Install Hook | ||
mkdir -p $pkgdir/usr/share/libalpm/hooks | ||
cp $srcdir/pacmanity/src/pacmanity.hook $pkgdir/usr/share/libalpm/hooks/pacmanity.hook | ||
cp $srcdir/pacmanity/src/pacmanity_aur.hook $pkgdir/usr/share/libalpm/hooks/pacmanity_aur.hook | ||
cp $srcdir/pacmanity.hook $pkgdir/usr/share/libalpm/hooks/zzz-pacmanity.hook | ||
|
||
source $pkgdir/usr/lib/pacmanity/pacmanity.sh; pacmanity_install; | ||
source $pkgdir/usr/lib/pacmanity/pacmanity_aur.sh; pacmanity_aur_install; | ||
source $pkgdir/usr/lib/pacmanity/pacmanity.sh | ||
pacmanity_install | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,68 +1,75 @@ | ||
# Pacmanity | ||
List of packages installed via pacman and yaourt on your Arch machine automatically saved to GitHub. | ||
Keeps a list of installed packages in a Gist at your GitHub account. | ||
|
||
## Installation | ||
|
||
**1) Downloading and installing:** | ||
**1. Download and install:** | ||
|
||
- using yaourt [Aur](https://aur.archlinux.org/packages/pacmanity/) | ||
``` | ||
$ yaourt pacmanity | ||
``` | ||
- using makepkg | ||
- From [AUR](https://aur.archlinux.org/packages/pacmanity/) using an AUR helper: | ||
```bash | ||
$ <aur_helper> -S pacmanity | ||
``` | ||
Some popular AUR helpers are [`yaourt`](https://github.com/archlinuxfr/yaourt), [`trizen`](https://github.com/trizen/trizen) and [`yay`](https://github.com/Jguer/yay). | ||
|
||
- From [AUR](https://aur.archlinux.org/packages/pacmanity/) using `makepkg`: | ||
```bash | ||
$ wget https://github.com/derektbrown/pacmanity/tarball/master -O - | tar xz | ||
$ cd DerekTBrown-pacmanity-*/ | ||
$ makepkg -si | ||
``` | ||
|
||
navigate to the downloaded directory (derektbrown-pacmanity-xxxxxx): | ||
**2. Setup:** | ||
|
||
``` | ||
$ makepkg | ||
$ sudo pacman -U | ||
``` | ||
|
||
**2) Setup stage:** | ||
On the installation stage you will be prompted to fill in GitHub credentials two times; | ||
1) first time it is needed to create gist for pacman-installed packages on GItHub; | ||
2) second time gist with AUR-installed packages should be set up, that is why the login details should be filled in once again | ||
During the installation of the package you will be prompted to log in to your GitHub account. | ||
|
||
|
||
## Usage | ||
|
||
Every time you install or remove a package using [official Arch repository](https://www.archlinux.org/packages/) or unofficial [AUR](https://aur.archlinux.org/) all the changes will be saved privately to your GitHub account. | ||
You have nothing to do, just install the pacmanity, and that's all. | ||
Two hooks will be created and run everytime the pacman command is used. | ||
Once installed, Pacmanity automatically maintains a list of your installed packages in a private Gist at your GitHub account. | ||
|
||
The list gets updated every time you install, update or remove packages, keeping track of the current explicitly installed packages from both Arch [official repos](https://www.archlinux.org/packages/) and [AUR](https://aur.archlinux.org/). They are listed in the Gist in that particular order (official, then AUR), separated by a blank line. | ||
|
||
### recovery | ||
No hassle: just install Pacmanity, follow the prompts and you are done. | ||
A pacman hook will be installed and conveniently run when needed to. | ||
|
||
By cloning the gist files to your fresh installed machine you can import them into pacman rather easy; | ||
## Recovery | ||
|
||
By cloning the Gist file to your fresh Arch installation you can easily bulk-install them: | ||
|
||
![gist-clone](https://image.prntscr.com/image/ObTqDXicRk6a9h7alSIVMw.png) | ||
|
||
* pacman package list: | ||
```bash | ||
$ git clone git@gist.github.com:<gist_repo>.git | ||
$ cd <gist_repo> | ||
``` | ||
|
||
- Using `pacman` to install only official packages: | ||
|
||
```bash | ||
$ git clone git@gist.github.com:#############.git | ||
$ cd ############# | ||
$ sudo pacman -S - < $(hostname).pacman | ||
$ sed -e '/^$/q' $(hostname).pacmanity | sudo pacman -S - | ||
``` | ||
|
||
* AUR package list: | ||
- Using an AUR helper to install all packages: | ||
|
||
```bash | ||
$ git clone git@gist.github.com:#############.git | ||
$ cd ############# | ||
$ xargs <$(hostname).yaourt pacaur -S --noedit | ||
$ <aur_helper> -S $(tr '\n' ' ' < $(hostname).pacmanity) | ||
``` | ||
|
||
**Screenshots:** | ||
Navigate to your Gist GitHub account here and you will see: | ||
- list of packages installed with 'pacman -S' command: | ||
- Using an AUR helper to install only AUR packages: | ||
|
||
```bash | ||
$ <aur_helper> -S $(sed -e '/^$/d' $(hostname).pacmanity | tr '\n' ' ') | ||
``` | ||
|
||
## Screenshots | ||
|
||
Navigate to your [Gist](https://gist.github.com) in GitHub and you will find: | ||
- List of currently installed packages from official repos: | ||
![pacman](http://image.prntscr.com/image/cf15521e7b794acdb37b2a8bc5e4455c.png) | ||
- list of packages installed from AUR with yaourt: | ||
- List of currently installed packages from AUR: | ||
![AUR](http://image.prntscr.com/image/d5bb89e7020d4b18a236d94adf3eb32f.png) | ||
- every installation will be automatically added to the gist: | ||
- Every package installation will be automatically added to the Gist: | ||
![after_installation](http://image.prntscr.com/image/65eeb152529e4b1dbab78de777074679.png) | ||
- every removal also will be mentioned on the list: | ||
- Every package removal will also be reported in the Gist: | ||
![after_removal](http://image.prntscr.com/image/3d945ff4d17e460a99dd1382cfb8689d.png) | ||
|
Submodule pacmanity
deleted from
8d6b5a
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,52 @@ | ||
#!/bin/bash | ||
# | ||
# pacmanity generates a list of packages installed via pacman GitHub | ||
# Pacmanity | ||
# Keeps a list of installed packages in a Gist at your GitHub account. | ||
|
||
pacmanity(){ | ||
# Add Ruby to PATH | ||
PATH="$(ruby -e 'print Gem.user_dir')/bin:$PATH" | ||
|
||
# Load Config | ||
[[ -r '/etc/pacmanity' ]] && source $pkgdir/etc/pacmanity | ||
pacmanity_install(){ | ||
echo "A list of installed packages will be automatically maintained" | ||
echo "by Pacmanity in a private Gist at your GitHub account." | ||
|
||
echo -e "\n- Step 1: Log in to Gist using your GitHub account:" | ||
[[ -f ~/.gist ]] || gist --login | ||
mkdir -p $pkgdir/root | ||
cp -v ~/.gist $pkgdir/root/.gist | ||
|
||
echo -e "\n- Step 2: Save list of currently installed packages to Gist:" | ||
GIST_URL=$( | ||
( | ||
pacman -Qqen | ||
echo | ||
pacman -Qqem | ||
) | gist -p -f $HOSTNAME.pacmanity -d "$HOSTNAME: List of installed packages" | ||
) | ||
|
||
echo "GIST_ID=$GIST_URL" | sed 's/https:\/\/gist.github.com\///g' >> $pkgdir/etc/pacmanity | ||
|
||
echo "An automatically mantained list of installed packages" | ||
echo "has been successfully created in your GitHub Gist." | ||
echo "Visit https://gist.github.com or the direct link below:" | ||
echo "$GIST_URL" | ||
} | ||
|
||
# Determine if Fresh Install is Needed | ||
if [ -z "$GIST_ID" ]; then | ||
echo -e "\nInfo: Gist backup for pacman-installed apps not setup." | ||
echo -e "\nYou need to use your GitHub credentials to log into GitHub Gist." | ||
pacmanity_update(){ | ||
if (pacman -Qqen; echo; pacman -Qqem) | gist -u "$GIST_ID" -f $HOSTNAME.pacmanity; then | ||
echo "Pacmanity: Gist successfully updated." | ||
else | ||
pacmanity_update; | ||
echo "Pacmanity: ERROR! Try running" | ||
echo "sudo gist --login" | ||
fi | ||
} | ||
|
||
pacmanity_install(){ | ||
echo -e "\nApps installed via 'pacman -S' command will be" | ||
echo -e "saved to the first package list privately to your GitHub Account."; | ||
|
||
echo -e "\nStep 1: Login to Gist GitHub"; | ||
gist --login; | ||
mkdir -p $pkgdir/root; | ||
cp ~/.gist $pkgdir/root/.gist; | ||
# Add Ruby to PATH | ||
PATH="$(ruby -e 'print Gem.user_dir')/bin:$PATH" | ||
|
||
echo -e "\nStep 2: Creating list with pacman-installed apps"; | ||
GIST_URL=$(pacman -Qqen | gist -p -f $HOSTNAME.pacman -d "$HOSTNAME: Packages installed via pacman") | ||
|
||
echo "GIST_ID=$GIST_URL" | sed 's/https:\/\/gist.github.com\///g' >> $pkgdir/etc/pacmanity; | ||
|
||
echo -e "\nYour package list is safely backed up, and will be updated" | ||
echo -e "automatically every time you install/remove a package using the pacman." | ||
echo -e "You can view your backup lists at https://gist.github.com/user" | ||
echo -e "or directly at the link below:\n"; | ||
echo "$GIST_URL"; | ||
} | ||
|
||
pacmanity_update(){ | ||
echo -e "\nUpdating package list backup on GitHub..."; | ||
if pacman -Qqen | gist -u "$GIST_ID" -f $HOSTNAME.pacman; then | ||
echo -e "Success!\n"; | ||
else | ||
echo -e "An error has occured.\nTry running sudo gist --login"; | ||
fi | ||
} | ||
# Load config | ||
[[ -r '/etc/pacmanity' ]] && source $pkgdir/etc/pacmanity | ||
|
||
pacmanity | ||
# Determine if fresh install is needed | ||
if [ -z "$GIST_ID" ]; then | ||
echo "Info: Gist is not set up for Pacmanity." | ||
echo "Reinstalling Pacmanity can solve this issue." | ||
else | ||
pacmanity_update | ||
fi |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.