Benutzer-Werkzeuge

Webseiten-Werkzeuge


root_bin_dvdrecord.sh

/root/bin/dvdrecord.sh

/root/bin/dvdrecord.sh
#!/bin/sh
 
VERSION="v2013030200"
 
################################################################################
#
# > vi /etc/devfs.conf
#   # Commonly used by many ports
#   link    cd0     cdrom
#   link    cd0     dvd
#
################################################################################
 
SPEED="8"
 
# Leerzeichen getrennte Liste
# aller Brenner
# der Prio nach sortiert
BRENNERNAMEN="PX-755A PX-820SA"
 
BETRIEBSSYSTEM="$(uname -s)"
OSREVISION="$(uname -r | tr -Cd '[0-9]')"
 
#==============================================================================#
SCANLISTE="$(cdrecord -scanbus)"
for RWNAME in ${BRENNERNAMEN}
do
#        BRENNERDEV="$(echo "${SCANLISTE}" | fgrep ${RWNAME} | awk '{print $1}')"
#------------------------------------------------------------------------------#
#if [ -z "${BRENNERDEV}" ] ; then
#------------------------------------------------------------------------------#
if [ "${BETRIEBSSYSTEM}" = "NetBSD" ] ; then
        BRENNERDEV="/dev/rcd0d"                 # CD-RW / DVD-RW
elif [ "${BETRIEBSSYSTEM}" = "Linux" ] ; then
        # BRENNERDEV="/dev/scd0"                # CD-RW / DVD-RW
        #BRENNERDEV="/dev/scd1"                  # CD-RW / DVD-RW
        # BRENNERDEV="/dev/sr0"                 # CD-RW
        # BRENNERDEV="/dev/sr1"                 # CD-RW / DVD-RW
        #BRENNERDEV="/dev/dvd"                  # DVD-RW
        BRENNERDEV="3,0,0"                      # CD-RW / DVD-RW
elif [ "${BETRIEBSSYSTEM}" = "FreeBSD" ] ; then
        BRENNERDEV="$(camcontrol devlist|fgrep "${RWNAME}"|awk -F'(' '{sub("[)]","");gsub("[,]","\n");print $2}'|egrep '^cd')"
        if [ "${OSREVISION}" -ge "90" ] ; then
                BRENNERDEV="/dev/${BRENNERDEV}"
        else
                if [ -z "$(kldstat | fgrep atapicam)" ] ; then
                        echo "
                        \"/dev/acd0\" funktioniert nicht!
                        Um eine DVD-ROM brennen zu koennen,
                        muss das Modul 'atapicam' geladen sein!
                        Dann erhaelt man das Geraet \"/dev/cd0\",
                        mit dem geht es dann:
                        kldload atapicam
                        echo 'atapicam_load=\"YES\"' >> /boot/loader.conf
                        "
                        kldload atapicam
                fi
        fi
        if [ -z "${BRENNERDEV}" ] ; then
                BRENNERDEV="$(fgrep "${RWNAME}" /var/log/dmesg.boot|awk -F':' '{print $1}')"
                if [ -z "${BRENNERDEV}" ] ; then
                        #BRENNERDEV="dev=ATA:/dev/acd0"
                        BRENNERDEV="/dev/cd0"                   # 'PLEXTOR ' 'DVDR   PX-820SA ' '1.00' Removable CD-ROM
                fi
        fi
elif [ "${BETRIEBSSYSTEM}" = "SunOS" ] ; then
        #BRENNERDEV="/dev/sr0"                                  # DVD-RW
        #BRENNERDEV="/dev/rdsk/c0t0d0p2"        # CD-RW / DVD-RW
        BRENNERDEV="1,0,0"                      # Solaris 10 U6
else
        echo "nicht unterstuetztes OS..."
        exit
fi
#------------------------------------------------------------------------------#
#fi
#------------------------------------------------------------------------------#
        if [ -n "${BRENNERDEV}" ] ; then
                echo "${BRENNERDEV}"
                break
        fi
