diff options
author | André Fabian Silva Delgado <andre@pc-01.localdomain> | 2012-05-04 15:33:55 -0300 |
---|---|---|
committer | André Fabian Silva Delgado <andre@pc-01.localdomain> | 2012-05-04 15:33:55 -0300 |
commit | 6bdcc59f94ecd2fd84facda953f92e1d2a5cf727 (patch) | |
tree | e3348a3a05ae33a3d6040f2f7a38a260cdc4a065 | |
parent | 64a660adb9a1ad658874759c186e0e9cbf138e63 (diff) |
updating all files
58 files changed, 1692 insertions, 599 deletions
@@ -5,14 +5,31 @@ This is a rebranded fork of the original Archiso for Parabola GNU/Linux-libre. * Boot parameters (initramfs stage) * hooks/archiso + * hooks/archiso_pxe_common * hooks/archiso_pxe_nbd + * hooks/archiso_pxe_http + * hooks/archiso_pxe_nfs * hooks/archiso_loop_mnt * Boot parameters (only for configs/releng) * etc/rc.conf +* Transfer ISO file to target medium (configs/releng) + * To -> CD / DVD / BD + * To -> USB-key / SD / HDD / SSD + * PC-BIOS (MBR) + * PC-BIOS (ISOHYBRID-MBR) + * PC-EFI (GPT) [x86_64 only] +* Alternative boot methods (configs/releng) + * ISO in loopback mode + * ISO in memdisk mode + * Network booting (PXE) [first stage] + * DHCP + TFTP + * DHCP + HTTP + * HTTP/NFS/NBD [second stage] * Build requirements * Image types generated by mkarchiso. * File format for aitab. * Why the /isolinux and /libre/boot/syslinux directories? +* Know issues * Building the most basic Parabola live media. (configs/baseline) * Building official Parabola live media. (configs/releng) @@ -37,15 +54,23 @@ This is a rebranded fork of the original Archiso for Parabola GNU/Linux-libre. performs a self-test of all files inside ${install_dir}, and continue booting if ok. Default: (unset) +* cow_label= Set the filesystem label where COW (dm-snapshot) + files must be stored. + Default: (unset) +* cow_device= Set the device node where COW (dm-snapshot) files + must be stored. + Default: (unset) or "/dev/disk/by-label/${cow_label}" +* cow_directory= Set a directory inside ${cow_device}. + Default: "/persistent_${archisolabel}/${arch}" +* cow_persistent= Set if snapshots are persistent "P" or non-persistent "N". + Default: "N" (if no ${cow_device} is used) otherwise "P". * cowspace_size= Set the size of tmpfs /cowspace. This space is used for Copy-On-Write files of dm-snapshot. - (directory not visible outside initramfs) Size is in bytes (suffix with "k", "m" and "g") or in percentage of available RAM. Default: "75%" -* copytoram_size= Set the size of tmpfs /cowpytoram. This space is used for +* copytoram_size= Set the size of tmpfs. This space is used for copy of all SquashFS images used, if copytoram=y. - (directory not visible outside initramfs) Size is in bytes (suffix with "k", "m" and "g") or in percentage of available RAM. Default: "75%" @@ -57,7 +82,7 @@ This is a rebranded fork of the original Archiso for Parabola GNU/Linux-libre. Default: (architecture of running kernel) -** hooks/archiso_pxe_nbd +** hooks/archiso_pxe_common * ip= This parameter is setup automatically by PXELINUX when option "IPAPPEND" is set to 1 or 2 in config. @@ -67,14 +92,53 @@ This is a rebranded fork of the original Archiso for Parabola GNU/Linux-libre. when option "IPAPPEND" is set to 2 or 3 in config. BOOTIF=<hardware-address-of-boot-interface> Default: (set via PXELINUX) + + +** hooks/archiso_pxe_nbd + * archiso_nbd_name= Set NBD export name used by the server. Default: archiso +* archiso_nbd_srv= Set an IP address where NBD reside. + If ${pxeserver} is used, PXE IP will be used. + Default: (unset) + + +** hooks/archiso_pxe_http + +* archiso_http_srv= Set an HTTP URL (must end with /) where ${archisobasedir} + is found with all *.sfs files. + In the IP/domain part if ${pxeserver} is used, use PXE IP. + Default: (unset) +* archiso_http_spc= Set the size of tmpfs where *.sfs files are downloaded. + Default: "75%" + + +** hooks/archiso_pxe_nfs + +* archiso_nfs_srv= Set the NFS-IP:/path of the server + In the IP part if ${pxeserver} is used, PXE IP will be used. + Default: (unset) +* archiso_nfs_opt= Set NFS mount options separated by comma. + Default: (unset, see below) + These are the implicit options: + port = as given by server portmap daemon + rsize = 1024 + wsize = 1024 + timeo = 7 + retrans = 3 + acregmin = 3 + acregmax = 60 + acdirmin = 30 + acdirmax = 60 + flags = hard, nointr, noposix, cto, ac ** hooks/archiso_loop_mnt -* img_dev= Device where archiso-image.iso reside. +* img_label= Set the filesystem label where archiso-image.iso. Default: (unset) +* img_dev= Device where archiso-image.iso reside. + Default: (unset) or "/dev/disk/by-label/${img_label}" * img_loop= Full path where archiso-image.iso is located on ${img_dev} Default: (unset) @@ -98,23 +162,258 @@ if nothing is specified on command line. +*** Transfer ISO image to target medium (configs/releng) + +ISO images names consist of: parabola-<YYYY>.<MM>.<DD>-<TYPE>-<ARCH>.iso + +Where: + <YYYY> Year + <MM> Month + <DD> Day + <TYPE> netinstall | core + <ARCH> i686 | x86_64 | dual(*) + +(*) "dual" includes both i686 and x86_64 architectures. + + +** To -> CD / DVD / BD + +Note: All ISO images are booteable on a PC-BIOS via "El Torito" in no-emulation mode, + All x86_64 ISO images are booteable on a PC-EFI via "El Torito" in no-emulation mode. + +Nomeclature: + <B> scsibus number + <T> target number + <L> lun number + (Note: see cdrecord -scanbus, for these numbers) + + +1) Write it directly using your favorite recording program. +# cdrecord dev=<B>,<T>,<L> -dao parabola-<YYYY>.<MM>.<DD>-<TYPE>-<ARCH>.iso + + +** To -> USB Flash Drive (USB-key) / Memory card (SD) / + Hard-Disk Drive (HDD) / Solid-State Drive (SSD) + +Note: These steps are the general workflow, you can skip some of them, + using another filesystem if your bootloader supports it, + installing to another directory than "arch/" or using more than + one partition. Just ensure that main boot params options + (archisolabel= and archisobasedir=) are set correctly according to your setup. + +Nomeclature: +<DEV-TARGET>: Device node of the drive where ISO contents should be copied + (example: /dev/sdx) +<DEV-TARGET-N>: Device node of the partition on <DEV-TARGET> + (example: /dev/sdx1) +<MNT-TARGET-N>: Mount point path where <DEV-TARGET-N> is mounted + (example: /mnt/sdx/1) +<ISO-SOURCE>: Path to the ISO file parabola-<YYYY>.<MM>.<DD>-<TYPE>-<ARCH>.iso + (example: ~/parabola-2012.04.16-netinstall-x86_64.iso) +<FS-LABEL>: Represents the filesystem label of the <ISO-SOURCE> + (example: LIBRE_201204 [for all ~/parabola-2012.04.*.iso]) + + +* PC-BIOS (MBR): + +Note: Using here a MBR partition mode as example, but GPT should also works + if machine firmware is not broken. + Just ensure that partition is set with attribute "2: legacy BIOS bootable" + and use gptmbr.bin instead of mbr.bin for syslinux. + +1) Create one partition entry in MBR (of type "b" for FAT32 or "83" for EXTFS) + and mark it as "active" (bootable). +# fdisk <DEV-TARGET> + +2) Create a FAT32 or EXTFS filesystem on such partition and setup a label. +# mkfs.vfat -F 32 -n <FS-LABEL> <DEV-TARGET-N> +# mkfs.ext4 -L <FS-LABEL> <DEV-TARGET-N> + +3) Mount target filesystem. +# mount <DEV-TARGET-N> <MNT-TARGET-N> + +4) Extract ISO image on target filesystem. +# bsdtar -x --exclude=isolinux/ --exclude=EFI/ -f <ISO-SOURCE> -C <MNT-TARGET-N> + +5) Install syslinux bootloader on target filesystem. +# extlinux -i <MNT-TARGET-N>/arch/boot/syslinux + +6) Unmount target filesystem. +# umount <MNT-TARGET-N> + +7) Install syslinux MBR boot code on target drive. +# dd bs=440 count=1 conv=notrunc if=/usr/lib/syslinux/mbr.bin of=<DEV-TARGET> + + +* PC-BIOS (ISOHYBRID-MBR): + +Note: This method is the most easily, quick and dirty, but is the most limited + if you want to use your target medium for other purposes. + +1) Dump ISO file to target medium. +# dd if=<ISO-SOURCE> of=<DEV-TARGET> + + +* PC-EFI (GPT) [x86_64 only] + +Note: Using here a GPT partition mode as example, but MBR should also works + if machine firmware is not broken. + +1) Create one partition entry in GPT (of type "ef00") +# gdisk <DEV-TARGET> + +2) Create a FAT32 filesystem on such partition and setup a label. +# mkfs.vfat -F 32 -n <FS-LABEL> <DEV-TARGET-N> + +3) Mount target filesystem. +# mount <DEV-TARGET-N> <MNT-TARGET-N> + +4) Extract ISO image on target filesystem. +# bsdtar -x --exclude=isolinux/ --exclude=arch/boot/syslinux/ -f <ISO-SOURCE> -C <MNT-TARGET-N> + +5) Extract efiboot.img on EFI/ on target filesystem. +# mcopy -s -i <MNT-TARGET-N>/EFI/archiso/efiboot.img ::/EFI <MNT-TARGET-N>/ + +6) Remove uneeded efiboot.img +# rm <MNT-TARGET-N>/EFI/archiso/efiboot.img + +7) Unmount target filesystem. +# umount <MNT-TARGET-N> + + + +*** Alternative boot methods (configs/releng) + +** ISO in loopback mode. + +Note: Described method is for using with GRUB2. + GRUB2 is installed on target media and parabola-<YYYY>.<MM>.<DD>-<TYPE>-<ARCH>.iso + is at path <TARGET-PATH> on disk <D> and partition <P>, + where filesystem is labeled as <TARGET-FS-LABEL>. + +menuentry "Parabola GNU/Linux-libre (x86_64)" { + set isofile="/<TARGET-PATH>/parabola-<YYYY>.<MM>.<DD>-<TYPE>-<ARCH>.iso" + loopback loop (hd<D>,<P>)$isofile + linux (loop)/arch/boot/x86_64/vmlinuz archisolabel=<FS-LABEL> img_label=<TARGET-FS-LABEL> img_loop=$isofile + initrd (loop)/arch/boot/x86_64/libreiso.img +} + +menuentry "Parabola GNU/Linux-libre (i686)" { + set isofile="/<TARGET-PATH>/parabola-<YYYY>.<MM>.<DD>-<TYPE>-<ARCH>.iso" + loopback loop (hd<D>,<P>)$isofile + linux (loop)/arch/boot/i686/vmlinuz archisolabel=<FS-LABEL> img_label=<TARGET-FS-LABEL> img_loop=$isofile + initrd (loop)/arch/boot/i686/libreiso.img +} + + +** ISO in memdisk mode. + +Note: Described method is for using with SYSLINUX. Anyway MEMDISK from SYSLINUX can work + with other bootloaders. + SYSLINUX is installed on target media and parabola-<YYYY>.<MM>.<DD>-<TYPE>-<ARCH>.iso + is at path <TARGET-PATH>. + On 32-bit systems, is needed to pass vmalloc=nnM to the kernel, where nn is the size + of the ISO image plus 64 MiB (or 128 MiB). + + +LABEL parabola_x64 + LINUX memdisk + INITRD /<TARGET-PATH>/parabola-<YYYY>.<MM>.<DD>-<TYPE>-<ARCH>.iso + APPEND iso + +LABEL parabola_x32 + LINUX memdisk + INITRD /<TARGET-PATH>/parabola-<YYYY>.<MM>.<DD>-<TYPE>-<ARCH>.iso + APPEND iso + + +** Network booting (PXE). + +All ISOs are ready to act as PXE server, some manual steps are needed +to setup the desired PXE boot mode. +Alternatively it is possible to use an existing PXE server following the same logic. +Note: Setup network first, adjust IP adresses, and respect all slashes "/". + +First stage is for loading kernel and initramfs via PXE, two methods described here: + +* DHCP + TFTP + +Note: All NIC firmwares should support this. + +# dnsmasq --port=0 \ + --enable-tftp \ + --tftp-root=/run/archiso/bootmnt \ + --dhcp-range=192.168.0.2,192.168.0.254,86400 \ + --dhcp-boot=/arch/boot/syslinux/gpxelinux.0 \ + --dhcp-option-force=209,boot/syslinux/archiso.cfg \ + --dhcp-option-force=210,/arch/ + +* DHCP + HTTP + +Note: Not all NIC firmware supports HTTP and DNS (if domain name is used). + At least this works with iPXE and gPXE. + +# dnsmasq --port=0 \ + --dhcp-range=192.168.0.2,192.168.0.254,86400 \ + --dhcp-boot=http://192.168.0.7/arch/boot/syslinux/gpxelinux.0 \ + --dhcp-option-force=209,boot/syslinux/archiso.cfg \ + --dhcp-option-force=210,http://192.168.0.7/arch/ + + +Once the kernel is started from PXE, SquashFS files and other misc files +inside "arch" directory must be loaded (second stage). One of the following +methods can be used to serve the rest of live-medium. + +* HTTP + +# darkhttpd /run/archiso/bootmnt + + +* NFS + +# echo "/run/archiso/bootmnt 192.168.0.*(ro,no_subtree_check,no_root_squash)" >> /etc/exports +# rc.d start rpcbind nfs-common nfs-server + + +* NBD + +Note: Adjust LIBRE_201204 as needed. + +# cat << EOF > /tmp/nbd-server.conf +[generic] +[archiso] + readonly = true + exportname = /dev/disk/by-label/LIBRE_201204 +EOF +# nbd-server -C /tmp/nbd-server.conf + + + *** Build requirements ** For mkarchiso script needs these packages (build host): - + devtools for mkarchroot + squashfs-tools for mksquashfs - + syslinux for isohybrid - + cdrkit for mkisofs + + libisoburn for xorriso + + rsync for rsync + +** For configs/releng build.sh needs theses packages (build host): + + dosfstools for mkfs.vfat ** For these hooks needs these packages (on target root-image) * archiso + (none) * archiso_loop_mnt + (none) -* archiso_pxe_nbd +* archiso_pxe_common + mkinitcpio-nfs-utils for ipconfig +* archiso_pxe_nbd + nbd for nbd-client - +* archiso_pxe_http + + curl for curl +* archiso_pxe_nfs + + mkinitcpio-nfs-utils for nfsmount +* archiso_shutdown + + (none) *** Image types generated by mkarchiso. @@ -123,10 +422,6 @@ if nothing is specified on command line. * image-name.fs.sfs SquashFS with only one file inside (image-name.fs), which is an image of some type of filesystem (ext4, ext3, ext2, xfs), all files reside on it. -* image-name.fs Like image-name.fs.sfs but without SquashFS. - (For testing purposes only. The option copytoram - for archiso hook does not have any effect on these images) - *** File format for aitab. @@ -141,7 +436,6 @@ It consists of some fields which define the behaviour of images. <mnt> Mount point. <arch> Architecture { i686 | x86_64 | any }. <sfs_comp> SquashFS compression type { gzip | lzo | xz }. - A special value of "none" denotes no usage of SquashFS. <fs_type> Set the filesystem type of the image { ext4 | ext3 | ext2 | xfs }. A special value of "none" denotes no usage of a filesystem. In that case all files are pushed directly to SquashFS filesystem. @@ -152,9 +446,6 @@ It consists of some fields which define the behaviour of images. This is an estimation, and calculated in a simple way. Space used + 10% (estimated for metadata overhead) + desired % -Note: Some combinations are invalid, example: sfs_comp=none and fs_type=none - - *** Why the /isolinux and /arch/boot/syslinux directories? @@ -165,6 +456,16 @@ When make your custom boot-pendrive, you need to copy /libre directory to it. /isolinux/isolinux.cfg just holds /libre/boot/syslinux/syslinux.cfg +*** Know issues + +** On shutdown there are two steps that [FAIL]: + "Unmounting Swap-backed Filesystems" and "Unmounting Non-API Filesystems", + These filesystem are in use at this stage by archiso, but... + This is not a real issue since, all mounted filesystem, loopback devices + and device mapper devices made by archiso will be "free" on "shutdown tmpfs" + (A.K.A deinitramfs), build at initramfs by [archiso_shutdown] initcpio hook. + + *** Building the most basic Parabola live media. (configs/baseline) @@ -177,7 +478,7 @@ When make your custom boot-pendrive, you need to copy /libre directory to it. * Install archiso on chroot (needs git and make) [host] # pacman -S git make --needed - [host] # git clone git://projects.archlinux.org/archiso.git + [host] # git clone git://projects.parabolagnulinux.org/archiso.git [host] # make -C archiso/archiso DESTDIR=/tmp/chroot install * Enter to chroot (prefix with linux32 if needed). @@ -191,7 +492,7 @@ When make your custom boot-pendrive, you need to copy /libre directory to it. [chroot] # echo 'Server = http://repo.parabolagnulinux.org/$repo/os/$arch' >> /etc/pacman.d/mirrorlist * Install aditional packages needed for mkarchiso. - [chroot] # pacman -S devtools squashfs-tools syslinux cdrkit + [chroot] # pacman -S devtools squashfs-tools syslinux cdrkit libisoburn rsync * Build a basic iso. [chroot] # cp -r /usr/share/archiso/configs/baseline /tmp @@ -205,7 +506,6 @@ Note: If you want to customize, just see the configs/releng directory which is used to build official images with much more things. - *** Building official Parabola live media. (configs/releng) Note: These steps should be done with 64 bits support. @@ -215,7 +515,7 @@ Note: These steps should be done with 64 bits support. [host64] # linux32 mkarchroot /tmp/chroot32 base [host64] # linux32 mkarchroot -r bash /tmp/chroot32 [chroot32] # echo 'Server = http://repo.parabolagnulinux.org/$repo/os/$arch' >> /etc/pacman.d/mirrorlist - [chroot32] # pacman -S devtools squashfs-tools syslinux cdrkit + [chroot32] # pacman -S devtools squashfs-tools syslinux cdrkit rsync dosfstools [chroot32] # exit * Prepare a 64 bits chroot enviroment. @@ -223,7 +523,7 @@ Note: These steps should be done with 64 bits support. [host64] # mkarchroot /tmp/chroot64 base [host64] # mkarchroot -r bash /tmp/chroot64 [chroot64] # echo 'Server = http://repo.parabolagnulinux.org/$repo/os/$arch' >> /etc/pacman.d/mirrorlist - [chroot64] # pacman -S devtools squashfs-tools syslinux cdrkit + [chroot64] # pacman -S devtools squashfs-tools syslinux cdrkit rsync dosfstools [chroot64] # exit * Install archiso on both chroots. @@ -245,20 +545,17 @@ Note: These steps should be done with 64 bits support. [chroot32] # mknod /dev/loop1032 b 7 1032 #assumed loop.max_part=0 (by default) [chroot32] # cp -r /usr/share/archiso/configs/releng /tmp [chroot32] # cd /tmp/releng - [chroot32] # ./build.sh all_iso_single - [chroot32] # ./build.sh purge_single #optional +* Build them! + [chroot64] # cd /tmp/releng + [chroot64] # ./build.sh build all all * Enter 64 bits chroot enviroment then build core and netinstall single images. [chroot64] # mkarchroot -r bash /tmp/chroot64 [chroot64] # mknod /dev/loop1064 b 7 1064 #assumed loop.max_part=0 (by default) [chroot64] # cp -r /usr/share/archiso/configs/releng /tmp +* Build them! [chroot64] # cd /tmp/releng - [chroot64] # ./build.sh all_iso_single - [chroot64] # ./build.sh purge_single #optional + [chroot64] # ./build.sh build all all -* Build core and netinstall dual images from any of the chroot enviroments. - - [host64] # mkarchroot -r bash /tmp/chroot64 - [chroot64] # cd /tmp/releng - [chroot64] # ./build.sh all_iso_dual +Note: See build.sh -h for more options. diff --git a/archiso/Makefile b/archiso/Makefile index 60632e2..28868bf 100644 --- a/archiso/Makefile +++ b/archiso/Makefile @@ -10,12 +10,23 @@ install-program: install-hooks: # hooks/install are needed by mkinitcpio - install -D -m 644 hooks/archiso $(DESTDIR)/lib/initcpio/hooks/archiso - install -D -m 644 install/archiso $(DESTDIR)/lib/initcpio/install/archiso - install -D -m 644 hooks/archiso_pxe_nbd $(DESTDIR)/lib/initcpio/hooks/archiso_pxe_nbd - install -D -m 644 install/archiso_pxe_nbd $(DESTDIR)/lib/initcpio/install/archiso_pxe_nbd - install -D -m 644 hooks/archiso_loop_mnt $(DESTDIR)/lib/initcpio/hooks/archiso_loop_mnt - install -D -m 644 install/archiso_loop_mnt $(DESTDIR)/lib/initcpio/install/archiso_loop_mnt + install -D -m 644 hooks/archiso $(DESTDIR)/usr/lib/initcpio/hooks/archiso + install -D -m 644 install/archiso $(DESTDIR)/usr/lib/initcpio/install/archiso + install -D -m 755 archiso_shutdown $(DESTDIR)/usr/lib/initcpio/archiso_shutdown + install -D -m 644 hooks/archiso_shutdown $(DESTDIR)/usr/lib/initcpio/hooks/archiso_shutdown + install -D -m 644 install/archiso_shutdown $(DESTDIR)/usr/lib/initcpio/install/archiso_shutdown + install -D -m 644 archiso_pxe_nbd $(DESTDIR)/usr/lib/initcpio/archiso_pxe_nbd + install -D -m 644 hooks/archiso_pxe_common $(DESTDIR)/usr/lib/initcpio/hooks/archiso_pxe_common + install -D -m 644 install/archiso_pxe_common $(DESTDIR)/usr/lib/initcpio/install/archiso_pxe_common + install -D -m 644 hooks/archiso_pxe_nbd $(DESTDIR)/usr/lib/initcpio/hooks/archiso_pxe_nbd + install -D -m 644 install/archiso_pxe_nbd $(DESTDIR)/usr/lib/initcpio/install/archiso_pxe_nbd + install -D -m 644 hooks/archiso_pxe_http $(DESTDIR)/usr/lib/initcpio/hooks/archiso_pxe_http + install -D -m 644 install/archiso_pxe_http $(DESTDIR)/usr/lib/initcpio/install/archiso_pxe_http + install -D -m 644 hooks/archiso_pxe_nfs $(DESTDIR)/usr/lib/initcpio/hooks/archiso_pxe_nfs + install -D -m 644 install/archiso_pxe_nfs $(DESTDIR)/usr/lib/initcpio/install/archiso_pxe_nfs + install -D -m 644 hooks/archiso_loop_mnt $(DESTDIR)/usr/lib/initcpio/hooks/archiso_loop_mnt + install -D -m 644 install/archiso_loop_mnt $(DESTDIR)/usr/lib/initcpio/install/archiso_loop_mnt + install -D -m 644 install/archiso_kms $(DESTDIR)/usr/lib/initcpio/install/archiso_kms install-examples: # install examples @@ -29,10 +40,23 @@ install-doc: uninstall: rm -f $(DESTDIR)/usr/sbin/mkarchiso rm -f $(DESTDIR)/usr/bin/testiso - rm -f $(DESTDIR)/lib/initcpio/hooks/archiso - rm -f $(DESTDIR)/lib/initcpio/install/archiso - rm -f $(DESTDIR)/lib/initcpio/hooks/archiso_pxe_nbd - rm -f $(DESTDIR)/lib/initcpio/install/archiso_pxe_nbd + rm -f $(DESTDIR)/usr/lib/initcpio/hooks/archiso + rm -f $(DESTDIR)/usr/lib/initcpio/install/archiso + rm -f $(DESTDIR)/usr/lib/initcpio/archiso_shutdown + rm -f $(DESTDIR)/usr/lib/initcpio/hooks/archiso_shutdown + rm -f $(DESTDIR)/usr/lib/initcpio/install/archiso_shutdown + rm -f $(DESTDIR)/usr/lib/initcpio/archiso_pxe_nbd + rm -f $(DESTDIR)/usr/lib/initcpio/hooks/archiso_pxe_common + rm -f $(DESTDIR)/usr/lib/initcpio/install/archiso_pxe_common + rm -f $(DESTDIR)/usr/lib/initcpio/hooks/archiso_pxe_nbd + rm -f $(DESTDIR)/usr/lib/initcpio/install/archiso_pxe_nbd + rm -f $(DESTDIR)/usr/lib/initcpio/hooks/archiso_pxe_http + rm -f $(DESTDIR)/usr/lib/initcpio/install/archiso_pxe_http + rm -f $(DESTDIR)/usr/lib/initcpio/hooks/archiso_pxe_nfs + rm -f $(DESTDIR)/usr/lib/initcpio/install/archiso_pxe_nfs + rm -f $(DESTDIR)/usr/lib/initcpio/hooks/archiso_loop_mnt + rm -f $(DESTDIR)/usr/lib/initcpio/install/archiso_loop_mnt + rm -f $(DESTDIR)/usr/lib/initcpio/install/archiso_kms rm -rf $(DESTDIR)/usr/share/archiso/ .PHONY: install install-program install-hooks install-examples install-doc uninstall diff --git a/archiso/archiso_pxe_nbd b/archiso/archiso_pxe_nbd new file mode 100644 index 0000000..e6b9872 --- /dev/null +++ b/archiso/archiso_pxe_nbd @@ -0,0 +1,6 @@ +omit_kill_nbd_client() { + add_omit_pids $(< /run/archiso/nbd_client.pid) +} + +add_hook shutdown_prekillall omit_kill_nbd_client +add_hook single_prekillall omit_kill_nbd_client diff --git a/archiso/archiso_shutdown b/archiso/archiso_shutdown new file mode 100644 index 0000000..85cce59 --- /dev/null +++ b/archiso/archiso_shutdown @@ -0,0 +1,40 @@ +#!/bin/ash + +# /oldroot depends on things inside /oldroot/run/archiso... +mkdir /oldrun +mount -n --move /oldroot/run /oldrun + +# Unmount all mounts now. +umount $(mount | awk '$3 ~/^\/oldroot/ {print $3}' | sort -r) + +# Remove all dm-snapshot devices. +dmsetup remove_all + +# Remove all loopback devices. +for _lup in $(grep ^/dev/loop /oldrun/archiso/used_block_devices | tac); do + if ! losetup -d ${_lup} 2> /dev/null; then + umount -d ${_lup} + fi +done + +# Unmount the space used to store *.cow. +umount /oldrun/archiso/cowspace + +# Unmount boot device if needed (no copytoram=y used) +if [[ ! -d /oldrun/archiso/copytoram ]]; then + if [[ -d /oldrun/archiso/img_dev ]]; then + umount /oldrun/archiso/img_dev + else + umount /oldrun/archiso/bootmnt + fi + if [[ -f /oldrun/archiso/nbd_client.pid ]]; then + nbd-client -d /dev/nbd0 + fi +fi + +# reboot / poweroff / halt, depending on the argument passed by init +# if something invalid is passed, we halt +case "$1" in + reboot|poweroff|halt) "$1" -f ;; + *) halt -f;; +esac diff --git a/archiso/hooks/archiso b/archiso/hooks/archiso index c973ffc..9445498 100644 --- a/archiso/hooks/archiso +++ b/archiso/hooks/archiso @@ -1,92 +1,100 @@ -# Initialize loopback device logic (we using on-demand mode) -# args: none -_init_loop_dev() { - modprobe loop - loop_dev_count=99 - loop_dev_range=$(cat /sys/block/loop0/range) - loop_dev_minor=$((loop_dev_count*loop_dev_range)) -} - -# Call this function before _make_loop_dev() each time. -# args: none -_next_loop_dev() { - loop_dev_count=$((loop_dev_count+1)) - loop_dev_minor=$((loop_dev_count*loop_dev_range)) -} - -# Setup a loopback device for image passed as argument and echo the path to loopback device used. -# args: /path/to/image_file -_make_loop_dev() { - local img="${1}" - mknod /dev/loop${loop_dev_count} b 7 ${loop_dev_minor} &> /dev/null - losetup /dev/loop${loop_dev_count} "${img}" &> /dev/null - echo /dev/loop${loop_dev_count} -} - -# args: source, mountpoint +# args: source, newroot, mountpoint _mnt_fs() { local img="${1}" - local mnt="${2}" + local newroot="${2}" + local mnt="${3}" local img_fullname="${img##*/}"; local img_name="${img_fullname%%.*}" local dm_snap_name="${dm_snap_prefix}_${img_name}" - local ro_dev ro_dev_size ro_dev_fs_type rw_dev + local ro_dev ro_dev_size rw_dev - mkdir -p "${mnt}" - - _next_loop_dev - ro_dev=$(_make_loop_dev "${img}") + ro_dev=$(losetup --find --show --read-only "${img}") + echo ${ro_dev} >> /run/archiso/used_block_devices ro_dev_size=$(blockdev --getsz ${ro_dev}) - ro_dev_fs_type=$(blkid -o value -s TYPE -p ${ro_dev} 2> /dev/null) - dd of="/cowspace/${img_name}.cow" count=0 seek=${ro_dev_size} &> /dev/null - _next_loop_dev - rw_dev=$(_make_loop_dev "/cowspace/${img_name}.cow") + if [[ "${cow_persistent}" == "P" ]]; then + if [[ -f "/run/archiso/cowspace/${cow_directory}/${img_name}.cow" ]]; then + msg ":: Found '/run/archiso/cowspace/${cow_directory}/${img_name}.cow', using as persistent." + else + msg ":: Creating '/run/archiso/cowspace/${cow_directory}/${img_name}.cow' as persistent." + dd of="/run/archiso/cowspace/${cow_directory}/${img_name}.cow" count=0 seek=${ro_dev_size} &> /dev/null + fi + else + if [[ -f "/run/archiso/cowspace/${cow_directory}/${img_name}.cow" ]]; then + msg ":: Found '/run/archiso/cowspace/${cow_directory}/${img_name}.cow' but non-persistent requested, removing." + rm -f "/run/archiso/cowspace/${cow_directory}/${img_name}.cow" + fi + msg ":: Creating '/run/archiso/cowspace/${cow_directory}/${img_name}.cow' as non-persistent." + dd of="/run/archiso/cowspace/${cow_directory}/${img_name}.cow" count=0 seek=${ro_dev_size} &> /dev/null + fi + + rw_dev=$(losetup --find --show "/run/archiso/cowspace/${cow_directory}/${img_name}.cow") + echo ${rw_dev} >> /run/archiso/used_block_devices - echo "0 ${ro_dev_size} snapshot ${ro_dev} ${rw_dev} N 8" | dmsetup create ${dm_snap_name} + echo "0 ${ro_dev_size} snapshot ${ro_dev} ${rw_dev} ${cow_persistent} 8" | dmsetup create ${dm_snap_name} - msg ":: Mounting '/dev/mapper/${dm_snap_name}' (${ro_dev_fs_type}) to '${mnt}'" - if ! mount -t "${ro_dev_fs_type}" "/dev/mapper/${dm_snap_name}" "${mnt}" ; then - echo "ERROR: while mounting '/dev/mapper/${dm_snap_name}' to '${mnt}'" - launch_interactive_shell - fi + _mnt_dev "/dev/mapper/${dm_snap_name}" "${newroot}${mnt}" "-w" + echo $(readlink -f /dev/mapper/${dm_snap_name}) >> /run/archiso/used_block_devices + echo "/dev/mapper/${dm_snap_name} ${mnt} auto defaults 0 0" >> ${newroot}/etc/fstab } # args: /path/to/image_file, mountpoint _mnt_sfs() { local img="${1}" local mnt="${2}" - local img_fullname="${img##*/}"; - - mkdir -p "${mnt}" + local img_fullname="${img##*/}" + local sfs_dev if [[ "${copytoram}" == "y" ]]; then msg -n ":: Copying squashfs image to RAM..." - if ! cp "${img}" "/copytoram/${img_fullname}" ; then - echo "ERROR: while copy '${img}' to '/copytoram/${img_fullname}'" + if ! cp "${img}" "/run/archiso/copytoram/${img_fullname}" ; then + echo "ERROR: while copy '${img}' to '/run/archiso/copytoram/${img_fullname}'" launch_interactive_shell fi - img="/copytoram/${img_fullname}" + img="/run/archiso/copytoram/${img_fullname}" msg "done." fi - _next_loop_dev - msg ":: Mounting '${img}' (SquashFS) to '${mnt}'" - if ! mount -r -t squashfs $(_make_loop_dev "${img}") "${mnt}" &> /dev/null ; then - echo "ERROR: while mounting '${img}' to '${mnt}'" + sfs_dev=$(losetup --find --show --read-only "${img}") + echo ${sfs_dev} >> /run/archiso/used_block_devices + _mnt_dev "${sfs_dev}" "${mnt}" "-r" +} + +# args: device, mountpoint, flags +_mnt_dev() { + local dev="${1}" + local mnt="${2}" + local flg="${3}" + + mkdir -p "${mnt}" + + msg ":: Mounting '${dev}' to '${mnt}'" + + while ! poll_device "${dev}" 30; do + echo "ERROR: '${dev}' device did not show up after 30 seconds..." + echo " Falling back to interactive prompt" + echo " You can try to fix the problem manually, log out when you are finished" + launch_interactive_shell + done + + if mount "${flg}" "${dev}" "${mnt}"; then + msg ":: Device '${dev}' mounted successfully." + else + echo "ERROR; Failed to mount '${dev}'" + echo " Falling back to interactive prompt" + echo " You can try to fix the problem manually, log out when you are finished" launch_interactive_shell fi } _verify_checksum() { local _status - cd "/bootmnt/${archisobasedir}" - md5sum -c checksum.md5 > /checksum.log 2>&1 + cd "/run/archiso/bootmnt/${archisobasedir}" + md5sum -c checksum.${arch}.md5 > /tmp/checksum.${arch}.log 2>&1 _status=$? cd "${OLDPWD}" return ${_status} } - run_hook() { [[ -z "${arch}" ]] && arch="$(uname -m)" [[ -z "${cowspace_size}" ]] && cowspace_size="75%" @@ -94,11 +102,24 @@ run_hook() { [[ -z "${archisobasedir}" ]] && archisobasedir="arch" [[ -z "${dm_snap_prefix}" ]] && dm_snap_prefix="arch" [[ -z "${archisodevice}" ]] && archisodevice="/dev/disk/by-label/${archisolabel}" + if [[ -z "${aitab}" ]]; then - aitab="/bootmnt/${archisobasedir}/aitab" + aitab="/run/archiso/bootmnt/${archisobasedir}/aitab" else - aitab="/bootmnt/${aitab}" + aitab="/run/archiso/bootmnt/${archisobasedir}/${aitab}" fi + + if [[ -n "${cow_label}" ]]; then + cow_device="/dev/disk/by-label/${cow_label}" + [[ -z "${cow_persistent}" ]] && cow_persistent="P" + elif [[ -n "${cow_device}" ]]; then + [[ -z "${cow_persistent}" ]] && cow_persistent="P" + else + cow_persistent="N" + fi + + [[ -z "${cow_directory}" ]] && cow_directory="persistent_${archisolabel}/${arch}" + # set mount handler for archiso mount_handler="archiso_mount_handler" } @@ -108,90 +129,69 @@ run_hook() { # args: /path/to/newroot archiso_mount_handler() { local newroot="${1}" - local fstype fserror - - _init_loop_dev - - msg ":: Waiting for boot device..." - while ! poll_device "${archisodevice}" 30; do - echo "ERROR: boot device didn't show up after 30 seconds..." - echo " Falling back to interactive prompt" - echo " You can try to fix the problem manually, log out when you are finished" - launch_interactive_shell - done - fstype=$(blkid -o value -s TYPE -p "${archisodevice}" 2> /dev/null) - if [[ -n "${fstype}" ]]; then - if mount -r -t "${fstype}" "${archisodevice}" /bootmnt; then - if [[ -f "${aitab}" ]]; then - msg ":: Mounted archiso volume successfully." - fserror=0 - else - echo "ERROR: Mounting was successful, but the '${aitab}' file does not exist." - fserror=1 - fi - else - echo "ERROR; Failed to mount '${archisodevice}' (FS is ${fstype})" - fserror=1 + if ! mountpoint -q "/run/archiso/bootmnt"; then + _mnt_dev "${archisodevice}" "/run/archiso/bootmnt" "-r" + if [[ "${copytoram}" != "y" ]]; then + echo $(readlink -f ${archisodevice}) >> /run/archiso/used_block_devices fi - else - echo "ERROR: '${archisodevice}' found, but the filesystem type is unknown." - fserror=1 fi - if [[ ${fserror} -eq 1 ]]; then + + if [[ ! -f "${aitab}" ]]; then + echo "ERROR: '${aitab}' file does not exist." echo " Falling back to interactive prompt" echo " You can try to fix the problem manually, log out when you are finished" launch_interactive_shell fi if [[ "${checksum}" == "y" ]]; then - if [[ -f "/bootmnt/${archisobasedir}/checksum.md5" ]]; then + if [[ -f "/run/archiso/bootmnt/${archisobasedir}/checksum.${arch}.md5" ]]; then msg -n ":: Self-test requested, please wait..." if _verify_checksum; then msg "done. Checksum is OK, continue booting." else echo "ERROR: one or more files are corrupted" - echo "see /checksum.log for details" + echo "see /tmp/checksum.${arch}.log for details" launch_interactive_shell fi else - echo "ERROR: checksum=y option specified but checksum.md5 not found" + echo "ERROR: checksum=y option specified but checksum.${arch}.md5 not found" launch_interactive_shell fi fi if [[ "${copytoram}" == "y" ]]; then - msg -n ":: Mounting /copytoram (tmpfs) filesystem, size=${copytoram_size}..." - mount -t tmpfs -o "size=${copytoram_size}",mode=0755 copytoram /copytoram - msg "done." + msg ":: Mounting /run/archiso/copytoram (tmpfs) filesystem, size=${copytoram_size}" + mkdir -p /run/archiso/copytoram + mount -t tmpfs -o "size=${copytoram_size}",mode=0755 copytoram /run/archiso/copytoram fi - msg -n ":: Mounting /cowspace (tmpfs) filesystem, size=${cowspace_size}..." - mount -t tmpfs -o "size=${cowspace_size}",mode=0755 cowspace /cowspace - msg "done." + if [[ -n "${cow_device}" ]]; then + _mnt_dev "${cow_device}" "/run/archiso/cowspace" "-r" + echo $(readlink -f ${cow_device}) >> /run/archiso/used_block_devices + mount -o remount,rw "/run/archiso/cowspace" + else + msg ":: Mounting /run/archiso/cowspace (tmpfs) filesystem, size=${cowspace_size}..." + mkdir -p /run/archiso/cowspace + mount -t tmpfs -o "size=${cowspace_size}",mode=0755 cowspace /run/archiso/cowspace + fi + mkdir -p "/run/archiso/cowspace/${cow_directory}" local aitab_img aitab_mnt aitab_arch aitab_sfs_comp aitab_fs_type aitab_fs_size while read aitab_img aitab_mnt aitab_arch aitab_sfs_comp aitab_fs_type aitab_fs_size; do [[ "${aitab_img#\#}" != "${aitab_img}" ]] && continue [[ "${aitab_arch}" != "any" && "${aitab_arch}" != "${arch}" ]] && continue if [[ "${aitab_fs_type}" != "none" ]]; then - if [[ "${aitab_sfs_comp}" != "none" ]]; then - _mnt_sfs "/bootmnt/${archisobasedir}/${aitab_arch}/${aitab_img}.fs.sfs" "/sfs/${aitab_img}" - _mnt_fs "/sfs/${aitab_img}/${aitab_img}.fs" "${newroot}${aitab_mnt}" - else - _mnt_fs "/bootmnt/${archisobasedir}/${aitab_arch}/${aitab_img}.fs" "${newroot}${aitab_mnt}" - fi + _mnt_sfs "/run/archiso/bootmnt/${archisobasedir}/${aitab_arch}/${aitab_img}.fs.sfs" "/run/archiso/sfs/${aitab_img}" + _mnt_fs "/run/archiso/sfs/${aitab_img}/${aitab_img}.fs" "${newroot}" "${aitab_mnt}" else - _mnt_sfs "/bootmnt/${archisobasedir}/${aitab_arch}/${aitab_img}.sfs" "${newroot}${aitab_mnt}" + _mnt_sfs "/run/archiso/bootmnt/${archisobasedir}/${aitab_arch}/${aitab_img}.sfs" "${newroot}${aitab_mnt}" fi done < "${aitab}" if [[ "${copytoram}" == "y" ]]; then - umount /bootmnt - else - mkdir "${newroot}/bootmnt" - mount --bind /bootmnt "${newroot}/bootmnt" + umount /run/archiso/bootmnt fi } diff --git a/archiso/hooks/archiso_loop_mnt b/archiso/hooks/archiso_loop_mnt index 13f8743..a02cfac 100644 --- a/archiso/hooks/archiso_loop_mnt +++ b/archiso/hooks/archiso_loop_mnt @@ -1,7 +1,8 @@ # vim: set ft=sh: run_hook () { - if [ -n "${img_dev}" ] && [ -n "${img_loop}" ]; then + [[ -n "${img_label}" ]] && img_dev="/dev/disk/by-label/${img_label}" + if [[ -n "${img_dev}" && -n "${img_loop}" ]]; then mount_handler="archiso_loop_mount_handler" fi } @@ -9,29 +10,23 @@ run_hook () { archiso_loop_mount_handler () { newroot="${1}" - msg ":: Waiting for boot device..." - while ! poll_device ${img_dev} 30; do - echo "ERROR: boot device didn't show up after 30 seconds..." - echo " Falling back to interactive prompt" - echo " You can try to fix the problem manually, log out when you are finished" - launch_interactive_shell - done + local _dev_loop + + msg ":: Setup a loop device from ${img_loop} located at device ${img_dev}" + _mnt_dev "${img_dev}" "/run/archiso/img_dev" "-r" + if [[ "${copytoram}" != "y" ]]; then + echo $(readlink -f ${img_dev}) >> /run/archiso/used_block_devices + fi - msg "::: Setup a loop device from ${img_loop} located at device ${img_dev}" - FSTYPE=$(blkid -o value -s TYPE -p ${img_dev} 2> /dev/null) - if [ -n "${FSTYPE}" ]; then - if mount -r -t "${FSTYPE}" ${img_dev} /img_dev > /dev/null 2>&1; then - _dev_loop=$(losetup -f) - losetup ${_dev_loop} /img_dev/${img_loop} - fi + if ! _dev_loop=$(losetup --find --show --read-only "/run/archiso/img_dev/${img_loop}"); then + echo "ERROR: Setting loopback device for file '/run/archiso/img_dev/${img_loop}'" + launch_interactive_shell fi archiso_mount_handler ${newroot} - if [ "${copytoram}" = "y" ]; then - msg "::: Deataching loop device ${_dev_loop}" + if [[ "${copytoram}" == "y" ]]; then losetup -d ${_dev_loop} - msg "::: Unmounting ${img_dev}" - umount ${img_dev} + umount /run/archiso/img_dev fi } diff --git a/archiso/hooks/archiso_pxe_common b/archiso/hooks/archiso_pxe_common new file mode 100644 index 0000000..febb503 --- /dev/null +++ b/archiso/hooks/archiso_pxe_common @@ -0,0 +1,42 @@ +# vim: set ft=sh: + +run_hook () { + local i net_mac bootif_mac bootif_dev + # These variables will be parsed from /tmp/net-*.conf generated by ipconfig + local DEVICE + local IPV4ADDR IPV4BROADCAST IPV4NETMASK IPV4GATEWAY IPV4DNS0 IPV4DNS1 + local HOSTNAME DNSDOMAIN NISDOMAIN ROOTSERVER ROOTPATH + local filename + # /tmp/net-*.conf + + if [[ -n "${ip}" ]]; then + if [[ -n "${BOOTIF}" ]]; then + bootif_mac=${BOOTIF#01-} + bootif_mac=${bootif_mac//-/:} + for i in /sys/class/net/*/address; do + read net_mac < ${i} + if [[ "${bootif_mac}" == "${net_mac}" ]]; then + bootif_dev=${i#/sys/class/net/} + bootif_dev=${bootif_dev%/address} + break + fi + done + ip="${ip}::${bootif_dev}" + fi + + # setup network and save some values + ipconfig "ip=${ip}" + + . /tmp/net-*.conf + + pxeserver=${ROOTSERVER} + + # setup DNS resolver + if [[ "${IPV4DNS0}" != "0.0.0.0" ]]; then + echo "nameserver ${IPV4DNS0}" > /etc/resolv.conf + fi + if [[ "${IPV4DNS1}" != "0.0.0.0" ]]; then + echo "nameserver ${IPV4DNS1}" >> /etc/resolv.conf + fi + fi +} diff --git a/archiso/hooks/archiso_pxe_http b/archiso/hooks/archiso_pxe_http new file mode 100644 index 0000000..ae56210 --- /dev/null +++ b/archiso/hooks/archiso_pxe_http @@ -0,0 +1,61 @@ +# vim: set ft=sh: + +run_hook() { + if [[ -n "${ip}" && -n "${archiso_http_srv}" ]]; then + + archiso_http_srv=$(eval echo ${archiso_http_srv}) + [[ -z "${archiso_http_spc}" ]] && archiso_http_spc="75%" + + mount_handler="archiso_pxe_http_mount_handler" + fi +} + +# Fetch a file with CURL +# +# $1 URL +# $2 Destination directory inside httpspace/${archisobasedir} +_curl_get() { + local _url="${1}" + local _dst="${2}" + + msg ":: Downloading '${_url}'" + if ! curl -f -o "/run/archiso/httpspace/${archisobasedir}${_dst}/${_url##*/}" --create-dirs "${_url}"; then + echo "ERROR: Downloading '${_url}'" + echo " Falling back to interactive prompt" + echo " You can try to fix the problem manually, log out when you are finished" + launch_interactive_shell + fi +} + +archiso_pxe_http_mount_handler () { + newroot="${1}" + + msg ":: Mounting /run/archiso/httpspace (tmpfs) filesystem, size='${archiso_http_spc}'" + mkdir -p "/run/archiso/httpspace" + mount -t tmpfs -o size="${archiso_http_spc}",mode=0755 httpspace "/run/archiso/httpspace" + + local _aitab_url="${archiso_http_srv}${aitab#/run/archiso/bootmnt/}" + local _aitab_file="/run/archiso/httpspace/${aitab#/run/archiso/bootmnt/}" + + _curl_get "${_aitab_url}" "/" + + local aitab_img aitab_mnt aitab_arch aitab_sfs_comp aitab_fs_type aitab_fs_size + while read aitab_img aitab_mnt aitab_arch aitab_sfs_comp aitab_fs_type aitab_fs_size; do + [[ "${aitab_img#\#}" != "${aitab_img}" ]] && continue + [[ "${aitab_arch}" != "any" && "${aitab_arch}" != "${arch}" ]] && continue + if [[ "${aitab_fs_type}" != "none" ]]; then + _curl_get "${archiso_http_srv}${archisobasedir}/${aitab_arch}/${aitab_img}.fs.sfs" "/${aitab_arch}" + else + _curl_get "${archiso_http_srv}${archisobasedir}/${aitab_arch}/${aitab_img}.sfs" "/${aitab_arch}" + fi + done < "${_aitab_file}" + + if [[ "${checksum}" == "y" ]]; then + _curl_get "${archiso_http_srv}${archisobasedir}/checksum.${arch}.md5" "/" + fi + + mkdir -p "/run/archiso/bootmnt" + mount -o bind /run/archiso/httpspace /run/archiso/bootmnt + + archiso_mount_handler ${newroot} +} diff --git a/archiso/hooks/archiso_pxe_nbd b/archiso/hooks/archiso_pxe_nbd index 588e033..6147d06 100644 --- a/archiso/hooks/archiso_pxe_nbd +++ b/archiso/hooks/archiso_pxe_nbd @@ -1,60 +1,9 @@ # vim: set ft=sh: -run_hook () { - local line i address netmask gateway dns0 dns1 rootserver rootpath filename - : > /ip_opts - - if [ -n "${ip}" ]; then - if [ -n "${BOOTIF}" ]; then - bootif_mac=${BOOTIF#01-} - bootif_mac=${bootif_mac//-/:} - bootif_dev=$(grep -l $bootif_mac /sys/class/net/*/address) - bootif_dev=${bootif_dev#/sys/class/net/} - bootif_dev=${bootif_dev%/address} - ip="$ip::$bootif_dev" - fi - - # setup network and save some values - ipconfig "ip=${ip}" | while read line; do - # echo ":: ${line}" - if [ "${line#"IP-Config:"}" != "${line}" ]; then - continue - fi - line="$(echo ${line} | sed -e 's/ :/:/g;s/: /=/g')" - for i in ${line}; do - case "${i}" in - address=*) - echo "${i}" >> /ip_opts - ;; - netmask=*) - echo "${i}" >> /ip_opts - ;; - gateway=*) - echo "${i}" >> /ip_opts - ;; - dns0=*) - echo "${i}" >> /ip_opts - ;; - dns1=*) - echo "${i}" >> /ip_opts - ;; - rootserver=*) - echo "${i}" >> /ip_opts - ;; - rootpath=*) - echo "${i}" >> /ip_opts - ;; - esac - done - done - - . /ip_opts - - echo "IP-Config: ${address}/${netmask}" - echo "IP-Config: gw: ${gateway} dns0: ${dns0} dns1: ${dns1}" - - nbdserver=${rootserver} +run_hook() { + if [[ -n "${ip}" && -n "${archiso_nbd_srv}" ]]; then + archiso_nbd_srv=$(eval echo ${archiso_nbd_srv}) [[ -z "${archiso_nbd_name}" ]] && archiso_nbd_name="archiso" mount_handler="archiso_pxe_nbd_mount_handler" @@ -74,21 +23,23 @@ archiso_pxe_nbd_mount_handler () { launch_interactive_shell done - msg "::: Setup NBD from ${nbdserver} at /dev/nbd0" - if [ "${copytoram}" = "y" ]; then - nbd-client ${nbdserver} -N ${archiso_nbd_name} /dev/nbd0 + msg ":: Setup NBD from ${archiso_nbd_srv} at /dev/nbd0" + if [[ "${copytoram}" = "y" ]]; then + nbd-client ${archiso_nbd_srv} -N ${archiso_nbd_name} /dev/nbd0 else - nbd-client ${nbdserver} -N ${archiso_nbd_name} /dev/nbd0 -persist + nbd-client ${archiso_nbd_srv} -N ${archiso_nbd_name} /dev/nbd0 -persist fi archisodevice=/dev/nbd0 archiso_mount_handler ${newroot} - if [ "${copytoram}" = "y" ]; then - msg "::: Disconnect NBD from ${nbdserver} at /dev/nbd0" + if [[ "${copytoram}" = "y" ]]; then + msg ":: Disconnect NBD from ${archiso_nbd_srv} at /dev/nbd0" nbd-client -d /dev/nbd0 else - pidof nbd-client > /run/nbd_client.pid + mkdir -p /run/archiso + pidof nbd-client > /run/archiso/nbd_client.pid + cp /archiso_pxe_nbd ${newroot}/etc/rc.d/functions.d/ fi } diff --git a/archiso/hooks/archiso_pxe_nfs b/archiso/hooks/archiso_pxe_nfs new file mode 100644 index 0000000..a053672 --- /dev/null +++ b/archiso/hooks/archiso_pxe_nfs @@ -0,0 +1,26 @@ +# vim: set ft=sh: + +run_hook() { + if [[ -n "${ip}" && -n "${archiso_nfs_srv}" ]]; then + + archiso_nfs_srv=$(eval echo ${archiso_nfs_srv}) + [[ -n "${archiso_nfs_opt}" ]] && archiso_nfs_opt="-o ${archiso_nfs_opt}" + + mount_handler="archiso_nfs_mount_handler" + fi +} + +archiso_nfs_mount_handler() { + newroot="${1}" + mkdir -p "/run/archiso/bootmnt" + msg ":: Mounting '${archiso_nfs_srv}'" + # Do not put "${archiso_nfs_opt}" nfsmount fails! + if ! nfsmount ${archiso_nfs_opt} "${archiso_nfs_srv}" "/run/archiso/bootmnt"; then + echo "ERROR: Mounting '${archiso_nfs_srv}'" + echo " Falling back to interactive prompt" + echo " You can try to fix the problem manually, log out when you are finished" + launch_interactive_shell + fi + + archiso_mount_handler ${newroot} +} diff --git a/archiso/hooks/archiso_shutdown b/archiso/hooks/archiso_shutdown new file mode 100644 index 0000000..24e4103 --- /dev/null +++ b/archiso/hooks/archiso_shutdown @@ -0,0 +1,23 @@ +run_hook () +{ + msg -n ":: Creating shutdown ramfs..." + + for _dir in bin lib sbin usr/bin usr/lib usr/sbin; do + mkdir -p /run/initramfs/${_dir} + done + cp /bin/busybox /run/initramfs/bin/ + cp /lib/ld-* /run/initramfs/lib/ + cp /lib/lib* /run/initramfs/lib/ + cp /usr/lib/lib* /run/initramfs/usr/lib/ + cp /bin/mount /run/initramfs/bin/ + cp /sbin/dmsetup /run/initramfs/sbin/ + cp /sbin/losetup /run/initramfs/sbin/ + if [[ -x /bin/nbd-client ]]; then + cp /bin/nbd-client /run/initramfs/bin/ + fi + + chroot /run/initramfs /bin/busybox --install + cp /shutdown /run/initramfs/ + + msg "done." +} diff --git a/archiso/install/archiso b/archiso/install/archiso index 514c011..c36c001 100644 --- a/archiso/install/archiso +++ b/archiso/install/archiso @@ -1,30 +1,19 @@ -build () -{ - MODULES="cdrom ide-cd_mod ide-core ide-generic loop dm-mod dm-snapshot squashfs isofs $(all_modules '/kernel/fs' | grep -v "nls")" - MODULES="${MODULES} $(checked_modules "/usb/host" | grep -ve "_cs" -e "sl811_hcd" -e "isp116x_hcd")" - MODULES="${MODULES} usb_storage sd_mod sr_mod" - MODULES="${MODULES} virtio_pci virtio_blk" - MODULES=$(echo ${MODULES}) #trim whitespace +#!/bin/bash - BINARIES="" - FILES="" - - add_dir /cowspace - add_dir /copytoram - add_dir /bootmnt - - add_binary /lib/udev/cdrom_id - add_binary /sbin/blockdev - add_binary /sbin/lvm - add_binary /sbin/dmsetup +build() { + MODULES="cdrom loop dm-snapshot" + SCRIPT="archiso" - add_file /lib/udev/rules.d/60-cdrom_id.rules - add_file /lib/udev/rules.d/10-dm.rules - add_file /lib/udev/rules.d/13-dm-disk.rules - add_file /lib/udev/rules.d/95-dm-notify.rules - add_file /lib/udev/rules.d/11-dm-lvm.rules + add_binary /usr/lib/udev/cdrom_id + add_binary blockdev + add_binary dmsetup + add_binary losetup + add_binary mountpoint - SCRIPT="archiso" + add_file /usr/lib/udev/rules.d/60-cdrom_id.rules + add_file /usr/lib/udev/rules.d/10-dm.rules + add_file /usr/lib/udev/rules.d/95-dm-notify.rules + add_file /usr/lib/initcpio/udev/11-dm-initramfs.rules /usr/lib/udev/rules.d/11-dm-initramfs.rules } -# vim:ft=sh:ts=4:sw=4:et: +# vim: set ft=sh ts=4 sw=4 et: diff --git a/archiso/install/archiso_kms b/archiso/install/archiso_kms new file mode 100644 index 0000000..6566049 --- /dev/null +++ b/archiso/install/archiso_kms @@ -0,0 +1,14 @@ +#!/bin/bash + +build() { + MODULES="radeon nouveau i915 via-agp sis-agp intel-agp" + if [[ $(uname -m) == i686 ]]; then + MODULES+=" amd64-agp ati-agp sworks-agp ali-agp amd-k7-agp nvidia-agp efficeon-agp" + fi +} + +help() { + cat << HELPEOF +Adds all common KMS drivers to the initramfs image. +HELPEOF +} diff --git a/archiso/install/archiso_loop_mnt b/archiso/install/archiso_loop_mnt index 2c8d6f2..4141043 100644 --- a/archiso/install/archiso_loop_mnt +++ b/archiso/install/archiso_loop_mnt @@ -1,18 +1,13 @@ -# vim: set ft=sh: +#!/bin/bash -build () -{ - MODULES="" - - BINARIES="" - FILES="" - add_dir /img_dev +build() { SCRIPT="archiso_loop_mnt" } -help () -{ +help() { cat<<HELPEOF This hook loads the necessary modules for boot via loop device. HELPEOF } + +# vim: set ft=sh ts=4 sw=4 et: diff --git a/archiso/install/archiso_pxe_common b/archiso/install/archiso_pxe_common new file mode 100644 index 0000000..b37e5a1 --- /dev/null +++ b/archiso/install/archiso_pxe_common @@ -0,0 +1,30 @@ +#!/bin/bash + +build() { + MODULES="${MODULES} $(comm -2 -3 <(checked_modules "/drivers/net/" | sort) \ + <(find $MODULEDIR/kernel/drivers/net/{irda,phy,wimax,wireless} \ + -name '*.ko*' \ + -exec bash -c 'printf "%s\n" "${@%%.ko*}" | sed "s@.*/@@;s@-@_@" | sort' _ {} +) \ + | grep -v -e 'ppp_' -e 'plip' -e 'pppoe')" + SCRIPT="archiso_pxe_common" + + + add_binary /lib/initcpio/ipconfig /bin/ipconfig + + # Add hosts support files+dns + add_symlink /lib/libnss_files.so.2 $(readlink /lib/libnss_files.so.2) + add_binary $(readlink -f /lib/libnss_files.so.2) + add_symlink /lib/libnss_dns.so.2 $(readlink /lib/libnss_dns.so.2) + add_binary $(readlink -f /lib/libnss_dns.so.2) + + add_dir /etc + echo "hosts: files dns" > $BUILDROOT/etc/nsswitch.conf +} + +help() { +cat<<HELPEOF + This hook loads the necessary modules for boot via PXE. +HELPEOF +} + +# vim: set ft=sh ts=4 sw=4 et: diff --git a/archiso/install/archiso_pxe_http b/archiso/install/archiso_pxe_http new file mode 100644 index 0000000..9e2ff65 --- /dev/null +++ b/archiso/install/archiso_pxe_http @@ -0,0 +1,15 @@ +#!/bin/bash + +build() { + SCRIPT="archiso_pxe_http" + + add_binary curl +} + +help() { +cat<<HELPEOF + This hook loads the necessary modules for boot via PXE and HTTP. +HELPEOF +} + +# vim: set ft=sh ts=4 sw=4 et: diff --git a/archiso/install/archiso_pxe_nbd b/archiso/install/archiso_pxe_nbd index c8ba1a4..1ee3910 100644 --- a/archiso/install/archiso_pxe_nbd +++ b/archiso/install/archiso_pxe_nbd @@ -1,24 +1,18 @@ -# vim: set ft=sh: +#!/bin/bash -build () -{ +build() { MODULES="nbd" - MODULES="${MODULES} $(comm -2 -3 <(checked_modules "/drivers/net/" | sort) \ - <(find $MODULEDIR/kernel/drivers/net/{irda,phy,wimax,wireless} \ - -name '*.ko*' \ - -exec bash -c 'printf "%s\n" "${@%%.ko*}" | sed "s@.*/@@;s@-@_@" | sort' _ {} +) \ - | grep -v -e 'ppp_' -e 'plip' -e 'pppoe')" - BINARIES="" - FILES="" SCRIPT="archiso_pxe_nbd" - add_binary "/usr/sbin/nbd-client" "/bin/nbd-client" - add_binary "/lib/initcpio/ipconfig" "/bin/ipconfig" + add_binary nbd-client + + add_file /usr/lib/initcpio/archiso_pxe_nbd /archiso_pxe_nbd } -help () -{ +help() { cat<<HELPEOF This hook loads the necessary modules for boot via PXE and NBD. HELPEOF } + +# vim: set ft=sh ts=4 sw=4 et: diff --git a/archiso/install/archiso_pxe_nfs b/archiso/install/archiso_pxe_nfs new file mode 100644 index 0000000..f7b6f5d --- /dev/null +++ b/archiso/install/archiso_pxe_nfs @@ -0,0 +1,16 @@ +#!/bin/bash + +build() { + MODULES="nfs" + SCRIPT="archiso_pxe_nfs" + + add_binary /lib/initcpio/nfsmount /bin/nfsmount +} + +help() { + cat <<HELPEOF + This hook loads the necessary modules for boot via PXE and NFS. +HELPEOF +} + +# vim: set ft=sh ts=4 sw=4 et: diff --git a/archiso/install/archiso_shutdown b/archiso/install/archiso_shutdown new file mode 100644 index 0000000..87b8297 --- /dev/null +++ b/archiso/install/archiso_shutdown @@ -0,0 +1,18 @@ +#!/bin/bash + +build() { + SCRIPT="archiso_shutdown" + + add_file /usr/lib/initcpio/archiso_shutdown /shutdown +} + +help() { + cat <<HELPEOF +This hook will create a shutdown initramfs in /run/initramfs +that we can pivot to on shutdown in order to unmount / and +and others mount points, dm-snapshot devices and loopback devices. +Mostly usefull for dm-snapshot persistent. +HELPEOF +} + +# vim: set ft=sh ts=4 sw=4 et: diff --git a/archiso/mkarchiso b/archiso/mkarchiso index 1c3242d..6f02131 100755 --- a/archiso/mkarchiso +++ b/archiso/mkarchiso @@ -2,15 +2,20 @@ set -e -u +export LANG=C + app_name=${0##*/} arch=$(uname -m) pkg_list="" +run_cmd="" quiet="y" pacman_conf="/etc/pacman.conf" export iso_label="PARABOLA_$(date +%Y%m)" iso_publisher="Parabola GNU/Linux-libre <https://parabolagnulinux.org>" iso_application="Parabola Live/Rescue CD" install_dir="libre" +work_dir="work" +out_dir="out" # Show an INFO message # $1: message string @@ -42,6 +47,44 @@ _show_space_usage () { _msg_info "Total: ${_total} MiB (100%) | Used: ${_used} MiB (${_pct_u}) | Avail: ${_avail} MiB ($((100 - ${_pct_u%\%}))%)" } +_chroot_mount () { + mount -t devtmpfs dev "${work_dir}/root-image/dev" + mount -t devpts devpts "${work_dir}/root-image/dev/pts" + mount -t tmpfs devshm "${work_dir}/root-image/dev/shm" + mount -t proc proc "${work_dir}/root-image/proc" + mount -t tmpfs run "${work_dir}/root-image/run" + mount -t sysfs sys "${work_dir}/root-image/sys" + mount -t tmpfs tmp "${work_dir}/root-image/tmp" + + trap '_chroot_umount' EXIT HUP INT TERM +} + +_chroot_umount () { + umount "${work_dir}/root-image/tmp" + umount "${work_dir}/root-image/sys" + umount "${work_dir}/root-image/run" + umount "${work_dir}/root-image/proc" + umount "${work_dir}/root-image/dev/shm" + umount "${work_dir}/root-image/dev/pts" + umount "${work_dir}/root-image/dev" + + trap - EXIT HUP INT TERM +} + +_chroot_init() { + if [[ ! -d ${work_dir}/root-image/var/cache/pacman ]]; then + mkdir -p ${work_dir}/root-image/{dev,proc,run,sys,tmp,var/lib/pacman} + _pacman "base" + _pacman "syslinux" + fi +} + +_chroot_run() { + _chroot_mount + eval chroot ${work_dir}/root-image "${run_cmd}" + _chroot_umount +} + # Mount a filesystem (trap signals in case of error for unmounting it # $1: source image # $2: mount-point @@ -97,30 +140,44 @@ _usage () echo "usage ${app_name} [options] command <command options>" echo " general options:" echo " -p PACKAGE(S) Package(s) to install, can be used multiple times" - echo " -C <file> Config file for pacman. Default ${pacman_conf}" + echo " -r <command> Run <command> inside root-image" + echo " -C <file> Config file for pacman." + echo " Default: '${pacman_conf}'" echo " -L <label> Set a label for the disk" + echo " Default: '${iso_label}'" echo " -P <publisher> Set a publisher for the disk" + echo " Default: '${iso_publisher}'" echo " -A <application> Set an application name for the disk" + echo " Default: '${iso_application}'" echo " -D <install_dir> Set an install_dir. All files will by located here." - echo " Default ${install_dir}" + echo " Default: '${install_dir}'" echo " NOTE: Max 8 characters, use only [a-z0-9]" + echo " -w <work_dir> Set the working directory" + echo " Default: '${work_dir}'" + echo " -o <out_dir> Set the output directory" + echo " Default: '${out_dir}'" echo " -v Enable verbose output" echo " -h This message" echo " commands:" - echo " create <dir>" - echo " create a base directory layout to work with" - echo " includes all specified packages" - echo " prepare <dir>" + echo " init" + echo " Make base layout and install base group" + echo " install" + echo " Install all specified packages (-p)" + echo " run" + echo " run command specified by -r" + echo " prepare" echo " build all images" - echo " checksum <dir>" + echo " checksum" echo " make a checksum.md5 for self-test" - echo " iso <dir> <image name>" + echo " pkglist" + echo " make a pkglist.txt of packages installed on root-image" + echo " iso <image name>" echo " build an iso image from the working dir" exit ${1} } # Shows configuration according to command mode. -# $1: create | prepare | iso +# $1: init | install | run | prepare | checksum | iso _show_config () { local _mode="$1" echo @@ -130,14 +187,22 @@ _show_config () { _msg_info " Working directory: ${work_dir}" _msg_info " Installation directory: ${install_dir}" case "${_mode}" in - create) + init) + _msg_info " Pacman config file: ${pacman_conf}" + ;; + install) _msg_info " Pacman config file: ${pacman_conf}" _msg_info " Packages: ${pkg_list}" ;; + run) + _msg_info " Run command: ${run_cmd}" + ;; prepare) ;; checksum) ;; + pkglist) + ;; iso) _msg_info " Image name: ${img_name}" _msg_info " Disk label: ${iso_label}" @@ -153,20 +218,23 @@ _pacman () { _msg_info "Installing packages to '${work_dir}/root-image/'..." + _chroot_mount + if [[ "${quiet}" = "y" ]]; then - mkarchroot -n -C "${pacman_conf}" -f "${work_dir}/root-image" $* &> /dev/null + pacman -Sy -r "${work_dir}/root-image" --config "${pacman_conf}" --needed --noconfirm $* &> /dev/null else - mkarchroot -n -C "${pacman_conf}" -f "${work_dir}/root-image" $* + pacman -Sy -r "${work_dir}/root-image" --config "${pacman_conf}" --needed --noconfirm $* fi - # Cleanup - find "${work_dir}" -name "*.pacnew" -name "*.pacsave" -name "*.pacorig" -delete + _chroot_umount + _msg_info "Packages installed successfully!" } # Cleanup root-image _cleanup () { _msg_info "Cleaning up what we can on root-image" + # remove the initcpio images that were generated for the host system if [[ -d "${work_dir}/root-image/boot" ]]; then find "${work_dir}/root-image/boot" -name '*.img' -delete @@ -195,9 +263,11 @@ _cleanup () { if [[ -d "${work_dir}/root-image/tmp" ]]; then find "${work_dir}/root-image/tmp" -mindepth 1 -delete fi - # Delete etc/mtab if not is a symlink. + # Delete package pacman related files. + find "${work_dir}" -name "*.pacnew" -name "*.pacsave" -name "*.pacorig" -delete + # Create etc/mtab if not is a symlink. if [[ ! -L "${work_dir}/root-image/etc/mtab" ]]; then - rm -f "${work_dir}/root-image/etc/mtab" + ln -sf "/proc/self/mounts" "${work_dir}/root-image/etc/mtab" fi } @@ -217,9 +287,9 @@ _mksfs () { _msg_info "Creating SquashFS image for '${work_dir}/${_src}', This may take some time..." local _seconds=${SECONDS} if [[ "${quiet}" = "y" ]]; then - mksquashfs "${work_dir}/${_src}" "${_sfs_img}" -noappend -comp "${_sfs_comp}" &> /dev/null + mksquashfs "${work_dir}/${_src}" "${_sfs_img}" -noappend -comp "${_sfs_comp}" -no-progress &> /dev/null else - mksquashfs "${work_dir}/${_src}" "${_sfs_img}" -noappend -comp "${_sfs_comp}" + mksquashfs "${work_dir}/${_src}" "${_sfs_img}" -noappend -comp "${_sfs_comp}" -no-progress fi _seconds=$((SECONDS - _seconds)) printf "[mkarchiso] INFO: Image creation done in %02d:%02d minutes\n" $((_seconds / 60)) $((_seconds % 60)) @@ -293,40 +363,79 @@ _mkfs () { command_checksum () { _show_config checksum - _msg_info "Creating checksum file for self-test" - cd "${work_dir}/iso/${install_dir}" - find -type f ! -name checksum.md5 -print0 | xargs -0 md5sum > checksum.md5 - cd ${OLDPWD} - _msg_info "Done!" + local _chk_arch + + for _chk_arch in i686 x86_64; do + if _is_directory_changed "${work_dir}/iso/${install_dir}" "${work_dir}/iso/${install_dir}/checksum.${_chk_arch}.md5"; then + _msg_info "Creating checksum file for self-test (${_chk_arch})" + cd "${work_dir}/iso/${install_dir}" + if [[ -d "${_chk_arch}" ]]; then + md5sum aitab > checksum.${_chk_arch}.md5 + find ${_chk_arch} -type f -print0 | xargs -0 md5sum >> checksum.${_chk_arch}.md5 + if [[ -d "any" ]]; then + find any -type f -print0 | xargs -0 md5sum >> checksum.${_chk_arch}.md5 + fi + fi + cd ${OLDPWD} + _msg_info "Done!" + fi + done +} + +command_pkglist () { + _show_config pkglist + + if _is_directory_changed "${work_dir}/root-image/var/lib/pacman/local" "${work_dir}/iso/${install_dir}/pkglist.${arch}.txt"; then + _msg_info "Creating a list of installed packages on live-enviroment" + pacman -Sl -r "${work_dir}/root-image" --config "${pacman_conf}" | \ + awk '/\[installed\]$/ {print $1 "/" $2 "-" $3}' > \ + "${work_dir}/iso/${install_dir}/pkglist.${arch}.txt" + _msg_info "Done!" + fi + } # Create an ISO9660 filesystem from "iso" directory. command_iso () { + local _iso_efi_boot_args="" + if [[ ! -f "${work_dir}/iso/isolinux/isolinux.bin" ]]; then _msg_error "The file '${work_dir}/iso/isolinux/isolinux.bin' does not exist." 1 fi + if [[ ! -f "${work_dir}/iso/isolinux/isohdpfx.bin" ]]; then + _msg_error "The file '${work_dir}/iso/isolinux/isohdpfx.bin' does not exist." 1 + fi - _show_config iso + # If exists, add an EFI "El Torito" boot image (FAT filesystem) to ISO-9660 image. + if [[ -f "${work_dir}/iso/EFI/archiso/efiboot.img" ]]; then + _iso_efi_boot_args="--efi-boot EFI/archiso/efiboot.img" + fi - _is_directory_changed "${work_dir}/iso" "${img_name}" + _show_config iso - _msg_info "Creating ISO image..." - local _qflag="" - if [[ ${quiet} == "y" ]]; then - _qflag="-quiet" + if _is_directory_changed "${work_dir}/iso" "${out_dir}/${img_name}"; then + mkdir -p ${out_dir} + _msg_info "Creating ISO image..." + local _qflag="" + if [[ ${quiet} == "y" ]]; then + _qflag="-quiet" + fi + xorriso -as mkisofs ${_qflag} \ + -iso-level 3 \ + -full-iso9660-filenames \ + -volid "${iso_label}" \ + -appid "${iso_application}" \ + -publisher "${iso_publisher}" \ + -preparer "prepared by mkarchiso" \ + -eltorito-boot isolinux/isolinux.bin \ + -eltorito-catalog isolinux/boot.cat \ + -no-emul-boot -boot-load-size 4 -boot-info-table \ + ${_iso_efi_boot_args} \ + -isohybrid-mbr ${work_dir}/iso/isolinux/isohdpfx.bin \ + -output "${out_dir}/${img_name}" \ + "${work_dir}/iso/" + _msg_info "Done! | $(ls -sh ${out_dir}/${img_name})" fi - mkisofs ${_qflag} -r -l \ - -b isolinux/isolinux.bin -c isolinux/boot.cat \ - -uid 0 -gid 0 \ - -udf -allow-limited-size -iso-level 3 \ - -input-charset utf-8 -p "prepared by mkarchiso" \ - -no-emul-boot -boot-load-size 4 -boot-info-table \ - -publisher "${iso_publisher}" \ - -A "${iso_application}" \ - -V "${iso_label}" \ - -o "${img_name}" "${work_dir}/iso/" - isohybrid "${img_name}" - _msg_info "Done! | $(ls -sh ${img_name})" } # Parse aitab and create each filesystem specified on that, and push it in "iso" directory. @@ -342,25 +451,15 @@ command_prepare () { if [[ ${_aitab_img} =~ ^# ]]; then continue fi - if [[ ${_aitab_sfs_comp} == "none" && ${_aitab_fs_type} == "none" ]]; then - _msg_error "In aitab, both fields 'sfs_comp' and 'fs_type' are set to none for '${_aitab_img}' image" 1 - fi local _src="${work_dir}/${_aitab_img}" local _dst="${work_dir}/iso/${install_dir}/${_aitab_arch}" mkdir -p "${_dst}" if [[ ${_aitab_fs_type} != "none" ]]; then - if [[ ${_aitab_sfs_comp} != "none" ]]; then - if _is_directory_changed "${_src}" "${_dst}/${_aitab_img}.fs.sfs"; then - _mkfs ${_aitab_img} ${_aitab_fs_type} ${_aitab_fs_size} - _mksfs ${_aitab_img}.fs ${_aitab_sfs_comp} - mv "${_src}.fs.sfs" "${_dst}" - rm "${_src}.fs" - fi - else - if _is_directory_changed "${_src}" "${_dst}/${_aitab_img}.fs"; then - _mkfs ${_aitab_img} ${_aitab_fs_type} ${_aitab_fs_size} - mv "${work_dir}/${_aitab_img}.fs" "${_dst}" - fi + if _is_directory_changed "${_src}" "${_dst}/${_aitab_img}.fs.sfs"; then + _mkfs ${_aitab_img} ${_aitab_fs_type} ${_aitab_fs_size} + _mksfs ${_aitab_img}.fs ${_aitab_sfs_comp} + mv "${_src}.fs.sfs" "${_dst}" + rm "${_src}.fs" fi else if _is_directory_changed "${_src}" "${_dst}/${_aitab_img}.sfs"; then @@ -373,7 +472,7 @@ command_prepare () { # Install packages on root-image. # A basic check to avoid double execution/reinstallation is done via hashing package names. -command_create () { +command_install () { if [[ ! -f "${pacman_conf}" ]]; then _msg_error "Pacman config file '${pacman_conf}' does not exist" 1 fi @@ -386,32 +485,43 @@ command_create () { _usage 1 fi - _show_config create + _show_config install local _pkg_list_hash _pkg_list_hash=$(echo ${pkg_list} | sort -u | md5sum | cut -c1-32) - if [[ -f "${work_dir}/create.${_pkg_list_hash}" ]]; then + if [[ -f "${work_dir}/install.${_pkg_list_hash}" ]]; then _msg_info "These packages are already installed, skipping." else - mkdir -p "${work_dir}/root-image/" _pacman "${pkg_list}" - : > "${work_dir}/create.${_pkg_list_hash}" + : > "${work_dir}/install.${_pkg_list_hash}" fi } +command_init() { + _show_config init + _chroot_init +} + +command_run() { + _show_config run + _chroot_run +} if [[ ${EUID} -ne 0 ]]; then _msg_error "This script must be run as root." 1 fi -while getopts 'p:C:L:P:A:D:fvh' arg; do +while getopts 'p:r:C:L:P:A:D:w:o:vh' arg; do case "${arg}" in p) pkg_list="${pkg_list} ${OPTARG}" ;; + r) run_cmd="${OPTARG}" ;; C) pacman_conf="${OPTARG}" ;; L) iso_label="${OPTARG}" ;; P) iso_publisher="${OPTARG}" ;; A) iso_application="${OPTARG}" ;; D) install_dir="${OPTARG}" ;; + w) work_dir="${OPTARG}" ;; + o) out_dir="${OPTARG}" ;; v) quiet="n" ;; h|?) _usage 0 ;; *) @@ -429,15 +539,15 @@ if [[ $# -lt 1 ]]; then fi command_name="${1}" -if [[ $# -lt 2 ]]; then - _msg_error "No working directory specified" 0 - _usage 1 -fi -work_dir="${2}" - case "${command_name}" in - create) - command_create + init) + command_init + ;; + install) + command_install + ;; + run) + command_run ;; prepare) command_prepare @@ -445,12 +555,15 @@ case "${command_name}" in checksum) command_checksum ;; + pkglist) + command_pkglist + ;; iso) - if [[ $# -lt 3 ]]; then + if [[ $# -lt 2 ]]; then _msg_error "No image specified" 0 _usage 1 fi - img_name="${3}" + img_name="${2}" command_iso ;; *) diff --git a/archiso/testiso b/archiso/testiso index 75bedc9..71e85e1 100755 --- a/archiso/testiso +++ b/archiso/testiso @@ -1,6 +1,6 @@ #!/bin/bash -if [ $# -eq 0 ]; then +if [[ $# -eq 0 ]]; then echo "usage: testiso <isofile> [id|ic|sd|sc|vd|vc]" echo echo "id boot .iso as IDE disk" @@ -8,7 +8,7 @@ if [ $# -eq 0 ]; then echo "sd boot .iso as SCSI disk" echo "sc boot .iso as SCSI cd-rom" echo "vd boot .iso as virtio disk" - echo "vc boot .iso as virtio cd-rom" +# echo "vc boot .iso as virtio cd-rom" exit 1 fi @@ -18,9 +18,9 @@ case "${2}" in sd) IF="scsi"; MEDIA="disk";; sc) IF="scsi"; MEDIA="cdrom";; vd) IF="virtio"; MEDIA="disk";; - vc) IF="virtio"; MEDIA="cdrom";; +# vc) IF="virtio"; MEDIA="cdrom";; *) IF="scsi"; MEDIA="cdrom";; esac -echo qemu -m 256 -drive file=${1},if=${IF},media=${MEDIA},boot=on -qemu -m 256 -drive file=${1},if=${IF},media=${MEDIA},boot=on +echo qemu-system-x86_64 -m 256 -drive file=${1},if=${IF},media=${MEDIA},boot=on +qemu-system-x86_64 -m 256 -drive file=${1},if=${IF},media=${MEDIA},boot=on diff --git a/configs/baseline/build.sh b/configs/baseline/build.sh index 3ae50e7..02f0fb5 100755 --- a/configs/baseline/build.sh +++ b/configs/baseline/build.sh @@ -2,27 +2,28 @@ set -e -u -name=parabola +iso_name=parabola iso_label="PARABOLA_$(date +%Y%m)" -version=$(date +%Y.%m.%d) +iso_version=$(date +%Y.%m.%d) install_dir=libre arch=$(uname -m) work_dir=work +out_dir=out verbose="n" script_path=$(readlink -f ${0%/*}) # Base installation (root-image) make_basefs() { - mkarchiso ${verbose} -D "${install_dir}" -p "base" create "${work_dir}" - mkarchiso ${verbose} -D "${install_dir}" -p "syslinux" create "${work_dir}" + mkarchiso ${verbose} -w "${work_dir}" -D "${install_dir}" init } # Copy mkinitcpio archiso hooks (root-image) make_setup_mkinitcpio() { if [[ ! -e ${work_dir}/build.${FUNCNAME} ]]; then - cp /lib/initcpio/hooks/archiso ${work_dir}/root-image/lib/initcpio/hooks - cp /lib/initcpio/install/archiso ${work_dir}/root-image/lib/initcpio/install + cp /usr/lib/initcpio/hooks/archiso ${work_dir}/root-image/usr/lib/initcpio/hooks + cp /usr/lib/initcpio/install/archiso ${work_dir}/root-image/usr/lib/initcpio/install + cp ${script_path}/mkinitcpio.conf ${work_dir}/root-image/etc/mkinitcpio-libreiso.conf : > ${work_dir}/build.${FUNCNAME} fi } @@ -31,11 +32,10 @@ make_setup_mkinitcpio() { make_boot() { if [[ ! -e ${work_dir}/build.${FUNCNAME} ]]; then mkdir -p ${work_dir}/iso/${install_dir}/boot/${arch} - mkinitcpio \ - -c ${script_path}/mkinitcpio.conf \ - -b ${work_dir}/root-image \ - -k /boot/vmlinuz-linux-libre \ - -g ${work_dir}/iso/${install_dir}/boot/${arch}/libreiso.img + mkarchiso ${verbose} -w "${work_dir}" -D "${install_dir}" \ + -r 'mkinitcpio -c /etc/mkinitcpio-libreiso.conf -k /boot/vmlinuz-linux-libre -g /boot/libreiso.img' \ + run + cp ${work_dir}/root-image/boot/libreiso.img ${work_dir}/iso/${install_dir}/boot/${arch}/libreiso.img cp ${work_dir}/root-image/boot/vmlinuz-linux-libre ${work_dir}/iso/${install_dir}/boot/${arch}/vmlinuz : > ${work_dir}/build.${FUNCNAME} fi @@ -59,6 +59,7 @@ make_isolinux() { mkdir -p ${work_dir}/iso/isolinux sed "s|%INSTALL_DIR%|${install_dir}|g" ${script_path}/isolinux/isolinux.cfg > ${work_dir}/iso/isolinux/isolinux.cfg cp ${work_dir}/root-image/usr/lib/syslinux/isolinux.bin ${work_dir}/iso/isolinux/ + cp ${work_dir}/root-image/usr/lib/syslinux/isohdpfx.bin ${work_dir}/iso/isolinux/ : > ${work_dir}/build.${FUNCNAME} fi } @@ -73,16 +74,16 @@ make_aitab() { # Build all filesystem images specified in aitab (.fs .fs.sfs .sfs) make_prepare() { - mkarchiso ${verbose} -D "${install_dir}" prepare "${work_dir}" + mkarchiso ${verbose} -w "${work_dir}" -D "${install_dir}" prepare } # Build ISO make_iso() { - mkarchiso ${verbose} -D "${install_dir}" checksum "${work_dir}" - mkarchiso ${verbose} -D "${install_dir}" -L "${iso_label}" iso "${work_dir}" "${name}-${version}-${arch}.iso" + mkarchiso ${verbose} -w "${work_dir}" -D "${install_dir}" checksum + mkarchiso ${verbose} -w "${work_dir}" -D "${install_dir}" -L "${iso_label}" -o "${out_dir}" iso "${iso_name}-${iso_version}-${arch}.iso" } -if [[ $verbose == "y" ]]; then +if [[ ${verbose} == "y" ]]; then verbose="-v" else verbose="" diff --git a/configs/baseline/mkinitcpio.conf b/configs/baseline/mkinitcpio.conf index 389ec51..a1aafa8 100644 --- a/configs/baseline/mkinitcpio.conf +++ b/configs/baseline/mkinitcpio.conf @@ -1,2 +1,2 @@ -HOOKS="base udev archiso sata filesystems" +HOOKS="base udev archiso virtio filesystems" COMPRESSION="xz" diff --git a/configs/baseline/syslinux/syslinux.cfg b/configs/baseline/syslinux/syslinux.cfg index 6bd59a5..a959e0a 100644 --- a/configs/baseline/syslinux/syslinux.cfg +++ b/configs/baseline/syslinux/syslinux.cfg @@ -1,12 +1,8 @@ -DEFAULT menu.c32 -PROMPT 0 +UI menu.c32 MENU TITLE Parabola GNU/Linux-libre -TIMEOUT 300 -LABEL libre +LABEL libre MENU LABEL Parabola GNU/Linux-libre LINUX /%INSTALL_DIR%/boot/%ARCH%/vmlinuz INITRD /%INSTALL_DIR%/boot/%ARCH%/libreiso.img APPEND archisobasedir=%INSTALL_DIR% archisolabel=%ARCHISO_LABEL% - -ONTIMEOUT libre diff --git a/configs/releng/build.sh b/configs/releng/build.sh index 4a48b0a..8080d25 100755 --- a/configs/releng/build.sh +++ b/configs/releng/build.sh @@ -2,53 +2,41 @@ set -e -u -name=parabola +iso_name=parabola iso_label="LIBRE_$(date +%Y%m)" -version=$(date +%Y.%m.%d) +iso_version=$(date +%Y.%m.%d) install_dir=libre arch=$(uname -m) work_dir=work -verbose="n" +out_dir=out +verbose="" +cmd_args="" script_path=$(readlink -f ${0%/*}) # Base installation (root-image) make_basefs() { - mkarchiso ${verbose} -D "${install_dir}" -p "base" create "${work_dir}" - mkarchiso ${verbose} -D "${install_dir}" -p "memtest86+ syslinux mkinitcpio-nfs-utils nbd" create "${work_dir}" + mkarchiso ${verbose} -w "${work_dir}" -D "${install_dir}" init + mkarchiso ${verbose} -w "${work_dir}" -D "${install_dir}" -p "memtest86+ mkinitcpio-nfs-utils nbd curl" install } # Additional packages (root-image) make_packages() { - mkarchiso ${verbose} -D "${install_dir}" -p "$(grep -v ^# ${script_path}/packages.${arch})" create "${work_dir}" -} - -# Customize installation (root-image) -make_customize_root_image() { - if [[ ! -e ${work_dir}/build.${FUNCNAME} ]]; then - cp -af ${script_path}/root-image ${work_dir} - chmod 750 ${work_dir}/root-image/etc/sudoers.d - chmod 440 ${work_dir}/root-image/etc/sudoers.d/g_wheel - mkdir -p ${work_dir}/root-image/etc/pacman.d - echo "Server = http://repo.parabolagnulinux.org/\$repo/os/\$arch" > \ - ${work_dir}/root-image/etc/pacman.d/mirrorlist - chroot ${work_dir}/root-image /usr/sbin/locale-gen - chroot ${work_dir}/root-image /usr/sbin/useradd -m -p "" -g users -G "audio,disk,optical,wheel" libre -# Cleanup, makes the ISO lighter -# Remove headers - rm -rf ${work_dir}/root-image/usr/include/* - : > ${work_dir}/build.${FUNCNAME} - fi + mkarchiso ${verbose} -w "${work_dir}" -D "${install_dir}" -p "$(grep -v ^# ${script_path}/packages.${arch})" install } # Copy mkinitcpio archiso hooks (root-image) make_setup_mkinitcpio() { if [[ ! -e ${work_dir}/build.${FUNCNAME} ]]; then local _hook - for _hook in archiso archiso_pxe_nbd archiso_loop_mnt; do - cp /lib/initcpio/hooks/${_hook} ${work_dir}/root-image/lib/initcpio/hooks - cp /lib/initcpio/install/${_hook} ${work_dir}/root-image/lib/initcpio/install + for _hook in archiso archiso_shutdown archiso_pxe_common archiso_pxe_nbd archiso_pxe_http archiso_pxe_nfs archiso_loop_mnt; do + cp /usr/lib/initcpio/hooks/${_hook} ${work_dir}/root-image/usr/lib/initcpio/hooks + cp /usr/lib/initcpio/install/${_hook} ${work_dir}/root-image/usr/lib/initcpio/install done + cp /usr/lib/initcpio/install/archiso_kms ${work_dir}/root-image/usr/lib/initcpio/install + cp /usr/lib/initcpio/archiso_shutdown ${work_dir}/root-image/usr/lib/initcpio + cp /usr/lib/initcpio/archiso_pxe_nbd ${work_dir}/root-image/usr/lib/initcpio + cp ${script_path}/mkinitcpio.conf ${work_dir}/root-image/etc/mkinitcpio-libreiso.conf : > ${work_dir}/build.${FUNCNAME} fi } @@ -59,11 +47,10 @@ make_boot() { local _src=${work_dir}/root-image local _dst_boot=${work_dir}/iso/${install_dir}/boot mkdir -p ${_dst_boot}/${arch} - mkinitcpio \ - -c ${script_path}/mkinitcpio.conf \ - -b ${_src} \ - -k /boot/vmlinuz-linux-libre \ - -g ${_dst_boot}/${arch}/libreiso.img + mkarchiso ${verbose} -w "${work_dir}" -D "${install_dir}" \ + -r 'mkinitcpio -c /etc/mkinitcpio-libreiso.conf -k /boot/vmlinuz-linux-libre -g /boot/archiso.img' \ + run + mv ${_src}/boot/archiso.img ${_dst_boot}/${arch}/libreiso.img mv ${_src}/boot/vmlinuz-linux-libre ${_dst_boot}/${arch}/vmlinuz cp ${_src}/boot/memtest86+/memtest.bin ${_dst_boot}/memtest cp ${_src}/usr/share/licenses/common/GPL2/license.txt ${_dst_boot}/memtest.COPYING @@ -71,15 +58,54 @@ make_boot() { fi } +# Prepare EFI "El Torito" boot image (using Linux >= 3.3 EFI boot stub) +make_boot_efi() { + if [[ ! -e ${work_dir}/build.${FUNCNAME} ]]; then + if [[ ${arch} == "x86_64" ]]; then + mkdir -p ${work_dir}/iso/EFI/archiso + dd of=${work_dir}/iso/EFI/archiso/efiboot.img bs=1 seek=20M count=0 + mkfs.vfat ${work_dir}/iso/EFI/archiso/efiboot.img + + mkdir -p ${work_dir}/efiboot + mount ${work_dir}/iso/EFI/archiso/efiboot.img ${work_dir}/efiboot + + mkdir -p ${work_dir}/efiboot/EFI/archiso + cp ${work_dir}/iso/${install_dir}/boot/x86_64/vmlinuz ${work_dir}/efiboot/EFI/archiso/vmlinuz.efi + cp ${work_dir}/iso/${install_dir}/boot/x86_64/libreiso.img ${work_dir}/efiboot/EFI/archiso/libreiso.img + + # There are plans to support command line options via a config file (not yet in linux-3.3) + #cp ${work_dir}/iso/${install_dir}/boot/x86_64/vmlinuz ${work_dir}/efiboot/EFI/boot/bootx64.efi + #cp ${work_dir}/iso/${install_dir}/boot/x86_64/libreiso.img ${work_dir}/efiboot/EFI/boot/linux-libre.img + #echo "archisolabel=${iso_label} initrd=\EFI\boot\linux-libre.img" | iconv -f ascii -t ucs2 > ${work_dir}/iso/EFI/boot/linux-libre.conf + + # For now, provide an EFI-shell until 'linux-libre.conf' hits mainline. + mkdir -p ${work_dir}/efiboot/EFI/boot + # EFI Shell 2.0 for UEFI 2.3+ ( http://sourceforge.net/apps/mediawiki/tianocore/index.php?title=UEFI_Shell ) + #wget -O ${work_dir}/efiboot/EFI/boot/bootx64.efi https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2/ShellBinPkg/UefiShell/X64/Shell.efi + # EFI Shell 1.0 for non UEFI 2.3+ ( http://sourceforge.net/apps/mediawiki/tianocore/index.php?title=Efi-shell ) + wget -O ${work_dir}/efiboot/EFI/boot/bootx64.efi https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2/EdkShellBinPkg/FullShell/X64/Shell_Full.efi + + # Add an EFI shell script for automatic boot if ESC-key is not pressed within 5 seconds timeout. + sed "s|%ARCHISO_LABEL%|${iso_label}|g; + s|%INSTALL_DIR%|${install_dir}|g" ${script_path}/efiboot/EFI/boot/startup.nsh > ${work_dir}/efiboot/EFI/boot/startup.nsh + + umount ${work_dir}/efiboot + fi + : > ${work_dir}/build.${FUNCNAME} + fi +} + # Prepare /${install_dir}/boot/syslinux make_syslinux() { if [[ ! -e ${work_dir}/build.${FUNCNAME} ]]; then local _src_syslinux=${work_dir}/root-image/usr/lib/syslinux local _dst_syslinux=${work_dir}/iso/${install_dir}/boot/syslinux mkdir -p ${_dst_syslinux} - sed "s|%ARCHISO_LABEL%|${iso_label}|g; - s|%INSTALL_DIR%|${install_dir}|g; - s|%ARCH%|${arch}|g" ${script_path}/syslinux/syslinux.cfg > ${_dst_syslinux}/syslinux.cfg + for _cfg in ${script_path}/syslinux/*.cfg; do + sed "s|%ARCHISO_LABEL%|${iso_label}|g; + s|%INSTALL_DIR%|${install_dir}|g; + s|%ARCH%|${arch}|g" ${_cfg} > ${_dst_syslinux}/${_cfg##*/} + done cp ${script_path}/syslinux/splash.png ${_dst_syslinux} cp ${_src_syslinux}/*.c32 ${_dst_syslinux} cp ${_src_syslinux}/*.com ${_dst_syslinux} @@ -98,6 +124,27 @@ make_isolinux() { mkdir -p ${work_dir}/iso/isolinux sed "s|%INSTALL_DIR%|${install_dir}|g" ${script_path}/isolinux/isolinux.cfg > ${work_dir}/iso/isolinux/isolinux.cfg cp ${work_dir}/root-image/usr/lib/syslinux/isolinux.bin ${work_dir}/iso/isolinux/ + cp ${work_dir}/root-image/usr/lib/syslinux/isohdpfx.bin ${work_dir}/iso/isolinux/ + : > ${work_dir}/build.${FUNCNAME} + fi +} + +# Customize installation (root-image) +make_customize_root_image() { + if [[ ! -e ${work_dir}/build.${FUNCNAME} ]]; then + cp -af ${script_path}/root-image ${work_dir} + chmod 750 ${work_dir}/root-image/etc/sudoers.d + chmod 440 ${work_dir}/root-image/etc/sudoers.d/g_wheel + mkdir -p ${work_dir}/root-image/etc/pacman.d + wget -O ${work_dir}/root-image/etc/pacman.d/mirrorlist https://parabolagnulinux.org/mirrorlist/all/ + sed -i "s/#Server/Server/g" ${work_dir}/root-image/etc/pacman.d/mirrorlist + sed -i 's/#\(en_US\.UTF-8\)/\1/' ${work_dir}/root-image/etc/locale.gen + mkarchiso ${verbose} -w "${work_dir}" -D "${install_dir}" \ + -r 'locale-gen' \ + run + mkarchiso ${verbose} -w "${work_dir}" -D "${install_dir}" \ + -r 'useradd -m -p "" -g users -G "audio,disk,optical,wheel" libre' \ + run : > ${work_dir}/build.${FUNCNAME} fi } @@ -122,28 +169,28 @@ make_usr_share() { # TODO add 'base' packages on [libre] make_core_repo() { if [[ ! -e ${work_dir}/build.${FUNCNAME} ]]; then - local _url _urls _pkg_name _cached_pkg _dst + local _url _urls _pkg_name _cached_pkg _dst _pkgs mkdir -p ${work_dir}/repo-core-any mkdir -p ${work_dir}/repo-core-${arch} - pacman -Sy - _urls=$(pacman -Sddp $(comm -2 -3 <(pacman -Sql core | sort ) <(grep -v ^# ${script_path}/core.exclude.${arch} | sort))) + mkdir -p ${work_dir}/pacman.db/var/lib/pacman + pacman -Sy -r ${work_dir}/pacman.db + _pkgs=$(comm -2 -3 <(pacman -Sql -r ${work_dir}/pacman.db core | sort | sed 's@^@core/@') \ + <(grep -v ^# ${script_path}/core.exclude.${arch} | sort | sed 's@^@core/@')) + _urls=$(pacman -Sddp -r ${work_dir}/pacman.db ${_pkgs}) + pacman -Swdd -r ${work_dir}/pacman.db --noprogressbar --noconfirm ${_pkgs} for _url in ${_urls}; do _pkg_name=${_url##*/} _cached_pkg=/var/cache/pacman/pkg/${_pkg_name} _dst=${work_dir}/repo-core-${arch}/${_pkg_name} - if [[ ! -e ${_dst} ]]; then - if [[ -e ${_cached_pkg} ]]; then - cp -v "${_cached_pkg}" "${_dst}" - else - wget -nv "${_url}" -O "${_dst}" - fi - fi - repo-add -q ${work_dir}/repo-core-${arch}/core.db.tar.gz ${work_dir}/repo-core-${arch}/${_pkg_name} - if [[ ${_pkg_name} =~ any.pkg ]]; then - mv "${_dst}" ${work_dir}/repo-core-any/${_pkg_name} - ln -sf ../any/${_pkg_name} ${work_dir}/repo-core-${arch}/${_pkg_name} + cp ${_cached_pkg} ${_dst} + repo-add -q ${work_dir}/repo-core-${arch}/core.db.tar.gz ${_dst} + if [[ ${_pkg_name} == *any.pkg.tar* ]]; then + mv ${_dst} ${work_dir}/repo-core-any/${_pkg_name} + ln -sf ../any/${_pkg_name} ${_dst} fi done + mkdir -p ${work_dir}/iso/${install_dir} + pacman -Sp -r ${work_dir}/pacman.db --print-format "%r/%n-%v" ${_pkgs} | sort > ${work_dir}/iso/${install_dir}/pkglist.repo-core.${arch}.txt : > ${work_dir}/build.${FUNCNAME} fi } @@ -160,15 +207,16 @@ make_aitab() { # Build all filesystem images specified in aitab (.fs .fs.sfs .sfs) make_prepare() { - mkarchiso ${verbose} -D "${install_dir}" prepare "${work_dir}" + mkarchiso ${verbose} -w "${work_dir}" -D "${install_dir}" pkglist + mkarchiso ${verbose} -w "${work_dir}" -D "${install_dir}" prepare } # Build ISO # args: $1 (core | netinstall) make_iso() { local _iso_type=${1} - mkarchiso ${verbose} -D "${install_dir}" checksum "${work_dir}" - mkarchiso ${verbose} -D "${install_dir}" -L "${iso_label}" iso "${work_dir}" "${name}-${version}-${_iso_type}-${arch}.iso" + mkarchiso ${verbose} -w "${work_dir}" -D "${install_dir}" checksum + mkarchiso ${verbose} -w "${work_dir}" -D "${install_dir}" -L "${iso_label}" -o "${out_dir}" iso "${iso_name}-${iso_version}-${_iso_type}-${arch}.iso" } # Build dual-iso images from ${work_dir}/i686/iso and ${work_dir}/x86_64/iso @@ -192,7 +240,7 @@ make_dual() { cp -a -l -f ${_src_one} ${work_dir}/dual cp -a -l -n ${_src_two} ${work_dir}/dual rm -f ${work_dir}/dual/iso/${install_dir}/aitab - rm -f ${work_dir}/dual/iso/${install_dir}/boot/syslinux/syslinux.cfg + rm -f ${work_dir}/dual/iso/${install_dir}/boot/syslinux/*.cfg if [[ ${_iso_type} == "core" ]]; then if [[ ! -e ${work_dir}/dual/iso/${install_dir}/any/repo-core-any.sfs || ! -e ${work_dir}/dual/iso/${install_dir}/i686/repo-core-i686.sfs || @@ -204,6 +252,8 @@ make_dual() { rm -f ${work_dir}/dual/iso/${install_dir}/any/repo-core-any.sfs rm -f ${work_dir}/dual/iso/${install_dir}/i686/repo-core-i686.sfs rm -f ${work_dir}/dual/iso/${install_dir}/x86_64/repo-core-x86_64.sfs + rm -f ${work_dir}/dual/iso/${install_dir}/pkglist.repo-core.i686.txt + rm -f ${work_dir}/dual/iso/${install_dir}/pkglist.repo-core.x86_64.txt fi paste -d"\n" <(sed "s|%ARCH%|i686|g" ${script_path}/aitab.${_iso_type}) \ <(sed "s|%ARCH%|x86_64|g" ${script_path}/aitab.${_iso_type}) | uniq > ${work_dir}/dual/iso/${install_dir}/aitab @@ -211,19 +261,89 @@ make_dual() { sed "s|%ARCHISO_LABEL%|${iso_label}|g; s|%INSTALL_DIR%|${install_dir}|g" ${_cfg} > ${work_dir}/dual/iso/${install_dir}/boot/syslinux/${_cfg##*/} done - mkarchiso ${verbose} -D "${install_dir}" checksum "${work_dir}/dual" - mkarchiso ${verbose} -D "${install_dir}" -L "${iso_label}" iso "${work_dir}/dual" "${name}-${version}-${_iso_type}-dual.iso" + mkarchiso ${verbose} -w "${work_dir}/dual" -D "${install_dir}" checksum + mkarchiso ${verbose} -w "${work_dir}/dual" -D "${install_dir}" -L "${iso_label}" -o "${out_dir}" iso "${iso_name}-${iso_version}-${_iso_type}-dual.iso" : > ${work_dir}/dual/build.${FUNCNAME}_${_iso_type} fi } +purge_single () +{ + if [[ -d ${work_dir} ]]; then + find ${work_dir} -mindepth 1 -maxdepth 1 \ + ! -path ${work_dir}/iso -prune \ + | xargs rm -rf + fi +} + +purge_dual () +{ + if [[ -d ${work_dir}/dual ]]; then + find ${work_dir}/dual -mindepth 1 -maxdepth 1 \ + ! -path ${work_dir}/dual/iso -prune \ + | xargs rm -rf + fi +} + +clean_single () +{ + rm -rf ${work_dir} + rm -f ${out_dir}/${iso_name}-${iso_version}-*-${arch}.iso +} + +clean_dual () +{ + rm -rf ${work_dir}/dual + rm -f ${out_dir}/${iso_name}-${iso_version}-*-dual.iso +} +make_common_single() { + make_basefs + make_packages + make_setup_mkinitcpio + make_boot + make_boot_efi + make_syslinux + make_isolinux + make_customize_root_image + make_lib_modules + make_usr_share + make_aitab $1 + make_prepare $1 + make_iso $1 +} _usage () { - echo "usage ${0##*/} net_iso_single | core_iso_single | all_iso_single | purge_single | clean_single" - echo " net_iso_dual | core_iso_dual | all_iso_dual | purge_dual | clean_dual" + echo "usage ${0} [options] command <command options>" + echo + echo " General options:" + echo " -N <iso_name> Set an iso filename (prefix)" + echo " Default: ${iso_name}" + echo " -V <iso_version> Set an iso version (in filename)" + echo " Default: ${iso_version}" + echo " -L <iso_label> Set an iso label (disk label)" + echo " Default: ${iso_label}" + echo " -D <install_dir> Set an install_dir (directory inside iso)" + echo " Default: ${install_dir}" + echo " -w <work_dir> Set the working directory" + echo " Default: ${work_dir}" + echo " -o <out_dir> Set the output directory" + echo " Default: ${out_dir}" + echo " -v Enable verbose output" + echo " -h This help message" echo + echo " Commands:" + echo " build <mode> <type>" + echo " Build selected .iso by <mode> and <type>" + echo " purge <mode>" + echo " Clean working directory except iso/ directory of build <mode>" + echo " clean <mode>" + echo " Clean working directory and .iso file in output directory of build <mode>" + echo + echo " Command options:" + echo " <mode> Valid values 'single', 'dual' or 'all'" + echo " <type> Valid values 'netinstall', 'core' or 'all'" exit ${1} } @@ -232,81 +352,175 @@ if [[ ${EUID} -ne 0 ]]; then _usage 1 fi +while getopts 'N:V:L:D:w:o:vh' arg; do + case "${arg}" in + N) + iso_name="${OPTARG}" + cmd_args+=" -N ${iso_name}" + ;; + V) + iso_version="${OPTARG}" + cmd_args+=" -V ${iso_version}" + ;; + L) + iso_label="${OPTARG}" + cmd_args+=" -L ${iso_label}" + ;; + D) + install_dir="${OPTARG}" + cmd_args+=" -D ${install_dir}" + ;; + w) + work_dir="${OPTARG}" + cmd_args+=" -w ${work_dir}" + ;; + o) + out_dir="${OPTARG}" + cmd_args+=" -o ${out_dir}" + ;; + v) + verbose="-v" + cmd_args+=" -v" + ;; + h|?) _usage 0 ;; + *) + _msg_error "Invalid argument '${arg}'" 0 + _usage 1 + ;; + esac +done + +shift $((OPTIND - 1)) + if [[ $# -lt 1 ]]; then echo "No command specified" _usage 1 fi command_name="${1}" -if [[ ${verbose} == "y" ]]; then - verbose="-v" -else - verbose="" +if [[ $# -lt 2 ]]; then + echo "No command mode specified" + _usage 1 fi +command_mode="${2}" -if [[ ${command_name} =~ single ]]; then - work_dir=${work_dir}/${arch} +if [[ ${command_name} == "build" ]]; then + if [[ $# -lt 3 ]]; then + echo "No build type specified" + _usage 1 + fi +command_type="${3}" fi -make_common_single() { - make_basefs - make_packages - make_customize_root_image - make_setup_mkinitcpio - make_boot - make_syslinux - make_isolinux - make_lib_modules - make_usr_share - make_aitab $1 - make_prepare $1 - make_iso $1 -} +if [[ ${command_mode} == "all" && ${arch} != "x86_64" ]]; then + echo "This mode <all> needs to be run on x86_64" + _usage 1 +fi + +if [[ ${command_mode} == "single" ]]; then + work_dir=${work_dir}/${arch} +fi case "${command_name}" in - net_iso_single) - make_common_single netinstall - ;; - core_iso_single) - make_core_repo - make_common_single core - ;; - all_iso_single) - make_common_single netinstall - make_core_repo - make_common_single core - ;; - net_iso_dual) - make_dual netinstall - ;; - core_iso_dual) - make_dual core - ;; - all_iso_dual) - make_dual netinstall - make_dual core - ;; - purge_single) - if [[ -d ${work_dir} ]]; then - find ${work_dir} -mindepth 1 -maxdepth 1 \ - ! -path ${work_dir}/iso -prune \ - | xargs rm -rf - fi - ;; - purge_dual) - if [[ -d ${work_dir}/dual ]]; then - find ${work_dir}/dual -mindepth 1 -maxdepth 1 \ - ! -path ${work_dir}/dual/iso -prune \ - | xargs rm -rf - fi + build) + case "${command_mode}" in + single) + case "${command_type}" in + netinstall) + make_common_single netinstall + ;; + core) + make_core_repo + make_common_single core + ;; + all) + make_common_single netinstall + make_core_repo + make_common_single core + ;; + *) + echo "Invalid build type '${command_type}'" + _usage 1 + ;; + esac + ;; + dual) + case "${command_type}" in + netinstall) + make_dual netinstall + ;; + core) + make_dual core + ;; + all) + make_dual netinstall + make_dual core + ;; + *) + echo "Invalid build type '${command_type}'" + _usage 1 + ;; + esac + ;; + all) + case "${command_type}" in + netinstall|core|all) + $0 ${cmd_args} build single ${command_type} + $0 ${cmd_args} purge single + linux32 $0 ${cmd_args} build single ${command_type} + linux32 $0 ${cmd_args} purge single + $0 ${cmd_args} build dual ${command_type} + $0 ${cmd_args} purge dual + ;; + *) + echo "Invalid build type '${command_type}'" + _usage 1 + ;; + esac + ;; + *) + echo "Invalid build mode '${command_mode}'" + _usage 1 + ;; + esac ;; - clean_single) - rm -rf ${work_dir} - rm -f ${name}-${version}-*-${arch}.iso + purge) + case "${command_mode}" in + single) + purge_single + ;; + dual) + purge_dual + ;; + all) + $0 ${cmd_args} purge single + linux32 $0 ${cmd_args} purge single + $0 ${cmd_args} purge dual + ;; + *) + echo "Invalid purge mode '${command_mode}'" + _usage 1 + ;; + esac ;; - clean_dual) - rm -rf ${work_dir}/dual - rm -f ${name}-${version}-*-dual.iso + clean) + case "${command_mode}" in + single) + clean_single + ;; + dual) + clean_dual + ;; + all) + $0 ${cmd_args} clean single + linux32 $0 ${cmd_args} clean single + $0 ${cmd_args} clean dual + ;; + *) + echo "Invalid clean mode '${command_mode}'" + _usage 1 + ;; + esac ;; *) echo "Invalid command name '${command_name}'" diff --git a/configs/releng/efiboot/EFI/boot/startup.nsh b/configs/releng/efiboot/EFI/boot/startup.nsh new file mode 100644 index 0000000..1433751 --- /dev/null +++ b/configs/releng/efiboot/EFI/boot/startup.nsh @@ -0,0 +1,10 @@ +@echo -off + +for %m run (0 9) + if exist fs%m:\EFI\archiso\vmlinuz.efi then + fs%m: + cd fs%m:\EFI\archiso + echo "Launching Parabola GNU/Linux-libre ISO Kernel fs%m:\EFI\archiso\vmlinuz.efi" + vmlinuz.efi archisobasedir=%INSTALL_DIR% archisolabel=%ARCHISO_LABEL% initrd=\EFI\archiso\libreiso.img + endif +endfor diff --git a/configs/releng/isolinux/isolinux.cfg b/configs/releng/isolinux/isolinux.cfg index e7bbaa4..1040d3f 100644 --- a/configs/releng/isolinux/isolinux.cfg +++ b/configs/releng/isolinux/isolinux.cfg @@ -1,5 +1,5 @@ DEFAULT loadconfig LABEL loadconfig - CONFIG /%INSTALL_DIR%/boot/syslinux/syslinux.cfg - APPEND /%INSTALL_DIR%/boot/syslinux/ + CONFIG /%INSTALL_DIR%/boot/syslinux/archiso.cfg + APPEND /%INSTALL_DIR%/ diff --git a/configs/releng/mkinitcpio.conf b/configs/releng/mkinitcpio.conf index df833eb..12a656d 100644 --- a/configs/releng/mkinitcpio.conf +++ b/configs/releng/mkinitcpio.conf @@ -1,2 +1,2 @@ -HOOKS="base udev memdisk archiso archiso_pxe_nbd archiso_loop_mnt pata scsi sata usb fw pcmcia filesystems usbinput" +HOOKS="base udev memdisk archiso_shutdown archiso archiso_loop_mnt archiso_pxe_common archiso_pxe_nbd archiso_pxe_http archiso_pxe_nfs archiso_kms pata scsi sata virtio usb fw pcmcia filesystems usbinput" COMPRESSION="xz" diff --git a/configs/releng/packages.i686 b/configs/releng/packages.i686 index 197dff3..109fb17 100644 --- a/configs/releng/packages.i686 +++ b/configs/releng/packages.i686 @@ -1,7 +1,7 @@ -aif -btrfs-progs-unstable +aif-libre +btrfs-progs crda -curl +darkhttpd ddrescue dhclient dialog @@ -9,10 +9,11 @@ dmraid dnsmasq dnsutils dosfstools +efibootmgr elinks gnu-netcat +gptfdisk hdparm -inetutils irssi lftp lilo @@ -37,4 +38,3 @@ tcpdump vpnc wireless_tools wpa_actiond -zile diff --git a/configs/releng/packages.x86_64 b/configs/releng/packages.x86_64 index 197dff3..109fb17 100644 --- a/configs/releng/packages.x86_64 +++ b/configs/releng/packages.x86_64 @@ -1,7 +1,7 @@ -aif -btrfs-progs-unstable +aif-libre +btrfs-progs crda -curl +darkhttpd ddrescue dhclient dialog @@ -9,10 +9,11 @@ dmraid dnsmasq dnsutils dosfstools +efibootmgr elinks gnu-netcat +gptfdisk hdparm -inetutils irssi lftp lilo @@ -37,4 +38,3 @@ tcpdump vpnc wireless_tools wpa_actiond -zile diff --git a/configs/releng/root-image/etc/hosts b/configs/releng/root-image/etc/hosts index f26c713..ddb2a52 100644 --- a/configs/releng/root-image/etc/hosts +++ b/configs/releng/root-image/etc/hosts @@ -3,7 +3,7 @@ # #<ip-address> <hostname.domain.org> <hostname> -127.0.0.1 localhost.localdomain localhost libreiso -::1 localhost.localdomain localhost libreiso +127.0.0.1 localhost.localdomain localhost libreiso +::1 localhost.localdomain localhost libreiso # End of file diff --git a/configs/releng/root-image/etc/issue b/configs/releng/root-image/etc/issue index 2e5b032..181b704 100644 --- a/configs/releng/root-image/etc/issue +++ b/configs/releng/root-image/etc/issue @@ -2,4 +2,4 @@ Parabola GNU/Linux-libre Live ISO (\l) \s-\r \m. Default logins "root" and "libre" have no password. -To begin installation, login as root. +To begin installation, login as root diff --git a/configs/releng/root-image/etc/motd b/configs/releng/root-image/etc/motd index 0943569..af615af 100644 --- a/configs/releng/root-image/etc/motd +++ b/configs/releng/root-image/etc/motd @@ -9,7 +9,4 @@ * If you encounter issues and want to report them or * * seek help, run /libre/report-issues * * * -* If you need help please consult * -* http://wiki.parabolagnulinux.org * -* * ************************************************************** diff --git a/configs/releng/root-image/etc/rc.conf b/configs/releng/root-image/etc/rc.conf index f34f828..750f47f 100644 --- a/configs/releng/root-image/etc/rc.conf +++ b/configs/releng/root-image/etc/rc.conf @@ -1,5 +1,5 @@ # -# /etc/rc.conf - Main Configuration for Parabola GNU/Linux-libre +# /etc/rc.conf - Main Configuration for Parabola GNU/Linux-Libre . /etc/archiso/functions @@ -30,4 +30,4 @@ USELVM="no" HOSTNAME="libreiso" -DAEMONS=(hwclock syslog-ng) +DAEMONS=(hwclock metalog) diff --git a/configs/releng/root-image/etc/rc.d/functions.d/automated_script b/configs/releng/root-image/etc/rc.d/functions.d/automated_script index 7a35acb..b89ad9e 100644 --- a/configs/releng/root-image/etc/rc.d/functions.d/automated_script +++ b/configs/releng/root-image/etc/rc.d/functions.d/automated_script @@ -1,16 +1,16 @@ automated_script () { script="$(kernel_cmdline script)" - if [[ -n "$script" ]]; then + if [[ -n "${script}" ]]; then stat_busy "Configuring $script" - if [[ "$script" =~ ^http:// || "$script" =~ ^ftp:// ]]; then - wget "$script" -q -O /tmp/startup_script >/dev/null + if [[ "${script}" =~ ^http:// || "${script}" =~ ^ftp:// ]]; then + wget "${script}" -q -O /tmp/startup_script >/dev/null rt=$? else - cp "$script" /tmp/startup_script + cp "${script}" /tmp/startup_script rt=$? fi - if [ $rt -eq 0 ]; then + if [ ${rt} -eq 0 ]; then chmod +x /tmp/startup_script echo -e '\nif [ $(tty) = "/dev/tty1" ]; then\n /tmp/startup_script\nfi\n' >> /root/.bash_profile stat_done diff --git a/configs/releng/root-image/etc/rc.d/functions.d/symlink_used_block_devices b/configs/releng/root-image/etc/rc.d/functions.d/symlink_used_block_devices new file mode 100644 index 0000000..f6b6062 --- /dev/null +++ b/configs/releng/root-image/etc/rc.d/functions.d/symlink_used_block_devices @@ -0,0 +1,7 @@ +symlink_used_block_devices() +{ + mkdir /run/aif + ln -s /run/archiso/used_block_devices /run/aif/ignore_block_devices +} + +add_hook multi_end symlink_used_block_devices diff --git a/configs/releng/syslinux.dual/archiso.cfg b/configs/releng/syslinux.dual/archiso.cfg new file mode 100644 index 0000000..d1817af --- /dev/null +++ b/configs/releng/syslinux.dual/archiso.cfg @@ -0,0 +1,11 @@ +DEFAULT select + +LABEL select +COM32 boot/syslinux/whichsys.c32 +APPEND -pxe- pxe -sys- sys -iso- sys + +LABEL pxe +CONFIG boot/syslinux/archiso_pxe_choose.cfg + +LABEL sys +CONFIG boot/syslinux/archiso_sys_choose.cfg diff --git a/configs/releng/syslinux.dual/archiso_head.cfg b/configs/releng/syslinux.dual/archiso_head.cfg new file mode 100644 index 0000000..e643f2d --- /dev/null +++ b/configs/releng/syslinux.dual/archiso_head.cfg @@ -0,0 +1,25 @@ +SERIAL 0 38400 +UI boot/syslinux/vesamenu.c32 +MENU TITLE Parabola GNU/Linux-libre +MENU BACKGROUND boot/syslinux/splash.png + +MENU WIDTH 78 +MENU MARGIN 4 +MENU ROWS 5 +MENU VSHIFT 10 +MENU TABMSGROW 13 +MENU CMDLINEROW 11 +MENU HELPMSGROW 16 +MENU HELPMSGENDROW 29 + +# Refer to http://syslinux.zytor.com/wiki/index.php/Doc/menu + +MENU COLOR border 30;44 #40ffffff #a0000000 std +MENU COLOR title 1;36;44 #9033ccff #a0000000 std +MENU COLOR sel 7;37;40 #e0ffffff #20ffffff all +MENU COLOR unsel 37;44 #50ffffff #a0000000 std +MENU COLOR help 37;40 #c0ffffff #a0000000 std +MENU COLOR timeout_msg 37;40 #80ffffff #00000000 std +MENU COLOR timeout 1;37;40 #c0ffffff #00000000 std +MENU COLOR msg07 37;40 #90ffffff #a0000000 std +MENU COLOR tabmsg 31;40 #30ffffff #00000000 std diff --git a/configs/releng/syslinux.dual/archiso_pxe32.cfg b/configs/releng/syslinux.dual/archiso_pxe32.cfg new file mode 100644 index 0000000..3700987 --- /dev/null +++ b/configs/releng/syslinux.dual/archiso_pxe32.cfg @@ -0,0 +1,32 @@ +LABEL arch32_nbd +TEXT HELP +Boot the Parabola GNU/Linux-libre (i686) live medium (Using NBD). It allows you to +install a libre Arch Linux or perform system maintenance. +ENDTEXT +MENU LABEL Boot Parabola GNU/Linux-libre (i686) (NBD) +LINUX boot/i686/vmlinuz +INITRD boot/i686/libreiso.img +APPEND archisobasedir=%INSTALL_DIR% archisolabel=%ARCHISO_LABEL% archiso_nbd_srv=${pxeserver} +IPAPPEND 3 + +LABEL arch32_nfs +TEXT HELP +Boot the Parabola GNU/Linux-libre (i686) live medium (Using NFS). It allows you to +install a libre Arch Linux or perform system maintenance. +ENDTEXT +MENU LABEL Boot Parabola GNU/Linux-libre (i686) (NFS) +LINUX boot/i686/vmlinuz +INITRD boot/i686/libreiso.img +APPEND archisobasedir=%INSTALL_DIR% archiso_nfs_srv=${pxeserver}:/run/archiso/bootmnt +IPAPPEND 3 + +LABEL arch32_http +TEXT HELP +Boot the Parabola GNU/Linux-libre (i686) live medium (Using HTTP). It allows you to +install a libre Arch Linux or perform system maintenance. +ENDTEXT +MENU LABEL Boot Parabola GNU/Linux-libre (i686) (HTTP) +LINUX boot/i686/vmlinuz +INITRD boot/i686/libreiso.img +APPEND archisobasedir=%INSTALL_DIR% archiso_http_srv=http://${pxeserver}/ +IPAPPEND 3 diff --git a/configs/releng/syslinux.dual/archiso_pxe64.cfg b/configs/releng/syslinux.dual/archiso_pxe64.cfg new file mode 100644 index 0000000..cfb8371 --- /dev/null +++ b/configs/releng/syslinux.dual/archiso_pxe64.cfg @@ -0,0 +1,32 @@ +LABEL arch64_nbd +TEXT HELP +Boot the Parabola GNU/Linux-libre (x86_64) live medium (Using NBD). It allows you to +install a libre Arch Linux or perform system maintenance. +ENDTEXT +MENU LABEL Boot Parabola GNU/Linux-libre (x86_64) (NBD) +LINUX boot/x86_64/vmlinuz +INITRD boot/x86_64/libreiso.img +APPEND archisobasedir=%INSTALL_DIR% archisolabel=%ARCHISO_LABEL% archiso_nbd_srv=${pxeserver} +IPAPPEND 3 + +LABEL arch64_nfs +TEXT HELP +Boot the Parabola GNU/Linux-libre (x86_64) live medium (Using NFS). It allows you to +install a libre Arch Linux or perform system maintenance. +ENDTEXT +MENU LABEL Boot Parabola GNU/Linux-libre (x86_64) (NFS) +LINUX boot/x86_64/vmlinuz +INITRD boot/x86_64/libreiso.img +APPEND archisobasedir=%INSTALL_DIR% archiso_nfs_srv=${pxeserver}:/run/archiso/bootmnt +IPAPPEND 3 + +LABEL arch64_http +TEXT HELP +Boot the Parabola GNU/Linux-libre (x86_64) live medium (Using HTTP). It allows you to +install a libre Arch Linux or perform system maintenance. +ENDTEXT +MENU LABEL Boot Parabola GNU/Linux-libre (x86_64) (HTTP) +LINUX boot/x86_64/vmlinuz +INITRD boot/x86_64/libreiso.img +APPEND archisobasedir=%INSTALL_DIR% archiso_http_srv=http://${pxeserver}/ +IPAPPEND 3 diff --git a/configs/releng/syslinux.dual/archiso_pxe_32_inc.cfg b/configs/releng/syslinux.dual/archiso_pxe_32_inc.cfg new file mode 100644 index 0000000..e4115df --- /dev/null +++ b/configs/releng/syslinux.dual/archiso_pxe_32_inc.cfg @@ -0,0 +1,3 @@ +INCLUDE boot/syslinux/archiso_head.cfg +INCLUDE boot/syslinux/archiso_pxe32.cfg +INCLUDE boot/syslinux/archiso_tail.cfg diff --git a/configs/releng/syslinux.dual/archiso_pxe_both_inc.cfg b/configs/releng/syslinux.dual/archiso_pxe_both_inc.cfg new file mode 100644 index 0000000..324523e --- /dev/null +++ b/configs/releng/syslinux.dual/archiso_pxe_both_inc.cfg @@ -0,0 +1,4 @@ +INCLUDE boot/syslinux/archiso_head.cfg +INCLUDE boot/syslinux/archiso_pxe32.cfg +INCLUDE boot/syslinux/archiso_pxe64.cfg +INCLUDE boot/syslinux/archiso_tail.cfg diff --git a/configs/releng/syslinux.dual/archiso_pxe_choose.cfg b/configs/releng/syslinux.dual/archiso_pxe_choose.cfg new file mode 100644 index 0000000..6296065 --- /dev/null +++ b/configs/releng/syslinux.dual/archiso_pxe_choose.cfg @@ -0,0 +1,11 @@ +DEFAULT choose + +LABEL choose +COM32 boot/syslinux/ifcpu64.c32 +APPEND have64 -- nohave64 + +LABEL have64 +CONFIG boot/syslinux/archiso_pxe_both_inc.cfg + +LABEL nohave64 +CONFIG boot/syslinux/archiso_pxe_32_inc.cfg diff --git a/configs/releng/syslinux.dual/archiso_sys32.cfg b/configs/releng/syslinux.dual/archiso_sys32.cfg new file mode 100644 index 0000000..cf66e23 --- /dev/null +++ b/configs/releng/syslinux.dual/archiso_sys32.cfg @@ -0,0 +1,9 @@ +LABEL arch32 +TEXT HELP +Boot the Parabola GNU/Linux-libre (i686) live medium. It allows you to +install a libre Arch Linux or perform system maintenance. +ENDTEXT +MENU LABEL Boot Parabola GNU/Linux-libre (i686) +LINUX boot/i686/vmlinuz +INITRD boot/i686/libreiso.img +APPEND archisobasedir=%INSTALL_DIR% archisolabel=%ARCHISO_LABEL% diff --git a/configs/releng/syslinux.dual/archiso_sys64.cfg b/configs/releng/syslinux.dual/archiso_sys64.cfg new file mode 100644 index 0000000..cc7490e --- /dev/null +++ b/configs/releng/syslinux.dual/archiso_sys64.cfg @@ -0,0 +1,9 @@ +LABEL arch64 +TEXT HELP +Boot the Parabola GNU/Linux-libre (x86_64) live medium. It allows you to +install a libre Arch Linux or perform system maintenance. +ENDTEXT +MENU LABEL Boot Parabola GNU/Linux-libre (x86_64) +LINUX boot/x86_64/vmlinuz +INITRD boot/x86_64/libreiso.img +APPEND archisobasedir=%INSTALL_DIR% archisolabel=%ARCHISO_LABEL% diff --git a/configs/releng/syslinux.dual/archiso_sys_32_inc.cfg b/configs/releng/syslinux.dual/archiso_sys_32_inc.cfg new file mode 100644 index 0000000..9e37093 --- /dev/null +++ b/configs/releng/syslinux.dual/archiso_sys_32_inc.cfg @@ -0,0 +1,3 @@ +INCLUDE boot/syslinux/archiso_head.cfg +INCLUDE boot/syslinux/archiso_sys32.cfg +INCLUDE boot/syslinux/archiso_tail.cfg diff --git a/configs/releng/syslinux.dual/archiso_sys_both_inc.cfg b/configs/releng/syslinux.dual/archiso_sys_both_inc.cfg new file mode 100644 index 0000000..4ed6b39 --- /dev/null +++ b/configs/releng/syslinux.dual/archiso_sys_both_inc.cfg @@ -0,0 +1,4 @@ +INCLUDE boot/syslinux/archiso_head.cfg +INCLUDE boot/syslinux/archiso_sys32.cfg +INCLUDE boot/syslinux/archiso_sys64.cfg +INCLUDE boot/syslinux/archiso_tail.cfg diff --git a/configs/releng/syslinux.dual/archiso_sys_choose.cfg b/configs/releng/syslinux.dual/archiso_sys_choose.cfg new file mode 100644 index 0000000..24c597a --- /dev/null +++ b/configs/releng/syslinux.dual/archiso_sys_choose.cfg @@ -0,0 +1,11 @@ +DEFAULT choose + +LABEL choose +COM32 boot/syslinux/ifcpu64.c32 +APPEND have64 -- nohave64 + +LABEL have64 +CONFIG boot/syslinux/archiso_sys_both_inc.cfg + +LABEL nohave64 +CONFIG boot/syslinux/archiso_sys_32_inc.cfg diff --git a/configs/releng/syslinux.dual/archiso_tail.cfg b/configs/releng/syslinux.dual/archiso_tail.cfg new file mode 100644 index 0000000..a55548c --- /dev/null +++ b/configs/releng/syslinux.dual/archiso_tail.cfg @@ -0,0 +1,27 @@ +LABEL existing +TEXT HELP +Boot an existing operating system. Press TAB to edit the disk and partition +number to boot. +ENDTEXT +MENU LABEL Boot existing OS +COM32 boot/syslinux/chain.c32 +APPEND hd0 0 + +# http://www.memtest.org/ +LABEL memtest +MENU LABEL Run Memtest86+ (RAM test) +LINUX boot/memtest + +# http://hdt-project.org/ +LABEL hdt +MENU LABEL Hardware Information (HDT) +COM32 boot/syslinux/hdt.c32 +APPEND modules_alias=boot/syslinux/hdt/modalias.gz pciids=boot/syslinux/hdt/pciids.gz + +LABEL reboot +MENU LABEL Reboot +COM32 boot/syslinux/reboot.c32 + +LABEL poweroff +MENU LABEL Power Off +COMBOOT boot/syslinux/poweroff.com diff --git a/configs/releng/syslinux.dual/syslinux.cfg b/configs/releng/syslinux.dual/syslinux.cfg index ac92998..3ee98de 100644 --- a/configs/releng/syslinux.dual/syslinux.cfg +++ b/configs/releng/syslinux.dual/syslinux.cfg @@ -1,12 +1,5 @@ -DEFAULT choose -PROMPT 0 +DEFAULT loadconfig -LABEL choose -KERNEL ifcpu64.c32 -APPEND have64 -- nohave64 - -LABEL have64 -CONFIG syslinux_both.cfg - -LABEL nohave64 -CONFIG syslinux_32only.cfg +LABEL loadconfig + CONFIG archiso.cfg + APPEND ../../ diff --git a/configs/releng/syslinux/archiso.cfg b/configs/releng/syslinux/archiso.cfg new file mode 100644 index 0000000..126fc77 --- /dev/null +++ b/configs/releng/syslinux/archiso.cfg @@ -0,0 +1,11 @@ +DEFAULT select + +LABEL select +COM32 boot/syslinux/whichsys.c32 +APPEND -pxe- pxe -sys- sys -iso- sys + +LABEL pxe +CONFIG boot/syslinux/archiso_pxe_inc.cfg + +LABEL sys +CONFIG boot/syslinux/archiso_sys_inc.cfg diff --git a/configs/releng/syslinux/archiso_head.cfg b/configs/releng/syslinux/archiso_head.cfg new file mode 100644 index 0000000..e643f2d --- /dev/null +++ b/configs/releng/syslinux/archiso_head.cfg @@ -0,0 +1,25 @@ +SERIAL 0 38400 +UI boot/syslinux/vesamenu.c32 +MENU TITLE Parabola GNU/Linux-libre +MENU BACKGROUND boot/syslinux/splash.png + +MENU WIDTH 78 +MENU MARGIN 4 +MENU ROWS 5 +MENU VSHIFT 10 +MENU TABMSGROW 13 +MENU CMDLINEROW 11 +MENU HELPMSGROW 16 +MENU HELPMSGENDROW 29 + +# Refer to http://syslinux.zytor.com/wiki/index.php/Doc/menu + +MENU COLOR border 30;44 #40ffffff #a0000000 std +MENU COLOR title 1;36;44 #9033ccff #a0000000 std +MENU COLOR sel 7;37;40 #e0ffffff #20ffffff all +MENU COLOR unsel 37;44 #50ffffff #a0000000 std +MENU COLOR help 37;40 #c0ffffff #a0000000 std +MENU COLOR timeout_msg 37;40 #80ffffff #00000000 std +MENU COLOR timeout 1;37;40 #c0ffffff #00000000 std +MENU COLOR msg07 37;40 #90ffffff #a0000000 std +MENU COLOR tabmsg 31;40 #30ffffff #00000000 std diff --git a/configs/releng/syslinux/archiso_pxe.cfg b/configs/releng/syslinux/archiso_pxe.cfg new file mode 100644 index 0000000..beb6fe9 --- /dev/null +++ b/configs/releng/syslinux/archiso_pxe.cfg @@ -0,0 +1,32 @@ +LABEL arch_nbd +TEXT HELP +Boot the Parabola GNU/Linux-libre live medium (Using NBD). It allows you to +install a libre Arch Linux or perform system maintenance. +ENDTEXT +MENU LABEL Boot Parabola GNU/Linux-libre (NBD) +LINUX boot/%ARCH%/vmlinuz +INITRD boot/%ARCH%/libreiso.img +APPEND archisobasedir=%INSTALL_DIR% archisolabel=%ARCHISO_LABEL% archiso_nbd_srv=${pxeserver} +IPAPPEND 3 + +LABEL arch_nfs +TEXT HELP +Boot the Parabola GNU/Linux-libre live medium (Using NFS). It allows you to +install a libre Arch Linux or perform system maintenance. +ENDTEXT +MENU LABEL Boot Parabola GNU/Linux-libre (NFS) +LINUX boot/%ARCH%/vmlinuz +INITRD boot/%ARCH%/libreiso.img +APPEND archisobasedir=%INSTALL_DIR% archiso_nfs_srv=${pxeserver}:/run/archiso/bootmnt +IPAPPEND 3 + +LABEL arch_http +TEXT HELP +Boot the Parabola GNU/Linux-libre live medium (Using HTTP). It allows you to +install a libre Arch Linux or perform system maintenance. +ENDTEXT +MENU LABEL Boot Parabola GNU/Linux-libre (HTTP) +LINUX boot/%ARCH%/vmlinuz +INITRD boot/%ARCH%/libreiso.img +APPEND archisobasedir=%INSTALL_DIR% archiso_http_srv=http://${pxeserver}/ +IPAPPEND 3 diff --git a/configs/releng/syslinux/archiso_pxe_inc.cfg b/configs/releng/syslinux/archiso_pxe_inc.cfg new file mode 100644 index 0000000..b2b6887 --- /dev/null +++ b/configs/releng/syslinux/archiso_pxe_inc.cfg @@ -0,0 +1,3 @@ +INCLUDE boot/syslinux/archiso_head.cfg +INCLUDE boot/syslinux/archiso_pxe.cfg +INCLUDE boot/syslinux/archiso_tail.cfg diff --git a/configs/releng/syslinux/archiso_sys.cfg b/configs/releng/syslinux/archiso_sys.cfg new file mode 100644 index 0000000..603e23d --- /dev/null +++ b/configs/releng/syslinux/archiso_sys.cfg @@ -0,0 +1,9 @@ +LABEL arch +TEXT HELP +Boot the Parabola GNU/Linux-libre live medium. It allows you to +install a libre Arch Linux or perform system maintenance. +ENDTEXT +MENU LABEL Boot Parabola GNU/Linux-libre +LINUX boot/%ARCH%/vmlinuz +INITRD boot/%ARCH%/libreiso.img +APPEND archisobasedir=%INSTALL_DIR% archisolabel=%ARCHISO_LABEL% diff --git a/configs/releng/syslinux/archiso_sys_inc.cfg b/configs/releng/syslinux/archiso_sys_inc.cfg new file mode 100644 index 0000000..56c6a17 --- /dev/null +++ b/configs/releng/syslinux/archiso_sys_inc.cfg @@ -0,0 +1,3 @@ +INCLUDE boot/syslinux/archiso_head.cfg +INCLUDE boot/syslinux/archiso_sys.cfg +INCLUDE boot/syslinux/archiso_tail.cfg diff --git a/configs/releng/syslinux/archiso_tail.cfg b/configs/releng/syslinux/archiso_tail.cfg new file mode 100644 index 0000000..a55548c --- /dev/null +++ b/configs/releng/syslinux/archiso_tail.cfg @@ -0,0 +1,27 @@ +LABEL existing +TEXT HELP +Boot an existing operating system. Press TAB to edit the disk and partition +number to boot. +ENDTEXT +MENU LABEL Boot existing OS +COM32 boot/syslinux/chain.c32 +APPEND hd0 0 + +# http://www.memtest.org/ +LABEL memtest +MENU LABEL Run Memtest86+ (RAM test) +LINUX boot/memtest + +# http://hdt-project.org/ +LABEL hdt +MENU LABEL Hardware Information (HDT) +COM32 boot/syslinux/hdt.c32 +APPEND modules_alias=boot/syslinux/hdt/modalias.gz pciids=boot/syslinux/hdt/pciids.gz + +LABEL reboot +MENU LABEL Reboot +COM32 boot/syslinux/reboot.c32 + +LABEL poweroff +MENU LABEL Power Off +COMBOOT boot/syslinux/poweroff.com diff --git a/configs/releng/syslinux/syslinux.cfg b/configs/releng/syslinux/syslinux.cfg index 14f48e6..3ee98de 100644 --- a/configs/releng/syslinux/syslinux.cfg +++ b/configs/releng/syslinux/syslinux.cfg @@ -1,70 +1,5 @@ -SERIAL 0 38400 -DEFAULT vesamenu.c32 -PROMPT 0 -MENU TITLE Parabola GNU/Linux-libre -MENU BACKGROUND splash.png -TIMEOUT 3000 +DEFAULT loadconfig -MENU WIDTH 78 -MENU MARGIN 4 -MENU ROWS 6 -MENU VSHIFT 10 -MENU TIMEOUTROW 13 -MENU TABMSGROW 11 -MENU CMDLINEROW 11 -MENU HELPMSGROW 16 -MENU HELPMSGENDROW 29 - -# Refer to http://syslinux.zytor.com/wiki/index.php/Doc/menu - -MENU COLOR border 30;44 #40ffffff #a0000000 std -MENU COLOR title 1;36;44 #9033ccff #a0000000 std -MENU COLOR sel 7;37;40 #e0ffffff #20ffffff all -MENU COLOR unsel 37;44 #50ffffff #a0000000 std -MENU COLOR help 37;40 #c0ffffff #a0000000 std -MENU COLOR timeout_msg 37;40 #80ffffff #00000000 std -MENU COLOR timeout 1;37;40 #c0ffffff #00000000 std -MENU COLOR msg07 37;40 #90ffffff #a0000000 std -MENU COLOR tabmsg 31;40 #30ffffff #00000000 std - -LABEL libre -TEXT HELP -Boot the Parabola live medium. It allows you to install a fully libre -Arch Linux or perform system maintenance. -ENDTEXT -MENU LABEL Boot Parabola GNU/Linux-libre -LINUX /%INSTALL_DIR%/boot/%ARCH%/vmlinuz -INITRD /%INSTALL_DIR%/boot/%ARCH%/libreiso.img -APPEND archisobasedir=%INSTALL_DIR% archisolabel=%ARCHISO_LABEL% -# Next line should be uncommented when prepare enviroment to boot from PXE. -#IPAPPEND 3 - -LABEL existing -TEXT HELP -Boot an existing operating system. Press TAB to edit the disk and partition -number to boot. -ENDTEXT -MENU LABEL Boot existing OS -COM32 chain.c32 -APPEND hd0 0 - -# http://www.memtest.org/ -LABEL memtest -MENU LABEL Run Memtest86+ (RAM test) -LINUX /%INSTALL_DIR%/boot/memtest - -# http://hdt-project.org/ -LABEL hdt -MENU LABEL Hardware Information (HDT) -COM32 hdt.c32 -APPEND modules_alias=hdt/modalias.gz pciids=hdt/pciids.gz - -LABEL reboot -MENU LABEL Reboot -COM32 reboot.c32 - -LABEL poweroff -MENU LABEL Power Off -COMBOOT poweroff.com - -ONTIMEOUT libre +LABEL loadconfig + CONFIG archiso.cfg + APPEND ../../ |