Permalink
Browse files

adding the rfs-pacman rootfs update/manipulation utility

  • Loading branch information...
1 parent d0c94da commit 2175cfe0859dfddc071698983d9326d2d4595b0e @WarheadsSE WarheadsSE committed Aug 5, 2012
Showing with 37 additions and 0 deletions.
  1. +37 −0 scripts/rfs-pacman
View
37 scripts/rfs-pacman
@@ -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
+
+

0 comments on commit 2175cfe

Please sign in to comment.