After getting hibernation to work, I accidentally rebooted to a previous state that had been left in the swap space. It pretty much trashed my filesystem. So, I wanted to reinstall all packages and somehow managed to reinstall them all as dependencies. To restore explicitly installed ones there should be a possibility to run # pacman -S --asexplicit <PACKAGE>, but for some reason it isn’t implemented in pacman v3.1.3.
So, I whipped up a quick hackish shell script to accomplish the task. Maybe someone with a similar problem will find this useful. But be warned, if something goes wrong, don’t blame me.
#!/bin/bash # File name: pkg_explicit if [ -z "$1" ]; then echo "Usage: $0 [--restore] <PACKAGE>"; exit 1; fi RESTORE=0 PKG_NAME=$1 if [ $1 == "--restore" ]; then RESTORE=1 PKG_NAME=$2 fi PKG=$(pacman -Q $PKG_NAME 2> /dev/null) if [ -z "$PKG" ]; then echo "No suck package installed!"; exit 1; fi PKG_DIR=/var/lib/pacman/local/$(echo $PKG | sed -e "s/ /-/")/ if [ ! -d $PKG_DIR ]; then echo "No such package installed!"; exit 1; fi if [ $RESTORE -eq 0 ]; then if [ -z "$(pacman -Qd $PKG_NAME 2> /dev/null)" ]; then echo "Package already explicit!"; exit 1; fi cp $PKG_DIR/desc{,.rec} sed -i "/%REASON%/,+2d" $PKG_DIR/desc else if [ ! -e $PKG_DIR/desc.rec ]; then echo "Nothing to restore!"; exit 1; fi mv $PKG_DIR/desc{.rec,} fi