how to make the file in /usr/lib writable


Forum: USB booting
Topic: how to make the file in /usr/lib writable
started by: yss

Posted by yss on April 15 2005,07:57
updating the /usr/lib file it claim the file inside /usr/lib is only read-file and unable to write. Any opinion?
Posted by tronik on 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

Posted by mikshaw on April 15 2005,23:19
Or if you are not so RAM-restricted, the included mkwriteable script is in /etc/init.d
Run it with "sudo /etc/init.d/mkwriteable" or boot with the "write" option.

With either script you will probably need to delete the symlink of the desired file in /usr/lib and copy it over from /KNOPPIX/usr/lib before it can be edited.

Powered by Ikonboard 3.1.2a
Ikonboard © 2001 Jarvis Entertainment Group, Inc.