diff --git a/Slax/debian/bootfiles/syslinux.cfg b/Slax/debian/bootfiles/syslinux.cfg index 3dd429c..da84bfc 100644 --- a/Slax/debian/bootfiles/syslinux.cfg +++ b/Slax/debian/bootfiles/syslinux.cfg @@ -27,17 +27,17 @@ MENU AUTOBOOT Press Esc for options, automatic boot in # second{,s} ... MENU TABMSG [F1] help [Tab] cmdline > LABEL default -MENU LABEL Run Slax (Persistent changes if writable) +MENU LABEL Run Slax (Persistent changes) KERNEL /slax/boot/vmlinuz -APPEND vga=normal initrd=/slax/boot/initrfs.img load_ramdisk=1 prompt_ramdisk=0 rw printk.time=0 slax.flags=perch +APPEND vga=normal initrd=/slax/boot/initrfs.img load_ramdisk=1 prompt_ramdisk=0 rw printk.time=0 slax.flags=perch,automount LABEL perch MENU LABEL Run Slax (Fresh start) KERNEL /slax/boot/vmlinuz -APPEND vga=normal initrd=/slax/boot/initrfs.img load_ramdisk=1 prompt_ramdisk=0 rw printk.time=0 +APPEND vga=normal initrd=/slax/boot/initrfs.img load_ramdisk=1 prompt_ramdisk=0 rw printk.time=0 slax.flags=automount LABEL toram MENU LABEL Run Slax (Copy to RAM) KERNEL /slax/boot/vmlinuz -APPEND vga=normal initrd=/slax/boot/initrfs.img load_ramdisk=1 prompt_ramdisk=0 rw printk.time=0 slax.flags=toram +APPEND vga=normal initrd=/slax/boot/initrfs.img load_ramdisk=1 prompt_ramdisk=0 rw printk.time=0 slax.flags=toram,automount diff --git a/initramfs/init b/initramfs/init index de0fa5b..3cb346d 100644 --- a/initramfs/init +++ b/initramfs/init @@ -48,7 +48,7 @@ union_append_bundles "$DATA" "$BUNDLES" "$UNION" # rootcopy copy_rootcopy_content "$DATA" "$UNION" -# create empty fstab +# create fstab fstab_create "$UNION" debug_shell header "Live Kit done, starting $LIVEKITNAME" diff --git a/livekitlib b/livekitlib index 030a045..70c3254 100644 --- a/livekitlib +++ b/livekitlib @@ -278,6 +278,16 @@ mounted_dir() } +# Get device tag. +# $1 = device +# $2 = tag name, such as TYPE, LABEL, UUID, etc +# +device_tag() +{ + blkid -s $2 "$1" | sed -r "s/^[^=]+=//" | tr -d '"' +} + + # Make sure to mount FAT12/16/32 using vfat # in order to support long filenames # $1 = device @@ -287,7 +297,7 @@ device_bestfs() debug_log "device_bestfs" "$*" local FS - FS="$(blkid -s TYPE "$1" | sed -r "s/.*TYPE=//" | tr -d '"' | tr [A-Z] [a-z])" + FS="$(device_tag "$1" TYPE | tr [A-Z] [a-z])" if [ "$FS" = "msdos" -o "$FS" = "fat" -o "$FS" = "vfat" ]; then FS="vfat" elif [ "$FS" = "ntfs" ]; then @@ -775,13 +785,30 @@ fstab_create() { debug_log "fstab_create" "$*" - local FSTAB + local FSTAB DEVICE FS LABEL + FSTAB="$1/etc/fstab" echo aufs / aufs defaults 0 0 > $FSTAB echo proc /proc proc defaults 0 0 >> $FSTAB echo sysfs /sys sysfs defaults 0 0 >> $FSTAB echo devpts /dev/pts devpts gid=5,mode=620 0 0 >> $FSTAB echo tmpfs /dev/shm tmpfs defaults 0 0 >> $FSTAB + + if grep -vq automount /proc/cmdline; then + return + fi + + echo >> $FSTAB + + blkid | cut -d: -f 1 | while read DEVICE; do + FS="$(device_tag $DEVICE TYPE)" + LABEL="$(device_tag $DEVICE LABEL | sed -r "s:[/ ]:_:g")" + if [ "$LABEL" = "" ]; then LABEL="$(basename $DEVICE)" + if [ "$FS" != "swap" ]; then + mkdir -p "$1/media/$LABEL" + echo "$DEVICE" "/media/$LABEL" $FS defaults,noatime 0 0 >> $FSTAB + fi + done }