Merge branch 'master' of ssh://git.openmamba.org:4444/usbinstall

Conflicts:
	src/usbinstall.sh

Add sudoers file
This commit is contained in:
Filippo Bedendo Bordon 2012-01-07 20:59:51 +01:00
commit 6a71d1f7d4

View File

@ -53,6 +53,14 @@ org.freedesktop.DBus.Properties.Get string:$3 string:$4`
return 0
}
function dbus_properties_get_bool() {
REPLY=`dbus-send --system --print-reply --dest=$1 $2 org.freedesktop.DBus.Properties.Get string:$3 string:$4`
[ $? -eq 0 ] || return 1
echo $REPLY | sed "s|.*boolean \(.*\)|\1|"
return 0
}
# Set progressbar (only if $DBUS_USBINSTALL = 1)
# Arg 1: value%
set_pbar()
@ -62,7 +70,7 @@ set_pbar()
fi
}
# Set status label
# Set status label (only if $DBUS_USBINSTALL = 1)
# Arg 1: string
set_status()
{
@ -83,10 +91,16 @@ export SELECT_BOOT=$2
export SELECT_ISO=$3
set_status "Smonto la chiavetta"
LANG=C udisks --unmount ${SELECT_USB}1 | grep failed && {
DEVICEISMOUNTED=`dbus_properties_get_bool org.freedesktop.UDisks /org/freedesktop/UDisks/devices/${SELECT_USB/*\/}1 \
org.freedesktop.UDisks.Device DeviceIsMounted`
if [ "$DEVICEISMOUNTED" = "true" ]; then
LANG=C udisks --unmount ${SELECT_USB}1 | grep failed && {
echo "Error: fail to umount the usb key (${SELECT_USB}1)"
exit 1
}
}
fi
set_pbar 2
@ -95,7 +109,7 @@ sudo fdisk $SELECT_USB < ./fdisk_template
set_pbar 5
sudo mkfs.ext3 ${SELECT_USB}1 -L openmamba_live
sleep 1
udisks --mount ${SELECT_USB}1
LANG=C udisks --mount ${SELECT_USB}1
set_pbar 30
@ -104,7 +118,7 @@ MOUNTDIR=`dbus_properties_get_stringlist org.freedesktop.UDisks /org/freedesktop
org.freedesktop.UDisks.Device DeviceMountPaths`
set_status "Estrazione del file di boot in corso..."
pushd $MOUNTDIR
pushd $MOUNTDIR >/dev/null
sudo chmod 777 ./
gunzip -c $SELECT_BOOT | cpio -i
set_pbar 38
@ -128,12 +142,12 @@ while [ $ORIG_SIZE -gt $DEST_SIZE ]; do
sleep 2
done
ln -fs `basename $SELECT_ISO` ./openmamba-live.iso
popd
popd >/dev/null
set_pbar 98
set_status "Smonto la chiavetta"
udisks --unmount ${SELECT_USB}1 | grep failed && {
LANG=C udisks --unmount ${SELECT_USB}1 | grep failed && {
echo "Error: fail to umount the usb key (${SELECT_USB}1)"
exit 2
}