Linux Page - blackbox configuration and cd-burning shellscripts

hmmm... one "under construction" sign spared...

Basics
Compaq Presario Laptop PIII 500MHz 40GB HDD
OS
SuSE Linux Pro 8.0 (& Win2k Dual Boot (LILO))
WM
Blackbox (CVS)
MTA
Postfix with TLS
MDA
Procmail with spamassassin, pyzor, dcc, ...
MUA
mutt with muttprint, gpg, sigrot, w3m, ...
WWW
Opera
Other tools I use: Rox-Filer, xmms, xmule, OpenOffice, Bluefish, vim (merely trying to get used to it), LaTeX/KOMA-Script (also just trying to get into it a bit).
What more? - I've made my own shellscripts to interface cdrecord et al. (to burn either backups or mp3s).
And I like disc-cover a lot.

I've put a little more effort into my security and mailing setup, which can be studied either in the pages referenced right on top of this page (Postfix, Procmail, mutt etc.), or on the security section...

Zum Seitenanfang


Blackbox

I am running a northsea-styled Blackbox 0.70 (CVS) with rox-filer desktop (aka "pinboard"), bbkeys (CVS), wmappkill, wmix, wmxmms (that's wmxmms (coming with xmms), not WMxmms.) and wmswallow-kinternet plugins

Then, in the first of my three workspaces, I have an Aterm with Screen running, which in turn provides mutt, bash and mc. I have another transparent, sticky, all-below aterm with 'top -i' running permanently in it.

Here are the screenshots
preview of Blackbox screenshot with mutt preview of Blackbox screenshot with aterms
my first workspace, with aterm, mutt and wmappkill, wmxmms, wmix and wmswallow/kinternet plugins in the slit. my second workspace along with some transparent aterms and bbox's menu.

how I get this?

For sake of completeness, here is my

~/.screenrc

screen -t shell 3 screen -t mutt -M 2 mutt screen -t mc 1 mc

~/.xinitrc

export ATERM_MAIN="-tr -trsb -fn 6x13 -sh 45 -fade 25 -trsb -vb -fg grey" export ATERM_TOP="-tr -trsb -fn 6x13 -sh 110 -tn xterm-vt220" if test "$WINDOWMANAGER" == "/usr/local/bin/blackbox"; then # /usr/local/bin/bbpager -c ~/.blackbox/.bbpagerrc & # this doesn't work with BB-CVS yet... # Dockapps /usr/X11/bin/wmAppKill & sleep 1 && /usr/X11/bin/wmxmms & sleep 2 && /usr/X11/bin/wmix & /usr/X11/bin/wmswallow -geometry 55x57 -noshape kinternet kinternet --swallow & # programs running in the background /usr/local/bin/bbkeys -c ~/.blackbox/.bbkeysrc & /usr/local/bin/xbut & sleep 3 && aterm $ATERM_MAIN -geometry 130x55+0+0 -e screen & sleep 4 && aterm $ATERM_TOP -geometry 81x30-0+0 -e top -i && wmctrl -r top -b add,below & sleep 3 && rox --pinboard=MyPinboard # finally, start blackbox exec /usr/local/bin/blackbox -rc ~/.blackbox/.blackboxrc exit 0

~/.blackbox/.blackboxrc

session.screen0.slit.placement: CenterRight session.screen0.slit.direction: Vertical session.screen0.slit.onTop: True session.screen0.slit.autoHide: True session.screen0.toolbar.placement: BottomCenter session.screen0.toolbar.onTop: True session.screen0.toolbar.autoHide: False session.screen0.toolbar.widthPercent: 70 session.screen0.windowPlacement: RowSmartPlacement session.screen0.edgeSnapThreshold: 10 session.screen0.fullMaximization: False session.screen0.focusLastWindow: True session.screen0.focusModel: SloppyFocus AutoRaise ClickRaise session.screen0.strftimeFormat: %d.%m.%y %H:%M session.screen0.placementIgnoresShaded: True session.screen0.disableBindingsWithScrollLock: False session.screen0.rowPlacementDirection: LeftToRight session.screen0.workspaces: 3 session.screen0.enableToolbar: True session.screen0.workspaceNames: WSpace 1,Office,MMedia session.screen0.focusNewWindows: True session.screen0.colPlacementDirection: TopToBottom session.screen0.opaqueMove: False session.styleFile: ~/.blackbox/styles/northsea session.menuFile: ~/.blackbox/.bboxmenu session.doubleClickInterval: 300 session.cacheMax: 200 session.imageDither: OrderedDither session.colorsPerChannel: 4 session.cacheLife: 5 session.autoRaiseDelay: 750 session.maximumColors: 126 *font: -microsoft-Verdana-medium-r-normal--12-0-0-0-p-0-iso8859-10

~/.blackbox/.bsetbgrc

CENTER ="display -backdrop -window root" FULL ="display -geometry 800x600 -window root" TILE ="display -window root" DEFAULT ="display -backdrop -window root"

~/.blackbox/.bbkeysrc

[begin] (bbkeys configuration file) [config] [option] (stylefile) {~/.blackbox/styles/northsea} [option] (honorModifiers) {false} [option] (raiseWhileCycling) {false} [option] (showCycleMenu) {true} [option] (menuTextJustify) {right} [option] (autoConfig) {true} [option] (autoConfigCheckTimeout) {10} [option] (workspaceColumns) {4} [option] (workspaceRows) {2} [option] (cycleMenuX) {200} [option] (cycleMenuY) {200} [end] [keybindings] (begin keybindings) [chain] (Control-Mod1-W) [sendToWorkspace] (1) {1} [sendToWorkspace] (2) {2} [sendToWorkspace] (3) {3} [end] [chain] (Mod1-Y) [execute] (1) {xmms} [execute] (2) {aumix -v +5} [execute] (3) {aumix -v -5} [end] [Lower] (Mod1-Down) [Raise] (Mod1-Up) [toggleShade] (Mod1-Control-Shift-Up) [Close] (Mod1-F4) [Iconify] (Mod1-Control-Shift-i) [toggleMaximizeFull] (Mod1-F12) [toggleMaximizeHorizontal] (Mod1-F11) [toggleMaximizeVertical] (Mod1-F10) [toggleOmnipresent] (Mod1-Control-Shift-s) [toggleDecorations] (Mod1-Control-Shift-t) [resizeWindowWidth] (Control-Shift-Left) {-5} [resizeWindowWidth] (Control-Shift-Right) {5} [resizeWindowHeight] (Control-Shift-Up) {-5} [resizeWindowHeight] (Control-Shift-Down) {5} [moveWindowUp] (Mod1-Control-Up) [moveWindowDown] (Mod1-Control-Down) [moveWindowLeft] (Mod1-Control-Left) [moveWindowRight] (Mod1-Control-Right) [NextWindow] (Mod1-Tab) [NextWindowOnAllWorkspaces] (Mod1-Control-Tab) [PrevWindow] (Mod1-Shift-Tab) [NextWorkspace] (Mod1-Control-Shift-Right) [PrevWorkspace] (Mod1-COntrol-Shift-Left) [changeWorkspace] (Mod1-1) {1} [changeWorkspace] (Mod1-2) {2} [changeWorkspace] (Mod1-3) {3} [showRootMenu] (Control-Escape) [Execute] (Mod1-F5) {xrefresh} [Execute] (Mod1-F1) {aterm} [Execute] (Mod1-F2) {bbrun -a -w} [Execute] (Mod4-E) {kfmclient openProfile filemanagement} [Execute] (Mod1-Control-Shift-m) {xterm -bg black -fg grey -wf +mb -vb -sb -rightbar -e 'mutt'} [Execute] (Mod1-Control-Shift-k) {kdesu kate} [Execute] (Mod1-Control-Shift-o) {opera} [Execute] (Mod1-Control-Shift-x) {xmms} [Execute] (Mod1-Control-Shift-a) {aterm -name "aterm" -title aterm -fn 6x13 -tr -trsb -sh 110 --geometry 95x35+80+240 -tn xterm-vt220} [Execute] (Mod1-Control-Shift-1) {rox ~} [Execute] (Mod1-Control-Shift-2) {rox /usr/local/apps} [Execute] (Mod1-Control-Shift-3) {~/OpenOffice/soffice -quickstart &} [end] (end keybindings) [end] (end bbkeys configuration)

~/.blackbox/.bboxmenu

...oh, no. this is just too long.

~/.blackbox/.bbpagerrc

this is not used right now, since i can't (yet) get bbpager-cvs to read it in correctly... bbpager.autoConfig: True bbpager.autoConfig.checkTimeout: 15 bbpager.position: +0-0 bbpager.desktop.width: 30 bbpager.desktop.height: 22 bbpager.rows: 1 bbpager.raised: True

Zum Seitenanfang


my cd-burning shellscripts

cd.backup.sh

#!/bin/bash # ------------------------------------------------ # Set variables PREV=`pwd` WRKDIR=`mktemp -d /var/CD/Temp/cdbackup.XXXXXX` BACKDIR="/var/CD/Backup" BACKREGDIR="$BACKDIR/registry" LIVEREGDIR="/windows/C/W2K/system32/config" echo "starting backup routines - make sure there is an empty medium in the CD recorder, i won't wait/check later on..." # First, backup MBR and partitions # ------------------------------------------------ SUCCESS_FLAG="" cd "$BACKDIR" echo "cd'ed to `pwd`, now backing up partition table..." parted /dev/hda print > "$BACKDIR/partitions.txt" || SUCCESS_FLAG="false" df -h | sort | grep "^/" > "$BACKDIR/mountpoints.txt" || SUCCESS_FLAG="false" dd if=/dev/hda of="$BACKDIR/hda.mbr" bs=512 count=1 || SUCCESS_FLAG="false" test -z $SUCCESS_FLAG && echo "Success, now proceeding with backing up home, mail and etc dirs..." test -z $SUCCESS_FLAG || echo "There have been errors backing up partition info, but backup continues..." # ------------------------------------------------ # Next, backup my home and etc directories SUCCESS_FLAG="" cd "$BACKDIR" echo "cd'ed to `pwd`, now proceeding with backing up linux home, mail and etc directories," echo "this can take a while (bzipping), so please be patient..." tar c --atime-preserve --bzip2 --one-file-system --preserve \ -f "$BACKDIR/wagner-home.tar.bz2" /home/wagner || SUCCESS_FLAG="false" tar c --atime-preserve --bzip2 --one-file-system --preserve \ -f "$BACKDIR/wagner-mail.tar.bz2" /var/mail/wagner || SUCCESS_FLAG="false" tar c --atime-preserve --bzip2 --one-file-system --preserve \ -f "$BACKDIR/etc.tar.bz2 /etc" || SUCCESS_FLAG="false" test -z $SUCCESS_FLAG && echo "Success, now proceeding with backing up the W2K registry..." test -z $SUCCESS_FLAG || echo "There have been errors backing up linux home, mail and etc dirs, but backup continues..." # ------------------------------------------------ # Then update my backup of the W2K registry SUCCESS_FLAG="" cd "$BACKREGDIR" for f in "SAM" "SECURITY" "default" "software" "system"; do cp -vu "$LIVEREGDIR/$f" "$BACKREGDIR/$f" || SUCCESS_FLAG="false" bzip2 -f "$BACKREGDIR/$f" "$BACKREGDIR/$f.bz2" || SUCCESS_FLAG="false" done cp -vu "/windows/C/Dokumente und Einstellungen/Administrator/NTUSER.DAT" \ "$BACKREGDIR/Administrator/NTUSER.DAT" || SUCCESS_FLAG="false" bzip2 -f "$BACKREGDIR/Administrator/NTUSER.DAT" \ "$BACKREGDIR/Administrator/NTUSER.DAT.bz2" || SUCCESS_FLAG="false" cp -vu "/windows/C/Dokumente und Einstellungen/wagner/NTUSER.DAT" \ "$BACKREGDIR/wagner/NTUSER.DAT" || SUCCESS_FLAG="false" bzip2 -f "$BACKREGDIR/wagner/NTUSER.DAT" \ "$BACKREGDIR/wagner/NTUSER.DAT.bz2" || SUCCESS_FLAG="false" test -z $SUCCESS_FLAG && echo "Success, now proceeding with the iso image creation..." test -z $SUCCESS_FLAG || echo "There have been errors backing up the registry, but backup continues..." # ------------------------------------------------ # Next, make my iso image (and test it)... SUCCESS_FLAG="" cd "$WRKDIR" echo "cd'ed to `pwd`, preparing ISO CD image now..." mkisofs --allow-lowercase --allow-multidot -J -R -l -L -quiet -V "BACKUP-`date +%y%m%d`" -o "$WRKDIR/cdimage.iso" "$BACKDIR" \ || SUCCESS_FLAG="false" echo "checking ISO CD image..." mount "$WRKDIR/cdimage.iso" -r -t iso9660 -o loop /mnt || SUCCESS_FLAG="false" cd /mnt || SUCCESS_FLAG="false" ls -AR > "$WRKDIR/dir.log" || SUCCESS_FLAG="false" cd "$WRKDIR" || SUCCESS_FLAG="false" umount /mnt || SUCCESS_FLAG="false" test -z $SUCCESS_FLAG && echo "Success, now proceeding with the writing..." test -z $SUCCESS_FLAG || { echo "There have been errors in creating the iso image, aborting backup..." exit } # ------------------------------------------------ # Finally, if all is okay, write the iso image. SUCCESS_FLAG="" cdrecord -s fs=8M -overburn -dao driveropts=burnfree -data "$WRKDIR/cdimage.iso" || SUCCESS_FLAG="false" test -z $SUCCESS_FLAG && echo "Done, checking CD..." test -z $SUCCESS_FLAG || { echo "There have been errors in writing the image, better check the cd manually..." exit } sleep 5 mount /media/cdrecorder || SUCCESS_FLAG="false" cd /media/cdrecorder || SUCCESS_FLAG="false" ls -AR > "$WRKDIR/dir2.log" || SUCCESS_FLAG="false" cd "$WRKDIR" || SUCCESS_FLAG="false" umount /media/cdrecorder || SUCCESS_FLAG="false" test -z "`diff $WRKDIR/dir.log $WRKDIR/dir2.log`" || SUCCESS_FLAG="false" test -z $SUCCESS_FLAG && echo "Success, now cleaning up and going home..." test -z $SUCCESS_FLAG || { echo "There have been errors with the CD, better check the cd manually..." exit } # ------------------------------------------------ # Clean up and go to where you came from... cd "$PREV" rm -frv "$WRKDIR/*" rmdir -v "$WRKDIR" test -z $SUCCESS_FLAG && echo "Done. And remember: Backup early, backup often."

cd.burndatadir.sh

#!/bin/bash # ------------------------------------------------ # Set variables PREV=`pwd` WRKDIR=`mktemp -d /var/CD/Temp/cdburn.XXXXXX` test -z $1 && BURNDIR=$PREV test -z $1 || BURNDIR=$1 echo "Starting Burn Routines, make sure there is an empty medium in the CD recorder, i won't wait or check later on..." # ------------------------------------------------ # Next, make my iso image (and test it)... SUCCESS_FLAG="" cd "$WRKDIR" echo "cd'ed to `pwd`, preparing ISO CD image of $BURNDIR now..." mkisofs --allow-lowercase --allow-multidot -J -R -l -L -quiet -V "BACKUP-`date +%y%m%d`" -o "$WRKDIR/cdimage.iso" "$BURNDIR" \ || SUCCESS_FLAG="false" echo "checking ISO CD image..." mount "$WRKDIR/cdimage.iso" -r -t iso9660 -o loop /mnt || SUCCESS_FLAG="false" cd /mnt || SUCCESS_FLAG="false" ls -AR > "$WRKDIR/dir.log" || SUCCESS_FLAG="false" cd "$WRKDIR" || SUCCESS_FLAG="false" umount /mnt || SUCCESS_FLAG="false" test -z $SUCCESS_FLAG && echo "Success, now proceeding with the writing..." test -z $SUCCESS_FLAG || { echo "There have been errors in creating the iso image, aborting backup..." exit } # ------------------------------------------------ # Finally, if all is okay, write the iso image. SUCCESS_FLAG="" cdrecord -s speed=8 fs=8M -overburn -dao -overburn driveropts=burnfree -data "$WRKDIR/cdimage.iso" || SUCCESS_FLAG="false" test -z $SUCCESS_FLAG && echo "Done, checking CD..." test -z $SUCCESS_FLAG || { echo "There have been errors in writing the image, better check the cd manually..." exit } sleep 5 mount /media/cdrecorder || SUCCESS_FLAG="false" cd /media/cdrecorder || SUCCESS_FLAG="false" ls -AR > "$WRKDIR/dir2.log" || SUCCESS_FLAG="false" cd "$WRKDIR" || SUCCESS_FLAG="false" umount /media/cdrecorder || SUCCESS_FLAG="false" test -z "`diff $WRKDIR/dir.log $WRKDIR/dir2.log`" || SUCCESS_FLAG="false" test -z $SUCCESS_FLAG && echo "Success, now cleaning up and going home..." test -z $SUCCESS_FLAG || { echo "There have been errors with the CD, better check the cd manually..." exit } # ------------------------------------------------ # Clean up and go to where you came from... cd "$PREV" rm -frv "$WRKDIR/*" rmdir -v "$WRKDIR" test -z $SUCCESS_FLAG && echo "Ready. Seeya"

cd.burnmp3.sh

#!/bin/bash # ------------------------------------------------ # Set variables PREV=`pwd` WRKDIR=`mktemp -d /var/CD/Temp/cdburn.XXXXXX` test -z $1 && BURNDIR="$PREV" test -z $1 || BURNDIR="$1" echo "changing to $BURNDIR..." cd "$BURNDIR" echo "converting filenames in $BURNDIR to blankless with lowercase extensions..." ls *.[mM][pP]3 &>/dev/null && for i in *.[mM][pP]3; do cp "$i" "$WRKDIR/"`echo $i | tr [:upper:] [:lower:] | tr ' ' '_'`; done echo "changing to $WRKDIR..." cd "$WRKDIR" ls *.mp3 &>/dev/null && echo "here's the list of mp3s now:" && ls -1 *.mp3 ls *.mp3 &>/dev/null && echo "converting mp3s now..." ; for i in *.mp3; do mpg123 -y -v -r 44100 --stereo -w `basename $i .mp3`.wav "$i"; done echo "here's the list of wavs now:"; file *.wav echo "generating toc-file..."; cd.generatetoc.sh *.wav echo cd.toc echo "recording cd now..." cdrdao write --driver generic-mmc --buffers 512 --speed 8 --overburn cd.toc echo "Done. Cleaning up..." cd "$PREV" rm -frv "$WRKDIR/*.*" rmdir -v "$WRKDIR" echo "Ready. Seeya"

cd.generatetoc.sh

(this isn't mine) #!/bin/sh # Usage: env DATA=1 generate_toc.sh stuff.iso # generate_toc.sh *.wav IFS=" " [ "$DATA" = "" ] && DATA=0 ( if [ $DATA -eq 1 ] then echo CD_ROM else echo CD_DA fi for file in $@ do echo if ( echo $file | grep '\.wav$' ) &>/dev/null then echo TRACK AUDIO echo AUDIOFILE \"$file\" 0 else echo TRACK MODE1 echo DATAFILE \"$file\" fi done ) >cd.toc

cd.copyaudio.sh

#!/bin/bash # --------------------------------------------- # Set variables PREV=`pwd` WRKDIR=`mktemp -d /var/CD/Temp/cdcopying.XXXXXX` cd "$WRKDIR" cdda2wav -vall -cddb=0 -D2,0 -B -x -Owav -dev=0,0,0 && \ echo "insert empty medium and press a key..." && \ read && \ cdrecord -v speed=8 fs=8M -eject -overburn -dao driveropts=burnfree -useinfo -text *.wav cd "$PREV" rm -frv "$WRKDIR/*" rmdir -v "$WRKDIR" echo "Ready. Seeya"

cd.encmp3dir.sh

#!/bin/bash echo "here's the list of wavs now:"; file *.wav ls *.mp3 &>/dev/null && echo "converting wavs now..." ; for i in *.wav; do lame -m j --vbr-new --alt-preset extreme "$i" "`basename $i .wav`.mp3"; done ls *.mp3 &>/dev/null && echo "here's the list of mp3s now:" && ls -1 *.mp3 echo "Ready. Seeya"

cd.printcovers.sh

#!/bin/bash echo "here's the list of .ps files now:"; ls *.ps ls *.ps &>/dev/null && echo "printint covers now..." ; for i in *.ps; do lpr -P lp $i ; done echo "Done. Seeya"