You are not logged in.

#1 2012-09-01 16:29:13

moofly
Member
Registered: 2012-09-01
Posts: 11

thought this may help some of you guys

This is helpful if you only have one arch system. it

  • updates all programs (including yaourt)

  • removes unused packages from cache

  • it also creates a text file that has all your programs (excluding yaourt) in it and so if you need to reinstall you just use that file to reinstall

sudo pacman -Syuv --noconfirm ; yaourt -Sbu --aur; sudo pacman -Scv --noconfirm ;  pacman -Qq | grep -vx "$( pacman -Qmq )" | sed '1i pacman -Syu --needed' | sed 'N;s/\n/ /;P;D;' | sed 'N;s/\n/ /;P;D;' | sed 'N;s/\n/ /;P;D;' | sed 'N;s/\n/ /;P;D;' | sed 'N;s/\n/ /;P;D;' | sed 'N;s/\n/ /;P;D;' | sed 'N;s/\n/ /;P;D;' | sed 'N;s/\n/ /;P;D;' | sed 'N;s/\n/ /;P;D;' | sed 'N;s/\n/ /;P;D;' > '/home/ryan/Computer Backup/main/new main' ; echo \''/home/ryan/Computer Backup/main/main update'\'' ; sudo shutdown -h now' > '/home/ryan/Computer Backup/main/main shutdown' ; echo \''/home/ryan/Computer Backup/main/main update'\'' ; sudo shutdown -r now' > '/home/ryan/Computer Backup/main/main restart'

This is helpful if you have two arch systems (if you are like me you have a main and backup in case your main messes up, intended or otherwise). It does the same as the other but also

  • compares your main and backup, then makes the backup have the same programs as your main (removes or adds including yaourt)

  • copies basic .conf files(rc.conf for example) from main to backup

  • copies /var/cache/pacman/pkg from main to backup

