Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
Hi,
So finally, this is my version made in bash/sh, with works when you get a crash of your machine and wanna burn in rescue mode rw
I hope you like it
Improvements are encouraged and email/private message are also too
Code:
#!/bin/sh
echo " "
echo "Beware, this is very buggy program, no warranty, possible loss of data!"
echo "version 0.01 Frenchn00b, 3 Nov 2008 on Debian Etch"
if [ "$1" == "--help" ] ; then
echo "Use:"
echo " burnthefolder arg1 [arg2] [arg3] [arg4]"
echo " "
echo "Arg1:"
echo "--debug"
echo "--help this help"
echo "arg1 specify the device to burn eg /dev/hdc "
echo " "
echo "Arg2:"
echo "--burn to start burning with growisofs"
echo "--simulate to simulate burning"
echo "Arg3:"
echo "--noeject Do not eject the media after burning"
echo "--nosound Do not start any sounds after burning"
echo "Arg3 Arg4:"
echo " Arg3 --temp"
echo " Arg4 folder where the temp files are generated eg /tmp/frenchn00b and not /tmp/frenchn00b/ "
exit 0
fi
if [ "$3" == "--temp" ] ; then
TMPFILLOC="$4"
if [ "$4" == "" ] ; then
TMPFILLOC="/tmp"
fi
else
TMPFILLOC="/tmp"
fi
maxsizeofyourdevice=4294967296
echo "Maxsizeofyourdevice set to 4294967296"
SIZE=0
LISTTMP=""
LISTTMPH=""
TOTAL_SIZE=0
TO_BURN=""
CDROM="0"
if [ "$CDROM" == "0" ] ; then
ISO=`mktemp $TMPFILLOC/isoXXX`
ISOH=`mktemp $TMPFILLOC/isoXXX`
echo " "
echo "temp files: $ISO $ISOH generated"
LISTTMP="$LISTTMP $ISO "
LISTTMPH="$LISTTMPH $ISOH "
CDROM="1"
fi
for X in *
do
SIZEH=`du -h "$X" | tail -n 1 | cut -f 1`
SIZE=`du -b "$X" | tail -n 1 | cut -f 1`
if [ `expr $SIZE + $TOTAL_SIZE` -gt "$maxsizeofyourdevice" ]
then
CDROM="0"
if [ "$CDROM" == "0" ] ; then
ISO=`mktemp $TMPFILLOC/isoXXX`
ISOH=`mktemp $TMPFILLOC/isoXXX`
echo " "
echo "temp files: $ISO $ISOH generated"
LISTTMP="$LISTTMP $ISO "
LISTTMPH="$LISTTMPH $ISOH "
CDROM="1"
fi
TO_BURN="$(pwd)/$X"
TOTAL_SIZE="$SIZE"
if [ "$1" == "--debug" ] ; then
echo "1:$SIZEH/${TOTAL_SIZE}: $TO_BURN"
else
echo "1:$SIZE/${TOTAL_SIZE}/$maxsizeofyourdevice: $TO_BURN"
fi
echo "$SIZEH: $TO_BURN" > "$ISOH"
echo "$TO_BURN" > "$ISO"
CDROM="0"
else
TO_BURN="$(pwd)/$X"
TO_BURNTOTAL="$TO_BURN $X "
TOTAL_SIZE=`expr $SIZE + $TOTAL_SIZE`
if [ "$1" == "--debug" ] ; then
echo "2:$SIZEH/${TOTAL_SIZE}: $TO_BURN"
else
echo "2:$SIZE/${TOTAL_SIZE}/$maxsizeofyourdevice: $TO_BURN"
fi
echo "$SIZEH: $TO_BURN" >> "$ISOH"
echo "$TO_BURN" >> "$ISO"
fi
done
#echo "DONE"
if [ "$1" == "--debug" ] ; then
echo " "
echo "------------"
echo "DEBUG Mode:"
echo "$LISTTMP"
for each in $LISTTMP ; do
echo "$each:"
cat "$each"
done
fi
if [ "$1" == "--debug" ] ; then
echo " "
echo "------------"
echo "DEBUG Mode (human):"
echo "$LISTTMPH"
for each in $LISTTMPH ; do
echo "$each:"
cat "$each"
done
fi
if [ ! "$1" == "--debug" ] ; then
if [ "$2" == "--simulate" ] ; then
echo " "
echo "------------"
echo "Simulation type on $1 media, no burning of $LISTTMP"
for each in $LISTTMP ; do
echo "growisofs -Z $1 -R -J -path-file $each"
echo "$each:"
cat "$each"
done
fi
if [ "$2" == "--burn" ] ; then
echo " "
echo "------------"
echo "Burn on $1 media, no burning of $LISTTMP"
for each in $LISTTMP ; do
echo " "
echo "------------"
echo "growisofs -Z $1 -R -J -path-file $each"
growisofs -Z "$1" -R -J -path-file "$each"
echo "$each:"
cat "$each"
echo "Burning of $each to $1: Done"
echo "Enter a new dvd media and press a key please"
if [ ! "$3" == "--nosound" ] ; then
aplay /usr/share/sounds/KDE_Beep.ogg
fi
if [ ! "$3" == "--noeject" ] ; then
eject "$1"
fi
read lkfdjsjkdklfdsa
done
fi
fi
could anyone debug it... the error is where is teh line growisofs is :
I have no idea how to use growisofs...
Code:
#!/bin/sh
echo " "
echo "Beware, this is very buggy program, no warranty, possible loss of data!"
echo "version 0.01 Frenchn00b, 3 Nov 2008 on Debian Etch"
if [ "$1" == "--help" ] ; then
echo "Use:"
echo " burnthefolder arg1 [arg2] [arg3] [arg4]"
echo " "
echo "Arg1:"
echo "--debug"
echo "--help this help"
echo "arg1 specify the device to burn eg /dev/hdc "
echo " "
echo "Arg2:"
echo "--burn to start burning with growisofs"
echo "--simulate to simulate burning"
echo "Arg3:"
echo "--noeject Do not eject the media after burning"
echo "--nosound Do not start any sounds after burning"
echo "Arg3 Arg4:"
echo " Arg3 --temp"
echo " Arg4 folder where the temp files are generated eg /tmp/frenchn00b and not /tmp/frenchn00b/ "
exit 0
fi
if [ "$3" == "--temp" ] ; then
TMPFILLOC="$4"
if [ "$4" == "" ] ; then
TMPFILLOC="/tmp"
fi
else
TMPFILLOC="/tmp"
fi
maxsizeofyourdevice=4294967296
echo "Maxsizeofyourdevice set to 4294967296"
SIZE=0
LISTTMP=""
LISTTMPH=""
TOTAL_SIZE=0
TO_BURN=""
CDROM="0"
if [ "$CDROM" == "0" ] ; then
ISO=`mktemp $TMPFILLOC/isoXXX`
ISOH=`mktemp $TMPFILLOC/isoXXX`
echo " "
echo "temp files: $ISO $ISOH generated"
LISTTMP="$LISTTMP $ISO "
LISTTMPH="$LISTTMPH $ISOH "
CDROM="1"
fi
for X in *
do
SIZEH=`du -h "$X" | tail -n 1 | cut -f 1`
SIZE=`du -b "$X" | tail -n 1 | cut -f 1`
if [ `expr $SIZE + $TOTAL_SIZE` -gt "$maxsizeofyourdevice" ]
then
CDROM="0"
if [ "$CDROM" == "0" ] ; then
ISO=`mktemp $TMPFILLOC/isoXXX`
ISOH=`mktemp $TMPFILLOC/isoXXX`
echo " "
echo "temp files: $ISO $ISOH generated"
LISTTMP="$LISTTMP $ISO "
LISTTMPH="$LISTTMPH $ISOH "
CDROM="1"
fi
TO_BURN="$(pwd)/$X"
TOTAL_SIZE="$SIZE"
if [ "$1" == "--debug" ] ; then
echo "1:$SIZEH/${TOTAL_SIZE}: $TO_BURN"
else
echo "1:$SIZE/${TOTAL_SIZE}/$maxsizeofyourdevice: $TO_BURN"
fi
echo "$SIZEH: $TO_BURN" > "$ISOH"
echo "$TO_BURN" > "$ISO"
CDROM="0"
else
TO_BURN="$(pwd)/$X"
TO_BURNTOTAL="$TO_BURN $X "
TOTAL_SIZE=`expr $SIZE + $TOTAL_SIZE`
if [ "$1" == "--debug" ] ; then
echo "2:$SIZEH/${TOTAL_SIZE}: $TO_BURN"
else
echo "2:$SIZE/${TOTAL_SIZE}/$maxsizeofyourdevice: $TO_BURN"
fi
echo "$SIZEH: $TO_BURN" >> "$ISOH"
echo "$TO_BURN" >> "$ISO"
fi
done
#echo "DONE"
if [ "$1" == "--debug" ] ; then
echo " "
echo "------------"
echo "DEBUG Mode:"
echo "$LISTTMP"
for each in $LISTTMP ; do
echo "$each:"
cat "$each"
done
fi
if [ "$1" == "--debug" ] ; then
echo " "
echo "------------"
echo "DEBUG Mode (human):"
echo "$LISTTMPH"
for each in $LISTTMPH ; do
echo "$each:"
cat "$each"
done
fi
if [ ! "$1" == "--debug" ] ; then
if [ "$2" == "--simulate" ] ; then
echo " "
echo "------------"
echo "Simulation type on $1 media, no burning of $LISTTMP"
for each in $LISTTMP ; do
echo "growisofs -Z $1 -R -J -path-file $each"
echo "$each:"
cat "$each"
done
fi
if [ "$2" == "--burn" ] ; then
echo " "
echo "------------"
echo "Burn on $1 media, no burning of $LISTTMP"
for each in $LISTTMP ; do
echo " "
echo "------------"
echo "nonhuman iso list: $LISTTMP "
echo "human iso list: $LISTTMPH "
echo " "
echo "start burning $each ? so press enter ..."
echo "if you would like to append on dvd instead of create new media, type append followed by enter"
printf ":>"
read questionapp
if [ "$questionapp" == "append" ] ; then
echo "growisofs -M $1 -R -J < $each"
growisofs -M "$1" -R -J -path-list "$(cat $each)"
else
echo "growisofs -Z $1 -R -J < $each"
growisofs -Z "$1" -R -J -path-list "$(cat $each)"
###growisofs -Z /dev/hdb -R -J -r -l -iso-level 2 -path-list bur/iso423
fi
echo "$each:"
cat "$each"
echo "Burning of $each to $1: Done"
echo "Enter a new dvd media and press a key please"
if [ ! "$3" == "--nosound" ] ; then
aplay /usr/share/sounds/KDE_Beep.ogg
fi
if [ ! "$3" == "--noeject" ] ; then
eject "$1"
fi
read lkfdjsjkdklfdsa
done
fi
fi
FINALLY I MADE IT
I CAN FINALLY BURN MY 160GB of data that have crashed!
because I used 0 0 in the /etc/fstab (wrong wrong)
SCRIPT WITH CHOICES MADE IN BASH FOR DVD BACKUP IN RESCUE MODE
SEARCH CODERS TO MAKE THIS SCRIPT EVEN BETTER
NO X REQUIRED
SKIP MODE TOO
APPEND MODE TOO
LISTISO TOO
AND MANY OTHER FEATURES (well, not really )
WORKING AND HARDLY TESTED, buggy
Code:
#!/bin/sh
echo " "
echo "Beware, this is very buggy program, no warranty, possible loss of data!"
echo "version 0.01 Frenchn00b, 3 Nov 2008 on Debian Etch"
if [ "$1" == "--help" ] ; then
echo "Use:"
echo " burnthefolder arg1 [arg2] [arg3] [arg4]"
echo " "
echo "Arg1:"
echo "--debug"
echo "--help this help"
echo "arg1 specify the device to burn eg /dev/hdc "
echo " "
echo "Arg2:"
echo "--burn to start burning with growisofs"
echo "--simulate to simulate burning"
echo "Arg3:"
echo "--noeject Do not eject the media after burning"
echo "--nosound Do not start any sounds after burning"
echo "Arg3 Arg4:"
echo " Arg3 --temp"
echo " Arg4 folder where the temp files are generated eg /tmp/frenchn00b and not /tmp/frenchn00b/ "
exit 0
fi
if [ "$3" == "--temp" ] ; then
TMPFILLOC="$4"
if [ "$4" == "" ] ; then
TMPFILLOC="/tmp"
fi
else
TMPFILLOC="/tmp"
fi
maxsizeofyourdevice=4294967296
echo "Maxsizeofyourdevice set to 4294967296"
SIZE=0
LISTTMP=""
LISTTMPH=""
TOTAL_SIZE=0
TO_BURN=""
CDROM="0"
if [ "$CDROM" == "0" ] ; then
ISO=`mktemp $TMPFILLOC/isoXXX`
ISOH=`mktemp $TMPFILLOC/isoXXX`
echo " "
echo "temp files: $ISO $ISOH generated"
LISTTMP="$LISTTMP $ISO "
LISTTMPH="$LISTTMPH $ISOH "
CDROM="1"
fi
for X in *
do
SIZEH=`du -h "$X" | tail -n 1 | cut -f 1`
SIZE=`du -b "$X" | tail -n 1 | cut -f 1`
if [ `expr $SIZE + $TOTAL_SIZE` -gt "$maxsizeofyourdevice" ]
then
CDROM="0"
if [ "$CDROM" == "0" ] ; then
ISO=`mktemp $TMPFILLOC/isoXXX`
ISOH=`mktemp $TMPFILLOC/isoXXX`
echo " "
echo "temp files: $ISO $ISOH generated"
LISTTMP="$LISTTMP $ISO "
LISTTMPH="$LISTTMPH $ISOH "
CDROM="1"
fi
TO_BURN="$(pwd)/$X"
TOTAL_SIZE="$SIZE"
if [ "$1" == "--debug" ] ; then
echo "1:$SIZEH/${TOTAL_SIZE}: $TO_BURN"
else
echo "1:$SIZE/${TOTAL_SIZE}/$maxsizeofyourdevice: $TO_BURN"
fi
echo "$SIZEH: $TO_BURN" > "$ISOH"
echo "$TO_BURN" > "$ISO"
CDROM="0"
else
TO_BURN="$(pwd)/$X"
TO_BURNTOTAL="$TO_BURN $X "
TOTAL_SIZE=`expr $SIZE + $TOTAL_SIZE`
if [ "$1" == "--debug" ] ; then
echo "2:$SIZEH/${TOTAL_SIZE}: $TO_BURN"
else
echo "2:$SIZE/${TOTAL_SIZE}/$maxsizeofyourdevice: $TO_BURN"
fi
echo "$SIZEH: $TO_BURN" >> "$ISOH"
echo "$TO_BURN" >> "$ISO"
fi
done
#echo "DONE"
if [ "$1" == "--debug" ] ; then
echo " "
echo "------------"
echo "DEBUG Mode:"
echo "$LISTTMP"
for each in $LISTTMP ; do
echo "$each:"
cat "$each"
done
fi
if [ "$1" == "--debug" ] ; then
echo " "
echo "------------"
echo "DEBUG Mode (human):"
echo "$LISTTMPH"
for each in $LISTTMPH ; do
echo "$each:"
cat "$each"
done
fi
if [ ! "$1" == "--debug" ] ; then
if [ "$2" == "--simulate" ] ; then
echo " "
echo "------------"
echo "Simulation type on $1 media, no burning of $LISTTMP"
for each in $LISTTMP ; do
echo "growisofs -Z $1 -R -J -path-file $each"
echo "$each:"
cat "$each"
done
fi
if [ "$2" == "--burn" ] ; then
cdburncounter=1
# echo $cdburncountermax cdburncounter
cdburncountermax="`ls -1 $4 | while read n ; do let counter+=1 ; clear ; echo $counter ; done `" ; echo $cdburncountermax
echo " "
echo "------------"
echo "Burn on $1 media, no burning of $LISTTMP"
for each in $LISTTMP ; do
echo " "
echo "------------"
echo "nonhuman iso list: $LISTTMP "
echo "human iso list: $LISTTMPH "
echo " "
SIZEFR=0
cat $each | while read fi ; do incr=` du -b "$fi" |tail -n 1 | cut -f 1 ` ; let SIZEFR+=$incr ; echo "$SIZEFR" > "$4/filesz" ; done
printf "The final size of the archive is "
printf `cat $4/filesz`
sizelof=`cat $4/filesz`
## here pleazse below help, dont know how to calc
## THEVQLUEFINQL1=`echo $maxsizeofyourdevice - $sizelof | bc `
## THEVQLUEFINQL2=`echo THEVQLUEFINQL1 / $maxsizeofyourdevice * 100 ) | bc `
echo " of $maxsizeofyourdevice ie $THEVQLUEFINQL2"
questionapp="checkcd"
while [ "$questionapp" == "checkcd" ] || [ "$questionapp" == "listiso" ] || [ "$questionapp" == "listisoless" ] || [ "$questionapp" == "ejectin" ] || [ "$questionapp" == "ejectout" ] || [ "$questionapp" == "umountcd" ] ; do
echo " "
echo "- if you would like to append the $each on dvd instead of create new media, type append followed by enter"
echo "- if you would like to skip $each on dvd instead of create new media, type skip followed by enter"
echo "- if you would like to listiso or listisoless to list the iso $each"
echo "- if you would like to checkcd to ls cdrom"
echo "- ejectin to slot in the cdrom"
echo "- umountcd to umount the cdrom"
echo "- ejectout to eject the cdrom"
echo "- Enter to continue for new DVD disc to be burnt"
printf "CD$cdburncounter/:>"
read questionapp
if [ "$questionapp" == "checkcd" ] ; then
echo "Cdrom: $1"
mount "$1" `cat /etc/fstab | grep /dev/hdb | awk ' { print $2 } '`
ls `cat /etc/fstab | grep $1 | awk ' { print $2 } '`
umount `cat /etc/fstab | grep $1 | awk ' { print $2 } '`
fi
if [ "$questionapp" == "listiso" ] ; then
cat "$each"
fi
if [ "$questionapp" == "ejectin" ] ; then
eject -t "$1"
fi
if [ "$questionapp" == "ejectout" ] ; then
eject "$1"
fi
if [ "$questionapp" == "umountcd" ] ; then
printf "Unmount $1 "
echo `cat /etc/fstab | grep $1 | awk ' { print $2 } '`
umount `cat /etc/fstab | grep $1 | awk ' { print $2 } '`
fi
if [ "$questionapp" == "listisoless" ] ; then
cat "$each" | less
fi
done
if [ ! "$questionapp" == "append" ] && [ ! "$questionapp" == "skip" ] ; then
clear
echo " "
echo "start burning $each ? so press enter ..."
echo "- if you would like to append the $each on dvd instead of create new media, type append followed by enter"
echo "- if you would like to skip $each on dvd instead of create new media, type skip followed by enter"
printf "CD$cdburncounter/:>"
read questionapp
fi
if [ "$questionapp" == "append" ] ; then
echo "growisofs -M $1 -R -J < $each"
growisofs -M "$1" -R -J -path-list "$each"
echo " $each burnt to $1"
let cdburncounter+=1
printf "The final size of the archive $cdburncounter over $cdburncountermax is "
echo `cat $4/filesz`
# echo $cdburncountermax cdburncounter
fi
if [ "$questionapp" == "skip" ] ; then
echo "growisofs -M $1 -R -J < $each"
echo " $each skipped, to $1"
let cdburncounter+=1
printf "The final size of the archive $cdburncounter over $cdburncountermax is "
echo `cat $4/filesz`
# echo $cdburncountermax cdburncounter
fi
if [ ! "$questionapp" == "append" ] && [ ! "$questionapp" == "skip" ] ; then
echo "growisofs -Z $1 -R -J < $each"
growisofs -Z "$1" -R -J -path-list "$each"
echo " $each burnt to $1"
let cdburncounter+=1
printf "The final size of the archive $cdburncounter over $cdburncountermax is "
echo `cat $4/filesz`
# echo $cdburncountermax cdburncounter
fi
echo " "
echo "Enter a new dvd media and press a key please"
if [ ! "$3" == "--nosound" ] ; then
#aplay /usr/share/sounds/KDE_Beep.ogg
beep
fi
if [ ! "$3" == "--noeject" ] ; then
eject "$1"
fi
read lkfdjsjkdklfdsa
done
fi
fi
##growisofs -Z /dev/hdb -R -J -r -l -iso-level 2 -path-list bur/iso423
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.