[Ovirt-devel] [PATCH] Don't specify absolute names for programs.
Mon May 5 19:07:53 UTC 2008
/etc/init.d/functions ensures that PATH is reasonable:
PATH="/sbin:/usr/sbin:/bin:/usr/bin"
Signed-off-by: Jim Meyering <meyering at redhat.com>
---
ovirt-host-creator/common-post.ks | 20 ++++++++++----------
ovirt-host-creator/ovirt-common.sh | 7 +++++--
ovirt-host-creator/ovirt-flash-static.sh | 4 ++--
ovirt-host-creator/ovirt-flash.sh | 6 +++---
ovirt-host-creator/ovirt-pxe.sh | 3 +--
5 files changed, 21 insertions(+), 19 deletions(-)
diff --git a/ovirt-host-creator/common-post.ks b/ovirt-host-creator/common-post.ks
index 18ab8d8..64fe0ee 100644
--- a/ovirt-host-creator/common-post.ks
+++ b/ovirt-host-creator/common-post.ks
@@ -63,11 +63,11 @@ start() {
BLOCKDEVS=`ls /dev/sd? /dev/hd? 2>/dev/null`
# now LVM partitions
- LVMDEVS="$DEVICES `/usr/sbin/lvscan | awk '{print $2}' | tr -d \"'\"`"
+ LVMDEVS="$DEVICES `lvscan | awk '{print $2}' | tr -d \"'\"`"
SWAPDEVS="$LVMDEVS"
for dev in $BLOCKDEVS; do
- SWAPDEVS="$SWAPDEVS `/sbin/fdisk -l $dev 2>/dev/null | tr '*' ' ' \
+ SWAPDEVS="$SWAPDEVS `fdisk -l $dev 2>/dev/null | tr '*' ' ' \
| awk '$5 ~ /82/ {print $1}'`"
done
@@ -76,7 +76,7 @@ start() {
sig=`dd if=$device bs=1 count=10 skip=$(( $PAGESIZE - 10 )) \
2>/dev/null`
if [ "$sig" = "SWAPSPACE2" ]; then
- /sbin/swapon $device
+ swapon $device
fi
done
}
@@ -92,7 +92,7 @@ esac
EOF
chmod +x /etc/init.d/ovirt-early
-/sbin/chkconfig ovirt-early on
+chkconfig ovirt-early on
# just to get a boot warning to shut up
touch /etc/resolv.conf
@@ -131,7 +131,7 @@ start() {
# then give up
tries=0
while [ "$VAL" != "SUCCESS" -a $tries -lt 5 ]; do
- VAL=`echo "KERB" | /usr/bin/nc $SRV_HOST 6666`
+ VAL=`echo "KERB" | nc $SRV_HOST 6666`
if [ "$VAL" == "SUCCESS" ]; then
break
fi
@@ -193,9 +193,9 @@ echo "Setting up bridged networking"
cat > /etc/kvm-ifup << \EOF
#!/bin/sh
-switch=$(/sbin/ip route list | awk '/^default / { print $NF }')
-/sbin/ifconfig $1 0.0.0.0 up
-/usr/sbin/brctl addif ${switch} $1
+switch=$(ip route list | awk '/^default / { print $NF }')
+ifconfig $1 0.0.0.0 up
+brctl addif ${switch} $1
EOF
chmod +x /etc/kvm-ifup
@@ -270,8 +270,8 @@ rm -f /etc/krb5.conf
echo "Creating shadow files"
# because we aren't installing authconfig, we aren't setting up shadow
# and gshadow properly. Do it by hand here
-/usr/sbin/pwconv
-/usr/sbin/grpconv
+pwconv
+grpconv
echo "Re-creating cracklib dicts"
# cracklib-dicts is 8MB. We probably don't need to have strict password
diff --git a/ovirt-host-creator/ovirt-common.sh b/ovirt-host-creator/ovirt-common.sh
index 2ada16e..1680a2c 100644
--- a/ovirt-host-creator/ovirt-common.sh
+++ b/ovirt-host-creator/ovirt-common.sh
@@ -1,11 +1,14 @@
+PATH=/sbin:/bin:/usr/bin
+export PATH
+
create_iso() {
KICKSTART=ovirt-`uname -i`.ks
if [ $# -eq 0 ]; then
LABEL=ovirt-`date +%Y%m%d%H%M`
- /usr/bin/livecd-creator --skip-minimize -c $KICKSTART -f $LABEL 1>&2 &&
+ livecd-creator --skip-minimize -c $KICKSTART -f $LABEL 1>&2 &&
echo $LABEL.iso
elif [ $# -eq 1 ]; then
- /usr/bin/livecd-creator --skip-minimize -c $KICKSTART -b $1 1>&2 &&
+ livecd-creator --skip-minimize -c $KICKSTART -b $1 1>&2 &&
echo $1
else
return 1
diff --git a/ovirt-host-creator/ovirt-flash-static.sh b/ovirt-host-creator/ovirt-flash-static.sh
index f31fc02..12e3d14 100755
--- a/ovirt-host-creator/ovirt-flash-static.sh
+++ b/ovirt-host-creator/ovirt-flash-static.sh
@@ -47,7 +47,7 @@ mount -o loop $IMGTMP/LiveOS/squashfs.img $SQUASHTMP
# clear out the old partition table
dd if=/dev/zero of=$USBDEVICE bs=4096 count=1
-echo -e 'n\np\n1\n\n\nt\n83\na\n1\nw\n' | /sbin/fdisk $USBDEVICE
+printf 'n\np\n1\n\n\nt\n83\na\n1\nw\n' | fdisk $USBDEVICE
cat /usr/lib/syslinux/mbr.bin > $USBDEVICE
dd if=$SQUASHTMP/LiveOS/ext3fs.img of=${USBDEVICE}1
@@ -62,7 +62,7 @@ mv $USBTMP/isolinux.cfg $USBTMP/extlinux.conf
LABEL=`echo $ISO | cut -d'.' -f1 | cut -c-16`
sed -i -e "s/ *append.*/ append initrd=initrd.img root=LABEL=$LABEL ro/" $USBTMP/extlinux.conf
-/sbin/extlinux -i $USBTMP
+extlinux -i $USBTMP
umount $USBTMP
umount $SQUASHTMP
diff --git a/ovirt-host-creator/ovirt-flash.sh b/ovirt-host-creator/ovirt-flash.sh
index bb0ca45..621972c 100755
--- a/ovirt-host-creator/ovirt-flash.sh
+++ b/ovirt-host-creator/ovirt-flash.sh
@@ -39,7 +39,7 @@ ISO=`create_iso $ISO` || exit 1
# clear out the old partition table
dd if=/dev/zero of=$USBDEVICE bs=4096 count=1
-echo -e 'n\np\n1\n\n\nt\n6\na\n1\nw\n' | /sbin/fdisk $USBDEVICE
-/sbin/mkdosfs -n ovirt ${USBDEVICE}1
+printf 'n\np\n1\n\n\nt\n6\na\n1\nw\n' | fdisk $USBDEVICE
+mkdosfs -n ovirt ${USBDEVICE}1
cat /usr/lib/syslinux/mbr.bin > $USBDEVICE
-/usr/bin/livecd-iso-to-disk $ISO ${USBDEVICE}1
+livecd-iso-to-disk $ISO ${USBDEVICE}1
diff --git a/ovirt-host-creator/ovirt-pxe.sh b/ovirt-host-creator/ovirt-pxe.sh
index 1581e15..632ec5d 100755
--- a/ovirt-host-creator/ovirt-pxe.sh
+++ b/ovirt-host-creator/ovirt-pxe.sh
@@ -30,5 +30,4 @@ fi
ISO=`create_iso $ISO` || exit 1
-/usr/bin/livecd-iso-to-pxeboot $ISO
-
+livecd-iso-to-pxeboot $ISO
--
1.5.5.1.126.g02179
More information about the ovirt-devel
mailing list