done
#==============================================================================#
 
 
################################################################################
### http://www.netbsd.org/docs/guide/en/chap-rmmedia.html
#13.16. DVD support
#
#Currently, NetBSD supports DVD media through the ISO 9660 also used for CD-ROMs. The new UDF filesystem also present on DVDs has been supported since NetBSD 4.0. Information about mounting ISO 9660 and UDF filesystems can be found in the mount_cd9660(8) and mount_udf(8) manual pages respectively. DVDs, DivX and many avi files be played with multimedia/ogle or multimedia/gmplayer.
#
#For some hints on creating DVDs, see this postings about growisofs and this article about recording CDs and DVDs with NetBSD.
#13.17. Creating ISO images from a CD
#
#To create an ISO image and save the checksum do this:
#
## readcd dev=/dev/cd0d f=/tmp/cd.iso
#
#Here is an alternative using dd(1):
#
## dd if=/dev/cd0d of=/tmp/cd.iso bs=2048
#
#If the CD has errors you can recover the rest with this:
#
## dd if=/dev/cd0d of=/tmp/cd.iso bs=2048 conv=noerror
#
#To create an ISO image from a mounted data CD first, mount the CD disk by:
#
## mount -t cd9660 -r /dev/cd0d /mnt/cdrom
#
#Second, get the image:
#
## mkhybrid -v -l -J -R -o /tmp/my_cd.iso /mnt/cdrom/
#
#13.18. Getting volume information from CDs and ISO images
#
#You can read the volume data from an unmounted CD with this command:
#
## file -s /dev/cd0d
#
#You can read the volume data from an ISO image with this command:
#
## isoinfo -d -i /tmp/my_cd.iso
#
#You can get the unique disk number from an unmounted CD with this:
#
## cd-discid /dev/cd0d
#
#You can read the table of contents of an unmounted CD with this command:
#
## cdrecord -v dev=/dev/cd0d -toc
################################################################################
# Auf einem Single-Layer 4,70GB-Intenso-Rohlingen  (DVD+R) lassen sich maximal 4469 MB brennen.
# Auf einem Double-Layer 8,50GB-Verbatim-Rohlingen (DVD+R) lassen sich maximal 8152 MB brennen.
################################################################################
# Double-Layer - DVD+R brennen (leider geht es bei mir nicht)
# ============================
#
# http://fy.chalmers.se/~appro/linux/DVD+RW/
#
### -use-the-force-luke=4gms
# growisofs -dvd-compat -use-the-force-luke=4gms -speed=${SPEED} -Z /dev/sr2 -U -D -J -r -ldots -joliet-long -allow-lowercase -allow-multidot /Pfad/Verzeichnis
#
#
#
# http://forum.ubuntuusers.de/topic/92119/
#
# growisofs -Z /dev/scd0=/dev/fd/0 -use-the-force-luke=notray -use-the-force-luke=tty -use-the-force-luke=tracksize:2441273 -dvd-compat -speed=${SPEED} -use-the-force-luke=bufsize:32m
#
#------------------------------------------------------------------------------#
#
# File "/Pfad/Verzeichnis/Datei" is larger than 4GiB-1.
# -allow-limited-size was not specified. There is no way do represent this file size. Aborting.
# :-( write failed: Input/output error
#
# -allow-limited-size
#
# Damit gehts!   ;-)
#
#
#
# :-( /dev/sr2: 4173824 blocks are free, 4185388 to be written!
#
# Blockgroesse in MB umrechnen:
# echo "4173824*2048/1024/1024" | bc -l
# 8152 MB
#
################################################################################
# ISO9660 Version 2 (inoffiziell): -L -iso-level 4
################################################################################
# UNIX/Linux: Rock-Ridge                      (-r)
# Solaris   : ISO9660/HFS hybrid              (-hfs)
# Mac OS    : ISO9660 mit HFS-Erweiterungen   (-apple)
# Windows   : Joliet                          (-J -joliet-long)
################################################################################
 
if [ -z "${1}" ] ; then
 
      cdrecord -toc dev=${BRENNERDEV}
      echo "DVD-Brenner"
        echo "${0} [DVD-Image.iso]"
      echo "oder"
        echo "${0} [Verzeichnis]"
 
