esperimenti con il boot di Slackware
Inviato: sab 17 gen 2009, 18:51
Ciao a tutti,
oggi mi sento in vena di sperimentare e quindi ho pensato di mettere mano agli script di init di Slackware per tirare fuori qualcosa di più snello e performante.
Sto leggendo /etc/rc.d/rc.S e non mi sembra nulla di troppo complicato, per prima cosa ho fatto un backup e adesso sto modificando il tutto togliendo quello che non mi serve e lasciando solo quello che mi necessita senza usare if/else...
Ho un dubbio per quanto riguarda questa sezione:
Mi serve?? dal fatto che non ho idea di cosa sia presumo di no, ma chiedere lumi a chi ne sa più di me non può farmi che bene... 
Qualunque spiegazione / link / rtfm è ben accetto, grazie
Ciau...
oggi mi sento in vena di sperimentare e quindi ho pensato di mettere mano agli script di init di Slackware per tirare fuori qualcosa di più snello e performante.
Sto leggendo /etc/rc.d/rc.S e non mi sembra nulla di troppo complicato, per prima cosa ho fatto un backup e adesso sto modificando il tutto togliendo quello che non mi serve e lasciando solo quello che mi necessita senza usare if/else...
Ho un dubbio per quanto riguarda questa sezione:
Codice: Seleziona tutto
# Initialize the Logical Volume Manager.
# This won't start unless we find /etc/lvmtab (LVM1) or
# /etc/lvm/backup/ (LVM2). This is created by /sbin/vgscan, so to
# use LVM you must run /sbin/vgscan yourself the first time (and
# create some VGs and LVs).
if [ -r /etc/lvmtab -o -d /etc/lvm/backup ]; then
echo "Initializing LVM (Logical Volume Manager):"
# Check for device-mapper support.
if ! grep -wq device-mapper /proc/devices ; then
# Try to load a device-mapper kernel module:
/sbin/modprobe -q dm-mod
fi
# Scan for new volume groups:
/sbin/vgscan --mknodes --ignorelockingfailure 2> /dev/null
if [ $? = 0 ]; then
# Make volume groups available to the kernel.
# This should also make logical volumes available.
/sbin/vgchange -ay --ignorelockingfailure
fi
fi
# Open any volumes created by cryptsetup:
if [ -f /etc/crypttab -a -x /sbin/cryptsetup.static ]; then
# First, check for device-mapper support.
if ! grep -wq device-mapper /proc/devices ; then
# If device-mapper exists as a module, try to load it.
# Try to load a device-mapper kernel module:
/sbin/modprobe -q dm-mod
fi
# NOTE: we only support LUKS formatted volumes (except for swap)!
cat /etc/crypttab | grep -v "^#" | grep -v "^$" | while read line; do
LUKS=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f1 -d' ')
DEV=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f2 -d' ')
PASS=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f3 -d' ')
OPTS=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f4 -d' ')
LUKSOPTS=""
if echo $OPTS | grep -wq ro ; then LUKSOPTS="${LUKSOPTS} --readonly" ; fi
# Skip LUKS volumes that were already unlocked (in the initrd):
/sbin/cryptsetup.static status $LUKS 1>/dev/null 2>/dev/null && continue
if /sbin/cryptsetup.static isLuks $DEV 2>/dev/null ; then
echo "Unlocking LUKS crypt volume '${LUKS}' on device '$DEV':"
if [ -n "${PASS}" ]; then
if [ -f ${PASS} ]; then
/sbin/cryptsetup.static ${LUKSOPTS} --key-file=${PASS} luksOpen $DEV $LUKS
elif [ "${PASS}" != "none" ]; then
# A password field of 'none' indicates a line for swap:
echo "${PASS}" | /sbin/cryptsetup.static ${LUKSOPTS} luksOpen $DEV $LUKS
fi
else
for i in seq 1 3 ; do
/sbin/cryptsetup.static ${LUKSOPTS} luksOpen $DEV $LUKS </dev/tty0 >/dev/tty0 2>&1
[ $? -eq 0 ] && break
done
fi
elif echo $OPTS | grep -wq swap ; then
# If any of the volumes is to be used as encrypted swap,
# then encrypt it using a random key and run mkswap:
echo "Creating encrypted swap on device '$DEV' mapped to '${LUKS}':"
/sbin/cryptsetup.static --cipher=aes --key-file=/dev/urandom --key-size=256 create $LUKS $DEV
mkswap /dev/mapper/$LUKS
fi
done
fi
Qualunque spiegazione / link / rtfm è ben accetto, grazie
Ciau...