diff -Naur slackware-live-0.4.5.orig/scripts/build-slackware-live.sh slackware-live-0.4.5/scripts/build-slackware-live.sh --- slackware-live-0.4.5.orig/scripts/build-slackware-live.sh 2014-02-11 22:32:24.000000000 +0200 +++ slackware-live-0.4.5/scripts/build-slackware-live.sh 2016-09-07 09:39:25.878108695 +0300 @@ -1,4 +1,7 @@ #!/bin/sh +#Dimitris Tzemos (changes for slackel,salix) + +LIVELABEL="LIVE" #edit in init script too CMDERROR=1 PARTITIONERROR=2 @@ -6,6 +9,11 @@ BOOTERROR=4 INSUFFICIENTSPACE=5 +if [ `uname -m` == "x86_64" ] +then grublibdir="/usr/lib64/grub" +else grublibdir="/usr/lib/grub" +fi + function add_packages() { packagesdirectory=$1 rootdirectory=$2 @@ -57,9 +65,9 @@ umount $rootdirectory/proc rm -f $rootdirectory/tmp/initrd.gz rm -f $rootdirectory/tmp/initrd-tree/{initrd-name,keymap,luksdev,resumedev,rootfs,rootdev,wait-for-root} - cp $initscriptbasepath/share/slackware-live/init $rootdirectory/tmp/initrd-tree/ + cp $initscriptbasepath/share/slackware-live/{init,keymaps} $rootdirectory/tmp/initrd-tree/ chmod +x $rootdirectory/tmp/initrd-tree/init - + cp $initscriptbasepath/sbin/build-slackware-live.sh $rootdirectory/tmp/initrd-tree/ for prg in unionfs mkfs.ext3; do @@ -72,6 +80,7 @@ done done + find $rootdirectory/tmp/initrd-tree/lib/modules/ -name "*.ko" | xargs strip --strip-unneeded cwd=`pwd` cd $rootdirectory/tmp/initrd-tree @@ -86,18 +95,23 @@ #BIOS/syslinux mkdir -p $livedirectory/boot/syslinux cp /usr/share/syslinux/menu.c32 $livedirectory/boot/syslinux/ + cp /usr/share/syslinux/vesamenu.c32 $livedirectory/boot/syslinux/ if [ ! -f $livedirectory/boot/syslinux/syslinux.cfg ]; then cat > $livedirectory/boot/syslinux/syslinux.cfg << EOF -prompt 1 -timeout 10 -default slackware - -label slackware - kernel /boot/vmlinuz - append max_loop=255 initrd=/boot/initrd.gz runlevel=5 +INCLUDE /boot/menus/mainmenu.cfg EOF fi + #Copy menus,splash image + if [ -d menus ]; then + cp -r menus $livedirectory/boot/ + cp slackel.png relinfo.msg $livedirectory/boot/syslinux/ + fi + +# if [ -d install_on_usb ]; then +# cp install_on_usb/* $livedirectory/boot/syslinux/ +# fi + #UEFI/elilo if [ `uname -m` == "x86_64" ]; then mkdir -p $livedirectory/EFI/BOOT @@ -105,17 +119,23 @@ cp $livedirectory/boot/initrd.gz $livedirectory/EFI/BOOT/ cp $livedirectory/boot/vmlinuz $livedirectory/EFI/BOOT/ if [ ! -f $livedirectory/EFI/BOOT/elilo.conf ]; then - cat > $livedirectory/EFI/BOOT/elilo.conf << EOF -prompt -timeout=10 -default=slackware - -image=vmlinuz - label=slackware - initrd=initrd.gz - append="max_loop=255 runlevel=5" -EOF + if [ -d ../common/elilo ]; then + cp ../common/elilo/* $livedirectory/EFI/BOOT/ + fi fi + +# if [ ! -f $livedirectory/EFI/BOOT/elilo.conf ]; then +# cat > $livedirectory/EFI/BOOT/elilo.conf << EOF +#prompt +#timeout=10 +#default=slackel +# +#image=vmlinuz +# label=slackel +# initrd=initrd.gz +# append="max_loop=255 runlevel=4" +#EOF +# fi dd if=/dev/zero of=/tmp/efi.img bs=1k count=16384 mkdosfs -n "EFIBOOT" /tmp/efi.img mount -o loop /tmp/efi.img /mnt/floppy @@ -253,7 +273,7 @@ if [ `uname -m` == "x86_64" ]; then altboot="-eltorito-alt-boot -no-emul-boot -eltorito-platform efi -eltorito-boot efi.img" fi - mkisofs -J -d -N -l -r -V "Slackware-Live" -hide-rr-moved -o $imagefilename \ + mkisofs -J -d -N -l -r -V "$LIVELABEL" -hide-rr-moved -o $imagefilename \ -b boot/syslinux/isolinux.bin -boot-load-size 4 -boot-info-table -no-emul-boot \ -c boot/syslinux/boot.catalog -hide boot.catalog -hide-joliet boot.catalog $altboot \ $livedirectory @@ -273,15 +293,20 @@ if [ "$installdevice" == "$installmedia" ]; then #install on whole disk: partition and format media if [ `uname -m` == "x86_64" ]; then #EFI/GPT - partitionnumber=2 + partitionnumber=1 installmedia="$installdevice$partitionnumber" dd if=/dev/zero of=$installdevice bs=512 count=34 >/dev/null 2>&1 - echo -e "2\nn\n\n\n+32M\nef00\nn\n\n\n\n\nr\nh\n1 2\nn\n\ny\n\nn\n\nn\nwq\ny\n" | gdisk $installdevice || return $PARTITIONERROR + #echo -e "2\nn\n\n\n+32M\nef00\nn\n\n\n\n0700\nr\nh\n1 2\nn\n\ny\n\nn\n\nn\nwq\ny\n" | gdisk $installdevice || return $PARTITIONERROR + echo -e "2\nn\n\n\n\n0700\nr\nh\n1 2\nn\n\ny\n\nn\n\nn\nwq\ny\n" | gdisk $installdevice || return $PARTITIONERROR + #hybrid MBR with BIOS boot partition (1007K) EFI partition (32M) and live partition + #echo -e "2\nn\n\n\n+32M\nef00\nn\n\n\n\n0700\nn\n128\n\n\nef02\nr\nh\n1 2\nn\n\ny\n\nn\nn\nwq\ny\n" | gdisk $installdevice || return $PARTITIONERROR partprobe $installdevice >/dev/null 2>&1; sleep 3 mkfs.fat -n "efi" $installdevice"1" || return $FORMATERROR - mkfs.ext3 -L "Slackware-Live" $installmedia || return $FORMATERROR + #mkfs.ext3 -L "$LIVELABEL" $installmedia || return $FORMATERROR + fat32option="-F 32" + mkfs.vfat $fat32option -n "$LIVELABEL" $installmedia || return $FORMATERROR else #BIOS/MBR - partitionnumber=4 + partitionnumber=1 installmedia="$installdevice$partitionnumber" if (( $mediasize < 2048 )) then heads=128; sectors=32 @@ -289,9 +314,13 @@ fi mkdiskimage $installdevice 1 $heads $sectors || return $PARTITIONERROR dd if=/dev/zero of=$installdevice bs=1 seek=446 count=64 >/dev/null 2>&1 - echo -e ',0\n,0\n,0\n,,83,*' | sfdisk $installdevice || return $PARTITIONERROR + #echo -e ',0\n,0\n,0\n,,83,*' | sfdisk $installdevice || return $PARTITIONERROR + #echo -e ',0\n,0\n,0\n,,b,*' | sfdisk $installdevice || return $PARTITIONERROR + echo -e ',,b,*' | sfdisk $installdevice || return $PARTITIONERROR partprobe $installdevice; sleep 3 - mkfs.ext3 -L "Slackware-Live" $installmedia || return $FORMATERROR + #mkfs.ext3 -L "$LIVELABEL" $installmedia || return $FORMATERROR + fat32option="-F 32" + mkfs.vfat $fat32option -n "$LIVELABEL" $installmedia || return $FORMATERROR fi sleep 3 @@ -303,14 +332,14 @@ umount /mnt/tmp fsck -fy $installmedia >/dev/null 2>&1 else #format partition - if fdisk -l $installdevice 2>/dev/null | grep -q GPT; then + if fdisk -l $installdevice 2>/dev/null | grep -q 'GPT\|gpt' ; then partitiontype=`gdisk -l $installdevice | grep "^ *$partitionnumber " | sed 's/ */:/g' | cut -f7 -d:` else partitiontype=`fdisk -l $installdevice 2>/dev/null | grep "^$installmedia " | sed -e 's/\*//' -e 's/ */:/g' | cut -f5 -d:` fi case $partitiontype in 83|8300) - mkfs.ext3 -L "Slackware-Live" $installmedia || return $FORMATERROR + mkfs.ext3 -L "$LIVELABEL" $installmedia || return $FORMATERROR ;; *) partition=`echo $installmedia | cut -c6-` @@ -319,30 +348,30 @@ if (( $size > 1024 )); then fat32option="-F 32" fi - mkfs.fat $fat32option -n "Slackware-Live" $installmedia || return $FORMATERROR + mkfs.fat $fat32option -n "$LIVELABEL" $installmedia || return $FORMATERROR esac sleep 3 fi fi #live system files copy - if [ `uname -m` == "x86_64" ]; then #EFI/GPT - efipartition="$installdevice"`gdisk -l $installdevice 2>/dev/null | grep " EF00 " | sed 's/ */:/g' | cut -f2 -d:` - if [ ! -z "$efipartition" ] && [ "$efipartition" != "$installmedia" ]; then - mkdir -p /mnt/tmp - if mount $efipartition /mnt/tmp >/dev/null 2>&1; then - sleep 1 - umount /mnt/tmp - else - mkfs.fat -n "efi" $efipartition || return $FORMATERROR - fi - mkdir -p /mnt/efi - mount $efipartition /mnt/efi - cp -r $livedirectory/EFI /mnt/efi/ - umount /mnt/efi - rmdir /mnt/efi - fi - fi +# if [ `uname -m` == "x86_64" ]; then #EFI/GPT +# efipartition="$installdevice"`gdisk -l $installdevice 2>/dev/null | grep " EF00 " | sed 's/ */:/g' | cut -f2 -d:` +# if [ ! -z "$efipartition" ] && [ "$efipartition" != "$installmedia" ]; then +# mkdir -p /mnt/tmp +# if mount $efipartition /mnt/tmp >/dev/null 2>&1; then +# sleep 1 +# umount /mnt/tmp +# else +# mkfs.fat -n "efi" $efipartition || return $FORMATERROR +# fi +# mkdir -p /mnt/efi +# mount $efipartition /mnt/efi +# cp -r $livedirectory/EFI /mnt/efi/ +# umount /mnt/efi +# rmdir /mnt/efi +# fi +# fi mkdir -p /mnt/install mount $installmedia /mnt/install @@ -374,21 +403,117 @@ rootdirectory=$1 systempart=$2 loadersetup=$3 - SYSINSTALLFS="ext4" + rootpassword=$4 + username=$5 + userpassword=$6 + installation_mode=$7 + bootloader=$8 + format_home=$9 + SYSINSTALLFS=${10} + home_dir=${11} + + #SYSINSTALLFS="ext4" # set default filesystem of root + if [ "$SYSINSTALLFS" == "" ]; then + SYSINSTALLFS="ext4" # set default filesystem of root + fi - mkfs.$SYSINSTALLFS $systempart || return $FORMATERROR mkdir -p /mnt/install + + if mount $systempart /mnt/install 2>/dev/null; then # if there is a filesystem find it + # fs=`mount | grep "$systempart" | cut -f5 -d' '` + # if echo $fs | grep -q "ext" || echo $fs | grep -q "btrfs" || echo $fs | grep -q "reiserfs"|| echo $fs | grep -q "jfs"|| echo $fs | grep -q "xfs"; then + # SYSINSTALLFS=$fs # find filesystem type + # fi + umount /mnt/install + else + umount /mnt/install + fi + + fs=$SYSINSTALLFS + + if [ "$fs" = "ext2" ]; then + flag=" -F " + elif [ "$fs" = "ext3" ]; then + flag=" -F " + elif [ "$fs" = "ext4" ]; then + flag=" -F " + elif [ "$fs" = "btrfs" ]; then + flag="-f -d single -m single" + elif [ "$fs" = "jfs" ]; then + flag=" -c -q " + elif [ "$fs" = "reiserfs" ]; then + flag=" -f " + elif [ "$fs" = "xfs" ]; then + flag=" -f -q " + fi + echo "formatting linux partition in $SYSINSTALLFS" + mkfs.$SYSINSTALLFS $flag $systempart || return $FORMATERROR # format partition + echo "mount linux partition to /mnt/install" mount $systempart /mnt/install - + + #handles home partition + if [ "$home_dir" != "" ] && [ "$home_dir" != "$systempart" ]; then + mkdir -p /mnt/install/home + if mount $home_dir /mnt/install/home 2>/dev/null; then # if there is a filesystem find it + fs=`mount | grep "$home_dir" | cut -f5 -d' '` + if echo $fs | grep -q "ext" || echo $fs | grep -q "btrfs" || echo $fs | grep -q "reiserfs"|| echo $fs | grep -q "jfs"|| echo $fs | grep -q "xfs"; then + SYSINSTALLFS=$fs # find filesystem type + fi + umount /mnt/install/home + fi + if [ "$format_home" = "yes" ]; then + echo "formatting home partition in $SYSINSTALLFS" + mkfs.$SYSINSTALLFS $flag $home_dir + fi + echo "mount home partition to /mnt/install/home" + mount $home_dir /mnt/install/home + + # if ! mount $home_dir /mnt/install/home 2>/dev/null; then + # mkfs.$SYSINSTALLFS $flag $home_dir + # mount $home_dir /mnt/install/home + # fi + + fi + #Copy begin - for directory in $rootdirectory/*; do - cp -dpr $directory /mnt/install/ - done + echo "Installing system" + # core, basic or full mode + if [ "$installation_mode" = "core" ]; then + echo "core installation" + modules=(01-core.slm 04-common.slm 05-kernel.slm 06-live.slm) + for directory in ${modules[@]}; do + cp -dpr $rootdirectory/$directory/* /mnt/install/ + done + fi + + if [ "$installation_mode" = "basic" ]; then + echo "basic installation" + modules=(01-core.slm 02-basic.slm 04-common.slm 05-kernel.slm 06-live.slm) + for directory in ${modules[@]}; do + cp -dpr $rootdirectory/$directory/* /mnt/install/ + done + fi + + if [ "$installation_mode" = "full" ]; then + echo "full installation" + modules=(01-core.slm 02-basic.slm 03-full.slm 04-common.slm 05-kernel.slm 06-live.slm) + for directory in ${modules[@]}; do + cp -dpr $rootdirectory/$directory/* /mnt/install/ + done + + #for directory in $rootdirectory/*; do + #cp -dpr $directory /mnt/install/ + #done + fi mkdir -p /mnt/install/{dev,proc,sys,tmp} cp -dpr /dev/sd* /mnt/install/dev/ #create disk nodes needed for LiLo - cp -dpr $rootdirectory/lib/udev/devices/* /mnt/install/dev/ + for dir in sys proc dev; do mount --bind /$dir /mnt/install/$dir; done + #if [ "$rootdirectory" = "/live/modules" ]; then + # cp -dpr /live/system/lib/udev/devices/* /mnt/install/dev/ + #fi + #cp -dpr $rootdirectory/lib/udev/devices/* /mnt/install/dev/ sed -i /^root:/d /mnt/install/etc/shadow #setup root password cat /etc/shadow | sed -n /^root:/p >> /mnt/install/etc/shadow @@ -397,8 +522,8 @@ cp -f /etc/rc.d/rc.keymap /mnt/install/etc/rc.d/ fi cp -f /etc/profile.d/lang.sh /mnt/install/etc/profile.d/ - if [ -f /etc/X11/xorg.conf.d/20-keyboard.conf ]; then - cp -f /etc/X11/xorg.conf.d/20-keyboard.conf /mnt/install/etc/X11/xorg.conf.d/ + if [ -f /etc/X11/xorg.conf.d/10-keymap.conf ]; then + cp -f /etc/X11/xorg.conf.d/10-keymap.conf /mnt/install/etc/X11/xorg.conf.d/ fi if [ -f /etc/X11/xorg.conf ]; then cp -f /etc/X11/xorg.conf /mnt/install/etc/X11/ @@ -411,23 +536,76 @@ cp -f /etc/hardwareclock /mnt/install/etc/ fi #Copy end - + echo "Setting up fstab" #FSTab begin cat > /mnt/install/etc/fstab << EOF proc /proc proc defaults 0 0 sysfs /sys sysfs defaults 0 0 +tmpfs /dev/shm tmpfs defaults 0 0 $systempart / $SYSINSTALLFS defaults 1 1 EOF - cat /etc/fstab | grep " swap " >> /mnt/install/etc/fstab - cat /etc/fstab | grep "/mnt" | grep -v "$systempart" >> /mnt/install/etc/fstab - cat /etc/fstab | grep "/mnt" | grep -v "$systempart" | cut -f2 -d' ' | while read mountpoint; do - mkdir /mnt/install$mountpoint - done + + if [ "$home_dir" != "" ] && [ "$home_dir" != "$systempart" ]; then + fs=`mount | grep "$home_dir" | cut -f5 -d' '` > /dev/null 2>&1 + if echo $fs | grep -q "ext" || echo $fs | grep -q "btrfs" || echo $fs | grep -q "reiserfs"|| echo $fs | grep -q "jfs"|| echo $fs | grep -q "xfs"; then + echo "$home_dir /home $fs defaults 1 1" >> /mnt/install/etc/fstab + fi + fi + + #cat /etc/fstab | grep " swap " >> /mnt/install/etc/fstab + + #cat /etc/fstab | grep "/mnt" | grep -v "$systempart" >> /mnt/install/etc/fstab + #cat /etc/fstab | grep "/mnt" | grep -v "$systempart" | cut -f2 -d' ' | while read mountpoint; do + # mkdir /mnt/install$mountpoint + #done echo "$systempart / $SYSINSTALLFS defaults 1 1" > /mnt/install/etc/mtab #FSTab end + + # First, determine our slackware kernel name: + for ELEMENT in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 ; do + if $(cat /proc/cmdline | cut -f $ELEMENT -d ' ' | grep -q BOOT_IMAGE) ; then + SLACK_KERNEL=$(cat /proc/cmdline | cut -f $ELEMENT -d ' ' | cut -f 2 -d = | sed "s/\/boot\///") + fi + done + unset ELEMENT + + # Next, find the kernel's release version: + VERSION=$(uname -r | tr - _) + + # Next find our initrd name + for ELEMENT in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 ; do + if $(cat /proc/cmdline | cut -f $ELEMENT -d ' ' | grep -q initrd) ; then + SLACK_INITRD=$(cat /proc/cmdline | cut -f $ELEMENT -d ' ' | cut -f 2 -d = | sed "s/\/boot\///") + fi + done + unset ELEMENT + ( cd /mnt/install/boot + if [ "$SLACK_KERNEL" == "vmlinuz" ]; then + if [ -r vmlinuz-huge-smp-$VERSION ]; then + ln -sf vmlinuz-huge-smp-$VERSION vmlinuz + ln -sf config-huge-smp-$VERSION config + ln -sf System.map-huge-smp-$VERSION System.map + fi + fi + + if [ "$SLACK_KERNEL" == "vmlinuznp" ]; then + if [ -r vmlinuz-huge-$VERSION ]; then + ln -sf vmlinuz-huge-$VERSION vmlinuz + ln -sf config-huge-$VERSION config + ln -sf System.map-huge-$VERSION System.map + fi + fi + + if [ "$SLACK_INITRD" == "nosmp.gz" ]; then + cp initrd.gz smp.gz + cp nosmp.gz initrd.gz + fi + ) + #InitRD begin if [ ! -f /mnt/install/boot/initrd.gz ]; then + echo "Setting initrd" kv=`basename /mnt/install/lib/modules/*` if lsmod | grep -q $SYSINSTALLFS; then moduleslist="$SYSINSTALLFS" @@ -445,16 +623,17 @@ done moduleslist=`echo $moduleslist | sed 's/:$//'` if [ ! -z "$moduleslist" ] && [ "$moduleslist" != "sg" ]; then - chroot /mnt/install mount /proc + #chroot /mnt/install mount /proc chroot /mnt/install mkinitrd -c -f $SYSINSTALLFS -r $systempart -k $kv -m $moduleslist - chroot /mnt/install umount /proc + #chroot /mnt/install umount /proc fi fi #InitRD end - + if [ "$bootloader" == "lilo" ]; then #LiLo begin if [ "$loadersetup" == "-auto" ]; then installdevice=`echo $systempart | cut -c1-8` + echo "Setting (e)Lilo" if [ -d /sys/firmware/efi ]; then #UEFI modprobe efivars efipartnum=`gdisk -l $installdevice | grep "EF00" | sed 's/ \+/ /g' | cut -f2 -d' '` @@ -462,7 +641,7 @@ if [ ! -z "$efipartition" ]; then mkdir -p /mnt/efi mount $efipartition /mnt/efi - efilabel="Slackware" + efilabel="Slackel" if [ -d /mnt/efi/EFI/$efilabel ]; then conflictpart=`cat /mnt/efi/EFI/$efilabel/elilo.conf | grep "append" | sed 's/.*root=\([^ ]*\).*/\1/'` if [ "$conflictpart" == "$systempart" ] @@ -476,10 +655,10 @@ cp /mnt/install/boot/vmlinuz /mnt/efi/EFI/$efilabel/ cat > /mnt/efi/EFI/$efilabel/elilo.conf << EOF timeout=1 -default=slackware +default=slackel image=vmlinuz - label=slackware + label=slackel append="root=$systempart ro" read-only EOF @@ -489,14 +668,14 @@ fi umount /mnt/efi rmdir /mnt/efi - efibootmgr -q -c -d $installdevice -p $efipartnum -l "\\EFI\\$efilabel\\elilo.efi" -L "Slackware ($systempart)" + efibootmgr -q -c -d $installdevice -p $efipartnum -l "\\EFI\\$efilabel\\elilo.efi" -L "Slackel ($systempart)" fi else #BIOS echo "boot = $installdevice" > /mnt/install/etc/lilo.conf - if [ -f /mnt/install/boot/slack.bmp ]; then + if [ -f /mnt/install/boot/slackel.bmp ]; then cat >> /mnt/install/etc/lilo.conf << EOF -bitmap = /boot/slack.bmp +bitmap = /boot/slackel.bmp bmp-colors = 255,0,255,0,255,0 bmp-table = 60,6,1,16 bmp-timer = 65,27,0,255 @@ -514,7 +693,7 @@ image = /boot/vmlinuz root = $systempart -label = Linux +label = slackel read-only EOF if [ -f /mnt/install/boot/initrd.gz ]; then @@ -529,16 +708,233 @@ table = $installdevice EOF fi - chroot /mnt/install mount /proc + #chroot /mnt/install mount /proc chroot /mnt/install lilo || return $BOOTERROR - chroot /mnt/install umount /proc + #chroot /mnt/install umount /proc + fi + fi + fi #LiLo end + + if [ "$bootloader" == "grub" ]; then + #grub begin + if [ "$loadersetup" == "-auto" ]; then + grustatus=$GRUBERROR + installdevice=`echo $systempart | cut -c1-8` + echo "Installing Grub Boot Loader on $installdevice" + efipartnum=`gdisk -l $installdevice 2>/dev/null | grep " EF00 " | sed 's/ */:/g' | cut -f2 -d:` + #if [ -d /sys/firmware/efi ] && [ ! -z "$efipartnum" ]; then #EFI + if [ ! -z "$efipartnum" ] && [ -d $grublibdir/x86_64-efi ]; then + efipartition="$installdevice$efipartnum" + #modprobe efivars #for efibootmgr; unneded here: done by grub install + mkdir -p /mnt/efi + mount $efipartition /mnt/efi + if [ `uname -m` != "x86_64" ] ; then #modprobe efivars fails on 32 bits Slackware + mv /lib/modules/`uname -r`/kernel/drivers/firmware/efi/efivars.{ko,ok} + efidir="slackware-`cat /etc/slackware-version | cut -f2 -d' '`" + echo "*** add boot entry for '\\EFI\\$efidir\\grubx64.efi' from UEFI setup ***" + fi + grub-install --efi-directory /mnt/efi --boot-directory /mnt/install/boot/ --target=x86_64-efi 2>/dev/null && grubstatus=0 + umount /mnt/efi + rmdir /mnt/efi + # Add the EFI System Partition to /etc/fstab: + mkdir -p /mnt/install/boot/efi + echo "$efipartition /boot/efi vfat defaults 1 0 " >> /mnt/install/etc/fstab + else #CSM + if echo -e "print\nquit" | parted $installdevice | grep -q ": msdos$" || + gdisk -l $installdevice 2>/dev/null | grep -q " EF02 "; then + grub-install --target=i386-pc --boot-directory /mnt/install/boot --recheck --force $installdevice && grubstatus=0 #grub-bios-setup + else + echo "Warning : GRUB can't be installed:" + #if [ -d /sys/firmware/efi ]; then + if [ -z "$efipartnum" ]; then + echo "- UEFI boot: no 'ef00' - efi partition on $installdevice" + else + echo "- CSM (legacy) boot: no 'ef02' - BIOS boot partition on $installdevice (GPT)" + fi + fi fi + #for dir in sys proc dev; do mount --bind /$dir /mnt/install/$dir; done + chroot /mnt/install grub-mkconfig -o /boot/grub/grub.cfg + #for dir in sys proc dev; do umount /mnt/install/$dir; done + fi + fi # end grub + + liveuser=$(cat /etc/passwd | grep /bin/bash | grep /home/| cut -d : -f 1) + if [ "$liveuser" != "" ]; then + echo "Deleting liveuser $liveuser" + #chroot /mnt/install mount /proc + chroot /mnt/install /usr/sbin/userdel -r $liveuser 2>/dev/null + #chroot /mnt/install umount /proc + fi + + if [ "$username" != "" ]; then + echo "Creating user $username with password $userpassword" + #chroot /mnt/install mount /proc + chroot /mnt/install /usr/sbin/useradd -s /bin/bash -g users -m -k /etc/skel -G audio,video,cdrom,floppy,lp,plugdev,polkitd,power,pulse,netdev,scanner,wheel "$username" + #chroot /mnt/install umount /proc + fi + + if [ "$userpassword" != "" ]; then + echo "Setting password for user $username to $userpassword" + #chroot /mnt/install mount /proc + echo ${username}:${userpassword} | chroot /mnt/install chpasswd + #chroot /mnt/install umount /proc + fi + + if [ "$rootpassword" != "" ]; then + echo "Setting password for root to $rootpassword" + #chroot /mnt/install mount /proc + echo root:${rootpassword} | chroot /mnt/install chpasswd + #chroot /mnt/install umount /proc + fi + + if [ -f /mnt/install/etc/kde/kdm/kdmrc ]; then + sed -i "s/NoPassEnable=.*/NoPassEnable=/g" /mnt/install/etc/kde/kdm/kdmrc + sed -i "s/NoPassUsers=.*/NoPassUsers=/g" /mnt/install/etc/kde/kdm/kdmrc + sed -i "s/DefaultUser=.*/DefaultUser=/g" /mnt/install/etc/kde/kdm/kdmrc + sed -i "s/AllowNullPasswd=.*/AllowNullPasswd=/g" /mnt/install/etc/kde/kdm/kdmrc + sed -i "s/AutoLoginEnable=.*/AutoLoginEnable=/g" /mnt/install/etc/kde/kdm/kdmrc + sed -i "s/AutoLoginUser=.*/AutoLoginUser=/g" /mnt/install/etc/kde/kdm/kdmrc + locale_noutf8=`cat /etc/kde/kdm/kdmrc | grep Language= | sed 's/\Language=//'` + sed -i "s/\(^\|^#\)Language=.*/Language=$locale_noutf8/" /mnt/install/etc/kde/kdm/kdmrc + fi + + + if [ -f /mnt/install/etc/gdm/custom.conf ]; then + cat > /mnt/install/etc/gdm/custom.conf << EOF +# GDM Custom Configuration file. +# +# This file is the appropriate place for specifying your customizations to the +# GDM configuration. If you run gdmsetup, it will automatically edit this +# file for you and will cause the daemon and any running GDM GUI programs to +# automatically update with the new configuration. Not all configuration +# options are supported by gdmsetup, so to modify some values it may be +# necessary to modify this file directly by hand. +# +# This file overrides the default configuration settings. These settings +# are stored in the GDM System Defaults configuration file, which is found +# at the following location. +# +# /usr/share/gdm/defaults.conf. +# +# This file contains comments about the meaning of each configuration option, +# so is also a useful reference. Also refer to the documentation links at +# the end of this comment for further information. In short, to hand-edit +# this file, simply add or modify the key=value combination in the +# appropriate section in the template below this comment section. +# +# For example, if you want to specify a different value for the Enable key +# in the "[debug]" section of your GDM System Defaults configuration file, +# then add "Enable=true" in the "[debug]" section of this file. If the +# key already exists in this file, then simply modify it. +# +# Older versions of GDM used the "gdm.conf" file for configuration. If your +# system has an old gdm.conf file on the system, it will be used instead of +# this file - so changes made to this file will not take effect. Consider +# migrating your configuration to this file and removing the gdm.conf file. +# +# If you hand edit a GDM configuration file, you can run the following +# command and the GDM daemon will immediately reflect the change. Any +# running GDM GUI programs will also be notified to update with the new +# configuration. +# +# gdmflexiserver --command="UPDATE_CONFIG " +# +# e.g, the "Enable" key in the "[debug]" section would be "debug/Enable". +# +# You can also run gdm-restart or gdm-safe-restart to cause GDM to restart and +# re-read the new configuration settings. You can also restart GDM by sending +# a HUP or USR1 signal to the daemon. HUP behaves like gdm-restart and causes +# any user session started by GDM to exit immediately while USR1 behaves like +# gdm-safe-restart and will wait until all users log out before restarting GDM. +# +# For full reference documentation see the gnome help browser under +# GNOME|System category. You can also find the docs in HTML form on +# http://www.gnome.org/projects/gdm/ +# +# NOTE: Lines that begin with "#" are considered comments. +# +# Have fun! + +[daemon] + +[security] + +[xdmcp] + +[gui] + +[greeter] + +[chooser] + +[debug] + +# Note that to disable servers defined in the GDM System Defaults +# configuration file (such as 0=Standard, you must put a line in this file +# that says 0=inactive, as described in the Configuration section of the GDM +# documentation. +# +[servers] + +# Also note, that if you redefine a [server-foo] section, then GDM will +# use the definition in this file, not the GDM System Defaults configuration +# file. It is currently not possible to disable a [server-foo] section +# defined in the GDM System Defaults configuration file. +# +EOF fi - #LiLo end + echo "Removing installer" + #chroot /mnt/install rm -f /home/one/Desktop/slackel-live-installer.desktop + chroot /mnt/install rm -f /home/one/Desktop/sli*.desktop + + #chroot /mnt/install spkg -d slackel-live-installer + chroot /mnt/install /sbin/spkg -d sli + + # Run various slackware install routines + #echo "Run various slackware install routines" + + #echo "run mkfont" + #if [ -f /mnt/install/var/log/setup/setup.04.mkfontdir ]; then + # chroot /mnt/install /var/log/setup/setup.04.mkfontdir + #fi + #echo " update-icon-cache" + #if [ -f /mnt/install/var/log/setup/setup.08.gtk-update-icon-cache ]; then + # chroot /mnt/install /var/log/setup/setup.08.gtk-update-icon-cache + #fi + #echo "run update all" + #if [ -f /mnt/install/usr/sbin/update-all ]; then + # chroot /mnt/install /usr/sbin/update-all + #fi + #echo "run setup services" + #if [ -f /mnt/install/var/log/setup/setup.services ]; then + # chroot /mnt/install /var/log/setup/setup.services + #fi + + # Set the hostname.echo "umount /mnt/install" + chmod 777 /mnt/install/etc/HOSTNAME + echo "slackel.example.net" > /mnt/install/etc/HOSTNAME + chmod 644 /mnt/install/etc/HOSTNAME + + # Use any available swap device: + for SWAPD in $(blkid |grep TYPE="\"swap\"" |cut -d: -f1) ; do + echo "Enabling swapping to '$SWAPD'" + echo "$SWAPD swap swap defaults 0 0" >> /mnt/install/etc/fstab + done + + for dir in sys proc dev; do umount /mnt/install/$dir; done + + if [ "$home_dir" != "" ] && [ "$home_dir" != "$systempart" ]; then + echo "umount /mnt/instal/home" + umount /mnt/install/home + fi + echo "umount /mnt/install" umount /mnt/install + + echo "remove /mnt/install" rmdir /mnt/install - + echo "end installation" return 0 } @@ -659,7 +1055,10 @@ moduleslist=$4 if [ -d "$rootdirectory" ] && [ ! -z "$livedirectory" ]; then if [ -z "$moduleslist" ]; then - moduleslist="squashfs:fuse:loop:ehci-pci:xhci-hcd:usb-storage" + #moduleslist="squashfs:fuse:loop:ehci-pci:xhci-hcd:usb-storage" + #moduleslist="squashfs:fuse:loop:xhci-pci:ehci-pci:usb-storage:ext3:isofs" + #moduleslist="squashfs:fuse:loop:xhci-pci:ohci-pci:ehci-pci:xhci-hcd:uhci-hcd:ehci-hcd:usb-storage:hid:usbhid:hid-generic:hid-cherry:hid-logitech:hid-logitech-dj:hid-logitech-hidpp:hid-lenovo:hid-microsoft:jbd:mbcache:ext3:ext4:isofs:fat:nls_cp437:nls_iso8859-1:msdos:vfat" + moduleslist="squashfs:fuse:loop:xhci-pci:ohci-pci:ehci-pci:xhci-hcd:uhci-hcd:ehci-hcd:usb-storage:hid:usbhid:i2c-hid:hid-generic:hid-cherry:hid-logitech:hid-logitech-dj:hid-logitech-hidpp:hid-lenovo:hid-microsoft:hid_multitouch:isofs:nls_cp437:nls_iso8859-1" fi init_live $rootdirectory $livedirectory $moduleslist else @@ -730,6 +1129,15 @@ rootdirectory=$2 systempart=$3 loadersetup=$4 + rootpassword=$5 + username=$6 + userpassword=$7 + installation_mode=$8 + bootloader=$9 + format_home=${10} + SYSINSTALLFS=${11} + home_dir=${12} + if [ -d "$rootdirectory" ] && [ -b "$systempart" ]; then systemsize=`du -s -m $rootdirectory | sed 's/\t.*//'` device=`echo $systempart | cut -c6-8` @@ -741,11 +1149,14 @@ echo "error: insufficant space on device '$systempart'" exit $INSUFFICIENTSPACE else - install_system $rootdirectory $systempart $loadersetup + if [ "$home_dir" == "" ]; then + SYSINSTALLFS="ext4" + fi + install_system $rootdirectory $systempart $loadersetup $rootpassword $username $userpassword $installation_mode $bootloader $format_home $SYSINSTALLFS $home_dir exit $! fi else - echo "`basename $0` --install root_dir device [-auto|-expert]" + echo "`basename $0` --install root_dir device [-auto|-expert] rootpassword username userpassword installation_mode bootloader format_home SYSINSTALLFS home_dir" exit $CMDERROR fi ;; @@ -780,7 +1191,7 @@ echo "`basename $0` --module root_dir live_dir module_file [-xz|-gzip] [-optional]" echo "`basename $0` --iso live_dir iso_file" echo "`basename $0` --usb live_dir device" - echo "`basename $0` --install root_dir device [-auto|-expert]" + echo "`basename $0` --install root_dir device [-auto|-expert] rootpassword username userpassword [core|basic|full] [grub|lilo] [yes|no] filesystem_type home_dir" echo "`basename $0` --share live_dir listen_interface ip_range [modules_list|auto]" echo "`basename $0` --unshare" exit $CMDERROR diff -Naur slackware-live-0.4.5.orig/scripts/init slackware-live-0.4.5/scripts/init --- slackware-live-0.4.5.orig/scripts/init 2014-02-07 11:04:23.000000000 +0200 +++ slackware-live-0.4.5/scripts/init 2016-09-03 20:12:58.831133436 +0300 @@ -1,5 +1,8 @@ #!/bin/ash +LIVELABEL="LIVE" #edit in build-slackware-live.sh script too +DISTRONAME="Slackel" + echo "" echo "*** Live system initialization ***" mount -v proc /proc -t proc @@ -30,23 +33,33 @@ fi sleeptime=0 alreadycheckedpartitions="" + while [ "$mediadetected" == "none" ] && [ "$sleeptime" != "10" ]; do #try each seconds, but don't wait (USB) more than 10 seconds - for partition in `cat /proc/partitions | sed -e 1d -e 2d | cut -c26-`; do - if mount -o ro /dev/$partition /slroot/live/media >/dev/null 2>/dev/nul; then - if [ -f /slroot/live/media/boot/liveboot ]; then - if [ "$partition" == "sr0" ] || [ "$partition" == "sr1" ] - then mediadetected="cd" - else mediadetected="sd" + if blkid | grep -q "LABEL=\"$LIVELABEL\""; then + livedevice=`blkid | grep "LABEL=\"$LIVELABEL\"" | sed -n 1p | cut -f1 -d:` + echo "$DISTRONAME-Live found on $livedevice" + mount -o ro $livedevice /slroot/live/media + if blkid | grep "LABEL=\"$LIVELABEL\"" | sed -n 1p | grep -q "TYPE=\"iso9660\"" + then mediadetected="cd" + else mediadetected="sd" + fi + else + for partition in `cat /proc/partitions | sed -e 1d -e 2d | cut -c26-`; do + if mount -o ro /dev/$partition /slroot/live/media >/dev/null 2>/dev/nul; then + if [ -f /slroot/live/media/boot/liveboot ]; then + if [ "$partition" == "sr0" ] || [ "$partition" == "sr1" ] + then mediadetected="cd" + else mediadetected="sd" + fi + livedevice="/dev/$partition" + echo "$DISTRONAME-Live found on $livedevice" + break + else + umount /slroot/live/media fi - livedevice="/dev/$partition" - title=`cat /slroot/live/media/boot/syslinux/syslinux.cfg | grep "menu title " | cut -f3 -d' '` - echo "$title found on $livedevice" - break - else - umount /slroot/live/media fi - fi - done + done + fi if [ "$mediadetected" == "none" ]; then sleep 1 let sleeptime+=1 @@ -136,17 +149,17 @@ changes=`echo "$changes" | cut -f1 -d=` fi if [ ! -d /slroot/live/media/$changes ] && [ ! -f /slroot/live/media/$changes ] && [ ! -b $changes ]; then #storage space creation - if [ ! -z "$filesize" ]; then - echo "Creating $changes ($filesize MB) persistent system storage ..." - dd if=/dev/zero of=/slroot/live/media/$changes bs=1024k count=0 seek=$filesize #TODO: check available space - sleep 1 - mkfs.ext3 -F /slroot/live/media/$changes - sleep 1 - else - #if mount | grep -q "$livedevice on /slroot/live/media type ext3"; then #TODO: check FS type + #if [ ! -z "$filesize" ]; then + # echo "Creating $changes ($filesize MB) persistent system storage ..." + # dd if=/dev/zero of=/slroot/live/media/$changes bs=1024k count=0 seek=$filesize #TODO: check available space + # sleep 1 + # mkfs.ext3 -F /slroot/live/media/$changes + # sleep 1 + #else + if mount | grep -q "$livedevice on /slroot/live/media type ext3"; then #TODO: check FS type mkdir -p /slroot/live/media/$changes - #fi - fi + fi + #fi fi if [ -d /slroot/live/media/$changes ] || [ -f /slroot/live/media/$changes ] || [ -b $changes ]; then echo "Using persistent system storage ($changes)" @@ -174,8 +187,10 @@ #setup system tree for directory in /slroot/live/union/*; do #bind /live/union top directories into / directoryname=`basename $directory` + if [[ -d "${directory}" && ! -L "${directory}" ]] ; then mkdir /slroot/$directoryname mount --bind $directory /slroot/$directoryname + fi done mkdir -p /slroot/tmp mkdir -p /slroot/sys @@ -186,6 +201,7 @@ cat > /slroot/live/union/etc/fstab << END proc /proc proc defaults 0 0 sysfs /sys sysfs defaults 0 0 +tmpfs /dev/shm tmpfs defaults 0 0 none / tmpfs defaults 0 0 END @@ -227,6 +243,9 @@ -e 's@^\( *\)\([a-z/]*sync\)@\1: #\2@' \ -e 's@^\(.*umount.*\)$@\1 \>/dev/null 2\>\&1@' \ -i /slroot/live/union/etc/rc.d/rc.6 +sed -e 's@^\(.*umount -v -a -l -f -r -t nfs,smbfs,cifs.*\)$@umount -v -a -l -f -r -t nfs,smbfs,cifs \>/dev/null 2\>\&1@' -i /slroot/live/union/etc/rc.d/rc.6 +sed -e 's@^\(.*umount -v -a -t no,proc,sysfs.*\)$@umount -v -a -t no,proc,sysfs \>/dev/null 2\>\&1@' -i /slroot/live/union/etc/rc.d/rc.6 + if [ -z "$changes" ] then sed -e 's@^\(.*-o remount.*\)$@mount -o remount,ro /live/media #\1\n/bin/sync\n/bin/sleep 3@' -i /slroot/live/union/etc/rc.d/rc.6 else sed -e 's@^\(.*-o remount.*\)$@mount -o remount,ro /live/media\nmount -o remount,ro /live/changes #\1\nsync; sleep 3@' \ @@ -262,25 +281,25 @@ home=`echo "$home" | cut -f1 -d=` fi if [ ! -d /slroot/live/media/$home ] && [ ! -f /slroot/live/media/$home ] && [ ! -b $home ]; then #storage space creation - if [ ! -z "$filesize" ]; then - echo "Creating $home ($filesize MB) persistent home directory ..." - dd if=/dev/zero of=/slroot/live/media/$home bs=1024k count=0 seek=$filesize #TODO: check available space - sleep 1 - mkfs.ext3 -F /slroot/live/media/$home - sleep 1 - mount -o loop /slroot/live/media/$home /slroot/$homedir - cp -dpR /slroot/live/union/etc/skel/.??* /slroot/$homedir/ - cp -dpR /slroot/live/union/etc/skel/* /slroot/$homedir/ - chown -R $uid:$gid /slroot/$homedir - umount /slroot/$homedir - else - #if mount | grep -q "$livedevice on /slroot/live/media type ext3"; then #TODO: check FS type (vfat not supported) + #if [ ! -z "$filesize" ]; then + # echo "Creating $home ($filesize MB) persistent home directory ..." + # dd if=/dev/zero of=/slroot/live/media/$home bs=1024k count=0 seek=$filesize #TODO: check available space + # sleep 1 + # mkfs.ext3 -F /slroot/live/media/$home + # sleep 1 + # mount -o loop /slroot/live/media/$home /slroot/$homedir + # cp -dpR /slroot/live/union/etc/skel/.??* /slroot/$homedir/ + # cp -dpR /slroot/live/union/etc/skel/* /slroot/$homedir/ + # chown -R $uid:$gid /slroot/$homedir + # umount /slroot/$homedir + #else + if mount | grep -q "$livedevice on /slroot/live/media type ext3"; then #TODO: check FS type (vfat not supported) mkdir -p /slroot/live/media/$home cp -dpR /slroot/live/union/etc/skel/.??* /slroot/live/media/$home/ cp -dpR /slroot/live/union/etc/skel/* /slroot/live/media/$home/ chown -R $uid:$gid /slroot/live/media/$home - #fi - fi + fi + #fi fi if [ -d /slroot/live/media/$home ] || [ -f /slroot/live/media/$home ] || [ -b $home ]; then echo "Setting up persistent home directory ($home)" @@ -308,7 +327,7 @@ #autologin runlevel=`cat /slroot/live/union/etc/inittab | sed -n /^id:[1-5]:initdefault:$/p | cut -f2 -d:` if [ $runlevel == 5 ]; then - sed -i 's/^c1:.*$/c1:5:respawn:\/sbin\/agetty -a linomad 38400 tty1 linux/' /slroot/live/union/etc/inittab + sed -i 's/^c1:.*$/c1:5:respawn:\/sbin\/agetty -a one 38400 tty1 linux/' /slroot/live/union/etc/inittab if [ -x /slroot/live/union/usr/bin/startx ]; then cat > /slroot/live/union/etc/profile.d/x.sh << END @@ -328,30 +347,65 @@ then sed -i s/^export\ LANG=.*/export\ LANG=$locale/ /slroot/live/union/etc/profile.d/lang.sh else echo "export LANG=$locale" >> /slroot/live/union/etc/profile.d/lang.sh fi + if [ -f /slroot/live/union/etc/kde/kdm/kdmrc ]; then + locale_noutf8=$(echo $locale | sed 's/\.utf8//') + sed -i "s/\(^\|^#\)Language=.*/Language=$locale_noutf8/" /slroot/live/union/etc/kde/kdm/kdmrc + fi + # Make firefox match OS locale + # Now included in $DISTRONAME version, but keep it for other Slackware version or distro + #if [ -w /slroot/live/union/usr/lib$LIBSUFFIX/firefox/greprefs/all.js ]; then + # sed -i -e 's/pref("intl.locale.matchOS", false);/pref("intl.locale.matchOS", true);/g' /slroot/live/union/usr/lib$LIBSUFFIX/firefox/greprefs/all.js + #fi + if [ -w /slroot/live/union/usr/lib$LIBSUFFIX/firefox-*/defaults/pref/langpacks.js ]; then + sed -i -e 's/pref("intl.locale.matchOS", false);/pref("intl.locale.matchOS", true);/g' /slroot/live/union/usr/lib$LIBSUFFIX/firefox-*/defaults/pref/langpacks.js + fi + # Make thunderbird match OS locale + # Now included in $DISTRONAME version, but keep it for other Slackware version or distro + #if [ -w /slroot/live/union/usr/lib$LIBSUFFIX/thunderbird/greprefs/all.js ]; then + # sed -i -e 's/pref("intl.locale.matchOS", false);/pref("intl.locale.matchOS", true);/g' /slroot/live/union/usr/lib$LIBSUFFIX/thunderbird/greprefs/all.js + #fi + if [ -w /slroot/live/union/usr/lib$LIBSUFFIX/thunderbird-*/defaults/pref/langpacks.js ]; then + sed -i -e 's/pref("intl.locale.matchOS", false);/pref("intl.locale.matchOS", true);/g' /slroot/live/union/usr/lib$LIBSUFFIX/thunderbird-*/defaults/pref/langpacks.js + fi fi if [ ! -z "$keymap" ]; then - echo "Setting up keymap ($keymap)" - cat > /slroot/live/union/etc/rc.d/rc.keymap < /slroot/live/union/etc/X11/xorg.conf.d/20-keyboard.conf << END + keyb=$keymap + if [ -n "$keyb" ] || [-n "$numlock" ] || [ -n "$scim" ] || [ -n "$ibus" ]; then + # keyboard settting + [ -n "$keyb" ] || keyb=us + [ -n "$numlock" ] || numlock=off + [ -n "$scim" ] || scim=off + [ -n "$ibus" ] || ibus=off + + grep "^$keyb|.*|.*|.*" /keymaps | sed -e "s/^.*|\(.*\)|\(.*\)|\(.*\)/\1|\2|\3/" > /slroot/live/union/tmp/xkb + xkblayout="$(sed -e "s/^\(.*\)|.*|.*/\1/" /slroot/live/union/tmp/xkb)" + xkbvariant="$(sed -e "s/^.*|\(.*\)|.*/\1/" /slroot/live/union/tmp/xkb)" + xkboptions="$(sed -e "s/^.*|.*|\(.*\)/\1/" /slroot/live/union/tmp/xkb)" + rm /slroot/live/union/tmp/xkb + # Fall back to keymap if no xkb maping available + if [ -z "$xkblayout" ]; then + xkblayout="$keyb" + xkbvariant="" + xkboptions="" + fi + /usr/bin/loadkeys -u $keyb.map 1>&2 2>/dev/null + if [ -e /slroot/live/union/etc/rc.d/rc.keymap ]; then + sed -i "s/\(^[ \t]*\/usr\/bin\/loadkeys -u\).*$/\1 $keyb.map/" /slroot/live/union/etc/rc.d/rc.keymap + fi + if [ -e /slroot/live/union/etc/X11/xorg.conf.d ]; then + cat < /slroot/live/union/etc/X11/xorg.conf.d/10-keymap.conf Section "InputClass" - Identifier "keyboard-all" - Driver "evdev" - Option "XkbLayout" "$xkblayout" - MatchIsKeyboard "on" +Identifier "Keyboard settings" +MatchIsKeyboard "yes" +Driver "evdev" +Option "XkbLayout" "$xkblayout" +Option "XkbVariant" "$xkbvariant" +Option "XkbOptions" "$xkboptions" EndSection -END +EOF fi + fi fi if [ ! -z "$tz" ]; then @@ -386,8 +440,20 @@ echo "/dev/$partition none swap defaults,noauto 0 0" >> /slroot/live/union/etc/fstab fi else - echo "/dev/$partition /mnt/$partition auto defaults,noauto,user 0 0" >> /slroot/live/union/etc/fstab - mkdir -p /slroot/live/union/mnt/$partition + if [ "$partition" = "sda1" ]; then + mkdir -p /slroot/live/union/boot/efi + mount -t vfat /dev/$partition /slroot/live/union/boot/efi 2>/dev/null + if [ -d /slroot/live/union/boot/efi/EFI ]; then + echo "Adding EFI partition to /etc/fstab" + echo "/dev/$partition /boot/efi vfat defaults 1 0" >> /slroot/live/union/etc/fstab + umount /slroot/live/union/boot/efi 2>/dev/null + else + umount /slroot/live/union/boot/efi 2>/dev/null + rm -rf /slroot/live/union/boot/efi + fi + fi + # echo "/dev/$partition /mnt/$partition auto defaults,noauto,user 0 0" >> /slroot/live/union/etc/fstab + # mkdir -p /slroot/live/union/mnt/$partition fi fi done