You are not logged in.

#1 2009-01-01 19:20:19

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

Packup - a simple backup/restore/migration script for Pacman

I have seen numerous posts on the forums asking for an easy way to backup and restore installed software for purposes of backup, migration or simply for convenience. Packup attempts to fill this void. Simply put, Packup is an ncurses wrapper for Pacman which provides a simple backup/restore/migration system for Arch. Don't believe me? Try it for yourself!


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

Offline

#2 2009-01-02 13:49:08

Mimi
Member
From: Germany
Registered: 2008-06-06
Posts: 39

Re: Packup - a simple backup/restore/migration script for Pacman

I had to change line 277 (8 -> 9):

awk '{ print $9 }'

and (line 303 - 311)

    test=$?
            if [ $test -eq 0 ]; then
                PKGMAN="pacman --noconfirm --noprogressbar -S "
                restore_install
            elif [ $test -eq 3 ]; then
                PKGMAN="yaourt --noconfirm --noprogressbar -S "
                restore_install
            else
                clear
                exit
            fi

It is what you make it. Even if you don't know what to make it.

Offline

#3 2009-01-02 17:10:51

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

Re: Packup - a simple backup/restore/migration script for Pacman

thanks for the input!

by default it should be $8 not $9... I'd love to know why yours responds differently.
same with the test=$?, that extra variable shouldn't be necessary, but I'd love to know why your setup required it.

please keep testing and let me know!


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

Offline

#4 2009-01-02 21:45:13

Mimi
Member
From: Germany
Registered: 2008-06-06
Posts: 39

Re: Packup - a simple backup/restore/migration script for Pacman

Ghost1227 wrote:

by default it should be $8 not $9... I'd love to know why yours responds differently.

┌─[~]
└─╼ ls -Bl packup-*                                     
-rw-r--r-- 1 julia users 2633  2. Jan 18:22 packup-complete-20090102-1821
┌─[~]
└─╼ ls -Bl packup-* | egrep -v '^d' | awk '{ print $8 }'
18:22

Maybe the problem is a different date format (de_DE.utf8).

┌─[~]
└─╼ ls -Bl --time-style=iso packup-* | egrep -v '^d' | awk '{ print $8 }' 
packup-complete-20090102-1821

If i select "Run Yaourt" the program exits, i don't know, maybe the exit status of the if condition (if [ $? = 0 ]) overrides the selection?

┌─[~]
└─╼ if [ $? = 1 ]; then echo abcdef; elif [ $? = 1 ]; then echo fedcba; fi           
fedcba

Or is it just me?


It is what you make it. Even if you don't know what to make it.

Offline

#5 2009-01-03 03:36:34

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

Re: Packup - a simple backup/restore/migration script for Pacman

Mimi wrote:
Ghost1227 wrote:

by default it should be $8 not $9... I'd love to know why yours responds differently.

┌─[~]
└─╼ ls -Bl packup-*                                     
-rw-r--r-- 1 julia users 2633  2. Jan 18:22 packup-complete-20090102-1821
┌─[~]
└─╼ ls -Bl packup-* | egrep -v '^d' | awk '{ print $8 }'
18:22

Maybe the problem is a different date format (de_DE.utf8).

┌─[~]
└─╼ ls -Bl --time-style=iso packup-* | egrep -v '^d' | awk '{ print $8 }' 
packup-complete-20090102-1821

Good point - added --time-style to the script, should fix that problem...

Mimi wrote:

If i select "Run Yaourt" the program exits, i don't know, maybe the exit status of the if condition (if [ $? = 0 ]) overrides the selection?

┌─[~]
└─╼ if [ $? = 1 ]; then echo abcdef; elif [ $? = 1 ]; then echo fedcba; fi           
fedcba

Or is it just me?

I think you miscopied something there...

if [ $? = 1 ]; ... elif [ $? = 1 ]; ...

it's kinda redundant... shouldn't one of those be =0? or =3? i'm not even sure which function you're referencing.


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

Offline

#6 2009-01-03 22:04:34

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

Re: Packup - a simple backup/restore/migration script for Pacman

Try not to hardcode xdg paths.
Eg, to find a packuprc, you should do something like

for config_dir in `echo ${XDG_CONFIG_HOME:-$HOME/.config}:${XDG_CONFIG_DIRS:-/etc/xdg} | sed 's/:/\t/g'`
do
   <if you find a config file, source it and break from loop>
done

To find data, use

${XDG_DATA_HOME:-$HOME/.local/share}:${XDG_DATA_DIRS:-'/usr/local/share/:/usr/share/'} | sed 's/:/\t/g'

Etc.

See http://standards.freedesktop.org/basedi … c-0.6.html


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

Offline

#7 2009-01-03 22:31:54

iphitus
Forum Fellow
From: Melbourne, Australia
Registered: 2004-10-09
Posts: 4,927

Re: Packup - a simple backup/restore/migration script for Pacman

Interesting. A neat feature would be an option which backs up any config file which is marked as backup and has changed since install. You can find this out by looking in /var/lib/pacman/local/*/files.

Just a few bash tips...
* $(find /stuff) instead of backticks `find /stuff `
* Use find or shell expansion instead of ls - ls is unreliable.
* Use bash's inbuilt [[ ]] rather than [ ].
More good bash stuff here: http://wooledge.org:8000/BashGuide and http://wooledge.org:8000/BashFAQ


Cheers!
James

Offline

#8 2009-01-04 01:03:50

weasel8
Member
Registered: 2008-12-15
Posts: 149

Re: Packup - a simple backup/restore/migration script for Pacman

This is awesome, great job. Cheers!

Offline

#9 2009-01-08 05:11:26

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

Re: Packup - a simple backup/restore/migration script for Pacman

Just released packup 0.3, no new features, mostly just code cleanup... but feel free to check it out in the AUR or check out the homepage here.


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

Offline

Board footer

Powered by FluxBB