else
 
  if [ "${BETRIEBSSYSTEM}" = "SunOS" ] ; then
      /etc/init.d/volmgt stop
      sleep 2
      /etc/init.d/volmgt stop
      sleep 1
  fi
 
 
  if [ -f "${1}" ] ; then
      ################################################################################
      # http://www.hubertus-sandmann.homepage.t-online.de/DVDs_brennen_mit_Linux.htm
      #
      ### Daten an eine breits gebrannte DVD anhängen
      ### Multisession-DVD
      # growisofs -M ${BRENNERDEV} -r -J ${1}
      #
      ### eine Multisession-DVD auffüllen
      ### das bietet maximale compatibilität
      # growisofs -M ${BRENNERDEV}=/dev/zero
      #
      ### sicheres löschen
      # growisofs -Z /dev/dvd=/dev/zero
      # growisofs -Z ${BRENNERDEV}=/dev/zero
      #
      ### Eine wiederbeschreibbare DVD formatieren
      # dvd+rw-format -f ${BRENNERDEV}
      #
      ### ein DVD-Image brennen
      echo "growisofs -dvd-compat -speed=${SPEED} -Z ${BRENNERDEV}=${1}"
      growisofs -dvd-compat -speed=${SPEED} -Z ${BRENNERDEV}=${1}
      #
      ### ein DVD-Image ohne Geschwindigkeitsvorgabe brennen
      #echo "growisofs -dvd-compat -Z ${BRENNERDEV}=${1}"
      #growisofs -dvd-compat -Z ${BRENNERDEV}=${1}
      #
      eject ${BRENNERDEV}
 
  elif [ -d "${1}" ] ; then
      ### Verzeichnis direkt brennen
      #
      # DVD-RW
      ### formatieren
      #dvd+rw-format -f ${BRENNERDEV}
      ### leeren
      #dvd+rw-format -b ${BRENNERDEV}
      #
 
      ### funktioniert mit allen Betriebssystemen
      # 4,7 GB
      #START="growisofs -dvd-compat -speed=${SPEED} -Z ${BRENNERDEV} -U -D -J -r -ldots -joliet-long -allow-lowercase -allow-multidot"
      #
      ### Standard mit UDF
      #START="growisofs -dvd-compat -speed=${SPEED} -Z ${BRENNERDEV} -U -D -J -udf -r -ldots -joliet-long -allow-lowercase -allow-multidot"
      START="growisofs -dvd-compat -speed=${SPEED} -use-the-force-luke=bufsize:256m -Z ${BRENNERDEV} -U -D -J -udf -r -ldots -joliet-long -allow-lowercase -allow-multidot"
      #
      ### funktioniert mit Linux
      # 8,5 GB
      #START="${START} -allow-limited-size"
      #
      ### funktioniert mit NetBSD
      # 8,5 GB
      #START="${START} -iso-level 4 -udf"
      # Mit "-iso-level 4" darf die maximale Länge von Verzeichnissen
      # und Dateien 207 Zeichen betragepn mit aktiviertem Rock-Ridge (-r)
      # sind es nur 197 Zeichenx.
      # Sicherheitshalber werden diese Limitierungen mit "-U -D" nochmal aufgehoben.
      ### Leider machen hier Dateien, die mehrere GB gross sind, probleme
      ### sie werden nicht von allen Systemen gelesen!
      #START="growisofs -dvd-compat -speed=${SPEED} -Z ${BRENNERDEV} -iso-level 4 -U -D -J -udf -r -joliet-long"
 
      if [ "${BETRIEBSSYSTEM}" = "Linux" ] ; then
              echo "${START} ${1}"
              ${START} ${1}
 
      elif [ "${BETRIEBSSYSTEM}" = "NetBSD" ] ; then
              ### funktioniert mit NetBSD 5.0.1
              echo "${START} ${1}"
              ${START} ${1}
 
      elif [ "${BETRIEBSSYSTEM}" = "FreeBSD" ] ; then
              echo "${START} ${1}"
              ${START} ${1}
 
      elif [ "${BETRIEBSSYSTEM}" = "SunOS" ] ; then
              ### funktioniert mit Solaris 10U6
              echo "${START} ${1}"
              ${START} ${1}
      else
              echo "OS wird zur Zeit nicht unterstuetzt..."
      fi
 
      ### Da das freie udf noch nicht stabil ist,
      ### verwende ich Rock-Ridge, das einzige stabile DVD-Dateisystem
      ### welches fast alle UNIX-Dateisystemfunktionen unterst\303\274tzt;
      ### es kann wesentlich mehr als das Joliet-Dateisystem von MS.
      ### HFS kann nur 8-Bit-Zeichen darstellen und ist damit unzureichend.
 
      # ISO9660 Version 2 (inoffiziell)
      # growisofs -dvd-compat -speed=${SPEED} -Z ${BRENNERDEV} -iso-level 4 -allow-leading-dots ${1}
 
      # UNIX: Rock-Ridge
      #growisofs -dvd-compat -speed=${SPEED} -Z ${BRENNERDEV} -r ${1}
 
      # Solaris: ISO9660/HFS hybrid
      # growisofs -dvd-compat -speed=${SPEED} -Z ${BRENNERDEV} -hfs ${1}
 
      # Mac OS: ISO9660 mit HFS-Erweiterungen
      # growisofs -dvd-compat -speed=${SPEED} -Z ${BRENNERDEV} -apple ${1}
 
      #
      eject ${BRENNERDEV}
 
  else
 
      echo 'Datei oder Verzeichnis existiert nicht!'
 
  fi
 
  if [ "${BETRIEBSSYSTEM}" = "SunOS" ] ; then
      /etc/init.d/volmgt start
  fi
fi
/home/http/wiki/data/pages/root_bin_dvdrecord.sh.txt · Zuletzt geändert: von manfred