X-Git-Url: http://gitweb.hugovil.com/?a=blobdiff_plain;f=stage2%2Fhv-utilities%2Fmedia-write;h=e66dba64e1f394ad560d243ead15596be3f2649b;hb=2c652ca09b0c4618e6b859728e838d6d095c7ffc;hp=dfcfb1c2ed8713e64f636e2a342f86599fea6305;hpb=16cc35ba4890382ee9368a176e4f5a7fa773b7a6;p=hvlinux.git diff --git a/stage2/hv-utilities/media-write b/stage2/hv-utilities/media-write index dfcfb1c..e66dba6 100755 --- a/stage2/hv-utilities/media-write +++ b/stage2/hv-utilities/media-write @@ -14,15 +14,15 @@ GROWISOFS_OPTS="-dvd-compat" # Try to read ATIP infos for CD disks to estimate capacity... MEDIA_ATIP_INFOS=$(cdrecord dev=${MEDIA_DEV} -atip 2>&1) -if echo ${MEDIA_ATIP_INFOS} | grep "ATIP info from disk" 1> /dev/null 2>&1; then +if echo ${MEDIA_ATIP_INFOS} | grep -q "ATIP info from disk"; then MEDIA_SIZE=${CD_MEDIA_SIZE} MEDIA_TYPE="CD" echo "CD disk detected" -elif echo ${MEDIA_ATIP_INFOS} | grep "Found DVD media but" 1> /dev/null 2>&1; then +elif echo ${MEDIA_ATIP_INFOS} | grep -q "Found DVD media but"; then MEDIA_SIZE=${DVD_MEDIA_SIZE} MEDIA_TYPE="DVD" echo "DVD disk detected" -elif echo ${MEDIA_ATIP_INFOS} | grep "cdrecord: No disk / Wrong disk" 1> /dev/null 2>&1; then +elif echo ${MEDIA_ATIP_INFOS} | grep -q "cdrecord: No disk / Wrong disk"; then echo "No disk inserted, aborting" exit 1 else @@ -82,7 +82,7 @@ fi # Create an empty file of $FILES_SIZE dd if=/dev/zero of=${TMP_FILE} bs=1024k count=${FILES_SIZE} -if [ $? != 0 ]; then +if [ $? -ne 0 ]; then echo "Error while creating empty file..." rm -f ${TMP_FILE} exit 1 @@ -90,7 +90,7 @@ fi # Create an extended-2 filesystem on this file echo y | /sbin/mke2fs -m 0 -b 2048 ${TMP_FILE} -if [ $? != 0 ]; then +if [ $? -ne 0 ]; then echo "Error creating file system on empty file..." rm -f ${TMP_FILE} exit 1 @@ -99,7 +99,7 @@ fi # Mount this empty file through the loopback device. mkdir -p ${TMP_MOUNT} mount -o loop -t ext2 ${TMP_FILE} ${TMP_MOUNT} -if [ $? != 0 ]; then +if [ $? -ne 0 ]; then echo "Error mounting empty file..." rm -f ${TMP_FILE} rm -rf $TMP_MOUNT @@ -112,7 +112,7 @@ rmdir ${TMP_MOUNT}/lost+found # Copy files to $TMP_MOUNT and umount it afterwards. echo "Copying files..." cp -a --parents ${FILES_WRITE_LIST} ${TMP_MOUNT} -if [ $? != 0 ]; then +if [ $? -ne 0 ]; then echo "Error while copying files..." umount ${TMP_MOUNT} rm -rf ${TMP_MOUNT} @@ -142,7 +142,7 @@ case "${MEDIA_TYPE}" in esac # Mounting the media to verify burned capacity -if ! grep ${MEDIA_DEV} /etc/mtab 1> /dev/null 2>&1; then +if ! grep -q ${MEDIA_DEV} /etc/mtab; then mount ${MEDIA_DEV} ${MEDIA_DIR} || exit 1 fi