tronik
Group: Members
Posts: 182
Joined: Dec. 2004 |
|
Posted: April 15 2005,16:44 |
|
From mikshaw:
Quote | Messing around with cbagger's mkwriteable script, and came up with something that allows the user to specify which directories to open up. I figure this could be useful for someone who is sensitive to RAM usage but also wants to be able to write to a particular directory or directories.
This hasn't been thoroughly tested, but it seems to work.
#!/bin/bash ARGS=$@ checkfile=/etc/sysconfig/writeable2 grep ^all $checkfile && exit do_bin() { cp -srd /KNOPPIX/bin/ /ramdisk ln -sf /ramdisk/bin / echo "bin" >> $checkfile } do_boot() { cp -srd /KNOPPIX/boot/ /ramdisk ln -sf /ramdisk/boot / echo "boot" >> $checkfile } do_lib() { cp -srd /KNOPPIX/lib/ /ramdisk ln -sf /ramdisk/lib / echo "lib" >> $checkfile } do_sbin() { cp -srd /KNOPPIX/sbin/ /ramdisk ln -sf /ramdisk/sbin / echo "sbin" >> $checkfile } do_usr() { cp -srd /KNOPPIX/usr/ /ramdisk ln -sf /ramdisk/usr/X11R6/lib/X11 /ramdisk/usr/lib/ ln -sf /ramdisk/usr / echo "usr" >> $checkfile } do_all() { grep ^bin $checkfile || do_bin grep ^boot $checkfile || do_boot grep ^lib $checkfile || do_lib grep ^sbin $checkfile || do_sbin grep ^usr $checkfile || do_usr cp -srd /KNOPPIX/var/cache/apt/ /ramdisk/var/cache rm -rf /ramdisk/var/cache/apt/archives/lock cp /KNOPPIX/var/cache/apt/archives/lock /ramdisk/var/cache/apt/archives rm -rf /ramdisk/var/lib/apt cp -srd /KNOPPIX/var/lib/apt/ /ramdisk/var/lib rm -f /var/lib/dpkg echo "all" > $checkfile exit } [ ! "$ARGS" ] && do_all for arg in bin boot lib sbin usr; do check_args=`echo $ARGS | grep -w $arg` check_done=`grep ^$arg $checkfile` if [ "$check_args" ]; then [ ! "$check_done" ] && do_$arg fi done
If the script is launched with no arguments, it should behave in basically the same way as the original.
Arguments are bin boot lib sbin usr
|
-------------- -william atlanta, GA, USA
DSL 1.0+2.4.27/sata : P4 2.4norwood : 512ddr2 : nvgf4ti4200-64 : 128mbLexar Jumpdrive Elite
|