Skip to Content.
Sympa Menu

sm-commit - [SM-Commit] GIT changes to test cauldron by Justin Boffemmyer (213ad70a3f3fe329653258d398b6b1521c114284)

sm-commit AT lists.ibiblio.org

Subject: Source Mage code commit list

List archive

Chronological Thread  
  • From: Justin Boffemmyer <scm AT sourcemage.org>
  • To: sm-commit AT lists.ibiblio.org
  • Subject: [SM-Commit] GIT changes to test cauldron by Justin Boffemmyer (213ad70a3f3fe329653258d398b6b1521c114284)
  • Date: Tue, 14 Oct 2008 18:44:41 -0500

GIT changes to test cauldron by Justin Boffemmyer <flux AT sourcemage.org>:

scripts/add-sauce.sh | 27 +++++++++++++--------------
scripts/cauldronchr.sh | 17 ++++++++---------
scripts/cleaniso.sh | 7 +++----
scripts/mkiso.sh | 5 ++---
scripts/mkrelease.sh | 9 ++++-----
scripts/mksystem.sh | 5 ++---
6 files changed, 32 insertions(+), 38 deletions(-)

New commits:
commit 213ad70a3f3fe329653258d398b6b1521c114284
Author: Justin Boffemmyer <flux AT sourcemage.org>
Commit: Justin Boffemmyer <flux AT sourcemage.org>

