You are not logged in.

#1 2009-04-12 00:15:12

thoffmeyer
Member
From: Chi
Registered: 2006-07-27
Posts: 91

pacbak.sh, backup pacman file lists..

So i'm not sure if someone has done anything like this before.. but I was reading the wiki and just thought I'd hack something together real quick.. This script will let you backup your current pacman installed list, and restore it if you decide to get your box the way you want it.. then all of a sudden it crashes and burns to the ground xD.. Anywho.. I know I could have done a better job but.. i'm lazy. Comments are so very welcome!!!

#!/bin/bash

# Set some random cool looking things :-/
ESC_SEQ="\x1b["
COL_RESET=$ESC_SEQ"39;49;00m"
COL_RED=$ESC_SEQ"31;01m"
COL_CYAN=$ESC_SEQ"36;01m"

# Checking if root
if [ "$(id -u)" != "0" ]; then
   echo -e $COL_RED"This script must be run as root"$COL_RESET
   exit 1
fi

case "$1" in

backup)
echo -e $COL_CYAN">>"$COL_RESET "Sending the backup command to pacman.."
pacman -Qqe | grep -v "$(pacman -Qmq)" > pacbak.bak
echo -e $COL_CYAN">>"$COL_RESET" Done!"
;;

restore)
echo -e $COL_CYAN">>"$COL_RESET "First lets update pacman"
pacman -Syy
echo -e $COL_CYAN">>"$COL_RESET "Okay, now lets restore our backed up list.."
sleep 2
pacman -S $(cat pacbak.bak)
echo -e $COL_CYAN">>"$COL_RESET "Done!"
;;

info)
echo -e $COL_CYAN">>"$COL_RESET "Simple script to backup and restore your pacman list of installed programs."
echo -e $COL_CYAN">>"$COL_RESET "Created by: Timothy Hoffmeyer <thoffmeyer>"
echo -e $COL_CYAN">>"$COL_RESET "Contact: <tim.hoffmeyer@archlinux.us>"
;;
  *)
    echo "usage: $0 {backup|restore|info}"
esac
exit 0

Offline

#2 2009-04-12 08:19:58

Dieter@be
Forum Fellow
From: Belgium
Registered: 2006-11-05
Posts: 2,000
Website

Re: pacbak.sh, backup pacman file lists..

thoffmeyer wrote:
#!/bin/bash

pacman -Qqe | grep -v "$(pacman -Qmq)" > pacbak.bak

Why are you filtering out those packages?
I personally want to backup explicitly installed packages, no matter where they are from.
Tip: host your own binary repo and when you build packages from AUR (or others from source) put them there.


< Daenyth> and he works prolifically
4 8 15 16 23 42

Offline

#3 2009-04-12 10:46:50

Ghost1227
Forum Fellow
From: Omaha, NE, USA
Registered: 2008-04-21
Posts: 1,422
Website

Re: pacbak.sh, backup pacman file lists..

check out packup


.:[My Blog] || [My GitHub]:.

Offline

#4 2009-04-12 21:38:02

thoffmeyer
Member
From: Chi
Registered: 2006-07-27
Posts: 91

Re: pacbak.sh, backup pacman file lists..

Dieter@be wrote:
thoffmeyer wrote:
#!/bin/bash

pacman -Qqe | grep -v "$(pacman -Qmq)" > pacbak.bak

Why are you filtering out those packages?
I personally want to backup explicitly installed packages, no matter where they are from.
Tip: host your own binary repo and when you build packages from AUR (or others from source) put them there.

I was setting up a repo @ my sever for packages.. so.. I'm working on it.. Thanks ghost1227.. arch-blocking like that.. lol.

Offline

Board footer

Powered by FluxBB