sudo pacman -Syuv --noconfirm ; yaourt -Sbu --aur; sudo pacman -Scv --noconfirm ; sudo mount -vt ext3 /dev/sda2 /mnt/backup; sudo cp -urv '/var/cache/pacman/pkg' '/mnt/backup/var/cache/pacman' ; sudo cp -uv --target-directory='/mnt/backup/etc' '/etc/ntp.conf' '/etc/environment' '/etc/pacman.conf' '/etc/rc.conf' '/etc/yaourtrc' '/etc/sudoers' ; sudo cp -uv '/etc/pacman.d/mirrorlist' '/mnt/backup/etc/pacman.d' ; sudo umount -v /mnt/backup ; pacman -Qq | grep -vx "$( pacman -Qmq )" > '/home/ryan/Computer Backup/main/main programs' ; pacman -Qq | grep "$( pacman -Qmq )"> '/home/ryan/Computer Backup/main/main yaourt programs';  pacman -Qq | grep -vx "$( pacman -Qmq )" | sed '1i mkdir /mnt/backup /mnt/files ; mount -vt ext3 /dev/sda2 /mnt/backup; cp -v --target-directory=/etc  '/mnt/backup/etc/pacman.conf' '/mnt/backup/etc/rc.conf'; /etc/rc.d/network restart ; cp -v /mnt/backup/etc/pacman.d/mirrorlist /etc/pacman.d ;  cp -urv '/mnt/backup/var/cache/pacman/pkg' '/var/cache/pacman'; pacman -Syu --needed'|sed 'N;s/\n/ /;P;D;' | sed 'N;s/\n/ /;P;D;' | sed 'N;s/\n/ /;P;D;' | sed 'N;s/\n/ /;P;D;' | sed 'N;s/\n/ /;P;D;' | sed 'N;s/\n/ /;P;D;' | sed 'N;s/\n/ /;P;D;' | sed 'N;s/\n/ /;P;D;' | sed 'N;s/\n/ /;P;D;' | sed 'N;s/\n/ /;P;D;' | sed 's/$/; cp -v --target-directory=\/etc \/mnt\/backup\/etc\/ntp.conf \/mnt\/backup\/etc\/sudoers  /g' > '/home/ryan/Computer Backup/main/new main' ; pacman -Qq | grep -vx "$( pacman -Qmq )" | sed '1i mkdir \/mnt\/main \/mnt\/files ; mount -vt ext3 \/dev\/sda1 \/mnt\/main ; cp -v --target-directory=\/etc  '\/mnt\/main\/etc\/pacman.conf' '\/mnt\/main\/etc\/rc.conf'; \/etc\/rc.d\/network restart ; cp -v \/mnt\/main\/etc\/pacman.d\/mirrorlist \/etc\/pacman.d ;  cp -urv '/mnt/main/var/cache/pacman/pkg' '/var/cache/pacman' ; pacman -Syu --needed'|sed 'N;s/\n/ /;P;D;' | sed 'N;s/\n/ /;P;D;' | sed 'N;s/\n/ /;P;D;' | sed 'N;s/\n/ /;P;D;' | sed 'N;s/\n/ /;P;D;' | sed 'N;s/\n/ /;P;D;' | sed 'N;s/\n/ /;P;D;' | sed 'N;s/\n/ /;P;D;' | sed 'N;s/\n/ /;P;D;' | sed 'N;s/\n/ /;P;D;' | sed 's/$/;  cp -v --target-directory=\/etc \/mnt\/main\/etc\/ntp.conf \/mnt\/main\/etc\/sudoers /g'> '/home/ryan/Computer Backup/backup/new backup' ; pacman -Qq | grep -vx "$( pacman -Qmq )" | sed '1ipacman -Qq | grep -vx "$( pacman -Qmq )" > '\''/home/ryan/Computer Backup/backup/backup programs'\'' ; comm -13 '\''/home/ryan/Computer Backup/main/main programs'\'' '\''/home/ryan/Computer Backup/backup/backup programs'\'' | sed '\''1isudo pacman -Runs'\''| sed '\''N;s/\\n/ /;P;D;'\'' | sed '\''N;s/\\n/ /;P;D;'\'' | sed '\''N;s/\\n/ /;P;D;'\'' | sed '\''N;s/\\n/ /;P;D;'\'' | sed '\''N;s/\\n/ /;P;D;'\'' > '\''/home/ryan/Computer Backup/backup/backup remove'\''; chmod a+x '\''/home/ryan/Computer Backup/backup/backup remove'\''; '\''/home/ryan/Computer Backup/backup/backup remove'\''; pacman -Qq | grep "$( pacman -Qmq )" > '\''/home/ryan/Computer Backup/backup/backup yaourt programs'\''; comm -13 '\''/home/ryan/Computer Backup/main/main yaourt programs'\'' '\''/home/ryan/Computer Backup/backup/backup yaourt programs'\'' | sed '\''1isudo pacman -Runs'\''| sed '\''N;s/\\n/ /;P;D;'\'' | sed '\''N;s/\\n/ /;P;D;'\'' | sed '\''N;s/\\n/ /;P;D;'\'' | sed '\''N;s/\\n/ /;P;D;'\'' | sed '\''N;s/\\n/ /;P;D;'\'' > '\''/home/ryan/Computer Backup/backup/backup yaourt remove'\''; chmod a+x '\''/home/ryan/Computer Backup/backup/backup yaourt remove'\''; '\''/home/ryan/Computer Backup/backup/backup yaourt remove'\''; comm -23 '\''/home/ryan/Computer Backup/main/main yaourt programs'\'' '\''/home/ryan/Computer Backup/backup/backup yaourt programs'\'' | sed '\''i yaourt'\'' | sed '\''N;s/\\n/ /;P;D;'\'' |sed $'\''i;'\''| sed '\''N;s/\\n/ /;P;D;'\'' | sed '\''N;s/\\n/ /;P;D;'\''| sed '\''N;s/\\n/ /;P;D;'\''| sed '\''N;s/\\n/ /;P;D;'\''| cut -c2-250 > '\''/home/ryan/Computer Backup/backup/backup install yaourt'\''; chmod a+x '\''/home/ryan/Computer Backup/backup/backup install yaourt'\''; '\''/home/ryan/Computer Backup/backup/backup install yaourt'\'' ;  sudo pacman -Syu --needed'|sed 'N;s/\n/ /;P;D;' | sed 'N;s/\n/ /;P;D;' | sed 'N;s/\n/ /;P;D;' | sed 'N;s/\n/ /;P;D;' | sed 'N;s/\n/ /;P;D;' | sed 'N;s/\n/ /;P;D;' | sed 'N;s/\n/ /;P;D;' | sed 'N;s/\n/ /;P;D;' | sed 'N;s/\n/ /;P;D;' | sed 'N;s/\n/ /;P;D;' | sed 's/$/; yaourt -Sbu --aur; sudo pacman -Sc; /g' > '/home/ryan/Computer Backup/backup/backup update'; echo \''/home/ryan/Computer Backup/main/main update'\'' ; sudo shutdown -h now' > '/home/ryan/Computer Backup/main/main shutdown' ; echo \''/home/ryan/Computer Backup/main/main update'\'' ; sudo shutdown -r now' > '/home/ryan/Computer Backup/main/main restart' ; echo \''/home/ryan/Computer Backup/backup/backup update'\'' ; sudo shutdown -h now' > '/home/ryan/Computer Backup/backup/backup shutdown' ; echo \''/home/ryan/Computer Backup/backup/backup update'\'' ; sudo shutdown -r now' > '/home/ryan/Computer Backup/backup/backup restart'

Of course for both of those you have to edit the paths to your liking.

Also if I messed up on it, let me know, all that text can get confusing.

Last edited by moofly (2012-09-03 04:45:33)

Offline

#2 2012-09-02 16:35:22

hadrons123
Member
From: chennai
Registered: 2011-10-07
Posts: 1,249

Re: thought this may help some of you guys

You can put this stuff in the arch wiki, but the commands would require more refinements. Most of this stuff fits only for your computer.


LENOVO Y 580 IVYBRIDGE 660M NVIDIA
Unix is user-friendly. It just isn't promiscuous about which users it's friendly with. - Steven King

Offline

#3 2012-10-08 08:46:45

domac
Member
Registered: 2012-08-06
Posts: 102

Re: thought this may help some of you guys

Maybe a packer alternate would be also appreciated. tongue


domac [ git ]

Offline

#4 2012-10-08 10:31:01

Mr.Elendig
#archlinux@freenode channel op
From: The intertubes
Registered: 2004-11-07
Posts: 3,731

Re: thought this may help some of you guys

  • You should be using && not ;

  • --noconfirm is evil

  • Take a look at expac


Evil #archlinux@freenode channel op and general support dude.
. files on github, Screenshots, Random pics and the rest

Offline

Board footer

Powered by FluxBB