scripts/*: better sudo support

Sudo is now supported more cleanly by execing the script itself ($0)
via sudo, parallel with how they use su.

diff --git a/scripts/add-sauce.sh b/scripts/add-sauce.sh
index cbfe6c4..1efeb65 100755
--- a/scripts/add-sauce.sh
+++ b/scripts/add-sauce.sh
@@ -42,13 +42,12 @@ done
shift $(($OPTIND - 1))

SELF=$0
-SUDOCMD=""

if [[ $UID -ne 0 ]]
then
if [[ -x $(which sudo > /dev/null) ]]
then
- SUDOCMD="sudo"
+ exec sudo "$SELF $*"
else
echo "Please enter the root password."
exec su -c "$SELF $*" root
@@ -78,19 +77,19 @@ fi >&2


# make sure we start with a clean TEMPDIR each run
-$SUDOCMD rm -rf $TEMPDIR
-$SUDOCMD mkdir -m 0700 $TEMPDIR
+ rm -rf $TEMPDIR
+ mkdir -m 0700 $TEMPDIR

# add the contents of base, which are files that
# should go onto both iso and system chroots
# this is mostly /etc content
-$SUDOCMD cp -a $MYDIR/base/* $TEMPDIR/
+ cp -a $MYDIR/base/* $TEMPDIR/

# ISO Sauce
if [[ $TYPE == "iso" ]] ;then
# copy everything from the cauldron repo iso dir
# into the TEMPDIR staging area
- $SUDOCMD cp -a $MYDIR/iso/* $TEMPDIR/
+ cp -a $MYDIR/iso/* $TEMPDIR/
fi

# System Sauce
@@ -99,13 +98,13 @@ then
# make sure that the grub stage files are available in /boot
# by copying them from CHROOTDIR (system) into the /boot dir
# in our TEMPDIR staging area
- $SUDOCMD cp -a $CHROOTDIR/usr/lib/grub/i386-pc/* $TEMPDIR/boot/grub/
+ cp -a $CHROOTDIR/usr/lib/grub/i386-pc/* $TEMPDIR/boot/grub/
fi

# ==== FIXUP starts here ====
-$SUDOCMD chown -R 0:0 $TEMPDIR/
-$SUDOCMD chmod -R u=rwX,go=u-w $TEMPDIR/
-$SUDOCMD chmod 0600 $TEMPDIR/etc/shadow
+ chown -R 0:0 $TEMPDIR/
+ chmod -R u=rwX,go=u-w $TEMPDIR/
+ chmod 0600 $TEMPDIR/etc/shadow
# ==== end fixup ====

# Get a list of all files we want to install
@@ -116,7 +115,7 @@ do
# This is safe even if the dir already exists
if [[ -d $i ]]
then
- $SUDOCMD mkdir -p $CHROOTDIR/$FILE
+ mkdir -p $CHROOTDIR/$FILE
continue
fi

@@ -136,12 +135,12 @@ do
echo ""
if [[ $OVERWRITE == y ]]
then
- $SUDOCMD cp -a $TEMPDIR/$FILE $CHROOTDIR/$FILE
+ cp -a $TEMPDIR/$FILE $CHROOTDIR/$FILE
fi
else
- $SUDOCMD cp -a $TEMPDIR/$FILE $CHROOTDIR/$FILE
+ cp -a $TEMPDIR/$FILE $CHROOTDIR/$FILE
fi
done

-$SUDOCMD rm -rf $TEMPDIR
+ rm -rf $TEMPDIR

diff --git a/scripts/cauldronchr.sh b/scripts/cauldronchr.sh
index ec815ac..b009ae4 100755
--- a/scripts/cauldronchr.sh
+++ b/scripts/cauldronchr.sh
@@ -42,13 +42,12 @@ done
shift $(($OPTIND - 1))

SELF=$0
-SUDOCMD=""

if [[ $UID -ne 0 ]]
then
if [[ -x $(which sudo > /dev/null) ]]
then
- SUDOCMD="sudo"
+ exec sudo "$SELF $*"
else
echo "Please enter the root password."
exec su -c "$SELF $*" root
@@ -59,12 +58,12 @@ CHROOT_DIR="${CHROOT_DIR:-.}"
[[ $# -gt 0 ]] && CHROOT_CMD="$@"
CHROOT_CMD="${CHROOT_CMD:-/bin/bash -l}"

-$SUDOCMD mount --bind /dev "$CHROOT_DIR"/dev
-$SUDOCMD mount --bind /dev/pts "$CHROOT_DIR"/dev/pts
-$SUDOCMD mount --bind /proc "$CHROOT_DIR"/proc
+ mount --bind /dev "$CHROOT_DIR"/dev
+ mount --bind /dev/pts "$CHROOT_DIR"/dev/pts
+ mount --bind /proc "$CHROOT_DIR"/proc

-$SUDOCMD chroot "$CHROOT_DIR" $CHROOT_CMD
+ chroot "$CHROOT_DIR" $CHROOT_CMD

-$SUDOCMD umount "$CHROOT_DIR"/proc
-$SUDOCMD umount "$CHROOT_DIR"/dev/pts
-$SUDOCMD umount "$CHROOT_DIR"/dev
+ umount "$CHROOT_DIR"/proc
+ umount "$CHROOT_DIR"/dev/pts
+ umount "$CHROOT_DIR"/dev
diff --git a/scripts/cleaniso.sh b/scripts/cleaniso.sh
index 0211c0d..75d1b86 100755
--- a/scripts/cleaniso.sh
+++ b/scripts/cleaniso.sh
@@ -35,13 +35,12 @@ done
shift $(($OPTIND - 1))

SELF=$0
-SUDOCMD=""

if [[ $UID -ne 0 ]]
then
if [[ -x $(which sudo > /dev/null) ]]
then
- SUDOCMD="sudo"
+ exec sudo "$SELF $*"
else
echo "Please enter the root password."
exec su -c "$SELF $*" root
@@ -101,11 +100,11 @@ do
then
# chroot and clean a directory using rmdir
echo "Attempting to remove directory
$ISOCHROOT/$DIRT"
- $SUDOCMD chroot "$ISOCHROOT" rmdir
--ignore-fail-on-non-empty "$DIRT"
+ chroot "$ISOCHROOT" rmdir
--ignore-fail-on-non-empty "$DIRT"
else
# chroot and clean an individual file
echo "Attempting to delete $ISOCHROOT/$DIRT"
- $SUDOCMD chroot "$ISOCHROOT" rm "$DIRT"
+ chroot "$ISOCHROOT" rm "$DIRT"
fi
fi
done
diff --git a/scripts/mkiso.sh b/scripts/mkiso.sh
index 1615cb2..7dbc39c 100755
--- a/scripts/mkiso.sh
+++ b/scripts/mkiso.sh
@@ -45,13 +45,12 @@ done
shift $(($OPTIND - 1))

SELF=$0
-SUDOCMD=""

if [[ $UID -ne 0 ]]
then
if [[ -x $(which sudo > /dev/null) ]]
then
- SUDOCMD="sudo"
+ exec sudo "$SELF $*"
else
echo "Please enter the root password."
exec su -c "$SELF $*" root
@@ -67,5 +66,5 @@ then
$SUODOCMD bzip2 -f -v $KEEP "${ISO_VERSION}.iso"
fi

-[[ $ISOCHOWN ]] && $SUDOCMD chown $UID:$GID ${ISO_VERSION}.iso*
+[[ $ISOCHOWN ]] && chown $UID:$GID ${ISO_VERSION}.iso*

diff --git a/scripts/mkrelease.sh b/scripts/mkrelease.sh
index b21dd13..18cb42e 100755
--- a/scripts/mkrelease.sh
+++ b/scripts/mkrelease.sh
@@ -43,13 +43,12 @@ done
shift $(($OPTIND - 1))

SELF=$0
-SUDOCMD=""

if [[ $UID -ne 0 ]]
then
if [[ -x $(which sudo > /dev/null) ]]
then
- SUDOCMD="sudo"
+ exec sudo "$SELF $*"
else
echo "Please enter the root password."
exec su -c "$SELF $*" root
@@ -62,10 +61,10 @@ GRIMOIRE_VER=$(<
"$TARGET"/var/lib/sorcery/codex/stable/VERSION)

for file in $(grep -qr '@ISO_VERSION@'
$TARGET/{etc,isolinux,usr/share/doc/smgl.install}/*)
do
- $SUDOCMD sed -i "s/@ISO_VERSION@/$VERSION/" "$file"
+ sed -i "s/@ISO_VERSION@/$VERSION/" "$file"
done

-$SUDOCMD sed -i "s/@GRIMOIRE_VERSION@/$GRIMOIRE_VER/"
"$TARGET"/isolinux/isolinux.msg
+ sed -i "s/@GRIMOIRE_VERSION@/$GRIMOIRE_VER/" "$TARGET"/isolinux/isolinux.msg

-$SUDOCMD $(dirname $0)/mkiso.sh $ISOCHOWN -kz "$TARGET" "smgl-$VERSION"
+ $(dirname $0)/mkiso.sh $ISOCHOWN -kz "$TARGET" "smgl-$VERSION"

diff --git a/scripts/mksystem.sh b/scripts/mksystem.sh
index 933cb6c..b4bacf7 100755
--- a/scripts/mksystem.sh
+++ b/scripts/mksystem.sh
@@ -32,13 +32,12 @@ done
shift $(($OPTIND - 1))

SELF=$0
-SUDOCMD=""

if [[ $UID -ne 0 ]]
then
if [[ -x $(which sudo > /dev/null) ]]
then
- SUDOCMD="sudo"
+ exec sudo "$SELF $*"
else
echo "Please enter the root password."
exec su -c "$SELF $*" root
@@ -54,7 +53,7 @@ SYSTAR="${2:-$(basename $SYSDIR).tar.bz2}"
[[ $(dirname $SYSTAR) == '.' ]] && SYSTAR="$PWD/$SYSTAR"

cd $SYSDIR
-$SUDOCMD tar $VERBOSE -jcf "$SYSTAR" *
+ tar $VERBOSE -jcf "$SYSTAR" *
echo "Output written to: $SYSTAR"

exit



  • [SM-Commit] GIT changes to test cauldron by Justin Boffemmyer (213ad70a3f3fe329653258d398b6b1521c114284), Justin Boffemmyer, 10/14/2008

Archive powered by MHonArc 2.6.24.

Top of Page