diff -Naur slackware-live-0.4.1.orig/scripts/build-slackware-live.sh slackware-live-0.4.1/scripts/build-slackware-live.sh --- slackware-live-0.4.1.orig/scripts/build-slackware-live.sh 2014-09-01 23:09:47.000000000 +0300 +++ slackware-live-0.4.1/scripts/build-slackware-live.sh 2014-10-21 22:40:25.550848546 +0300 @@ -1,6 +1,6 @@ #!/bin/sh -LIVELABEL="Slackware-Live" #edit in init script too +LIVELABEL="LIVE" #edit in init script too CMDERROR=1 PARTITIONERROR=2 @@ -8,6 +8,7 @@ BOOTERROR=4 INSUFFICIENTSPACE=5 GRUBERROR=6 +splash_image="salix.png" function add_packages() { packagesdirectory=$1 @@ -46,7 +47,7 @@ mkdir -p $livedirectory/boot/optional cp -f $rootdirectory/boot/vmlinuz $livedirectory/boot/ - #initrd.gz + #create initrd.gz kv=`ls -l $rootdirectory/boot/vmlinuz | cut -f2 -d'>' | sed s/^[^0-9]*//` if [ ! -h $rootdirectory/boot/vmlinuz ] || [ ! -d $rootdirectory/lib/modules/$kv ]; then kv=`basename $rootdirectory/lib/modules/*` @@ -60,7 +61,7 @@ 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/ @@ -86,63 +87,42 @@ cd - >/dev/null rm -rf $rootdirectory/tmp/initrd-tree + #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/ + cp /usr/share/syslinux/chain.c32 $livedirectory/boot/syslinux/ + cp /usr/share/syslinux/isohdpfx.bin $livedirectory/boot/syslinux/ + cp /usr/share/syslinux/isolinux.bin $livedirectory/boot/syslinux/ + + if [ ! -f $livedirectory/boot/syslinux/syslinux.cfg ]; then + cat > $livedirectory/boot/syslinux/syslinux.cfg << EOF +INCLUDE /boot/menus/mainmenu.cfg +EOF + fi + + #Copy menus,splash image + if [ -d menus ]; then + cp -r menus $livedirectory/boot/ + cp salix.png relinfo.msg $livedirectory/boot/syslinux/ + fi + + #Copy install_on_usb script + #if [ -d install_on_usb ]; then + # cp ../common/install_on_usb/install_on_usb.sh $livedirectory/boot/syslinux + #fi + #grub.cfg mkdir -p $livedirectory/boot/grub + #Copy splash image + if [ -f "$splash_image" ]; then + cp $splash_image $livedirectory/boot/grub/ + fi + if [ ! -f $livedirectory/boot/grub/grub.cfg ]; then - cat > $livedirectory/boot/grub/grub.cfg << EOF -set timeout=5 -set default=4 - -menuentry "Arabic" { - linux /boot/vmlinuz max_loop=255 locale=ar_EG.UTF-8 keymap=us tz=Mideast/Riyadh88 hwc=localtime home=/home - initrd /boot/initrd.gz -} -menuentry "Bengali" { - linux /boot/vmlinuz max_loop=255 locale=bn_BD.UTF-8 keymap=us tz=Asia/Dacca hwc=localtime home=/home - initrd /boot/initrd.gz -} -menuentry "Chinese" { - linux /boot/vmlinuz max_loop=255 locale=zh_cn.UTF-8 keymap=us tz=Etc/GMT+8 hwc=localtime home=/home - initrd /boot/initrd.gz -} -menuentry "English" { - linux /boot/vmlinuz max_loop=255 locale=en_US.UTF-8 keymap=us tz=America/New_York hwc=localtime home=/home - initrd /boot/initrd.gz -} -menuentry "French" { - linux /boot/vmlinuz max_loop=255 locale=fr_FR.UTF-8 keymap=fr tz=Europe/Paris hwc=localtime home=/home - initrd /boot/initrd.gz -} -menuentry "German" { - linux /boot/vmlinuz max_loop=255 locale=de_DE.UTF-8 keymap=de tz=Europe/Berlin hwc=localtime home=/home - initrd /boot/initrd.gz -} -menuentry "Hindi" { - linux /boot/vmlinuz max_loop=255 locale=hi_IN.UTF-8 keymap=us tz=Asia/Dili hwc=localtime home=/home - initrd /boot/initrd.gz -} -menuentry "Italian" { - linux /boot/vmlinuz max_loop=255 locale=it_IT.UTF-8 keymap=it tz=Europe/Rome hwc=localtime home=/home - initrd /boot/initrd.gz -} -menuentry "Japan" { - linux /boot/vmlinuz max_loop=255 locale=ja_JP.UTF-8 keymap=jp106 tz=Asia/Tokyo hwc=localtime home=/home - initrd /boot/initrd.gz -} -menuentry "Portuguese" { - linux /boot/vmlinuz max_loop=255 locale=pt_PT.UTF-8 keymap=pt tz=Europe/Lisbon hwc=localtime home=/home - initrd /boot/initrd.gz -} -menuentry "Russian" { - linux /boot/vmlinuz max_loop=255 locale=ru_RU.UTF-8 keymap=ru Asia/Moscow hwc=localtime home=/home - initrd /boot/initrd.gz -} -menuentry "Spanish" { - linux /boot/vmlinuz max_loop=255 locale=es_ES.UTF-8 keymap=es tz=Europe/Madrid hwc=localtime home=/home - initrd /boot/initrd.gz -} -EOF + cp -a ../common/grub $livedirectory/boot/ fi + } @@ -283,29 +263,58 @@ #CSM grub-mkimage -O i386-pc -o "$livedirectory/boot/grub/bios.img.tmp" -c /tmp/grub.$$.cfg \ - search iso9660 biosdisk configfile normal all_video boot linux multiboot + search iso9660 biosdisk configfile normal all_video boot gfxmenu gfxterm font png linux multiboot cat $grublibdir/i386-pc/cdboot.img $livedirectory/boot/grub/bios.img.tmp > $livedirectory/boot/grub/bios.img rm -f $livedirectory/boot/grub/bios.img.tmp if [ `uname -m` == "x86_64" ]; then #EFI dd if=/dev/zero of=$livedirectory/boot/grub/efi.img bs=1k count=1024 mkfs.vfat -n "EFIBOOT" $livedirectory/boot/grub/efi.img - mkdir -p /mnt/floppy - mount -o loop $livedirectory/boot/grub/efi.img /mnt/floppy - mkdir -p /mnt/floppy/EFI/BOOT - grub-mkimage -O x86_64-efi -o "/mnt/floppy/EFI/BOOT/bootx64.efi" -c /tmp/grub.$$.cfg \ - search iso9660 configfile normal all_video boot linux multiboot + mkdir -p /mnt/efi + mount -o loop $livedirectory/boot/grub/efi.img /mnt/efi + mkdir -p /mnt/efi/EFI/BOOT + grub-mkimage -O x86_64-efi -o "/mnt/efi/EFI/BOOT/bootx64.efi" -c /tmp/grub.$$.cfg \ + search iso9660 configfile normal all_video boot gfxmenu gfxterm font png linux multiboot altboot="-eltorito-alt-boot -no-emul-boot -eltorito-platform efi -eltorito-boot boot/grub/efi.img" - umount /mnt/floppy + umount /mnt/efi fi rm -f /tmp/grub.$$.cfg - mkisofs -J -d -N -l -r -V "$LIVELABEL" -hide-rr-moved -o $imagefilename \ - -b boot/grub/bios.img -boot-load-size 4 -boot-info-table -no-emul-boot \ - -c boot/boot.catalog -hide boot.catalog -hide-joliet boot.catalog $altboot \ - $livedirectory - - rm -f $livedirectory/boot/grub/*.img +# mkisofs -J -d -N -l -r -V "$LIVELABEL" -hide-rr-moved -o $imagefilename \ +# -b boot/grub/bios.img -boot-load-size 4 -boot-info-table -no-emul-boot \ +# -c boot/boot.catalog -hide boot.catalog -hide-joliet boot.catalog $altboot \ +# $livedirectory + +# rm -f $livedirectory/boot/grub/*.img +iso_publisher="Salix Linux " +iso_application="Salix Linux Live/Rescue CD" +install_dir="arch" +work_dir="work" +out_dir="out" +sfs_comp="xz" + if [ `uname -m` == "x86_64" ]; then + _iso_efi_boot_args="-eltorito-alt-boot + -e boot/grub/efi.img + -no-emul-boot + -isohybrid-gpt-basdat" + else + _iso_efi_boot_args="" + fi + xorriso -as mkisofs ${_qflag} \ + -iso-level 3 \ + -full-iso9660-filenames \ + -volid "${LIVELABEL}" \ + -appid "${iso_application}" \ + -publisher "${iso_publisher}" \ + -preparer "prepared by build-slackware-live" \ + -eltorito-boot boot/syslinux/isolinux.bin \ + -eltorito-catalog boot/syslinux/boot.cat \ + -no-emul-boot -boot-load-size 4 -boot-info-table \ + -isohybrid-mbr ${livedirectory}/boot/syslinux/isohdpfx.bin \ + ${_iso_efi_boot_args} \ + -output "${imagefilename}" \ + "${livedirectory}" + } @@ -321,10 +330,13 @@ efipartition="$installdevice""1" dd if=/dev/zero of=$installdevice bs=512 count=34 >/dev/null 2>&1 #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\n\nn\n128\n\n\nef02\nr\nh\n1 2\nn\n\ny\n\nn\nn\nwq\ny\n" | gdisk $installdevice || return $PARTITIONERROR + #echo -e "2\nn\n\n\n+32M\nef00\nn\n\n\n\n\nn\n128\n\n\nef02\nr\nh\n1 2\nn\n\ny\n\nn\nn\nwq\ny\n" | gdisk $installdevice || return $PARTITIONERROR + 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; sleep 3 mkfs.fat -n "efi" $efipartition || return $FORMATERROR - mkfs.ext3 -L "$LIVELABEL" $installmedia || return $FORMATERROR + #mkfs.ext3 -L "$LIVELABEL" $installmedia || return $FORMATERROR + fat32option="-F 32" + mkfs.vfat $fat32option -n "$LIVELABEL" $installmedia || return $FORMATERROR sleep 3 else #install on partition: filesystem check and format if needed @@ -335,7 +347,7 @@ umount /mnt/tmp fsck -fy $installmedia >/dev/null 2>&1 else #format partition - if echo -e "print\nquit" | parted $installdevice | grep -q " : msdos$"; then + if echo -e "print\nquit" | parted $installdevice | grep -q ": msdos$"; then partitiontype=`gdisk -l $installdevice | grep "^ *$partnum " | 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:` @@ -383,7 +395,7 @@ if [ `uname -m` == "x86_64" ] && [ ! -z "$efipartnum" ]; then #EFI mkdir -p /mnt/efi mount $efipartition /mnt/efi - mkdir -p /mnt/efi/EFI/BOOT/ + mkdir -p /mnt/efi/EFI/BOOT/ #~ uuid=`blkid | grep "^$installmedia:" | sed 's/.*UUID=\"\([^\"]*\)\".*/\1/'` cat > /tmp/grub.$$.cfg << EOF #search --fs-uuid --set=root $uuid @@ -391,23 +403,23 @@ set prefix=(\$root)/boot/grub source \$prefix/grub.cfg EOF - grub-mkimage -p "" -o /mnt/efi/EFI/BOOT/bootx64.efi -O x86_64-efi -c /tmp/grub.$$.cfg \ - search part_gpt fat ext2 normal boot configfile linux multiboot all_video && grubstatus=0 + grub-mkimage -p "" -o "/mnt/efi/EFI/BOOT/bootx64.efi" -O x86_64-efi -c /tmp/grub.$$.cfg \ + search part_gpt fat ext2 normal boot configfile linux multiboot all_video font gfxterm png jpeg gfxmenu && grubstatus=0 rm -f /tmp/grub.$$.cfg umount /mnt/efi rmdir /mnt/efi fi - if echo -e "print\nquit" | parted $installdevice | grep -q " : msdos$" || + if echo -e "print\nquit" | parted $installdevice | grep -q ": msdos$" || gdisk -l $installdevice 2>/dev/null | grep -q " EF02 "; then #CSM sfdisk $installdevice -A $partnum 2>/dev/null - grub-install --target=i386-pc --boot-directory=/mnt/install/boot $installdevice && grubstatus=0 + grub-install --force --target=i386-pc --boot-directory=/mnt/install/boot $installdevice && grubstatus=0 fi umount /mnt/install rmdir /mnt/install - return $grubstatus + retur n $grubstatus } @@ -415,6 +427,10 @@ rootdirectory=$1 systempart=$2 loadersetup=$3 + username=$4 + userpassword=$5 + installation_mode=$6 + SYSINSTALLFS="ext4" mkfs.$SYSINSTALLFS $systempart || return $FORMATERROR @@ -423,11 +439,39 @@ mount $systempart /mnt/install #copy - for directory in $rootdirectory/*; do - cp -dpr $directory /mnt/install/ - done + #Copy begin + 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 $rootdirectory/lib/udev/devices/* /mnt/install/dev/ + if [ "$rootdirectory" = "/live/modules" ]; then + cp -dpr /live/system/lib/udev/devices/* /mnt/install/dev/ + fi #setup rootpw=`cat /etc/shadow | grep root | cut -f2 -d:` #root password @@ -437,8 +481,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/ @@ -450,21 +494,65 @@ if [ -f /etc/hardwareclock ]; then cp -f /etc/hardwareclock /mnt/install/etc/ fi - - #fstab + #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 $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 + #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 + #initrd begin if [ ! -f /mnt/install/boot/initrd.gz ]; then kv=`basename /mnt/install/lib/modules/*` if lsmod | grep -q $SYSINSTALLFS; then @@ -488,8 +576,10 @@ chroot /mnt/install umount /proc fi fi - - #grub + #InitRD end + + #grub begin + echo "Installing Grub Boot Loader on $installdevice" if [ "$loadersetup" == "-auto" ]; then grustatus=$GRUBERROR installdevice=`echo $systempart | cut -c1-8` @@ -502,7 +592,7 @@ grub-install --efi-directory /mnt/efi --boot-directory /mnt/install/boot/ && grubstatus=0 umount /mnt/efi else #CSM - if echo -e "print\nquit" | parted $installdevice | grep -q " : msdos$" || + if echo -e "print\nquit" | parted $installdevice | grep -q ": msdos$" || gdisk -l $installdevice 2>/dev/null | grep -q " EF02 "; then grub-install --boot-directory /mnt/install/boot $installdevice && grubstatus=0 else @@ -519,6 +609,156 @@ for dir in sys proc dev; do umount /mnt/install/$dir; done fi + + 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 lp,floppy,audio,video,cdrom,plugdev,power,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 [ -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 + 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 + + echo "Removing installer" + chroot /mnt/install mount /proc + chroot /mnt/install rm -f /home/one/Desktop/sli*.desktop + chroot /mnt/install spkg -d sli + chroot /mnt/install umount /proc + + # Run various slackware install routines + echo "Run various slackware install routines" + chroot /mnt/install mount /proc + if [ -f /mnt/install/var/log/setup/setup.04.mkfontdir ]; then + chroot /mnt/install /var/log/setup/setup.04.mkfontdir + fi + + 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 + + if [ -f mnt/install/usr/sbin/update-all ]; then + chroot /mnt/install /usr/sbin/update-all + fi + + if [ -f mnt/install/var/log/setup/setup.services ]; then + chroot /mnt/install /var/log/setup/setup.services + fi + + chroot /mnt/install umount /proc + + # Set the hostname. + chmod 777 /mnt/install/etc/HOSTNAME + echo "darkstar.example.net" > /mnt/install/etc/HOSTNAME + chmod 644 /mnt/install/etc/HOSTNAME + umount /mnt/install rmdir /mnt/install @@ -622,6 +862,10 @@ rootdirectory=$2 systempart=$3 loadersetup=$4 + username=$5 + userpassword=$6 + installation_mode=$7 + if [ -d "$rootdirectory" ] && [ -b "$systempart" ]; then systemsize=`du -s -m $rootdirectory/../modules | sed 's/\t.*//'` device=`echo $systempart | cut -c6-8` @@ -633,11 +877,11 @@ echo "error: insufficant space on device '$systempart'" exit $INSUFFICIENTSPACE else - install_system $rootdirectory $systempart $loadersetup + install_system $rootdirectory $systempart $loadersetup $username $userpassword $installation_mode exit $! fi else - echo "`basename $0` --install root_dir device [-auto|-expert]" + echo "`basename $0` --install root_dir device [-auto|-expert] username userpassword installation_mode" exit $CMDERROR fi ;; diff -Naur slackware-live-0.4.1.orig/scripts/init slackware-live-0.4.1/scripts/init --- slackware-live-0.4.1.orig/scripts/init 2014-03-16 16:50:14.000000000 +0200 +++ slackware-live-0.4.1/scripts/init 2014-10-17 07:34:04.136426395 +0300 @@ -1,6 +1,7 @@ #!/bin/ash -LIVELABEL="Slackware-Live" #edit in build-slackware-live.sh script too +LIVELABEL="LIVE" #edit in build-slackware-live.sh script too +title="Salix-Live" echo "" echo "*** Live system initialization ***" @@ -27,14 +28,16 @@ ifconfig eth0 $address netmask $netmask route add default gw $gateway mount -t nfs -o nolock $nfsroot /slroot/live/media - echo "Slackware-Live found on $nfsroot" + title=`cat /slroot/live/media/boot/syslinux/syslinux.cfg | grep "menu title " | cut -f3 -d' '` + echo "$title found on $nfsroot" fi sleeptime=0 alreadycheckedpartitions="" + while [ "$mediadetected" == "none" ] && [ "$sleeptime" != "10" ]; do #try each seconds, but don't wait (USB) more than 10 seconds if blkid | grep -q "LABEL=\"$LIVELABEL\""; then livedevice=`blkid | grep "LABEL=\"$LIVELABEL\"" | sed -n 1p | cut -f1 -d:` - echo "Slackware-Live found on $livedevice" + echo "$title 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" @@ -49,7 +52,7 @@ else mediadetected="sd" fi livedevice="/dev/$partition" - echo "Slackware-Live found on $livedevice" + echo "$title found on $livedevice" break else umount /slroot/live/media @@ -64,6 +67,11 @@ fi done +if [ "$mediadetected" == "none" ]; then + echo "*** Live system error - live media not detected - exiting ***" + sh +fi + #copy live-media to RAM if requested if [ "$copy2ram" == "yes" ]; then echo -n "Copying live system to RAM ..." @@ -130,29 +138,49 @@ unionfs -o ro,allow_other,suid,dev,use_ino,cow,max_files=524288,chroot=/slroot $unionfsmodulesbranches /slroot/live/system #setup persistent system changes -mkdir /slroot/live/changes -if [ ! -z "$changes" ]; then - echo "Using persistent system storage ($changes)" - if [ "$mediadetected" == "nfs" ]; then - mount -t nfs -o nolock $changes /slroot/live/changes #TODO: no auth / security - else - changesdevice=`blkid | grep "\"$changes\"" | cut -f1 -d:` - if [ "$changesdevice" == "$livedevice" ]; then - changes="/changes" - changesdevice="" - fi - if [ -z "$changesdevice" ]; then #directory +if [ ! -z "$changes" ] && [ ! "$copy2ram" == "yes" ] && [ "$mediadetected" != "cd" ]; then + mkdir /slroot/live/changes + if [ "$mediadetected" == "sd" ]; then + if [ ! -b $changes ]; then mount -o remount,rw /slroot/live/media - mkdir -p /slroot/live/media/$changes - mount --bind /slroot/live/media/$changes /slroot/live/changes - else #device - mount $changesdevice /slroot/live/changes fi + if echo $changes | grep -q "="; then + filesize=`echo "$changes" | cut -f2 -d=` + 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 + mkdir -p /slroot/live/media/$changes + fi + #fi + fi + if [ -d /slroot/live/media/$changes ] || [ -f /slroot/live/media/$changes ] || [ -b $changes ]; then + echo "Using persistent system storage ($changes)" + if [ -b $changes ] + then mount $changes /slroot/live/changes + else + if [ -d /slroot/live/media/$changes ] + then mount --bind /slroot/live/media/$changes /slroot/live/changes + else mount -o loop /slroot/live/media/$changes /slroot/live/changes + fi + fi + fi + else + echo "Using persistent system storage ($changes)" + mount -t nfs -o nolock $changes /slroot/live/changes #TODO: no auth / security fi fi #mount (union) all modules (ro) and /live/changes (rw) in /live/union (rw) mkdir /slroot/live/union +mkdir -p /slroot/live/changes mount -t aufs -o br=/slroot/live/changes=rw:$aufsmodulesbranches none /slroot/live/union 2>/dev/null || unionfs -o allow_other,suid,dev,use_ino,cow,max_files=524288,chroot=/slroot /live/changes=rw:$unionfsmodulesbranches /slroot/live/union @@ -185,7 +213,6 @@ echo "cat /proc/mounts | grep -v '^rootfs' > /etc/mtab" >> /slroot/live/union/etc/rc.d/rc.S #update /etc/mtab echo "mount -o remount,rw /live/media" >> /slroot/live/union/etc/rc.d/rc.S if [ "$fastboot" == "yes" ]; then #faster startup (actions already done by "build-slackware-live.sh --sysprep") - echo "Enabling fast boot" sed -e 's@\(.*/usr/bin/fc-cache -f.*\)@ : #\1@' \ -e 's@\(.*rc.udev start\)@ : #\1@' \ -e 's@\(.*icon.*${theme_dir}.*\)@ : #\1@' \ @@ -232,34 +259,56 @@ fi #setup persistent homedir -if [ ! -z "$home" ]; then - echo "Setting up persistent home directory ($home)" +if [ ! -z "$home" ] && [ ! "$copy2ram" == "yes" ] && [ "$mediadetected" != "cd" ]; then uid=1000 if [ -z "`grep "^[^:]\+:x:$uid:" /slroot/live/union/etc/passwd | cut -f1 -d:`" ]; then uid=0 fi homedir=`grep "x:$uid:" /slroot/live/union/etc/passwd | cut -f6 -d:` gid=`grep "x:$uid:" /slroot/live/union/etc/passwd | cut -f4 -d:` - if [ "$mediadetected" == "nfs" ]; then - mount -t nfs -o nolock $home /slroot/$homedir #TODO: no auth / security - else - homedevice=`blkid | grep "\"$home\"" | cut -f1 -d:` - if [ "$homedevice" == "$livedevice" ]; then - home="/home" - homedevice="" - fi - if [ -z "$homedevice" ]; then #directory + if [ "$mediadetected" == "sd" ]; then + if [ ! -b $home ]; then mount -o remount,rw /slroot/live/media - if [ ! -d /slroot/live/media/$home ]; then + fi + if echo $home | grep -q "="; then + filesize=`echo "$home" | cut -f2 -d=` + 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) 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 + if [ -d /slroot/live/media/$home ] || [ -f /slroot/live/media/$home ] || [ -b $home ]; then + echo "Setting up persistent home directory ($home)" + if [ -b $home ]; then + mount $home /slroot/$homedir + else + if [ -d /slroot/live/media/$home ] + then mount --bind /slroot/live/media/$home /slroot/$homedir + else mount -o loop /slroot/live/media/$home /slroot/$homedir + fi fi - mount --bind /slroot/live/media/$home /slroot/$homedir - else #device - mount $home /slroot/$homedir fi + else + echo "Setting up persistent home directory ($home)" + mount -t nfs -o nolock $home /slroot/$homedir #TODO: no auth / security fi fi @@ -272,10 +321,7 @@ #autologin runlevel=`cat /slroot/live/union/etc/inittab | sed -n /^id:[1-5]:initdefault:$/p | cut -f2 -d:` if [ $runlevel == 5 ]; then - login=`cat /slroot/live/union/etc/passwd | grep ":1000:" | cut -f1 -d:` - if [ -z "$login" ]; then login="root"; fi - echo "Setting up autologin (login=$login)" - sed -i "s/^c1:.*$/c1:5:respawn:\/sbin\/agetty -a $login 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 @@ -295,42 +341,69 @@ 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 $lang | 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 Salix 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 + # Make thunderbird match OS locale + # Now included in Salix 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 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 if [ -f /slroot/usr/share/zoneinfo/$tz ]; then - echo "Setting up timezone ($tz)" cat /slroot/usr/share/zoneinfo/$tz > /slroot/etc/localtime ln -sf /usr/share/zoneinfo/$tz /slroot/etc/localtime-copied-from fi fi if [ ! -z "$hwc" ]; then if [ "$hwc" == "UTC" ] || [ "$hwc" == "localtime" ]; then - echo "Setting up hardware clock ($hwc)" echo "$hwc" > /slroot/etc/hardwareclock fi fi @@ -342,22 +415,21 @@ fi #detect fixed partitions -blkid | while read line; do - partition=`echo $line | cut -f1 -d: | cut -c 6-` - device=`echo $partition | cut -c1-3` - type=`echo $line | sed 's/^.*TYPE=\"\([^\"]*\)\".*$/\1/'` - if [ "`cat /sys/block/$device/removable`" == "0" ]; then - if [ "$type" == "swap" ]; then +for partition in /sys/block/sd?/sd*; do + device=`echo $partition | cut -f4 -d/` + partition=`echo $partition | cut -f5 -d/` + if [ "$partition" != "sd*" ] && [ "`cat /sys/block/$device/removable`" == "0" ]; then + if swapon /dev/$partition >/dev/null 2>/dev/null; then + swapoff /dev/$partition if [ "$useswap" == "yes" ]; then echo "Enabling swap on /dev/$partition" echo "/dev/$partition none swap defaults 0 0" >> /slroot/live/union/etc/fstab else echo "/dev/$partition none swap defaults,noauto 0 0" >> /slroot/live/union/etc/fstab fi - else - echo "Detected /dev/$partition ($type)" - echo "/dev/$partition /mnt/$partition $type defaults,noauto,user 0 0" >> /slroot/live/union/etc/fstab - mkdir -p /slroot/live/union/mnt/$partition + #else + # 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 @@ -375,7 +447,9 @@ umount /sys mount -r -o remount /slroot 2>/dev/null #remount root directory read-only for normal startup sed -i 's/READWRITE=yes/:/' /slroot/etc/rc.d/rc.S 2>/dev/null #aufs doesn't allow remounting (claiming it is busy) - echo "*** Live system ready ***" +if [ ! -z "$debug" ]; then + sleep $debug +fi echo "" exec switch_root /slroot /sbin/init