adding the rfs-pacman rootfs update/manipulation utility

This commit is contained in:
WarheadsSE 2012-08-05 14:59:20 -04:00
parent d0c94da92b
commit 2175cfe085

37
scripts/rfs-pacman Executable file
View file

@ -0,0 +1,37 @@
#!/bin/bash
# rfs-pacman
# simplified rootfs manipulation with pacman.
##
# current directory
PWD=`pwd`
# does this directory have etc/pacman.conf?
if [ -f $PWD/etc/pacman.conf ]; then
SHORT=`echo $PWD | sed 's/.*\///'`
ARCH=`grep 'Architecture =' etc/pacman.conf | sed 's/Architecture = //'`
echo "Calling pacman:"
echo " -root: $PWD"
echo " -arch: $ARCH"
SEDPWD=`echo $PWD | sed 's/\\//\\\\\//g'`
sed "s/\/etc\/pacman.d/$SEDPWD\/etc\/pacman.d/" \
$PWD/etc/pacman.conf > etc/pacman.conf.rfs
pacman \
-r $PWD \
-b $PWD/var/lib/pacman \
--arch $ARCH \
--cachedir $PWD/var/cache/pacman/pkg \
--config $PWD/etc/pacman.conf.rfs \
--logfile $PWD/../$SHORT.pacman.log \
$@
rm $PWD/etc/pacman.conf.rfs
else
echo "'$PWD' doesn't appear to be a rootfs."
fi