diff options
author | Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar> | 2011-06-18 18:38:58 -0300 |
---|---|---|
committer | Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar> | 2011-06-18 18:38:27 -0300 |
commit | 85d243ff5836fc17416c65dca8a9e8b4e9d915bc (patch) | |
tree | 78b3ec86fea064580c43966da866d46e31ab7007 | |
parent | 4a1bd4c7697bdc7aa89eca04009d868e4dd39cb4 (diff) | |
download | archiso32-85d243ff5836fc17416c65dca8a9e8b4e9d915bc.tar.xz |
[archiso] Use dm-snapshot instead of aufs2 (A.K.A. "The Big Commit")
* Use device mapper + snapshot module, instead union layer filesystem.
* A block-level approach vs vfs-level.
* No more unofficial (Linux) things.
* More memory is needed.
* Refactor mkarchiso.
* Refactor hooks/archiso.
* Fix install/archiso_pxe_nbd
(due recent change in mkinitcpio-0.6.15 on checked_modules()/all_modules())
[Thanks Dave for the improved workaround]
* New configs/releng to build official images.
* Works with a Bash script instead of Makefile.
(better control and easy to maintain)
* Remove configs/syslinux-iso.
* Remove archiso2dual script. Integrate functionality in configs/releng.
* New configs/baseline to build the most basic live medium or use as template.
* New README (draft). [Thanks Dieter for fixing english grammar]
Signed-off-by: Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar>
-rw-r--r-- | README | 273 | ||||
-rw-r--r-- | README.old | 117 | ||||
-rw-r--r-- | archiso/Makefile | 16 | ||||
-rw-r--r-- | archiso/hooks/archiso | 207 | ||||
-rw-r--r-- | archiso/install/archiso | 23 | ||||
-rw-r--r-- | archiso/install/archiso_pxe_nbd | 8 | ||||
-rwxr-xr-x | archiso/mkarchiso | 559 | ||||
-rw-r--r-- | archiso2dual/Makefile | 13 | ||||
-rw-r--r-- | archiso2dual/README | 55 | ||||
-rwxr-xr-x | archiso2dual/archiso2dual | 411 | ||||
-rw-r--r-- | archiso2dual/isomounts | 12 | ||||
-rw-r--r-- | archiso2dual/removefiles.lst | 7 | ||||
-rw-r--r-- | configs/baseline/aitab | 2 | ||||
-rwxr-xr-x | configs/baseline/build.sh | 97 | ||||
-rw-r--r-- | configs/baseline/isolinux/isolinux.cfg | 5 | ||||
-rw-r--r-- | configs/baseline/mkinitcpio.conf | 2 | ||||
-rw-r--r-- | configs/baseline/root-image/etc/fstab | 2 | ||||
-rw-r--r-- | configs/baseline/syslinux/syslinux.cfg | 12 | ||||
-rw-r--r-- | configs/releng/aitab.core | 6 | ||||
-rw-r--r-- | configs/releng/aitab.netinstall | 4 | ||||
-rwxr-xr-x | configs/releng/build.sh | 284 | ||||
-rw-r--r-- | configs/releng/core.exclude.i686 | 4 | ||||
-rw-r--r-- | configs/releng/core.exclude.x86_64 | 4 | ||||
-rw-r--r-- | configs/releng/isolinux/isolinux.cfg | 5 | ||||
-rw-r--r-- | configs/releng/mkinitcpio.conf (renamed from configs/syslinux-iso/mkinitcpio.conf) | 4 | ||||
-rw-r--r-- | configs/releng/packages.i686 (renamed from configs/syslinux-iso/packages.i686) | 10 | ||||
-rw-r--r-- | configs/releng/packages.x86_64 (renamed from configs/syslinux-iso/packages.x86_64) | 10 | ||||
-rwxr-xr-x | configs/releng/root-image/arch/report-issues (renamed from configs/syslinux-iso/overlay/arch/report-issues) | 0 | ||||
-rwxr-xr-x | configs/releng/root-image/arch/setup (renamed from configs/syslinux-iso/overlay/arch/setup) | 0 | ||||
-rw-r--r-- | configs/releng/root-image/etc/arch-release (renamed from configs/syslinux-iso/overlay/etc/arch-release) | 0 | ||||
-rw-r--r-- | configs/releng/root-image/etc/archiso/functions (renamed from configs/syslinux-iso/overlay/etc/archiso/functions) | 0 | ||||
-rw-r--r-- | configs/releng/root-image/etc/fstab (renamed from configs/syslinux-iso/overlay/etc/fstab) | 2 | ||||
-rw-r--r-- | configs/releng/root-image/etc/hosts (renamed from configs/syslinux-iso/overlay/etc/hosts) | 1 | ||||
-rw-r--r-- | configs/releng/root-image/etc/inittab (renamed from configs/syslinux-iso/overlay/etc/inittab) | 16 | ||||
-rw-r--r-- | configs/releng/root-image/etc/issue (renamed from configs/syslinux-iso/overlay/etc/issue) | 0 | ||||
-rw-r--r-- | configs/releng/root-image/etc/motd (renamed from configs/syslinux-iso/overlay/etc/motd) | 0 | ||||
-rw-r--r-- | configs/releng/root-image/etc/pam.d/su (renamed from configs/syslinux-iso/overlay/etc/pam.d/su) | 0 | ||||
-rw-r--r-- | configs/releng/root-image/etc/rc.conf (renamed from configs/syslinux-iso/overlay/etc/rc.conf) | 3 | ||||
-rwxr-xr-x | configs/releng/root-image/etc/rc.d/archiso (renamed from configs/syslinux-iso/overlay/etc/rc.d/archiso) | 9 | ||||
-rw-r--r-- | configs/releng/root-image/etc/rc.d/functions.d/automated_script (renamed from configs/syslinux-iso/overlay/etc/rc.d/functions.d/automated_script) | 0 | ||||
-rw-r--r-- | configs/releng/root-image/etc/sudoers.d/g_wheel (renamed from configs/syslinux-iso/overlay/etc/sudoers) | 1 | ||||
-rwxr-xr-x | configs/releng/root-image/usr/bin/autologin (renamed from configs/syslinux-iso/overlay/usr/bin/autologin) | 0 | ||||
-rwxr-xr-x | configs/releng/root-image/usr/bin/km (renamed from configs/syslinux-iso/overlay/usr/bin/km) | 0 | ||||
-rw-r--r-- | configs/releng/syslinux.dual/syslinux.cfg (renamed from archiso2dual/syslinux.cfg) | 0 | ||||
-rw-r--r-- | configs/releng/syslinux.dual/syslinux_32only.cfg (renamed from archiso2dual/syslinux_32only.cfg) | 0 | ||||
-rw-r--r-- | configs/releng/syslinux.dual/syslinux_arch32.cfg (renamed from archiso2dual/syslinux_arch32.cfg) | 3 | ||||
-rw-r--r-- | configs/releng/syslinux.dual/syslinux_arch64.cfg (renamed from archiso2dual/syslinux_arch64.cfg) | 3 | ||||
-rw-r--r-- | configs/releng/syslinux.dual/syslinux_both.cfg (renamed from archiso2dual/syslinux_both.cfg) | 0 | ||||
-rw-r--r-- | configs/releng/syslinux.dual/syslinux_head.cfg (renamed from archiso2dual/syslinux_head.cfg) | 7 | ||||
-rw-r--r-- | configs/releng/syslinux.dual/syslinux_tail.cfg (renamed from archiso2dual/syslinux_tail.cfg) | 0 | ||||
-rw-r--r-- | configs/releng/syslinux/splash.png (renamed from configs/syslinux-iso/boot-files/splash.png) | bin | 45400 -> 45400 bytes | |||
-rw-r--r-- | configs/releng/syslinux/syslinux.cfg (renamed from configs/syslinux-iso/boot-files/syslinux/syslinux.cfg) | 7 | ||||
-rw-r--r-- | configs/syslinux-iso/Makefile | 94 | ||||
-rw-r--r-- | configs/syslinux-iso/boot-files/releasenotes.txt | 3 | ||||
-rwxr-xr-x | configs/syslinux-iso/download-repo.sh | 66 | ||||
-rw-r--r-- | configs/syslinux-iso/instructions | 36 | ||||
-rw-r--r-- | configs/syslinux-iso/isomounts | 12 | ||||
-rw-r--r-- | configs/syslinux-iso/overlay/etc/pacman.conf | 80 |
58 files changed, 1232 insertions, 1263 deletions
@@ -1,117 +1,156 @@ -Archiso For Dummies Like Me and You -------------------------------------- - - -- What the hell is Archiso? - -Archiso is a small set of bash scripts that is capable of building fully -functional Arch Linux based live CDs. It is a very generic tool, so it -could potentially be used to generate anything from rescue systems, -to install disks, to special interest live CD systems, and who knows what -else. Simply put, if it involves Arch on a shiny coaster, it can do it. - - -- Alright, so how does one install it? - -First off, Archiso has some dependencies: - - mkinitcpio - - cdrkit - - squashfs-tools - - aufs2 (only needed in target media) - - aufs2-util (only needed in target media) - - devtools for mkarchroot - - syslinux - - nbd - - mkinitcpio-nfs-utils - -Archiso itself can be installed with the handy dandy included Makefile, -and the incantation 'make install'. - - -- Great, so how do you use this thing? - -The heart and soul of Archiso is mkarchiso. All of its options are -documented in its usage output, so we won't go into detail here. -Instead, let's go over the general process. - -The first thing you should probably do is create a directory to work -in, and cd to it. This'll help keep things organized. Next, you'll want -to create a mkinitcpio config file that suits your needs. Typically this -means modifying whatever hooks you want. A typical set of hooks for -archiso looks something like this: - -HOOKS="base udev archiso archiso_pxe_nbd pata scsi sata usb fw pcmcia filesystems usbinput" - -It's probably worth mentioning that hardware autodetection and things -of that nature do not belong here. Only what's necessary to get the system -on its feet, and out of the initcpio really belong here, fancier stuff -can be done on the booted system anyway. - -You'll also want to create a list of packages you want installed on your -live CD system. A file full of package names, one-per-line, is the format -for this. Typically you'll want BASE and a kernel as a bare minimum, but -you're free to install whatever else you want. This is *great* for -special interest live CDs, just specify packages you want and gogogo. - -The last item of importance is what are called addons. Basically this -means any other crap you might want to include on your live CD, including -binary package repos, special configurations, random files, we don't -know, be creative. mkarchiso expects them all to be put in a single -directory, with an fstab-like config file. Currently two types of addons -are supported, squashfs images that get layered onto the root union, and -plain directories which can be bind mounted anywhere under the root. - -If you want to add a squashfs union layer: -- Set up whatever you want to include in a separate directory someplace, - as if that directory was / . Then run mksquahfs on it, and copy the - created image to your addons directory. -- Add an entry to your addons config file (which must be named 'config', - by the way). Typical squashfs entries look like this: - live_overlay.sqfs / squashfs - Where the first component is the path to the image relative to your - addons directory, the second is the mountpoint (irrelevant for - squashfs, they will all get layered at /) and of course the third - component is the type. -- Be aware that the order of entries on the config matters! Entries will - be layered on top of one another, later entries are mounted _UNDER_ - earlier entries (an unfortunate counterintuitive result of the way we - have to mount the unions). - -If you want to add plain directories to bind mount: -- Set up your directory somewhere, and copy it to your addon directory. -- Add an entry to your addons config file, example entry: - core /packages bind - where the first component is the path to the directory relative to - your addons directory, the second component is where you'd like it - bind-mounted relative to the live CD's root filesystem, and the last - component is the type. - - -- How can build installation mediums like provided by Arch Linux? - -- Just follow these next steps as root. -- Note that mkarchroot is optional, but with it, will ensure to have - a clean enviroment for building isos. -- This clean chroot, will take about 400MB (+130MB with all needed tools). -- After make, max space usage is about 2GB. -- In last step instead of just execute make, can be more selective: - Execute "make net-iso" or make "core-iso". - Do not execute make net-iso after make core-iso, otherwise net-iso - will be really a core-iso. - - -pacman -S devtools --needed -mkarchroot /tmp/somedir base -mkarchroot -r bash /tmp/somedir -# vi/nano /etc/pacman.d/mirrorlist and uncomment your prefered mirror. -pacman -S git squashfs-tools syslinux devtools cdrkit make nbd mkinitcpio-nfs-utils -cd /tmp -git clone git://projects.archlinux.org/archiso.git -cd archiso/archiso -make install -cd ../configs/syslinux-iso/ -make - -Done! - -vim: textwidth=72 +INDEX +----- + +* Image types generated by mkarchiso. +* File format for aitab. +* Why the /isolinux and /arch/boot/syslinux directories? +* Building the most basic Arch Linux live media. (configs/baseline) +* Building official Arch Linux live media. (configs/releng) + + + +*** Image types generated by mkarchiso. + +* image-name.sfs SquashFS image with all files directly on it. +* 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. + +The aitab file holds information about the filesystems images that must be +created by mkarchiso and mounted at initramfs stage from the archiso hook. +It consists of some fields which define the behaviour of images. + +# <img> <mnt> <arch> <sfs_comp> <fs_type> <fs_size> + +<img> Image name without extension (.fs .fs.sfs .sfs). +<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. +<fs_size> An absolute value of file system image size in MiB. + (example: 100, 1000, 4096, etc) + A relative value of file system free space [in percent]. + {1%..99%} (example 50%, 10%, 7%). + 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? + +The /isolinux directory holds files needed for the ISOLINUX boot loader +module of SYSLINUX. ISOLINUX can not find config files on +/arch/boot/syslinux, like other boot loaders modules (EXTLINUX, SYSLINUX, etc). +When make your custom boot-pendrive, you need to copy /arch directory to it. +/isolinux/isolinux.cfg just holds /arch/boot/syslinux/syslinux.cfg + + + +*** Building the most basic Arch Linux live media. (configs/baseline) + +* First install devtools if needed, mkarchroot needs it. + [host] # pacman -S devtools + +* Create a chroot to work on it. + (prefix with linux32 if you want to build a 32 bits enviroment under 64 bits) + [host] # mkarchroot /tmp/chroot base + +* Enter it. (prefix with linux32 if needed). + [host] # mkarchroot -r bash /tmp/chroot + +* Create a loopback device. + (mkarchiso does not create it, use other number if not available) + [chroot] # mknod /dev/loop0 b 7 0 + +* Setup a mirror. + [chroot] # echo 'Server = MIRROR/archlinux/$repo/os/$arch' >> /etc/pacman.d/mirrorlist + +* Install aditional packages needed for mkarchiso. + (git is only needed to get a copy of archiso.git) + [chroot] # pacman -S git squashfs-tools syslinux devtools cdrkit make + +* Install archiso. + [chroot] # cd /tmp + [chroot] # git clone git://projects.archlinux.org/archiso.git + [chroot] # cd archiso/archiso + [chroot] # make install-program + +* Build a basic iso. + [chroot] # cd /tmp/archiso/configs/baseline + [chroot] # ./build.sh + +* Exit from chroot. + [chroot] # exit + +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 Arch Linux live media. (configs/releng) + +Note: These steps should be done with 64 bits support. + +* Prepare a 32 bit chroot enviroment. + +linux32 mkarchroot /tmp/chroot32 base +linux32 mkarchroot -r bash /tmp/chroot32 +echo 'Server = MIRROR/archlinux/$repo/os/$arch' >> /etc/pacman.d/mirrorlist +pacman -S squashfs-tools syslinux devtools cdrkit make mkinitcpio-nfs-utils nbd --noconfirm --needed +exit + +* Prepare a 64 bits chroot enviroment. + +mkarchroot /tmp/chroot64 base +mkarchroot -r bash /tmp/chroot64 +echo 'Server = MIRROR/archlinux/$repo/os/$arch' >> /etc/pacman.d/mirrorlist +pacman -S squashfs-tools syslinux devtools cdrkit make mkinitcpio-nfs-utils nbd --noconfirm --needed +exit + +* Create a shared directory which archiso can access from both chroot enviroments. + +mkdir /tmp/shared +cd /tmp/shared +git clone git://github.com/djgera/archiso.git -b dm-snapshot +cd +mount --bind /tmp/shared /tmp/chroot32/tmp +mount --bind /tmp/shared /tmp/chroot64/tmp + +* Enter 32 bits chroot enviroment, install mkarchiso, + then build core and netinstall single images. + +linux32 mkarchroot -r bash /tmp/chroot32 +mknod /dev/loop1032 b 7 1032 +cd /tmp/archiso/archiso +make install-program +cd ../configs/releng/ +./build.sh all_iso_single + +* Enter 64 bits chroot enviroment, install mkarchiso, + then build core and netinstall single images. + +mkarchroot -r bash /tmp/chroot64 +mknod /dev/loop1064 b 7 1064 +cd /tmp/archiso/archiso +make install-program +cd ../configs/releng/ +./build.sh all_iso_single + +* Finally build core and netinstall dual images + from any of the chroot enviroments. (The final result is the same). + +mkarchroot -r bash /tmp/chroot64 +cd /tmp/archiso/configs/releng/ +./build.sh all_iso_dual diff --git a/README.old b/README.old new file mode 100644 index 0000000..cbfed9e --- /dev/null +++ b/README.old @@ -0,0 +1,117 @@ +Archiso For Dummies Like Me and You +------------------------------------- + + +- What the hell is Archiso? + +Archiso is a small set of bash scripts that is capable of building fully +functional Arch Linux based live CDs. It is a very generic tool, so it +could potentially be used to generate anything from rescue systems, +to install disks, to special interest live CD systems, and who knows what +else. Simply put, if it involves Arch on a shiny coaster, it can do it. + + +- Alright, so how does one install it? + +First off, Archiso has some dependencies: + - mkinitcpio + - cdrkit + - squashfs-tools + - aufs2 (only needed in target media) + - aufs2-util (only needed in target media) + - devtools for mkarchroot + - syslinux + - nbd + - mkinitcpio-nfs-utils + +Archiso itself can be installed with the handy dandy included Makefile, +and the incantation 'make install'. + + +- Great, so how do you use this thing? + +The heart and soul of Archiso is mkarchiso. All of its options are +documented in its usage output, so we won't go into detail here. +Instead, let's go over the general process. + +The first thing you should probably do is create a directory to work +in, and cd to it. This'll help keep things organized. Next, you'll want +to create a mkinitcpio config file that suits your needs. Typically this +means modifying whatever hooks you want. A typical set of hooks for +archiso looks something like this: + +HOOKS="base udev archiso pata scsi sata usb fw pcmcia filesystems usbinput" + +It's probably worth mentioning that hardware autodetection and things +of that nature do not belong here. Only what's necessary to get the system +on its feet, and out of the initcpio really belong here, fancier stuff +can be done on the booted system anyway. + +You'll also want to create a list of packages you want installed on your +live CD system. A file full of package names, one-per-line, is the format +for this. Typically you'll want BASE and a kernel as a bare minimum, but +you're free to install whatever else you want. This is *great* for +special interest live CDs, just specify packages you want and gogogo. + +The last item of importance is what are called addons. Basically this +means any other crap you might want to include on your live CD, including +binary package repos, special configurations, random files, we don't +know, be creative. mkarchiso expects them all to be put in a single +directory, with an fstab-like config file. Currently two types of addons +are supported, squashfs images that get layered onto the root union, and +plain directories which can be bind mounted anywhere under the root. + +If you want to add a squashfs union layer: +- Set up whatever you want to include in a separate directory someplace, + as if that directory was / . Then run mksquahfs on it, and copy the + created image to your addons directory. +- Add an entry to your addons config file (which must be named 'config', + by the way). Typical squashfs entries look like this: + live_overlay.sqfs / squashfs + Where the first component is the path to the image relative to your + addons directory, the second is the mountpoint (irrelevant for + squashfs, they will all get layered at /) and of course the third + component is the type. +- Be aware that the order of entries on the config matters! Entries will + be layered on top of one another, later entries are mounted _UNDER_ + earlier entries (an unfortunate counterintuitive result of the way we + have to mount the unions). + +If you want to add plain directories to bind mount: +- Set up your directory somewhere, and copy it to your addon directory. +- Add an entry to your addons config file, example entry: + core /packages bind + where the first component is the path to the directory relative to + your addons directory, the second component is where you'd like it + bind-mounted relative to the live CD's root filesystem, and the last + component is the type. + + +- How can build installation mediums like provided by Arch Linux? + +- Just follow these next steps as root. +- Note that mkarchroot is optional, but with it, will ensure to have + a clean enviroment for building isos. +- This clean chroot, will take about 400MB (+130MB with all needed tools). +- After make, max space usage is about 2GB. +- In last step instead of just execute make, can be more selective: + Execute "make net-iso" or make "core-iso". + Do not execute make net-iso after make core-iso, otherwise net-iso + will be really a core-iso. + + +pacman -S devtools --needed +mkarchroot /tmp/somedir base +mkarchroot -r bash /tmp/somedir +# vi/nano /etc/pacman.d/mirrorlist and uncomment your prefered mirror. +pacman -S git squashfs-tools syslinux devtools cdrkit make nbd mkinitcpio-nfs-utils +cd /tmp +git clone git://projects.archlinux.org/archiso.git +cd archiso/archiso +make install +cd ../configs/syslinux-iso/ +make + +Done! + +vim: textwidth=72 diff --git a/archiso/Makefile b/archiso/Makefile index 93d68af..74f9ff2 100644 --- a/archiso/Makefile +++ b/archiso/Makefile @@ -1,6 +1,8 @@ all: -install: all +install: install-program install-examples install-doc + +install-program: # install to sbin since script only usable by root install -D -m 755 mkarchiso $(DESTDIR)/usr/sbin/mkarchiso # testiso can be used by anyone @@ -12,11 +14,16 @@ install: all 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 docs and examples + +install-examples: + # install examples install -d -m 755 $(DESTDIR)/usr/share/archiso/ cp -r ../configs $(DESTDIR)/usr/share/archiso/configs - install -D -m 644 ../README $(DESTDIR)/usr/share/doc/archiso/README +install-doc: + install -d -m 755 $(DESTDIR)/usr/share/archiso/ + install -D -m 644 ../README $(DESTDIR)/usr/share/doc/archiso/README + uninstall: rm -f $(DESTDIR)/usr/sbin/mkarchiso rm -f $(DESTDIR)/usr/bin/testiso @@ -25,4 +32,5 @@ uninstall: rm -f $(DESTDIR)/lib/initcpio/hooks/archiso_pxe_nbd rm -f $(DESTDIR)/lib/initcpio/install/archiso_pxe_nbd rm -rf $(DESTDIR)/usr/share/archiso/ - rm -rf $(DESTDIR)/usr/share/doc/archiso/ + +.PHONY: install install-program install-examples install-doc uninstall diff --git a/archiso/hooks/archiso b/archiso/hooks/archiso index a129b20..b81bbf7 100644 --- a/archiso/hooks/archiso +++ b/archiso/hooks/archiso @@ -1,158 +1,165 @@ -# args: source, mountpoint -_mnt_aufs() { - src="${1}" - mnt="${2}" - msg "::: Adding new aufs branch: ${src} to ${mnt}" - mkdir -p "${mnt}" - /bin/mount -t aufs -o remount,append:"${src}"=ro none "${mnt}" +# Initialize loopback device logic (we using on-demand mode) +# args: none +_init_loop_dev() { + loop_dev_cnt=99 +} + +# Call this function before _make_loop_dev() each time. +# args: none +_next_loop_dev() { + loop_dev_cnt=$((loop_dev_cnt+1)) +} + +# Setup a loopback device for image passed as arguemnt and echo the path to loopback device used. +# args: /path/to/image_file +_make_loop_dev() { + local img="${1}" + mknod /dev/loop${loop_dev_cnt} b 7 ${loop_dev_cnt} &> /dev/null + losetup /dev/loop${loop_dev_cnt} "${img}" &> /dev/null + echo /dev/loop${loop_dev_cnt} } # args: source, mountpoint -_mnt_bind() { - src="${1}" - mnt="${2}" - msg "::: Binding ${src} to ${mnt}" +_mnt_fs() { + local img="${1}" + local mnt="${2}" + local img_fullname="${img##*/}"; + local img_name="${img_fullname%%.*}" + local ro_dev ro_dev_size ro_dev_fs_type rw_dev + mkdir -p "${mnt}" - /bin/mount -o bind "${src}" "${mnt}" + + _next_loop_dev + ro_dev=$(_make_loop_dev "${img}") + 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") + + echo "0 ${ro_dev_size} snapshot ${ro_dev} ${rw_dev} N 8" | dmsetup create ${img_name} + + msg ":: Mounting '/dev/mapper/${img_name}' (${ro_dev_fs_type}) to '${mnt}'" + if ! mount -t "${ro_dev_fs_type}" "/dev/mapper/${img_name}" "${mnt}" ; then + echo "ERROR: while mounting '/dev/mapper/${img_name}' to '${mnt}'" + launch_interactive_shell + fi } # args: /path/to/image_file, mountpoint -_mnt_squashfs() { - img="${1}" - mnt="${2}" - img_fullname="${img##*/}"; - img_name="${img_fullname%.*}" - tmp_mnt="/ro_branch/${img_name}" - - if [ "${copytoram}" = "y" ]; then +_mnt_sfs() { + local img="${1}" + local mnt="${2}" + local img_fullname="${img##*/}"; + + mkdir -p "${mnt}" + + if [[ "${copytoram}" == "y" ]]; then msg -n ":: Copying squashfs image to RAM..." - /bin/cp "${img}" "/copytoram/${img_fullname}" - if [ $? -ne 0 ]; then - echo "ERROR: while copy ${img} to /copytoram/${img_fullname}" + if ! cp "${img}" "/copytoram/${img_fullname}" ; then + echo "ERROR: while copy '${img}' to '/copytoram/${img_fullname}'" launch_interactive_shell fi img="/copytoram/${img_fullname}" msg "done." fi - - mkdir -p "${tmp_mnt}" - /bin/mount -r -t squashfs "${img}" "${tmp_mnt}" - if [ $? -ne 0 ]; then - echo "ERROR: while mounting ${img} to ${tmp_mnt}" + _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}'" launch_interactive_shell fi - - if [ "/${mnt#/*/}" = "/" ]; then - _mnt_aufs "${tmp_mnt}" "${mnt}" - else - _mnt_bind "${tmp_mnt}" "${mnt}" - fi } run_hook() { - if [ "x${arch}" = "x" ]; then - arch="$(uname -m)" - fi - - if [ "x${rw_branch_size}" = "x" ]; then - rw_branch_size="75%" - fi - - if [ "x${copytoram_size}" = "x" ]; then - copytoram_size="75%" - fi - - if [ "x${archisobasedir}" = "x" ]; then - archisobasedir="arch" - fi - - if [ "x${isomounts}" != "x" ]; then - isomounts="/bootmnt/${isomounts}" + [[ -z "${arch}" ]] && arch="$(uname -m)" + [[ -z "${cowspace_size}" ]] && cowspace_size="75%" + [[ -z "${copytoram_size}" ]] && copytoram_size="75%" + [[ -z "${archisobasedir}" ]] && archisobasedir="arch" + [[ -z "${archisodevice}" ]] && archisodevice="/dev/disk/by-label/${archisolabel}" + if [[ -z "${aitab}" ]]; then + aitab="/bootmnt/${archisobasedir}/aitab" else - isomounts="/bootmnt/${archisobasedir}/isomounts" + aitab="/bootmnt/${aitab}" fi - - if [ "x${archisodevice}" = "x" ]; then - archisodevice="/dev/disk/by-label/${archisolabel}" - fi - # set mount handler for archiso mount_handler="archiso_mount_handler" } +# This function is called normally from init script, but it can be called +# as chain from other mount handlers. +# args: /path/to/newroot archiso_mount_handler() { - newroot="${1}" + local newroot="${1}" + local fstype fserror + + _init_loop_dev msg ":: Waiting for boot device..." - while ! poll_device ${archisodevice} 30; do + 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 > /dev/null 2>&1; then - if [ -e "${isomounts}" ]; then - echo "SUCCESS: Mounted archiso volume successfully." - fserror="0" + 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 ${isomounts} file does not exist." - fserror="1" + 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" + echo "ERROR; Failed to mount '${archisodevice}' (FS is ${fstype})" + fserror=1 fi else - echo "ERROR: ${archisodevice} found, but the filesystem type is unknown." - fserror="1" + echo "ERROR: '${archisodevice}' found, but the filesystem type is unknown." + fserror=1 fi - if [ "${fserror}" = "1" ]; then + if [[ ${fserror} -eq 1 ]]; then 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 [ "${copytoram}" = "y" ]; then + 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." fi - msg -n ":: Mounting rw_branch (tmpfs) filesystem, size=${rw_branch_size}..." - mount -t tmpfs -o "size=${rw_branch_size}",mode=0755 rw_branch /rw_branch + msg -n ":: Mounting /cowspace (tmpfs) filesystem, size=${cowspace_size}..." + mount -t tmpfs -o "size=${cowspace_size}",mode=0755 cowspace /cowspace msg "done." - msg ":: Mounting root (aufs) filesystem" - /bin/mount -t aufs -o dirs=/rw_branch=rw union "${newroot}" - if [ $? -ne 0 ]; then - echo "ERROR: while mounting root (aufs) filesystem." - launch_interactive_shell - fi - - msg ":: Mounting images" - while read img imgarch mountpoint type; do - # check if this line is a comment (starts with #) - [ "${img#"#"}" != "${img}" ] && continue - - [ "$imgarch" != "$arch" ] && continue - - [ ! -r "/bootmnt/${archisobasedir}/${img}" ] && continue - - if [ "${type}" = "bind" ]; then - _mnt_bind "/bootmnt/${archisobasedir}/${img}" "${newroot}${mountpoint}" - elif [ "${type}" = "squashfs" ]; then - _mnt_squashfs "/bootmnt/${archisobasedir}/${img}" "${newroot}${mountpoint}" + 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 + else + _mnt_sfs "/bootmnt/${archisobasedir}/${aitab_arch}/${aitab_img}.sfs" "${newroot}${aitab_mnt}" fi - done < "${isomounts}" + done < "${aitab}" - if [ "${copytoram}" = "y" ]; then - /bin/umount /bootmnt + if [[ "${copytoram}" == "y" ]]; then + umount /bootmnt else - _mnt_bind /bootmnt "${newroot}/bootmnt" + mkdir "${newroot}/bootmnt" + mount --bind /bootmnt "${newroot}/bootmnt" fi } diff --git a/archiso/install/archiso b/archiso/install/archiso index 7ad9d06..3ac6246 100644 --- a/archiso/install/archiso +++ b/archiso/install/archiso @@ -1,25 +1,28 @@ install () { - MODULES="cdrom ide-cd_mod ide-core ide-generic aufs squashfs isofs loop $(all_modules '/kernel/fs' | grep -v "nls") " - MODULES="${MODULES} $(checked_modules "/usb/host" | grep -ve "_cs" -e "sl811-hcd" -e "isp116x-hcd")" - MODULES=$(echo ${MODULES}) #trim whitespace - if [ "x${MODULES}" != "x" ]; then - MODULES="${MODULES} usb_storage sd_mod sr_mod" - fi + 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 BINARIES="" FILES="" - add_dir /rw_branch - add_dir /ro_branch + + add_dir /cowspace add_dir /copytoram add_dir /bootmnt - add_device /lib/udev/devices/loop0 b 7 0 - add_binary /lib/udev/cdrom_id + add_binary /sbin/blockdev + add_binary /sbin/lvm + add_binary /sbin/dmsetup 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 SCRIPT="archiso" } diff --git a/archiso/install/archiso_pxe_nbd b/archiso/install/archiso_pxe_nbd index fbf43c6..189a7b1 100644 --- a/archiso/install/archiso_pxe_nbd +++ b/archiso/install/archiso_pxe_nbd @@ -2,8 +2,12 @@ install () { - MODULES="nbd $(checked_modules "/drivers/net/" | grep -v -e "/irda/" -e "/phy/" -e "/plip" -e "/ppp" -e "/wimax/" -e "/wireless/") " - + 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" diff --git a/archiso/mkarchiso b/archiso/mkarchiso index a165d03..92b2a26 100755 --- a/archiso/mkarchiso +++ b/archiso/mkarchiso @@ -1,254 +1,439 @@ #!/bin/bash -PKGLIST="" -QUIET="y" -FORCE="n" -PACCONFIG="/etc/pacman.conf" -export LABEL="ARCH_$(date +%Y%m)" -PUBLISHER="Arch Linux <http://www.archlinux.org>" -APPLICATION="Arch Linux Live/Rescue CD" -COMPRESSION="xz" -CREATE_DEFAULT="n" -INSTALL_DIR="arch" - -APPNAME=$(basename "${0}") -ARCH=$(uname -m) - -# usage: usage <exitvalue> -usage () +set -e -u + +app_name=${0##*/} +arch=$(uname -m) +pkg_list="" +quiet="y" +pacman_conf="/etc/pacman.conf" +export iso_label="ARCH_$(date +%Y%m)" +iso_publisher="Arch Linux <http://www.archlinux.org>" +iso_application="Arch Linux Live/Rescue CD" +install_dir="arch" + +# Show an INFO message +# $1: message string +_msg_info() { + local _msg="${1}" + echo "[mkarchiso] INFO: ${_msg}" +} + +# Show an ERROR message then exit with status +# $1: message string +# $2: exit code number (with 0 does not exit) +_msg_error() { + local _msg="${1}" + local _error=${2} + echo + echo "[mkarchiso] ERROR: ${_msg}" + echo + if [[ ${_error} -gt 0 ]]; then + exit ${_error} + fi +} + +# Show space usage similar to df, but better formatted. +# $1: mount-point or mounted device. +_show_space_usage () { + local _where="${1}" + local _fs _total _used _avail _pct_u=0 _mnt + read _fs _total _used _avail _pct_u _mnt < <(df -m "${_where}" | tail -1) &> /dev/null + _msg_info "Total: ${_total} MiB (100%) | Used: ${_used} MiB (${_pct_u}) | Avail: ${_avail} MiB ($((100 - ${_pct_u%\%}))%)" +} + +# Mount a filesystem (trap signals in case of error for unmounting it +# $1: source image +# $2: mount-point +_mount_fs() { + local _src="${1}" + local _dst="${2}" + trap "_umount_fs ${_src}" EXIT HUP INT TERM + mkdir -p "${_dst}" + _msg_info "Mounting '${_src}' on '${_dst}'" + mount "${_src}" "${_dst}" + _show_space_usage "${_dst}" +} + +# Unmount a filesystem (and untrap signals) +# $1: mount-point or device/image +_umount_fs() { + local _dst="${1}" + _show_space_usage "${_dst}" + _msg_info "Unmounting '${_dst}'" + umount "${_dst}" + rmdir "${_dst}" + trap - EXIT HUP INT TERM +} + +# Compare if a file/directory (source) is newer than other file (target) +# $1: source file/directory +# $2: target file +# return: 0 if target does not exists or if target is older than source. +# 1 if target is newer than source +_is_directory_changed() { + local _src="${1}" + local _dst="${2}" + + if [ -e "${_dst}" ]; then + if [[ $(find ${_src} -newer ${_dst} | wc -l) -gt 0 ]]; then + _msg_info "Target '${_dst}' is older than '${_src}', updating." + rm -f "${_dst}" + return 0 + else + _msg_info "Target '${_dst}' is up to date with '${_src}', skipping." + return 1 + fi + else + _msg_info "Target '${_dst}' does not exist, making it from '${_src}'" + return 0 + fi +} + +# Show help usage, with an exit status. +# $1: exit status number. +_usage () { - echo "usage ${APPNAME} [options] command <command options>" + echo "usage ${app_name} [options] command <command options>" echo " general options:" - echo " -f Force overwrite of working files/squashfs image/bootable image" - echo " -p PACKAGE(S) Additional package(s) to install, can be used multiple times" - echo " -C <file> Config file for pacman. Default $PACCONFIG" + echo " -p PACKAGE(S) Package(s) to install, can be used multiple times" + echo " -C <file> Config file for pacman. Default ${pacman_conf}" echo " -L <label> Set a label for the disk" echo " -P <publisher> Set a publisher for the disk" echo " -A <application> Set an application name for the disk" - echo " -c <compressor> Set SquashFS compression type: gzip, xz or lzo. Default $COMPRESSION" - echo " NOTES:" - echo " xz: needs Linux >= 2.6.38" - echo " lzo: needs Linux >= 2.6.36" - echo " -D <install_dir> Set an install_dir. All files will by located here on ISO (except for syslinux)" - echo " Default $INSTALL_DIR" + echo " -D <install_dir> Set an install_dir. All files will by located here." + echo " Default ${install_dir}" echo " NOTE: Max 8 characters, use only [a-z0-9]" - echo " -d Create default user directory /home/arch" 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 " build all images" echo " iso <dir> <image name>" echo " build an iso image from the working dir" - exit $1 + exit ${1} } -while getopts 'p:C:L:P:A:c:D:dfvh' arg; do - case "${arg}" in - p) PKGLIST="${PKGLIST} ${OPTARG}" ;; - C) PACCONFIG="${OPTARG}" ;; - L) LABEL="${OPTARG}" ;; - P) PUBLISHER="${OPTARG}" ;; - A) APPLICATION="${OPTARG}" ;; - c) COMPRESSION="${OPTARG}" ;; - D) INSTALL_DIR="${OPTARG}" ;; - d) CREATE_DEFAULT="y" ;; - f) FORCE="y" ;; - v) QUIET="n" ;; - h|?) usage 0 ;; - *) echo "invalid argument '${arg}'"; usage 1 ;; +# Shows configuration according to command mode. +# $1: create | prepare | iso +_show_config () { + local _mode="$1" + echo + _msg_info "Configuration settings" + _msg_info " Command: ${command_name}" + _msg_info " Architecture: ${arch}" + _msg_info " Working directory: ${work_dir}" + _msg_info " Installation directory: ${install_dir}" + case "${_mode}" in + create) + _msg_info " Pacman config file: ${pacman_conf}" + _msg_info " Packages: ${pkg_list}" + ;; + prepare) + ;; + iso) + _msg_info " Image name: ${img_name}" + _msg_info " Disk label: ${iso_label}" + _msg_info " Disk publisher: ${iso_publisher}" + _msg_info " Disk application: ${iso_application}" + ;; esac -done - -#trim spaces -PKGLIST="$(echo $PKGLIST)" - -shift $(($OPTIND - 1)) - -# do UID checking here so someone can at least get usage instructions -if [ "$EUID" != "0" ]; then - echo "error: This script must be run as root." - exit 1 -fi - -if [ ! -f "$PACCONFIG" ]; then - echo "error: pacman config file '$PACCONFIG' does not exist" - exit 1 -fi - -command_name="${1}" -work_dir="" -imgname="" - -case "${command_name}" in - create) work_dir="${2}"; imgname="none" ;; - iso) work_dir="${2}"; imgname="${3}" ;; - *) echo "invalid command name '${command_name}'"; usage 1 ;; -esac - -[ "x${imgname}" = "x" ] && echo "Image name must be specified" && usage 1 -[ "x${work_dir}" = "x" ] && echo "Please specify a working directory" && usage 1 - -echo "${APPNAME} : Configuration Settings" -echo " working directory: ${work_dir}" -echo " image name: ${imgname}" + echo +} -# usage: _pacman <packages>... +# Install desired packages to root-image _pacman () { - local ret - if [ "${QUIET}" = "y" ]; then - mkarchroot -n -C "$PACCONFIG" -f "${work_dir}/root-image" $* 2>&1 >/dev/null - ret=$? + _msg_info "Installing packages to '${work_dir}/root-image/'" + + if [[ "${quiet}" = "y" ]]; then + mkarchroot -n -C "${pacman_conf}" -f "${work_dir}/root-image" $* &> /dev/null else - mkarchroot -n -C "$PACCONFIG" -f "${work_dir}/root-image" $* - ret=$? + mkarchroot -n -C "${pacman_conf}" -f "${work_dir}/root-image" $* fi # Cleanup - find "${work_dir}" -name *.pacnew -name *.pacsave -name *.pacorig -delete - - if [ $ret -ne 0 ]; then - exit 1 - fi + find "${work_dir}" -name "*.pacnew" -name "*.pacsave" -name "*.pacorig" -delete } -command_create () { - echo "====> Creating working directory: ${work_dir}" - mkdir -p "${work_dir}/iso/${INSTALL_DIR}/${ARCH}" - mkdir -p "${work_dir}/root-image/" - - if [ "${PKGLIST}" != "" ]; then - echo "====> Installing packages to '${work_dir}/root-image/'" - _pacman "${PKGLIST}" - - echo "Cleaning up what we can" - if [ -d "${work_dir}/root-image/boot/" ]; then - # remove the initcpio images that were generated for the host system - find "${work_dir}/root-image/boot" -name '*.img' -delete - fi - - if [ ${CREATE_DEFAULT} == "y" ]; then - if [ -d "${work_dir}/root-image/home/" ]; then - echo "Creating default home directory" - install -d -o1000 -g100 -m0755 "${work_dir}/root-image/home/arch" - fi - fi - - # Delete pacman database sync cache files (*.tar.gz) +# 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 + fi + # Delete pacman database sync cache files (*.tar.gz) + if [[ -d "${work_dir}/root-image/var/lib/pacman" ]]; then find "${work_dir}/root-image/var/lib/pacman" -maxdepth 1 -type f -delete - # Delete pacman database sync cache + fi + # Delete pacman database sync cache + if [[ -d "${work_dir}/root-image/var/lib/pacman/sync" ]]; then find "${work_dir}/root-image/var/lib/pacman/sync" -delete - # Delete pacman package cache + fi + # Delete pacman package cache + if [[ -d "${work_dir}/root-image/var/cache/pacman/pkg" ]]; then find "${work_dir}/root-image/var/cache/pacman/pkg" -type f -delete - # Delete all log files, keeps empty dirs. + fi + # Delete all log files, keeps empty dirs. + if [[ -d "${work_dir}/root-image/var/log" ]]; then find "${work_dir}/root-image/var/log" -type f -delete - # Delete all temporary files and dirs + fi + # Delete all temporary files and dirs + if [[ -d "${work_dir}/root-image/var/tmp" ]]; then find "${work_dir}/root-image/var/tmp" -mindepth 1 -delete - # Delete all temporary files and dirs + fi + # Delete all temporary files and dirs + if [[ -d "${work_dir}/root-image/tmp" ]]; then find "${work_dir}/root-image/tmp" -mindepth 1 -delete fi } -# _mksquash dirname -_mksquash () { - if [ ! -d "$1" ]; then - echo "Error: '$1' is not a directory" - return 1 - fi +# Makes a SquashFS filesystem image of file/directory passes as argument with desired compression. +# $1: Source file/directory +# $2: SquashFS compression type (gzip | lzo | xz) +_mksfs () { + local _src="${1}" + local _sfs_comp="${2}" - sqimg="${work_dir}/iso/${INSTALL_DIR}/${ARCH}/$(basename ${1}).sqfs" - echo "====> Generating SquashFS image for '${1}'" - if [ -e "${sqimg}" ]; then - dirhaschanged=$(find ${1} -newer ${sqimg}) - if [ "${dirhaschanged}" != "" ]; then - echo "SquashFS image '${sqimg}' is not up to date, rebuilding..." - rm "${sqimg}" - else - echo "SquashFS image '${sqimg}' is up to date, skipping." - return - fi + if [[ ! -e "${work_dir}/${_src}" ]]; then + _msg_error "The path '${work_dir}/${_src}' does not exist" 1 fi - echo "Creating SquashFS image. This may take some time..." - start=$(date +%s) - if [ "${QUIET}" = "y" ]; then - mksquashfs "${1}" "${sqimg}" -noappend -comp "${COMPRESSION}" >/dev/null + local _sfs_img="${work_dir}/${_src}.sfs" + + _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 else - mksquashfs "${1}" "${sqimg}" -noappend -comp "${COMPRESSION}" + mksquashfs "${work_dir}/${_src}" "${_sfs_img}" -noappend -comp "${_sfs_comp}" fi - minutes=$(echo $start $(date +%s) | awk '{ printf "%0.2f",($2-$1)/60 }') - echo "Image creation done in $minutes minutes." + _seconds=$((SECONDS - _seconds)) + printf "[mkarchiso] INFO: Image creation done in %02d:%02d minutes\n" $((_seconds / 60)) $((_seconds % 60)) } -_imgcommon () { - for d in $(find "${work_dir}" -maxdepth 1 -type d -name '[^.]*'); do - if [ "$d" != "${work_dir}/iso" -a \ - "$(basename "$d")" != "iso" -a \ - "$d" != "${work_dir}" ]; then - _mksquash "$d" - fi - done +# Makes a filesystem from a source directory. +# $1: Source directory +# $2: Target filesystem type (ext4 | ext3 | ext2 | xfs) +# $3: Size of target filesystem. Can be an absolute value in MiB, or relative value of desired free space (1% - 99%) +_mkfs () { + local _src="${1}" + local _fs_type="${2}" + local _fs_size="${3}" - echo "====> Making bootable image" + local _fs_src="${work_dir}/${_src}" + local _fs_img="${work_dir}/${_src}.fs" - # Sanity checks - if [ ! -d "${work_dir}/iso" ]; then - echo "Error: '${work_dir}/iso' doesn't exist. What did you do?!" - exit 1 + if [[ ! -e "${_fs_src}" ]]; then + _msg_error "The path '${_fs_src}' does not exist" 1 fi - if [ ! -f "${work_dir}/iso/${INSTALL_DIR}/isomounts" ]; then - echo "Error: the isomounts file doesn't exist. This image won't do anything" - echo " Protecting you from yourself and erroring out here..." - exit 1 - fi + local _spc_used + _spc_used=$(du -sxm "${_fs_src}" | awk '{print $1}') - if [ -e "${imgname}" ]; then - if [ "${FORCE}" = "y" ]; then - echo "Removing existing bootable image..." - rm -rf "${imgname}" - else - echo "Error: Image '${imgname}' already exists, aborting." - exit 1 + # Caculate FS size with desired % of free space, adds 10% overhead to used space. + if [[ ${_fs_size} != ${_fs_size%\%} ]]; then + if [[ ${_fs_size%\%} -le 0 || ${_fs_size%\%} -ge 100 ]]; then + _msg_error "Invalid percentage of free space specified '${_fs_size}' on '${_src}', should be 0% < x < 100%" 1 + fi + _fs_size=$((_spc_used * 110 / (100 - ${_fs_size%\%}))) + else + local _spc_used_over=$((_spc_used * 11 / 10)) + if [[ ${_fs_size} -lt ${_spc_used_over} ]]; then + _msg_error "Filesystem size specified '${_fs_size}' MiB for '${_src}' is too small, must be at least '${_spc_used_over}' MiB" 1 fi fi - if ! sed "s|%ARCHISO_LABEL%|${LABEL}|g; - s|%INSTALL_DIR%|${INSTALL_DIR}|g; - s|%ARCH%|${ARCH}|g" -i ${work_dir}/iso/syslinux/syslinux.cfg; then - echo "Error: ${work_dir}/iso/syslinux/syslinux.cfg, doesn't exist, aborting." - exit 1 + _msg_info "Creating ${_fs_type} image of ${_fs_size} MiB" + dd of="${_fs_img}" count=0 bs=1M seek=${_fs_size} &> /dev/null + local _qflag="" + if [[ ${quiet} == "y" ]]; then + _qflag="-q" fi + case "${_fs_type}" in + ext4) + mkfs.ext4 ${_qflag} -O ^has_journal -m 0 -F "${_fs_img}" + tune2fs -c 0 -i 0 "${_fs_img}" &> /dev/null + ;; + ext3) + mkfs.ext3 ${_qflag} -m 0 -F "${_fs_img}" + tune2fs -c 0 -i 0 "${_fs_img}" &> /dev/null + ;; + ext2) + mkfs.ext2 ${_qflag} -m 0 -F "${_fs_img}" + tune2fs -c 0 -i 0 "${_fs_img}" &> /dev/null + ;; + xfs) + mkfs.xfs ${_qflag} "${_fs_img}" + ;; + *) + _msg_error "Invalid filesystem: ${_fs_type}" 1 + ;; + esac + _mount_fs "${_fs_img}" "${work_dir}/mnt/${_src}" + _msg_info "Copying '${_fs_src}/' to '${work_dir}/mnt/${_src}/'" + rsync -aH "${_fs_src}/" "${work_dir}/mnt/${_src}/" + _umount_fs "${work_dir}/mnt/${_src}" } +# Create an ISO9660 filesystem from "iso" directory. command_iso () { - _imgcommon + if [[ ! -f "${work_dir}/iso/isolinux/isolinux.bin" ]]; then + _msg_error "The file '${work_dir}/iso/isolinux/isolinux.bin' does not exist." 1 + fi + + _show_config iso + + _is_directory_changed "${work_dir}/iso" "${img_name}" - echo "Creating ISO image..." - qflag="" - [ "${QUIET}" = "y" ] && qflag="-quiet" - mkisofs ${qflag} -r -l \ - -b syslinux/isolinux.bin -c syslinux/boot.cat \ + _msg_info "Creating ISO image..." + local _qflag="" + if [[ ${quiet} == "y" ]]; then + _qflag="-quiet" + 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 "${PUBLISHER}" \ - -A "${APPLICATION}" \ - -V "${LABEL}" \ - -o "${imgname}" "${work_dir}/iso/" - isohybrid "${imgname}" + -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. +command_prepare () { + if [[ ! -f "${work_dir}/iso/${install_dir}/aitab" ]]; then + _msg_error "The file '${work_dir}/iso/${install_dir}/aitab' does not exist." 1 + fi + _show_config prepare + + _cleanup + 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 + 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 + fi + else + if _is_directory_changed "${_src}" "${_dst}/${_aitab_img}.sfs"; then + _mksfs ${_aitab_img} ${_aitab_sfs_comp} + mv "${work_dir}/${_aitab_img}.sfs" "${_dst}" + fi + fi + done < "${work_dir}/iso/${install_dir}/aitab" +} + +# Install packages on root-image. +# A basic check to avoid double execution/reinstallation is done via hashing package names. +command_create () { + if [[ ! -f "${pacman_conf}" ]]; then + _msg_error "Pacman config file '${pacman_conf}' does not exist" 1 + fi + + #trim spaces + pkg_list="$(echo ${pkg_list})" + + if [[ -z ${pkg_list} ]]; then + _msg_error "Packages must be specified" 0 + _usage 1 + fi + + _show_config create + + 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 + _msg_info "These packages are already installed, skipping." + else + mkdir -p "${work_dir}/root-image/" + : > "${work_dir}/create.${_pkg_list_hash}" + _pacman "${pkg_list}" + fi } -# Go through the main commands in order. If 'all' was specified, then we want -# to do everything. Start with 'install'. -if [ "${command_name}" = "create" ]; then - command_create + +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 + case "${arg}" in + p) pkg_list="${pkg_list} ${OPTARG}" ;; + C) pacman_conf="${OPTARG}" ;; + L) iso_label="${OPTARG}" ;; + P) iso_publisher="${OPTARG}" ;; + A) iso_application="${OPTARG}" ;; + D) install_dir="${OPTARG}" ;; + v) quiet="n" ;; + h|?) _usage 0 ;; + *) + _msg_error "Invalid argument '${arg}'" 0 + _usage 1 + ;; + esac +done + +shift $((OPTIND - 1)) + +if [[ $# -lt 1 ]]; then + _msg_error "No command specified" 0 + _usage 1 fi -if [ "${command_name}" = "iso" ]; then - command_iso +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 + ;; + prepare) + command_prepare + ;; + iso) + if [[ $# -lt 3 ]]; then + _msg_error "No image specified" 0 + _usage 1 + fi + img_name="${3}" + command_iso + ;; + *) + _msg_error "Invalid command name '${command_name}'" 0 + _usage 1 + ;; +esac # vim:ts=4:sw=4:et: diff --git a/archiso2dual/Makefile b/archiso2dual/Makefile deleted file mode 100644 index f615bce..0000000 --- a/archiso2dual/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -all: - -install: all - install -D -m 755 archiso2dual $(DESTDIR)/usr/sbin/archiso2dual - install -d -m 755 $(DESTDIR)/usr/share/archiso2dual/syslinux - install -D -m 644 isomounts $(DESTDIR)/usr/share/archiso2dual/isomounts - install -D -m 644 syslinux.cfg $(DESTDIR)/usr/share/archiso2dual/syslinux/syslinux.cfg - install -D -m 644 *.cfg $(DESTDIR)/usr/share/archiso2dual/syslinux/ - install -D -m 644 removefiles.lst $(DESTDIR)/usr/share/archiso2dual/removefiles.lst - -uninstall: - rm -f $(DESTDIR)/usr/sbin/archiso2dual - rm -rf $(DESTDIR)/usr/share/archiso2dual diff --git a/archiso2dual/README b/archiso2dual/README deleted file mode 100644 index 5e18aed..0000000 --- a/archiso2dual/README +++ /dev/null @@ -1,55 +0,0 @@ -Tree structure of an iso image archlinux-2010.04.24-core-dual.iso (610MB) -running with profile "split": - -# tree -I *.c32 -. -|-- any -| `-- usrshare.sqfs -|-- boot -| |-- i686 -| | |-- archiso.img -| | `-- vmlinuz26 -| |-- syslinux -| | |-- boot.cat -| | |-- isolinux.bin -| | |-- syslinux.cfg -| | `-- memdisk -| |-- memtest -| |-- memtest.COPYING -| |-- releasenotes.txt -| |-- splash.png -| |-- x86_64 -| | |-- archiso.img -| | `-- vmlinuz26 -|-- i686 -| |-- core-pkgs.sqfs -| |-- libmodules.sqfs -| |-- overlay.sqfs -| `-- root-image.sqfs -|-- isomounts.i686 -|-- isomounts.x86_64 -|-- isomounts.x86_64-i686 -`-- x86_64 - |-- core-pkgs.sqfs - |-- libmodules.sqfs - |-- overlay.sqfs - `-- root-image.sqfs - -7 directories, 26 files - -* Current dual image sizes (basic/split/full) - -664M archlinux-2010.04.24-core-dual.iso -610M archlinux-2010.04.24-core-dual.iso -572M archlinux-2010.04.24-core-dual.iso - -326M archlinux-2010.04.24-netinstall-dual.iso -272M archlinux-2010.04.24-netinstall-dual.iso -234M archlinux-2010.04.24-netinstall-dual.iso - -* Current single image sizes: -326M archlinux-2010.04.24-core-i686.iso -342M archlinux-2010.04.24-core-x86_64.iso - -161M archlinux-2010.04.24-netinstall-i686.iso -169M archlinux-2010.04.24-netinstall-x86_64.iso diff --git a/archiso2dual/archiso2dual b/archiso2dual/archiso2dual deleted file mode 100755 index 4e80b4d..0000000 --- a/archiso2dual/archiso2dual +++ /dev/null @@ -1,411 +0,0 @@ -#!/bin/bash - -# -# Join two Arch Linux iso images of i686 and x86_64 architecture. -# Contributed for archiso by Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar> -# - -set -e -u - -publisher="Arch Linux <http://www.archlinux.org>" -application="Arch Linux Live/Rescue disk" -label="ARCH_$(date +%Y%m)" -isofile_i686="" -isofile_x86_64="" -imgname="" -quiet="y" -profile_type="basic" -work_dir="/tmp/archiso2dual" -isomounts_file="/usr/share/archiso2dual/isomounts" -syslinuxcfg_dir="/usr/share/archiso2dual/syslinux" -removefiles_file="/usr/share/archiso2dual/removefiles.lst" -compression="xz" -install_dir="arch" -appname=${0##*/} -_error="0" -_confirm="n" -_v="" -_iscoreiso=n - -iso_umount() { - echo "Executing: ${FUNCNAME}" - trap - 0 1 2 15 - umount ${_v} ${work_dir}/i686/mnt - umount ${_v} ${work_dir}/x86_64/mnt -} - -iso_mount() { - echo "Executing: ${FUNCNAME}" - trap 'iso_umount' 0 1 2 15 - mount ${_v} -t udf -o ro,loop ${isofile_i686} ${work_dir}/i686/mnt - mount ${_v} -t udf -o ro,loop ${isofile_x86_64} ${work_dir}/x86_64/mnt -} - -kernel_copy() { - echo "Executing: ${FUNCNAME}" - for _arch in i686 x86_64; do - cp ${_v} ${work_dir}/${_arch}/mnt/${install_dir}/boot/${_arch}/archiso.img ${work_dir}/iso/${install_dir}/boot/${_arch}/archiso.img - cp ${_v} ${work_dir}/${_arch}/mnt/${install_dir}/boot/${_arch}/vmlinuz26 ${work_dir}/iso/${install_dir}/boot/${_arch}/vmlinuz26 - done -} - -syslinux_copy() { - echo "Executing: ${FUNCNAME}" - cp ${_v} ${work_dir}/i686/mnt/${install_dir}/boot/{memtest*,splash.png} ${work_dir}/iso/${install_dir}/boot/ - cp ${_v} ${work_dir}/i686/mnt/syslinux/*.c32 ${work_dir}/iso/syslinux/ - cp ${_v} ${work_dir}/i686/mnt/syslinux/poweroff.com ${work_dir}/iso/syslinux/ - cp ${_v} ${work_dir}/i686/mnt/syslinux/memdisk ${work_dir}/iso/syslinux/ - cp ${_v} ${work_dir}/i686/mnt/syslinux/isolinux.bin ${work_dir}/iso/syslinux/ - cp ${_v} ${work_dir}/i686/mnt/syslinux/pxelinux.0 ${work_dir}/iso/syslinux/ - cp ${_v} ${work_dir}/i686/mnt/syslinux/gpxelinux.0 ${work_dir}/iso/syslinux/ - cp ${_v} -r ${work_dir}/i686/mnt/syslinux/hdt ${work_dir}/iso/syslinux/ -} - -syslinuxcfg_copy() { - echo "Executing: ${FUNCNAME}" - for _cfg in ${syslinuxcfg_dir}/*.cfg; do - sed "s|%ARCHISO_LABEL%|${label}|g; - s|%INSTALL_DIR%|${install_dir}|g" ${_cfg} > ${work_dir}/iso/syslinux/$(basename ${_cfg}) - done -} - -isomounts_copy() { - echo "Executing: ${FUNCNAME}" - cp ${_v} ${isomounts_file} ${work_dir}/iso/${install_dir}/ -} - -squashfs_copy() { - echo "Executing: ${FUNCNAME}" - for _arch in i686 x86_64; do - cp ${_v} ${work_dir}/${_arch}/mnt/${install_dir}/${_arch}/*.sqfs ${work_dir}/iso/${install_dir}/${_arch}/ - done -} - -make_iso() { - echo "Executing: ${FUNCNAME}" - if [ "${quiet}" = "y" ]; then - _qflag="-quiet" - else - _qflag="" - fi - mkisofs ${_v} ${_qflag} -r -l \ - -b syslinux/isolinux.bin -c syslinux/boot.cat \ - -uid 0 -gid 0 \ - -udf -allow-limited-size -iso-level 3 \ - -input-charset utf-8 -p "prepared by archiso2dual" \ - -no-emul-boot -boot-load-size 4 -boot-info-table \ - -publisher "${publisher}" \ - -A "${application}" \ - -V "${label}" \ - -o "${imgname}" "${work_dir}/iso/" - isohybrid "${imgname}" -} - -unsquashfs_image() { - echo "Executing: ${FUNCNAME}" - img=${1} - arch=${2} - rm -rf ${work_dir}/tmp/${arch}/${img} - if [ "${quiet}" = "y" ]; then - unsquashfs -d ${work_dir}/tmp/${arch}/${img} ${work_dir}/iso/${install_dir}/${arch}/${img}.sqfs > /dev/null - else - unsquashfs -d ${work_dir}/tmp/${arch}/${img} ${work_dir}/iso/${install_dir}/${arch}/${img}.sqfs - fi -} - -mksquashfs_image() { - echo "Executing: ${FUNCNAME}" - img=${1} - arch=${2} - rm -f ${work_dir}/iso/${install_dir}/${arch}/${img}.sqfs - if [ "${quiet}" = "y" ]; then - mksquashfs ${work_dir}/tmp/${arch}/${img} ${work_dir}/iso/${install_dir}/${arch}/${img}.sqfs -comp ${compression} > /dev/null - else - mksquashfs ${work_dir}/tmp/${arch}/${img} ${work_dir}/iso/${install_dir}/${arch}/${img}.sqfs -comp ${compression} - fi -} - -usrshare_make_image() { - echo "Executing: ${FUNCNAME}" - mkdir -p ${work_dir}/tmp/any/usrshare/usr - cp -a ${work_dir}/tmp/i686/root-image/usr/share ${work_dir}/tmp/any/usrshare/usr - mksquashfs_image usrshare any -} - -libmodules_make_image() { - echo "Executing: ${FUNCNAME}" - for _arch in i686 x86_64; do - mkdir -p ${work_dir}/tmp/${_arch}/libmodules/lib - cp -a ${work_dir}/tmp/${_arch}/root-image/lib/modules ${work_dir}/tmp/${_arch}/libmodules/lib - mksquashfs_image libmodules ${_arch} - done -} - -core_pkgs_make_image() { - echo "Executing: ${FUNCNAME}" - mkdir -p ${work_dir}/tmp/any/core-any-pkgs/src/core/pkg - cp -a ${work_dir}/tmp/i686/core-pkgs/src/core/pkg/*-any.pkg.* ${work_dir}/tmp/any/core-any-pkgs/src/core/pkg - for _arch in i686 x86_64; do - rm -rf ${work_dir}/tmp/${_arch}/core-pkgs/src/core/pkg/*-any.pkg.* - mksquashfs_image core-pkgs ${_arch} - done - mksquashfs_image core-any-pkgs any -} - -core_pkgs_extract() { - echo "Executing: ${FUNCNAME}" - for _arch in i686 x86_64; do - unsquashfs_image core-pkgs ${_arch} - done -} - -check_if_core_medium() { - echo "Executing: ${FUNCNAME}" - if [ -f ${work_dir}/iso/${install_dir}/i686/core-pkgs.sqfs ] && [ -f ${work_dir}/iso/${install_dir}/x86_64/core-pkgs.sqfs ]; then - _iscoreiso=y - fi -} - -root_image_extract() { - echo "Executing: ${FUNCNAME}" - for _arch in i686 x86_64; do - unsquashfs_image root-image ${_arch} - done -} - -root_image_purge() { - echo "Executing: ${FUNCNAME}" - while read _file; do - [ "${_file#"#"}" != "${_file}" ] && continue - for _arch in i686 x86_64; do - rm -rf "${work_dir}/tmp/${_arch}/root-image/${_file}" - done - done < "${removefiles_file}" -} - -root_image_list_purge() { - while read _file; do - [ "${_file#"#"}" != "${_file}" ] && continue - for _arch in i686 x86_64; do - echo "${work_dir}/tmp/${_arch}/root-image/${_file}" - done - done < "${removefiles_file}" -} - -root_image_make_image() { - echo "Executing: ${FUNCNAME}" - for _arch in i686 x86_64; do - rm -rf ${work_dir}/tmp/${_arch}/root-image/usr/share - rm -rf ${work_dir}/tmp/${_arch}/root-image/lib/modules - mksquashfs_image root-image ${_arch} - done -} - -make_workspace() { - echo "Executing: ${FUNCNAME}" - for _arch in i686 x86_64; do - mkdir ${_v} -p ${work_dir}/iso/${install_dir}/${_arch} - mkdir ${_v} -p ${work_dir}/iso/${install_dir}/boot/${_arch} - mkdir ${_v} -p ${work_dir}/${_arch}/mnt - mkdir ${_v} -p ${work_dir}/tmp/${_arch} - done - mkdir ${_v} -p ${work_dir}/iso/syslinux - mkdir ${_v} -p ${work_dir}/iso/${install_dir}/any - mkdir ${_v} -p ${work_dir}/tmp/any -} - -show_help() -{ - exitvalue=${1} - echo - echo "${appname} [options] -3 <i686.iso> -6 <x86_64.iso> -o <output.iso>" - echo - echo " needed options:" - echo " -3 <i686.iso> Path to i686 source iso image" - echo " -6 <x86_64.iso> Path to x86_64 source iso image" - echo " -o <output.iso> Path to dual target iso image" - echo - echo " general options:" - echo " -M <isomounts> Path to isomounts file - (default to '${isomounts_file}'" - echo " -S <syslinux> Path to syslinux.cfg file - (default to '${syslinuxcfg_dir}'" - echo " -R <removefiles> Path to removefiles file - (default to '${removefiles_file}'" - echo " -w <workdir> Set work directory - (default to '${work_dir}')" - echo " -T <profile> Type of target image (work is done on root-image.sqfs): - basic: join both images, no changes in root-image - split: 'basic' + split out usr/share/ and lib/modules/ from root-image - full: 'split' + remove specified directories (with -R) from root-image - (default to '${profile_type}')" - echo " -L <label> Set a label for the disk [max 11 chars] - (default to '${label}')" - echo " -P <publisher> Set a publisher for the disk - (default to '${publisher}')" - echo " -A <application> Set an application name for the disk - (default to '${application}')" - echo " -c <compressor> Set SquashFS compression type: gzip, xz or lzo. - (default to '${compression}')" - echo " -D <install_dir> Set an install_dir - (default to '${install_dir}')" - echo " NOTES:" - echo " Must match install_dir from both .iso sources" - echo " Max 8 characters, use only [a-z0-9]" - echo " -y Confirm execution (otherwise only show configuration)" - echo " -v Enable verbose output" - echo " -h This message" - exit ${exitvalue} -} - -show_config() { - echo - echo "${appname} : Configuration settings" - echo " source iso i686 image: ${isofile_i686}" - echo " source iso x86_64 image: ${isofile_x86_64}" - echo " target iso image: ${imgname}" - echo " install directory on ISO: ${install_dir}" - echo " isomounts file: ${isomounts_file}" - echo " syslinux.cfg path: ${syslinuxcfg_dir}" - echo " removefiles.lst file: ${removefiles_file}" - echo " working directory: ${work_dir}" - echo " profile: ${profile_type}" - echo " label: ${label}" - echo " publisher: ${publisher}" - echo " application: ${application}" - echo " compression: ${compression}" - echo - if [ "${profile_type}" = "full" ]; then - echo "These files will be deleted (selected via -R option)" - root_image_list_purge - fi -} - -options_check() { - if [ "x${isofile_i686}" = "x" ]; then - echo "*ERROR*: -3 <i686.iso> must be specified" - _error="1" - fi - - if [ "x${isofile_x86_64}" = "x" ]; then - echo "*ERROR*: -6 <x86_64.iso> must be specified" - _error="1" - fi - - if [ "x${imgname}" = "x" ]; then - echo "*ERROR*: -o <output.iso> must be specified" - _error="1" - fi - - if [ ${_error} = "1" ]; then - show_help 1 - fi -} - -sanity_check() { - echo - if [ ! -f "${isofile_i686}" ]; then - echo "*ERROR*: ${isofile_i686} does not exist" - _error="1" - fi - - if [ ! -f "${isofile_x86_64}" ]; then - echo "*ERROR*: ${isofile_x86_64} does not exist" - _error="1" - fi - - if [ -f "${imgname}" ]; then - echo "*ERROR*: ${imgname} already exists, aborting" - _error="1" - fi - - if [ ! -f "${isomounts_file}" ]; then - echo "*ERROR*: ${isomounts_file} does not exist, , specify one with -M option" - _error="1" - fi - - if [ ! -f "${syslinuxcfg_dir}/syslinux.cfg" ]; then - echo "*ERROR*: ${syslinuxcfg_dir}/syslinux.cfg does not exist, specify one with -S option" - _error="1" - fi - - if [ ! -f "${removefiles_file}" ]; then - echo "*ERROR*: ${removefiles_file} does not exist, specify one with -R option" - _error="1" - fi - - if [ -d "${work_dir}" ]; then - echo "*ERROR*: work directory ${work_dir} is present, first delete it" - _error="1" - fi - - if [ ${_error} = "1" ]; then - exit 1 - fi -} - -if [ "$EUID" != "0" ]; then - echo "*ERROR*: This script must be run as root." - exit 1 -fi - -while getopts '3:6:o:T:M:S:R:L:P:A:c:D:yvh' arg; do - case "${arg}" in - 3) isofile_i686="${OPTARG}" ;; - 6) isofile_x86_64="${OPTARG}" ;; - o) imgname="${OPTARG}" ;; - T) case "${OPTARG}" in - "basic"|"split"|"full") profile_type="${OPTARG}" ;; - *) echo; echo "*ERROR*: invalid argument in -T option: ${profile_type}"; show_help 1 ;; - esac - ;; - M) isomounts_file="${OPTARG}" ;; - S) syslinuxcfg_dir="${OPTARG}" ;; - R) removefiles_file="${OPTARG}" ;; - L) label="${OPTARG}" ;; - P) publisher="${OPTARG}" ;; - A) application="${OPTARG}" ;; - c) compression="${OPTARG}" ;; - D) install_dir="${OPTARG}" ;; - w) work_dir="${OPTARG}" ;; - y) _confirm="y" ;; - v) quiet="n"; _v="-v" ;; - h|?) show_help 0 ;; - *) echo; echo "*ERROR*: invalid argument '${arg}'"; show_help 1 ;; - esac -done - -options_check -sanity_check -show_config - -if [ "${_confirm}" != "y" ]; then - echo - echo "If configuration is correct, re-execute with -y" - exit 1 -fi -make_workspace -iso_mount -kernel_copy -syslinux_copy -squashfs_copy -check_if_core_medium -iso_umount -syslinuxcfg_copy -isomounts_copy -if [ ${profile_type} = "full" ] || [ ${profile_type} = "split" ]; then - root_image_extract - if [ ${profile_type} = "full" ]; then - root_image_purge - fi - if [ ${_iscoreiso} = "y" ]; then - core_pkgs_extract - fi - usrshare_make_image - libmodules_make_image - root_image_make_image - if [ ${_iscoreiso} = "y" ]; then - core_pkgs_make_image - fi -fi -make_iso diff --git a/archiso2dual/isomounts b/archiso2dual/isomounts deleted file mode 100644 index ead8067..0000000 --- a/archiso2dual/isomounts +++ /dev/null @@ -1,12 +0,0 @@ -i686/overlay.sqfs i686 / squashfs -x86_64/overlay.sqfs x86_64 / squashfs -any/core-any-pkgs.sqfs i686 / squashfs -any/core-any-pkgs.sqfs x86_64 / squashfs -i686/core-pkgs.sqfs i686 / squashfs -x86_64/core-pkgs.sqfs x86_64 / squashfs -any/usrshare.sqfs i686 / squashfs -any/usrshare.sqfs x86_64 / squashfs -i686/libmodules.sqfs i686 / squashfs -x86_64/libmodules.sqfs x86_64 / squashfs -i686/root-image.sqfs i686 / squashfs -x86_64/root-image.sqfs x86_64 / squashfs diff --git a/archiso2dual/removefiles.lst b/archiso2dual/removefiles.lst deleted file mode 100644 index 516ff02..0000000 --- a/archiso2dual/removefiles.lst +++ /dev/null @@ -1,7 +0,0 @@ -# files/directories to remove from root-image.sqfs -boot -usr/include -usr/share/doc -usr/share/info -usr/share/man -usr/src diff --git a/configs/baseline/aitab b/configs/baseline/aitab new file mode 100644 index 0000000..fbd4d00 --- /dev/null +++ b/configs/baseline/aitab @@ -0,0 +1,2 @@ +# <img> <mnt> <arch> <sfs_comp> <fs_type> <fs_size> +root-image / %ARCH% xz ext4 50% diff --git a/configs/baseline/build.sh b/configs/baseline/build.sh new file mode 100755 index 0000000..3c896e8 --- /dev/null +++ b/configs/baseline/build.sh @@ -0,0 +1,97 @@ +#!/bin/bash + +set -e -u + +name=archlinux +iso_label="ARCH_$(date +%Y%m)" +version=$(date +%Y.%m.%d) +install_dir=arch +arch=$(uname -m) +work_dir=work +verbose="n" + +# This function can be called after make_basefs() +get_linux_ver() { + local ALL_kver + eval $(grep ^ALL_kver ${work_dir}/root-image/etc/mkinitcpio.d/kernel26.kver) + echo ${ALL_kver} +} + +# 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}" +} + +# Customize installation (root-image) +make_customize_root_image() { + if [[ ! -e ${work_dir}/build.${FUNCNAME} ]]; then + cp -af root-image ${work_dir} + : > ${work_dir}/build.${FUNCNAME} + fi +} + +# Prepare ${install_dir}/boot/ +make_boot() { + if [[ ! -e ${work_dir}/build.${FUNCNAME} ]]; then + mkdir -p ${work_dir}/iso/${install_dir}/boot/${arch} + cp ${work_dir}/root-image/boot/vmlinuz26 ${work_dir}/iso/${install_dir}/boot/${arch} + mkinitcpio -c ./mkinitcpio.conf -b ${work_dir}/root-image -k $(get_linux_ver) -g ${work_dir}/iso/${install_dir}/boot/${arch}/archiso.img + : > ${work_dir}/build.${FUNCNAME} + fi +} + +# Prepare /${install_dir}/boot/syslinux +make_syslinux() { + if [[ ! -e ${work_dir}/build.${FUNCNAME} ]]; then + mkdir -p ${work_dir}/iso/${install_dir}/boot/syslinux + sed "s|%ARCHISO_LABEL%|${iso_label}|g; + s|%INSTALL_DIR%|${install_dir}|g; + s|%ARCH%|${arch}|g" syslinux/syslinux.cfg > ${work_dir}/iso/${install_dir}/boot/syslinux/syslinux.cfg + cp ${work_dir}/root-image/usr/lib/syslinux/menu.c32 ${work_dir}/iso/${install_dir}/boot/syslinux/ + : > ${work_dir}/build.${FUNCNAME} + fi +} + +# Prepare /isolinux +make_isolinux() { + if [[ ! -e ${work_dir}/build.${FUNCNAME} ]]; then + mkdir -p ${work_dir}/iso/isolinux + sed "s|%INSTALL_DIR%|${install_dir}|g" isolinux/isolinux.cfg > ${work_dir}/iso/isolinux/isolinux.cfg + cp ${work_dir}/root-image/usr/lib/syslinux/isolinux.bin ${work_dir}/iso/isolinux/ + : > ${work_dir}/build.${FUNCNAME} + fi +} + +# Process aitab +make_aitab() { + if [[ ! -e ${work_dir}/build.${FUNCNAME} ]]; then + sed "s|%ARCH%|${arch}|g" aitab > ${work_dir}/iso/${install_dir}/aitab + : > ${work_dir}/build.${FUNCNAME} + fi +} + +# Build all filesystem images specified in aitab (.fs .fs.sfs .sfs) +make_prepare() { + mkarchiso ${verbose} -D "${install_dir}" prepare "${work_dir}" +} + +# Build ISO +make_iso() { + mkarchiso ${verbose} -D "${install_dir}" -L "${iso_label}" iso "${work_dir}" "${name}-${version}-${arch}.iso" +} + +if [[ $verbose == "y" ]]; then + verbose="-v" +else + verbose="" +fi + +make_basefs +make_customize_root_image +make_boot +make_syslinux +make_isolinux +make_aitab +make_prepare +make_iso diff --git a/configs/baseline/isolinux/isolinux.cfg b/configs/baseline/isolinux/isolinux.cfg new file mode 100644 index 0000000..e7bbaa4 --- /dev/null +++ b/configs/baseline/isolinux/isolinux.cfg @@ -0,0 +1,5 @@ +DEFAULT loadconfig + +LABEL loadconfig + CONFIG /%INSTALL_DIR%/boot/syslinux/syslinux.cfg + APPEND /%INSTALL_DIR%/boot/syslinux/ diff --git a/configs/baseline/mkinitcpio.conf b/configs/baseline/mkinitcpio.conf new file mode 100644 index 0000000..389ec51 --- /dev/null +++ b/configs/baseline/mkinitcpio.conf @@ -0,0 +1,2 @@ +HOOKS="base udev archiso sata filesystems" +COMPRESSION="xz" diff --git a/configs/baseline/root-image/etc/fstab b/configs/baseline/root-image/etc/fstab new file mode 100644 index 0000000..4b82b80 --- /dev/null +++ b/configs/baseline/root-image/etc/fstab @@ -0,0 +1,2 @@ +# <file system> <dir> <type> <options> <dump> <pass> +/dev/mapper/root-image / auto defaults 0 0 diff --git a/configs/baseline/syslinux/syslinux.cfg b/configs/baseline/syslinux/syslinux.cfg new file mode 100644 index 0000000..f755453 --- /dev/null +++ b/configs/baseline/syslinux/syslinux.cfg @@ -0,0 +1,12 @@ +DEFAULT menu.c32 +PROMPT 0 +MENU TITLE Arch Linux +TIMEOUT 300 + +LABEL arch +MENU LABEL Arch Linux +LINUX /%INSTALL_DIR%/boot/%ARCH%/vmlinuz26 +INITRD /%INSTALL_DIR%/boot/%ARCH%/archiso.img +APPEND archisobasedir=%INSTALL_DIR% archisolabel=%ARCHISO_LABEL% + +ONTIMEOUT arch diff --git a/configs/releng/aitab.core b/configs/releng/aitab.core new file mode 100644 index 0000000..e538000 --- /dev/null +++ b/configs/releng/aitab.core @@ -0,0 +1,6 @@ +# <img> <mnt> <arch> <sfs_comp> <fs_type> <fs_size> +root-image / %ARCH% xz ext4 50% +lib-modules /lib/modules %ARCH% xz ext4 10% +usr-share /usr/share any xz ext4 50% +core-pkgs /repo/pkg %ARCH% xz none 0 +core-any-pkgs /repo/any any xz none 0 diff --git a/configs/releng/aitab.netinstall b/configs/releng/aitab.netinstall new file mode 100644 index 0000000..26733d2 --- /dev/null +++ b/configs/releng/aitab.netinstall @@ -0,0 +1,4 @@ +# <img> <mnt> <arch> <sfs_comp> <fs_type> <fs_size> +root-image / %ARCH% xz ext4 50% +lib-modules /lib/modules %ARCH% xz ext4 10% +usr-share /usr/share any xz ext4 50% diff --git a/configs/releng/build.sh b/configs/releng/build.sh new file mode 100755 index 0000000..1aa80fd --- /dev/null +++ b/configs/releng/build.sh @@ -0,0 +1,284 @@ +#!/bin/bash + +set -e -u + +name=archlinux +iso_label="ARCH_$(date +%Y%m)" +version=$(date +%Y.%m.%d) +install_dir=arch +arch=$(uname -m) +work_dir=work +verbose="n" + +# This function can be called after make_basefs() +get_linux_ver() { + local ALL_kver + eval $(grep ^ALL_kver ${work_dir}/root-image/etc/mkinitcpio.d/kernel26.kver) + echo ${ALL_kver} +} + +# Base installation (root-image) +make_basefs() { + mkarchiso ${verbose} -D "${install_dir}" -p "base" create "${work_dir}" + mkarchiso ${verbose} -D "${install_dir}" -p "memtest86+ syslinux" create "${work_dir}" +} + +# Additional packages (root-image) +make_packages() { + mkarchiso ${verbose} -D "${install_dir}" -p "$(grep -v ^# packages.${arch})" create "${work_dir}" +} + +# Customize installation (root-image) +make_customize_root_image() { + if [[ ! -e ${work_dir}/build.${FUNCNAME} ]]; then + cp -af root-image ${work_dir} + chmod 750 ${work_dir}/root-image/etc/sudoers.d + chmod 440 ${work_dir}/root-image/etc/sudoers.d/g_wheel + if [[ ! -L ${work_dir}/root-image/etc/mtab ]]; then + rm -f ${work_dir}/root-image/etc/mtab + fi + mkdir -p ${work_dir}/root-image/etc/pacman.d + wget -O ${work_dir}/root-image/etc/pacman.d/mirrorlist http://www.archlinux.org/mirrorlist/all/ + sed -i "s/#Server/Server/g" ${work_dir}/root-image/etc/pacman.d/mirrorlist + : > ${work_dir}/build.${FUNCNAME} + fi +} + +# Prepare ${install_dir}/boot/ +make_boot() { + if [[ ! -e ${work_dir}/build.${FUNCNAME} ]]; then + local _src=${work_dir}/root-image + local _dst_boot=${work_dir}/iso/${install_dir}/boot + mkdir -p ${_dst_boot}/${arch} + cp ${_src}/boot/vmlinuz26 ${_dst_boot}/${arch} + mkinitcpio -c ./mkinitcpio.conf -b ${_src} -k $(get_linux_ver) -g ${_dst_boot}/${arch}/archiso.img + cp ${_src}/boot/memtest86+/memtest.bin ${_dst_boot}/memtest + cp ${_src}/usr/share/licenses/common/GPL2/license.txt ${_dst_boot}/memtest.COPYING + : > ${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" syslinux/syslinux.cfg > ${_dst_syslinux}/syslinux.cfg + cp syslinux/splash.png ${_dst_syslinux} + cp ${_src_syslinux}/*.c32 ${_dst_syslinux} + cp ${_src_syslinux}/*.com ${_dst_syslinux} + cp ${_src_syslinux}/*.0 ${_dst_syslinux} + cp ${_src_syslinux}/memdisk ${_dst_syslinux} + mkdir -p ${_dst_syslinux}/hdt + wget -O - http://pciids.sourceforge.net/v2.2/pci.ids | gzip -9 > ${_dst_syslinux}/hdt/pciids.gz + cat ${work_dir}/root-image/lib/modules/$(get_linux_ver)/modules.alias | gzip -9 > ${_dst_syslinux}/hdt/modalias.gz + : > ${work_dir}/build.${FUNCNAME} + fi +} + +# Prepare /isolinux +make_isolinux() { + if [[ ! -e ${work_dir}/build.${FUNCNAME} ]]; then + mkdir -p ${work_dir}/iso/isolinux + sed "s|%INSTALL_DIR%|${install_dir}|g" isolinux/isolinux.cfg > ${work_dir}/iso/isolinux/isolinux.cfg + cp ${work_dir}/root-image/usr/lib/syslinux/isolinux.bin ${work_dir}/iso/isolinux/ + : > ${work_dir}/build.${FUNCNAME} + fi +} + +# Split out /lib/modules from root-image (makes more "dual-iso" friendly) +make_lib_modules() { + if [[ ! -e ${work_dir}/build.${FUNCNAME} ]]; then + mv ${work_dir}/root-image/lib/modules ${work_dir}/lib-modules + : > ${work_dir}/build.${FUNCNAME} + fi +} + +# Split out /usr/share from root-image (makes more "dual-iso" friendly) +make_usr_share() { + if [[ ! -e ${work_dir}/build.${FUNCNAME} ]]; then + mv ${work_dir}/root-image/usr/share ${work_dir}/usr-share + : > ${work_dir}/build.${FUNCNAME} + fi +} + +# Make [core] repository, keep "any" pkgs in a separate fs (makes more "dual-iso" friendly) +make_core_repo() { + if [[ ! -e ${work_dir}/build.${FUNCNAME} ]]; then + local _url _urls _pkg_name _cached_pkg _dst + mkdir -p ${work_dir}/core-any-pkgs + mkdir -p ${work_dir}/core-pkgs + pacman -Sy + _urls=$(pacman -Sddp $(comm -2 -3 <(pacman -Sql core | sort ) <(grep -v ^# core.exclude.${arch} | sort))) + for _url in ${_urls}; do + _pkg_name=${_url##*/} + _cached_pkg=/var/cache/pacman/pkg/${_pkg_name} + _dst=${work_dir}/core-pkgs/${_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}/core-pkgs/core.db.tar.gz ${work_dir}/core-pkgs/${_pkg_name} + if [[ ${_pkg_name} =~ any.pkg ]]; then + mv "${_dst}" ${work_dir}/core-any-pkgs/${_pkg_name} + ln -sf ../any/${_pkg_name} ${work_dir}/core-pkgs/${_pkg_name} + fi + done + : > ${work_dir}/build.${FUNCNAME} + fi +} + +# Process aitab +# args: $1 (core | netinstall) +make_aitab() { + local _iso_type=${1} + if [[ ! -e ${work_dir}/build.${FUNCNAME}_${_iso_type} ]]; then + sed "s|%ARCH%|${arch}|g" aitab.${_iso_type} > ${work_dir}/iso/${install_dir}/aitab + : > ${work_dir}/build.${FUNCNAME}_${_iso_type} + fi +} + +# Build all filesystem images specified in aitab (.fs .fs.sfs .sfs) +make_prepare() { + mkarchiso ${verbose} -D "${install_dir}" prepare "${work_dir}" +} + +# Build ISO +# args: $1 (core | netinstall) +make_iso() { + local _iso_type=${1} + mkarchiso ${verbose} -D "${install_dir}" -L "${iso_label}" iso "${work_dir}" "${name}-${version}-${_iso_type}-${arch}.iso" +} + +# Build dual-iso images from ${work_dir}/i686/iso and ${work_dir}/x86_64/iso +# args: $1 (core | netinstall) +make_dual() { + local _iso_type=${1} + if [[ ! -e ${work_dir}/dual/build.${FUNCNAME}_${_iso_type} ]]; then + if [[ ! -d ${work_dir}/i686/iso || ! -d ${work_dir}/x86_64/iso ]]; then + echo "ERROR: i686 or x86_64 builds does not exist." + _usage 1 + fi + local _src_one _src_two _cfg + if [[ ${arch} == "i686" ]]; then + _src_one=${work_dir}/i686/iso + _src_two=${work_dir}/x86_64/iso + else + _src_one=${work_dir}/x86_64/iso + _src_two=${work_dir}/i686/iso + fi + mkdir -p ${work_dir}/dual/iso + 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 + if [[ ${_iso_type} == "core" ]]; then + if [[ ! -e ${work_dir}/dual/iso/${install_dir}/any/core-any-pkgs.sfs || + ! -e ${work_dir}/dual/iso/${install_dir}/i686/core-pkgs.sfs || + ! -e ${work_dir}/dual/iso/${install_dir}/x86_64/core-pkgs.sfs ]]; then + echo "ERROR: core_iso_single build is not found." + _usage 1 + fi + else + rm -f ${work_dir}/dual/iso/${install_dir}/any/core-any-pkgs.sfs + rm -f ${work_dir}/dual/iso/${install_dir}/i686/core-pkgs.sfs + rm -f ${work_dir}/dual/iso/${install_dir}/x86_64/core-pkgs.sfs + fi + paste -d"\n" <(sed "s|%ARCH%|i686|g" aitab.${_iso_type}) \ + <(sed "s|%ARCH%|x86_64|g" aitab.${_iso_type}) | uniq > ${work_dir}/dual/iso/${install_dir}/aitab + for _cfg in syslinux.dual/*.cfg; do + 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}" -L "${iso_label}" iso "${work_dir}/dual" "${name}-${version}-${_iso_type}-dual.iso" + : > ${work_dir}/dual/build.${FUNCNAME}_${_iso_type} + fi +} + + + +_usage () +{ + echo "usage ${0##*/} net_iso_single | core_iso_single | all_iso_single | clean_single" + echo " net_iso_dual | core_iso_dual | all_iso_dual | clean_dual" + echo + exit ${1} +} + +if [[ ${EUID} -ne 0 ]]; then + echo "This script must be run as root." + _usage 1 +fi + +if [[ $# -lt 1 ]]; then + echo "No command specified" + _usage 1 +fi +command_name="${1}" + +if [[ ${verbose} == "y" ]]; then + verbose="-v" +else + verbose="" +fi + +if [[ ${command_name} =~ single ]]; then + work_dir=${work_dir}/${arch} +fi + +make_common_single() { + make_basefs + make_packages + make_customize_root_image + make_boot + make_syslinux + make_isolinux + make_lib_modules + make_usr_share + make_aitab $1 + make_prepare $1 + make_iso $1 +} + +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 + ;; + clean_single) + rm -rf ${work_dir} + rm -f ${name}-${version}-*-${arch}.iso + ;; + clean_dual) + rm -rf ${work_dir}/dual + rm -f ${name}-${version}-*-dual.iso + ;; + *) + echo "Invalid command name '${command_name}'" + _usage 1 + ;; +esac diff --git a/configs/releng/core.exclude.i686 b/configs/releng/core.exclude.i686 new file mode 100644 index 0000000..a04ceef --- /dev/null +++ b/configs/releng/core.exclude.i686 @@ -0,0 +1,4 @@ +gcc-ada +gcc-fortran +gcc-go +gcc-objc diff --git a/configs/releng/core.exclude.x86_64 b/configs/releng/core.exclude.x86_64 new file mode 100644 index 0000000..a04ceef --- /dev/null +++ b/configs/releng/core.exclude.x86_64 @@ -0,0 +1,4 @@ +gcc-ada +gcc-fortran +gcc-go +gcc-objc diff --git a/configs/releng/isolinux/isolinux.cfg b/configs/releng/isolinux/isolinux.cfg new file mode 100644 index 0000000..e7bbaa4 --- /dev/null +++ b/configs/releng/isolinux/isolinux.cfg @@ -0,0 +1,5 @@ +DEFAULT loadconfig + +LABEL loadconfig + CONFIG /%INSTALL_DIR%/boot/syslinux/syslinux.cfg + APPEND /%INSTALL_DIR%/boot/syslinux/ diff --git a/configs/syslinux-iso/mkinitcpio.conf b/configs/releng/mkinitcpio.conf index aea436d..df833eb 100644 --- a/configs/syslinux-iso/mkinitcpio.conf +++ b/configs/releng/mkinitcpio.conf @@ -1,6 +1,2 @@ -# vim:set ft=sh -MODULES="" -BINARIES="" -FILES="" HOOKS="base udev memdisk archiso archiso_pxe_nbd archiso_loop_mnt pata scsi sata usb fw pcmcia filesystems usbinput" COMPRESSION="xz" diff --git a/configs/syslinux-iso/packages.i686 b/configs/releng/packages.i686 index 51085a1..11d68e5 100644 --- a/configs/syslinux-iso/packages.i686 +++ b/configs/releng/packages.i686 @@ -1,6 +1,4 @@ aif -aufs2 -aufs2-util b43-fwcutter btrfs-progs-unstable crda @@ -19,9 +17,7 @@ ipw2100-fw ipw2200-fw lftp lilo -memtest86+ -ndiswrapper -ndiswrapper-utils +nbd netcfg nfs-utils nilfs-utils @@ -35,12 +31,8 @@ parted pptpclient rsync speedtouch -squashfs-tools -syslinux tcpdump -tiacx tiacx-firmware wireless_tools wpa_actiond -wpa_supplicant zd1211-firmware diff --git a/configs/syslinux-iso/packages.x86_64 b/configs/releng/packages.x86_64 index 51085a1..11d68e5 100644 --- a/configs/syslinux-iso/packages.x86_64 +++ b/configs/releng/packages.x86_64 @@ -1,6 +1,4 @@ aif -aufs2 -aufs2-util b43-fwcutter btrfs-progs-unstable crda @@ -19,9 +17,7 @@ ipw2100-fw ipw2200-fw lftp lilo -memtest86+ -ndiswrapper -ndiswrapper-utils +nbd netcfg nfs-utils nilfs-utils @@ -35,12 +31,8 @@ parted pptpclient rsync speedtouch -squashfs-tools -syslinux tcpdump -tiacx tiacx-firmware wireless_tools wpa_actiond -wpa_supplicant zd1211-firmware diff --git a/configs/syslinux-iso/overlay/arch/report-issues b/configs/releng/root-image/arch/report-issues index bf3b3a3..bf3b3a3 100755 --- a/configs/syslinux-iso/overlay/arch/report-issues +++ b/configs/releng/root-image/arch/report-issues diff --git a/configs/syslinux-iso/overlay/arch/setup b/configs/releng/root-image/arch/setup index 908d106..908d106 100755 --- a/configs/syslinux-iso/overlay/arch/setup +++ b/configs/releng/root-image/arch/setup diff --git a/configs/syslinux-iso/overlay/etc/arch-release b/configs/releng/root-image/etc/arch-release index 153f8b2..153f8b2 100644 --- a/configs/syslinux-iso/overlay/etc/arch-release +++ b/configs/releng/root-image/etc/arch-release diff --git a/configs/syslinux-iso/overlay/etc/archiso/functions b/configs/releng/root-image/etc/archiso/functions index 9fffdcb..9fffdcb 100644 --- a/configs/syslinux-iso/overlay/etc/archiso/functions +++ b/configs/releng/root-image/etc/archiso/functions diff --git a/configs/syslinux-iso/overlay/etc/fstab b/configs/releng/root-image/etc/fstab index 2b5f519..0df0cba 100644 --- a/configs/syslinux-iso/overlay/etc/fstab +++ b/configs/releng/root-image/etc/fstab @@ -2,4 +2,4 @@ # /etc/fstab: static file system information # # <file system> <dir> <type> <options> <dump> <pass> -union / auto noauto 0 0 +/dev/mapper/root-image / auto defaults 0 0 diff --git a/configs/syslinux-iso/overlay/etc/hosts b/configs/releng/root-image/etc/hosts index b6f25e3..e474be0 100644 --- a/configs/syslinux-iso/overlay/etc/hosts +++ b/configs/releng/root-image/etc/hosts @@ -4,5 +4,6 @@ #<ip-address> <hostname.domain.org> <hostname> 127.0.0.1 localhost.localdomain localhost archiso +::1 localhost.localdomain localhost archiso # End of file diff --git a/configs/syslinux-iso/overlay/etc/inittab b/configs/releng/root-image/etc/inittab index 47ea845..2bbc494 100644 --- a/configs/syslinux-iso/overlay/etc/inittab +++ b/configs/releng/root-image/etc/inittab @@ -24,18 +24,18 @@ rh:06:wait:/etc/rc.shutdown su:S:wait:/sbin/sulogin -p # -8 options fixes umlauts problem on login -c1:2345:respawn:/sbin/agetty -n -l /usr/bin/autologin -8 38400 tty1 linux -c2:2345:respawn:/sbin/agetty -8 38400 tty2 linux -c3:2345:respawn:/sbin/agetty -8 38400 tty3 linux -c4:2345:respawn:/sbin/agetty -8 38400 tty4 linux -c5:2345:respawn:/sbin/agetty -8 38400 tty5 linux -c6:2345:respawn:/sbin/agetty -8 38400 tty6 linux +c1:2345:respawn:/sbin/agetty -8 -s -n -l /usr/bin/autologin 38400 tty1 linux +c2:2345:respawn:/sbin/agetty -8 -s 38400 tty2 linux +c3:2345:respawn:/sbin/agetty -8 -s 38400 tty3 linux +c4:2345:respawn:/sbin/agetty -8 -s 38400 tty4 linux +c5:2345:respawn:/sbin/agetty -8 -s 38400 tty5 linux +c6:2345:respawn:/sbin/agetty -8 -s 38400 tty6 linux # Serial Virtual Console for KVM and others VMs -#s0:2345:respawn:/sbin/agetty -8 9600 ttyS0 linux +#s0:2345:respawn:/sbin/agetty -8 -s 9600 ttyS0 linux # Hypervisor Virtual Console for Xen and KVM -#h0:2345:respawn:/sbin/agetty -8 38400 hvc0 linux +#h0:2345:respawn:/sbin/agetty -8 -s 38400 hvc0 linux ca::ctrlaltdel:/sbin/shutdown -t3 -r now diff --git a/configs/syslinux-iso/overlay/etc/issue b/configs/releng/root-image/etc/issue index ce82e88..ce82e88 100644 --- a/configs/syslinux-iso/overlay/etc/issue +++ b/configs/releng/root-image/etc/issue diff --git a/configs/syslinux-iso/overlay/etc/motd b/configs/releng/root-image/etc/motd index ddd9fbc..ddd9fbc 100644 --- a/configs/syslinux-iso/overlay/etc/motd +++ b/configs/releng/root-image/etc/motd diff --git a/configs/syslinux-iso/overlay/etc/pam.d/su b/configs/releng/root-image/etc/pam.d/su index a291042..a291042 100644 --- a/configs/syslinux-iso/overlay/etc/pam.d/su +++ b/configs/releng/root-image/etc/pam.d/su diff --git a/configs/syslinux-iso/overlay/etc/rc.conf b/configs/releng/root-image/etc/rc.conf index aff67e9..92236a2 100644 --- a/configs/syslinux-iso/overlay/etc/rc.conf +++ b/configs/releng/root-image/etc/rc.conf @@ -23,7 +23,6 @@ CONSOLEMAP="$(kernel_cmdline consolemap ${CONSOLEMAP_DEFAULT})" USECOLOR="$(kernel_cmdline usecolor ${USECOLOR_DEFAULT})" VERBOSE="$(kernel_cmdline verbose ${VERBOSE_DEFAULT})" -MOD_AUTOLOAD="yes" MODULES=() UDEV_TIMEOUT=30 @@ -33,4 +32,4 @@ USELVM="no" HOSTNAME="archiso" -DAEMONS=(hwclock syslog-ng network archiso) +DAEMONS=(hwclock syslog-ng archiso) diff --git a/configs/syslinux-iso/overlay/etc/rc.d/archiso b/configs/releng/root-image/etc/rc.d/archiso index 7f9239d..1429516 100755 --- a/configs/syslinux-iso/overlay/etc/rc.d/archiso +++ b/configs/releng/root-image/etc/rc.d/archiso @@ -18,14 +18,6 @@ do_locale_gen () stat_done } -# GIT does not manage perms others thans 755 and 644, so fix here. -do_fix_perms () -{ - stat_busy "Fixing file permissions..." - chmod 440 /etc/sudoers - stat_done -} - # If an alternate console was specified on the kernel command line, # start agetty on it too. do_special_console() @@ -50,7 +42,6 @@ case "$1" in start) do_locale_gen do_makeuser - do_fix_perms do_special_console ;; esac diff --git a/configs/syslinux-iso/overlay/etc/rc.d/functions.d/automated_script b/configs/releng/root-image/etc/rc.d/functions.d/automated_script index edb8ea3..edb8ea3 100644 --- a/configs/syslinux-iso/overlay/etc/rc.d/functions.d/automated_script +++ b/configs/releng/root-image/etc/rc.d/functions.d/automated_script diff --git a/configs/syslinux-iso/overlay/etc/sudoers b/configs/releng/root-image/etc/sudoers.d/g_wheel index 67b20ba..8c45359 100644 --- a/configs/syslinux-iso/overlay/etc/sudoers +++ b/configs/releng/root-image/etc/sudoers.d/g_wheel @@ -1,2 +1 @@ -root ALL=(ALL) ALL %wheel ALL=(ALL) NOPASSWD: ALL diff --git a/configs/syslinux-iso/overlay/usr/bin/autologin b/configs/releng/root-image/usr/bin/autologin index c124f9e..c124f9e 100755 --- a/configs/syslinux-iso/overlay/usr/bin/autologin +++ b/configs/releng/root-image/usr/bin/autologin diff --git a/configs/syslinux-iso/overlay/usr/bin/km b/configs/releng/root-image/usr/bin/km index e24d780..e24d780 100755 --- a/configs/syslinux-iso/overlay/usr/bin/km +++ b/configs/releng/root-image/usr/bin/km diff --git a/archiso2dual/syslinux.cfg b/configs/releng/syslinux.dual/syslinux.cfg index ac92998..ac92998 100644 --- a/archiso2dual/syslinux.cfg +++ b/configs/releng/syslinux.dual/syslinux.cfg diff --git a/archiso2dual/syslinux_32only.cfg b/configs/releng/syslinux.dual/syslinux_32only.cfg index c7a452d..c7a452d 100644 --- a/archiso2dual/syslinux_32only.cfg +++ b/configs/releng/syslinux.dual/syslinux_32only.cfg diff --git a/archiso2dual/syslinux_arch32.cfg b/configs/releng/syslinux.dual/syslinux_arch32.cfg index f912874..6947d75 100644 --- a/archiso2dual/syslinux_arch32.cfg +++ b/configs/releng/syslinux.dual/syslinux_arch32.cfg @@ -5,6 +5,7 @@ perform system maintenance. ENDTEXT MENU LABEL Boot Arch Linux (i686) LINUX /%INSTALL_DIR%/boot/i686/vmlinuz26 -APPEND initrd=/%INSTALL_DIR%/boot/i686/archiso.img archisobasedir=%INSTALL_DIR% archisolabel=%ARCHISO_LABEL% rw_branch_size=75% locale=en_US.UTF-8 +INITRD /%INSTALL_DIR%/boot/i686/archiso.img +APPEND archisobasedir=%INSTALL_DIR% archisolabel=%ARCHISO_LABEL% # Next line should be uncommented when prepare enviroment to boot from PXE. #IPAPPEND 3 diff --git a/archiso2dual/syslinux_arch64.cfg b/configs/releng/syslinux.dual/syslinux_arch64.cfg index 10786cd..02ddc5a 100644 --- a/archiso2dual/syslinux_arch64.cfg +++ b/configs/releng/syslinux.dual/syslinux_arch64.cfg @@ -5,6 +5,7 @@ perform system maintenance. ENDTEXT MENU LABEL Boot Arch Linux (x86_64) LINUX /%INSTALL_DIR%/boot/x86_64/vmlinuz26 -APPEND initrd=/%INSTALL_DIR%/boot/x86_64/archiso.img archisobasedir=%INSTALL_DIR% archisolabel=%ARCHISO_LABEL% rw_branch_size=75% locale=en_US.UTF-8 +INITRD /%INSTALL_DIR%/boot/x86_64/archiso.img +APPEND archisobasedir=%INSTALL_DIR% archisolabel=%ARCHISO_LABEL% # Next line should be uncommented when prepare enviroment to boot from PXE. #IPAPPEND 3 diff --git a/archiso2dual/syslinux_both.cfg b/configs/releng/syslinux.dual/syslinux_both.cfg index 9cd1584..9cd1584 100644 --- a/archiso2dual/syslinux_both.cfg +++ b/configs/releng/syslinux.dual/syslinux_both.cfg diff --git a/archiso2dual/syslinux_head.cfg b/configs/releng/syslinux.dual/syslinux_head.cfg index ff955e4..2f692f8 100644 --- a/archiso2dual/syslinux_head.cfg +++ b/configs/releng/syslinux.dual/syslinux_head.cfg @@ -1,14 +1,9 @@ DEFAULT vesamenu.c32 PROMPT 0 MENU TITLE Arch Linux -MENU BACKGROUND /%INSTALL_DIR%/boot/splash.png +MENU BACKGROUND splash.png TIMEOUT 3000 -# TODO: Replace these crappy messages with something useful -F1 boot.txt -F2 options.txt -F3 help.txt - MENU WIDTH 78 MENU MARGIN 4 MENU ROWS 7 diff --git a/archiso2dual/syslinux_tail.cfg b/configs/releng/syslinux.dual/syslinux_tail.cfg index 7dd1270..7dd1270 100644 --- a/archiso2dual/syslinux_tail.cfg +++ b/configs/releng/syslinux.dual/syslinux_tail.cfg diff --git a/configs/syslinux-iso/boot-files/splash.png b/configs/releng/syslinux/splash.png Binary files differindex 64b959a..64b959a 100644 --- a/configs/syslinux-iso/boot-files/splash.png +++ b/configs/releng/syslinux/splash.png diff --git a/configs/syslinux-iso/boot-files/syslinux/syslinux.cfg b/configs/releng/syslinux/syslinux.cfg index 3b75340..de840f4 100644 --- a/configs/syslinux-iso/boot-files/syslinux/syslinux.cfg +++ b/configs/releng/syslinux/syslinux.cfg @@ -2,12 +2,12 @@ SERIAL 0 38400 DEFAULT vesamenu.c32 PROMPT 0 MENU TITLE Arch Linux -MENU BACKGROUND /%INSTALL_DIR%/boot/splash.png +MENU BACKGROUND splash.png TIMEOUT 3000 MENU WIDTH 78 MENU MARGIN 4 -MENU ROWS 5 +MENU ROWS 6 MENU VSHIFT 10 MENU TIMEOUTROW 13 MENU TABMSGROW 11 @@ -34,7 +34,8 @@ perform system maintenance. ENDTEXT MENU LABEL Boot Arch Linux LINUX /%INSTALL_DIR%/boot/%ARCH%/vmlinuz26 -APPEND initrd=/%INSTALL_DIR%/boot/%ARCH%/archiso.img archisobasedir=%INSTALL_DIR% archisolabel=%ARCHISO_LABEL% rw_branch_size=75% locale=en_US.UTF-8 +INITRD /%INSTALL_DIR%/boot/%ARCH%/archiso.img +APPEND archisobasedir=%INSTALL_DIR% archisolabel=%ARCHISO_LABEL% # Next line should be uncommented when prepare enviroment to boot from PXE. #IPAPPEND 3 diff --git a/configs/syslinux-iso/Makefile b/configs/syslinux-iso/Makefile deleted file mode 100644 index 441917e..0000000 --- a/configs/syslinux-iso/Makefile +++ /dev/null @@ -1,94 +0,0 @@ -ver=$(shell date +%Y.%m.%d) - -WORKDIR=work -INSTALL_DIR=arch -COMPRESS=xz - -ARCH?=$(shell uname -m) - -PWD=$(shell pwd) -NETname=$(PWD)/archlinux-$(ver)-netinstall-$(ARCH).iso -COREname=$(PWD)/archlinux-$(ver)-core-$(ARCH).iso - -PACKAGES="$(shell cat packages.$(ARCH))" - -kver_FILE=$(WORKDIR)/root-image/etc/mkinitcpio.d/kernel26.kver - -all: net-iso core-iso - -# Rules for each type of image -core-iso: $(COREname) -net-iso: $(NETname) - -$(COREname): core-pkgs base-fs - mkarchiso -D $(INSTALL_DIR) -c $(COMPRESS) iso $(WORKDIR) $@ -$(NETname): base-fs - mkarchiso -D $(INSTALL_DIR) -c $(COMPRESS) iso $(WORKDIR) $@ - -# This is the main rule for make the working filesystem. -base-fs: root-image bootfiles initcpio overlay iso-mounts - - -# Rules for make the root-image for base filesystem. -root-image: $(WORKDIR)/root-image/.arch-chroot -$(WORKDIR)/root-image/.arch-chroot: - mkarchiso -D $(INSTALL_DIR) -p base create $(WORKDIR) - mkarchiso -D $(INSTALL_DIR) -p $(PACKAGES) create $(WORKDIR) - -# Rule for make /boot -bootfiles: root-image - mkdir -p $(WORKDIR)/iso/$(INSTALL_DIR)/boot/$(ARCH) - cp $(WORKDIR)/root-image/boot/System.map26 $(WORKDIR)/iso/$(INSTALL_DIR)/boot/$(ARCH)/ - cp $(WORKDIR)/root-image/boot/vmlinuz26 $(WORKDIR)/iso/$(INSTALL_DIR)/boot/$(ARCH)/ - cp $(WORKDIR)/root-image/boot/memtest86+/memtest.bin $(WORKDIR)/iso/$(INSTALL_DIR)/boot/memtest - cp $(WORKDIR)/root-image/usr/share/licenses/common/GPL2/license.txt $(WORKDIR)/iso/$(INSTALL_DIR)/boot/memtest.COPYING - cp boot-files/splash.png $(WORKDIR)/iso/$(INSTALL_DIR)/boot/ - mkdir -p $(WORKDIR)/iso/syslinux - cp $(WORKDIR)/root-image/usr/lib/syslinux/*.c32 $(WORKDIR)/iso/syslinux/ - cp $(WORKDIR)/root-image/usr/lib/syslinux/poweroff.com $(WORKDIR)/iso/syslinux/ - cp $(WORKDIR)/root-image/usr/lib/syslinux/isolinux.bin $(WORKDIR)/iso/syslinux/ - cp $(WORKDIR)/root-image/usr/lib/syslinux/memdisk $(WORKDIR)/iso/syslinux/ - cp $(WORKDIR)/root-image/usr/lib/syslinux/pxelinux.0 $(WORKDIR)/iso/syslinux/ - cp $(WORKDIR)/root-image/usr/lib/syslinux/gpxelinux.0 $(WORKDIR)/iso/syslinux/ - cp boot-files/syslinux/syslinux.cfg $(WORKDIR)/iso/syslinux/syslinux.cfg - # Add pci.ids and modules.alias for hdt - mkdir -p $(WORKDIR)/iso/syslinux/hdt/ - wget -O - http://pciids.sourceforge.net/v2.2/pci.ids | gzip -9 > $(WORKDIR)/iso/syslinux/hdt/pciids.gz - cat $(WORKDIR)/root-image/lib/modules/$(shell grep ^ALL_kver $(kver_FILE) | cut -d= -f2)/modules.alias | gzip -9 > $(WORKDIR)/iso/syslinux/hdt/modalias.gz - -# Rules for initcpio images -initcpio: $(WORKDIR)/iso/$(INSTALL_DIR)/boot/$(ARCH)/archiso.img -$(WORKDIR)/iso/$(INSTALL_DIR)/boot/$(ARCH)/archiso.img: mkinitcpio.conf $(WORKDIR)/root-image/.arch-chroot - mkdir -p $(WORKDIR)/iso/$(INSTALL_DIR)/boot/$(ARCH)/ - mkinitcpio -c ./mkinitcpio.conf -b $(WORKDIR)/root-image -k $(shell grep ^ALL_kver $(kver_FILE) | cut -d= -f2) -g $@ - - -# overlay filesystem -overlay: - mkdir -p $(WORKDIR)/overlay/etc/pacman.d - cp -r overlay $(WORKDIR)/ - wget -O $(WORKDIR)/overlay/etc/pacman.d/mirrorlist http://www.archlinux.org/mirrorlist/all/ - sed -i "s/#Server/Server/g" $(WORKDIR)/overlay/etc/pacman.d/mirrorlist - - -# Rule to process isomounts file. -iso-mounts: $(WORKDIR)/iso/$(INSTALL_DIR)/isomounts -$(WORKDIR)/iso/$(INSTALL_DIR)/isomounts: isomounts root-image - sed "s|@ARCH@|$(ARCH)|g" isomounts > $@ - - -# Rule for make the [core] repo packages -core-pkgs: - ./download-repo.sh core $(WORKDIR)/core-pkgs/src/core/pkg - - -# Clean-up all work -clean: - rm -rf $(WORKDIR) $(NETname) $(COREname) - - -.PHONY: all core-iso net-iso -.PHONY: base-fs -.PHONY: root-image bootfiles initcpio overlay iso-mounts -.PHONY: core-pkgs -.PHONY: clean diff --git a/configs/syslinux-iso/boot-files/releasenotes.txt b/configs/syslinux-iso/boot-files/releasenotes.txt deleted file mode 100644 index 1c2e057..0000000 --- a/configs/syslinux-iso/boot-files/releasenotes.txt +++ /dev/null @@ -1,3 +0,0 @@ -Arch Linux Live Medium - Release Notes --------------------------- diff --git a/configs/syslinux-iso/download-repo.sh b/configs/syslinux-iso/download-repo.sh deleted file mode 100755 index 255304e..0000000 --- a/configs/syslinux-iso/download-repo.sh +++ /dev/null @@ -1,66 +0,0 @@ -#!/bin/sh -# This script downloads a entire pacman repo to a dir -# using the locally configured best mirror. -# -# Copyright (c) 2009 Aaron Griffin <aaronmgriffin@gmail.com> -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. - -REPO="$1" -DEST="$2" - -REPO_CHANGED=n - -if [ -z "$REPO" -o -z "$DEST" ]; then - echo "usage: $(basename $0) <reponame> <dest-dir>" - exit 1 -fi - -if [ $EUID -ne 0 ]; then - echo "This script must be run as root (for pacman -Sp)" - exit 1 -fi - -[ -d "$DEST" ] || mkdir -p "$DEST" - -#update repos -/usr/bin/pacman -Sy - -#Ensure we have core/pkgname format, so we don't get crap from other repos -PKGS=$(/usr/bin/pacman -Sl $REPO | cut -d' ' -f1,2 | tr ' ' '/') - -if [ -n "$PKGS" ]; then - baseurl="" - cachedir="/var/cache/pacman/pkg" - for url in $(/usr/bin/pacman -Sdp $PKGS | grep '://'); do - baseurl="$(dirname "$url")" #save for later - pkgname="$(basename "$url")" - cachedpkg="$cachedir/$pkgname" - if [ ! -e "$DEST/$pkgname" ]; then - if [ -e "$cachedpkg" ]; then - cp -v "$cachedpkg" "$DEST/$pkgname" - REPO_CHANGED=y - else - wget -nv "$url" -O "$DEST/$pkgname" - REPO_CHANGED=y - fi - fi - done - if [ "$REPO_CHANGED" = "y" ]; then - wget -nv "$baseurl/$REPO.db" -O "$DEST/$REPO.db" - fi -else - echo "No packages to download... what'd you break?" - exit 1 -fi diff --git a/configs/syslinux-iso/instructions b/configs/syslinux-iso/instructions deleted file mode 100644 index 5998788..0000000 --- a/configs/syslinux-iso/instructions +++ /dev/null @@ -1,36 +0,0 @@ - Arch Linux - Installation and Live-CDs - ---------------------------- - -All images give you a live console environment in which you can do -a manual or automatic installation and which can be used as maintenance and rescue systems. - -All iso files can also be written to hard disks/usbkeys. - -Flavors: --------- -Netinstall images are the preferred install media for Arch Linux. -You can always get up to date packages using these media. -Core images contain a snapshot of the core repository, which makes them ideal -for offline installations when no Internet access is available -to install the base system. (you can do a netinstall with these also) - -Both come in i686, x86_64 or dual variant. The latter contains both and lets you choose -an architecture at boot. - -How to obtain and use these installation images: -------------------------------------- -Torrents are preferred (they are webseed enabled), but you can also just get the images -from an Arch mirror. - -The Official Arch Linux Install Guide gives you more info: - http://wiki.archlinux.org/index.php/Official_Arch_Linux_Install_Guide - -More info / getting in touch: ----------------------------- -http://bugs.archlinux.org/ -http://mailman.archlinux.org/mailman/listinfo/arch-releng - -Happy installing! -Happy ARCHing! -- Arch Linux Release Engineering team diff --git a/configs/syslinux-iso/isomounts b/configs/syslinux-iso/isomounts deleted file mode 100644 index 608149b..0000000 --- a/configs/syslinux-iso/isomounts +++ /dev/null @@ -1,12 +0,0 @@ -# archiso isomounts file -# img - location of image/directory to mount relative to addons directory -# arch - architecture of this image -# mount point - absolute location on the post-initrd root -# type - either 'bind' or 'squashfs' for now - -# syntax: <img> <arch> <mount point> <type> - -# ORDER MATTERS! Files take top-down precedence. Be careful -@ARCH@/overlay.sqfs @ARCH@ / squashfs -@ARCH@/core-pkgs.sqfs @ARCH@ / squashfs -@ARCH@/root-image.sqfs @ARCH@ / squashfs diff --git a/configs/syslinux-iso/overlay/etc/pacman.conf b/configs/syslinux-iso/overlay/etc/pacman.conf deleted file mode 100644 index 206ab23..0000000 --- a/configs/syslinux-iso/overlay/etc/pacman.conf +++ /dev/null @@ -1,80 +0,0 @@ -# -# /etc/pacman.conf -# -# See the pacman.conf(5) manpage for option and repository directives - -# -# GENERAL OPTIONS -# -[options] -# The following paths are commented out with their default values listed. -# If you wish to use different paths, uncomment and update the paths. -#RootDir = / -#DBPath = /var/lib/pacman/ -#CacheDir = /var/cache/pacman/pkg/ -#LogFile = /var/log/pacman.log -HoldPkg = pacman glibc -# If upgrades are available for these packages they will be asked for first -SyncFirst = pacman -#XferCommand = /usr/bin/wget --passive-ftp -c -O %o %u -#XferCommand = /usr/bin/curl -C - -f %u > %o -#CleanMethod = KeepInstalled -Architecture = auto - -# Pacman won't upgrade packages listed in IgnorePkg and members of IgnoreGroup -#IgnorePkg = -#IgnoreGroup = - -#NoUpgrade = -#NoExtract = - -# Misc options (all disabled by default) -#UseSyslog -#ShowSize -#UseDelta -#TotalDownload -#CheckSpace - -# -# REPOSITORIES -# - can be defined here or included from another file -# - pacman will search repositories in the order defined here -# - local/custom mirrors can be added here or in separate files -# - repositories listed first will take precedence when packages -# have identical names, regardless of version number -# - URLs will have $repo replaced by the name of the current repo -# - URLs will have $arch replaced by the name of the architecture -# -# Repository entries are of the format: -# [repo-name] -# Server = ServerName -# Include = IncludePath -# -# The header [repo-name] is crucial - it must be present and -# uncommented to enable the repo. -# - -# The testing repositories are disabled by default. To enable, uncomment the -# repo name header and Include lines. You can add preferred servers immediately -# after the header, and they will be used before the default mirrors. - -#[testing] -#Include = /etc/pacman.d/mirrorlist - -[core] -Include = /etc/pacman.d/mirrorlist - -[extra] -Include = /etc/pacman.d/mirrorlist - -#[community-testing] -#Include = /etc/pacman.d/mirrorlist - -[community] -Include = /etc/pacman.d/mirrorlist - -# An example of a custom package repository. See the pacman manpage for -# tips on creating your own repositories. -#[custom] -#Server = file:///home/custompkgs - |