skweez.net

Alles skweez?

1001111001011101011101010100110

Alles zu “commandlinefoo”

05.05.2010

Mehrere Archive per Skript entpacken

von wagges.

Ich war gerade in der dämlichen Lage, 200 tgz-Archive entpacken zu müssen. Dank Ritze hat die Sache dann ein doch noch relativ kurzes und schmerzloses Ende genommen…mit folgendem Skript, das man vom Ordner mit den Dateien aus ausführt
Erstmal natürlich das Skript erstellen

$ nano ichbintoll.sh

Mit Inhalt füllen

#!bin/bash
 
for i in $( ls )
do
     tar -xvf $i -C PFAD_ZUM_ZIELORDNER
done

und die Rackete noch startbar machen

$ chmod +x ichbintoll.sh

und dann mit

sh ichbintoll.sh

starten.

19.02.2010

Reinstall Ubuntu with minimal effort

von mks.

Following up on this post, here’s how to do it with apt-get on distros like Debian and Ubuntu.

  1. Get the list of installed packages.

    dpkg -l | awk '{print $2}' > installed_packages.txt

    You have to manually remove the first few lines from the file, as dpkg -l outputs some header lines.

  2. Reinstall the base system.

    If you use to remove software that’s installed by default, you should do a minimal install here, so you don’t need to remove those extra packages. Otherwise just use the default install.

    Remember you should have to have your partitions layed out wisely in the first place. An extra home partition should be mandatory!

  3. Reinstall packages.

    apt-get install `cat installed_packages.txt`

  4. That’s it.

    You have all the packages you used to have before the reinstall.

This method can be used e.g. for distribution upgrades, if the normal way using update-manager doesn’t work for you (or didn’t do in the past).

19.02.2010

Reinstall Archlinux with minimal effort

von mks.

Sometimes you have to reinstall a borked system. With most Linux distributions this is dead easy, because likely every package manager has a function to get a list of all installed packages. Of course you should partition your harddisk wisely so you can just mount (e.g.) your old home partition afterwards.

Here’s how to do this with Archlinux’ package manager pacman.

  1. Get the list of installed packages.

    pacman -Qet | awk '{print $1}' > installed_packages.txt

    This gets all explicitly installed top level packages, i.e. those that are not required by other packages.

    Save that file on an external media of course.

  2. Reinstall the base system.

    Reinstall using your favorite install media. Setup all your configuration files (from your backup of course …). Setup /etc/fstab. Setup networking etc.

  3. Reinstall packages.

    pacman -Sy `cat installed_packages.txt`

    Getting the file from where you saved it in the first place of course.

  4. That’s it.

If you have installed packages from AUR, you should use yaourt instead of pacman, because pacman will of course fail to install those. So step 2.5 would be to install yaourt.

16.02.2010

Disabling Gnome auto mount on a per partition basis

von mks.

… works with this command:

gnome-mount --write-settings --mount-options noauto --device /dev/sd[xn]

14.01.2010

Backup with tar and ssh

von mks.

Backup with:

# tar zcvf - /data/to/backup | ssh user@backupserver "cat > /path/to/backup.tar.gz"

Restore a backup with:

# cd /
# ssh user@backupserver "cat /path/to/backup.tar.gz" | tar zxvf -

Howto extend this with GPG? Update: Thanks GibKing!

Backup with GPG:

# tar czf - /data/to/backup | gpg -e –default-recipient-self | ssh user@backupserver “cat > /path/to/backup.tar.gz.gpg”

Restore with GPG:

# ssh user@backupserver “cat /path/to/backup.tar.gz.pgp” | gpg -d|tar xzf -

Remember that all the commands after a ‘#’ sign are in one line!

13.01.2010

Downgrade von Paketen unter Ubuntu

von ritze.

Ich habe mir vor ein paar Tagen die aktuelle Entwicklerversion vom Webkit-Browser Midori angesehen. Dazu habe ich die zwei PPAs von Midori und Webkit in Ubuntu 9.10 Karmic Koala eingebunden. Das Webkit-PPA wird für aktuelle Webkit-Bibliotheken benötigt. So wurden neben dem Open-Source-Browser auch bereits installierte Pakete aktualisiert. Zwar sieht Midori recht schick aus und kann schon einiges, jedoch ist er für den alltäglichen Gebrauch noch ungeeignet. Also wieder runter damit!

Das Paket midori ließ sich auch ohne Probleme deinstallieren, jedoch machten libsoup2.4-1 und libsoup-gnome2.4-1 Probleme. Denn hätte ich diese ohne weiteres durch ältere Versionen ersetzt, dann wären wegen ein paar Abhängigkeiten Programme wie Banshee, Pidgin, Evolution, Totem und Gwibber entfernt worden. Deshalb musste ich die Abhängigkeiten ignorieren und dann die ältere Paketversion installieren:

sudo apt-get install --force-yes libsoup2.4-1=2.28.1-2 libsoup-gnome2.4-1=2.28.1-2