index : archiso32 | |
Archlinux32 iso tools | gitolite user |
summaryrefslogtreecommitdiff |
author | Aaron Griffin <aaronmgriffin@gmail.com> | 2008-10-19 15:49:55 -0500 |
---|---|---|
committer | Aaron Griffin <aaronmgriffin@gmail.com> | 2008-10-19 15:49:55 -0500 |
commit | c2ffda39f9c400945ca0283eccfeda2afc40891b (patch) | |
tree | 572abd0052adb55026e5646f4b1c7bf02e60dcf2 | |
parent | f3c061b5413fcb7ed7ea75036054ea14115b8f41 (diff) |
-rw-r--r-- | archiso/hooks/archiso | 10 | ||||
-rwxr-xr-x | archiso/mkarchiso | 169 | ||||
-rw-r--r-- | configs/default/Makefile | 41 | ||||
-rw-r--r-- | configs/default/overlay/boot/grub/menu.lst | 4 | ||||
-rw-r--r-- | configs/default/overlay/etc/rc.conf | 2 | ||||
-rw-r--r-- | configs/install-iso/Makefile | 12 | ||||
-rw-r--r-- | configs/install-iso/overlay/boot/grub/menu.lst | 8 | ||||
-rw-r--r-- | configs/install-iso/overlay/etc/rc.conf | 2 | ||||
-rw-r--r-- | configs/xfce4/overlay/boot/grub/menu.lst | 4 | ||||
-rw-r--r-- | configs/xfce4/overlay/etc/rc.conf | 2 |
diff --git a/archiso/hooks/archiso b/archiso/hooks/archiso index 1464a6a..b614afd 100644 --- a/archiso/hooks/archiso +++ b/archiso/hooks/archiso @@ -47,7 +47,7 @@ run_hook () msg ":: Scanning cd drives..." for cdrom in /dev/cd/*; do if mount -r -t iso9660 "${cdrom}" ${bootmnt} >/dev/null 2>&1; then - if [ -e "${bootmnt}/archlive.sqfs" ]; then + if [ -e "${bootmnt}/archiso.sqfs" ]; then found=1 msg "${cdrom}" break @@ -63,7 +63,7 @@ run_hook () for usb in /dev/sd[a-z][0-9]; do if mount -r -t vfat "${usb}" ${bootmnt} >/dev/null 2>&1 ||\ mount -r -t ext2 "${usb}" ${bootmnt} >/dev/null 2>&1; then - if [ -e "${bootmnt}/archlive.sqfs" ]; then + if [ -e "${bootmnt}/archiso.sqfs" ]; then found=1 msg "${usb}" break @@ -80,11 +80,11 @@ run_hook () exit 1 fi - base_img="${bootmnt}/archlive.sqfs" + base_img="${bootmnt}/archiso.sqfs" if [ "${copytoram}" = "y" ]; then msg ":: Copying squashfs image to RAM" - /bin/cat ${base_img} > /tmpfs/archlive.sqfs - base_img="/tmpfs/archlive.sqfs" + /bin/cat ${base_img} > /tmpfs/archiso.sqfs + base_img="/tmpfs/archiso.sqfs" fi msg ":: Mounting squashfs image" diff --git a/archiso/mkarchiso b/archiso/mkarchiso index e6d3877..943f0c1 100755 --- a/archiso/mkarchiso +++ b/archiso/mkarchiso @@ -1,16 +1,10 @@ #!/bin/bash CPIOCONFIG="$(pwd)/archiso-mkinitcpio.conf" -DEF_CONFIG_DIR="$(pwd)/overlay" -PKGFILE="$(pwd)/packages.list" PKGLIST="" QUIET="y" FORCE="n" -ADDON_DIR="" - -command_name="" -work_dir="" -imgname="" +MOUNTFILE="$(pwd)/mounts" APPNAME=$(basename "${0}") @@ -21,26 +15,21 @@ usage () echo " general options:" echo " -f Force overwrite of working files/squashfs image/bootable image" echo " -i CPIO_CONFIG Use CONFIG file for mkinitcpio. default: ${CPIOCONFIG}" - echo " -P PKGFILE File with list of packages to install. default: ${PKGFILE}" echo " -p PACKAGE Additional package to install, can be used multiple times" - echo " -a ADDON_DIR Use addons from DIR. default: none" echo " -t <iso,disk> Type of image to create. Defaults to iso." echo " -v Enable verbose output." echo " -h This message." echo " commands:" - echo " install <working dir> : where to build the image root" - echo " squash <working dir> : generate a squashfs image of the installed root" - echo " img <working dir> <image name> : build an image from the working directory" - echo " all <working dir> <image name> : perform all of the above, in order" + echo " install <working dir> <pkg file> : install packages to the working dir" + echo " squash <working dir> <sqfs name> : generate a squashfs image of the working dir" + echo " img <working dir> <image name> : build an image from the working dir" exit $1 } while getopts 'i:P:p:a:t:fvh' arg; do case "${arg}" in i) CPIOCONFIG="${OPTARG}" ;; - P) PKGFILE="${OPTARG}" ;; p) PKGLIST="${PKGLIST} ${OPTARG}" ;; - a) ADDON_DIR="${OPTARG}" ;; t) IMG_TYPE="${OPTARG}" ;; f) FORCE="y" ;; v) QUIET="n" ;; @@ -61,22 +50,24 @@ if [ "$EUID" != "0" ]; then fi command_name="${1}" +work_dir="" +pkgfile="" +imgname="" + case "${command_name}" in - install) work_dir="${2}" ;; - squash) work_dir="${2}" ;; + install) work_dir="${2}"; pkgfile="${3}"; imgname="none" ;; + squash) work_dir="${2}"; imgname="${3}" ;; img) work_dir="${2}"; imgname="${3}" ;; - all) work_dir="${2}"; imgname="${3}" ;; *) echo "invalid command name '${command_name}'"; usage 1 ;; esac -[ "x${work_dir}" = "x" ] && (echo "please specify a working directory" && usage 1) - -IMGROOT="${work_dir}/img" -INSTROOT="${work_dir}/install" +[ "x${imgname}" = "x" ] && (echo "Image name must be specified" && usage 1) +[ "x${work_dir}" = "x" ] && (echo "Please specify a working directory" && usage 1) _kversion () { - source ${INSTROOT}/etc/mkinitcpio.d/kernel26.kver + # Man this is gross... we need a better way to get the kernel version + source ${work_dir}/etc/mkinitcpio.d/kernel26.kver echo ${ALL_kver} } @@ -85,12 +76,16 @@ _pacman () { local ret if [ "${QUIET}" = "y" ]; then - mkarchroot -f ${INSTROOT} $* 2>&1 >/dev/null + mkarchroot -f ${work_dir} $* 2>&1 >/dev/null ret=$? else - mkarchroot -f ${INSTROOT} $* + mkarchroot -f ${work_dir} $* ret=$? fi + + # Cleanup + find "${work_dir}" -name *.pacnew -name *.pacsave -name *.pacorig -delete + if [ $ret -ne 0 ]; then exit 1 fi @@ -111,94 +106,85 @@ install_pkgfile () fi } - command_install () { - echo "====> Installing/building image root" + echo "====> Installing packages to '${work_dir}'" if [ -e "${work_dir}" -a "${FORCE}" = "n" ]; then echo "error: Working dir '${work_dir}' already exists, aborting." exit 1 fi - mkdir -p "${IMGROOT}" - mkdir -p "${INSTROOT}" + mkdir -p "${work_dir}" echo "Installing packages..." - echo " Installing packages from '${PKGFILE}'" - install_pkgfile "${PKGFILE}" + echo " Installing packages from '${pkgfile}'" + install_pkgfile "${pkgfile}" for pkg in ${PKGLIST}; do echo " Installing package '${pkg}'" _pacman "${pkg}" done - echo "Updating kernel module dependencies" - kernelver=$(_kversion) - depmod -a -b "${INSTROOT}" "${kernelver}" - # remove the initcpio images that were generated for the host system - find "${INSTROOT}/boot" -name *.img -delete + if [ -d "${work_dir}/lib/modules/" ]; then + echo "Updating kernel module dependencies" + kernelver=$(_kversion) + depmod -a -b "${work_dir}" "${kernelver}" + fi - echo "Creating default home directory" - install -d -o1000 -g100 -m0755 "${INSTROOT}/home/arch" + echo "Cleaning up what we can" + if [ -d "${work_dir}/boot/" ]; then + # remove the initcpio images that were generated for the host system + find "${work_dir}/boot" -name *.img -delete + fi - # Cleanup - echo "Cleaning up image root files..." - find "${INSTROOT}" -name *.pacnew -name *.pacsave -name *.pacorig -delete + #TODO is this needed? do it at the Makefile level? + if [ -d "${work_dir}/home/" ]; then + echo "Creating default home directory" + install -d -o1000 -g100 -m0755 "${work_dir}/home/arch" + fi # delete a lot of unnecessary cache/log files kill_dirs="var/abs var/cache/man var/cache/pacman var/log/* var/mail tmp/* initrd" for x in ${kill_dirs}; do - if [ -e "${INSTROOT}/${x}" ]; then - rm -rf "${INSTROOT}/${x}" + if [ -e "${work_dir}/${x}" ]; then + rm -rf "${work_dir}/${x}" fi done # pacman DBs are big, delete all sync dbs - rm -rf "${INSTROOT}/var/lib/pacman/sync" + rm -rf "${work_dir}/var/lib/pacman/sync" - # copy over kernel and grub configs for boot - if [ -e "${INSTROOT}/boot" -a -e "${DEF_CONFIG_DIR}/boot" ]; then - rm -rf "${IMGROOT}/boot" - cp -r "${INSTROOT}/boot" "${IMGROOT}" - cp -rf "${DEF_CONFIG_DIR}/boot" "${IMGROOT}" - fi - - # TODO: this might belong somewhere else - mkdir -p "${IMGROOT}/addons" - if [ -d "${ADDON_DIR}" ]; then - echo "Copying addons from ${ADDON_DIR}..." - cp -r ${ADDON_DIR}/* "${IMGROOT}/addons" - fi + #TODO test for existance + cp "${MOUNTFILE}" "${work_dir}/mounts" # always make an addon out of DEF_CONFIG_DIR - echo "Creating default overlay..." - if [ "${QUIET}" = "y" ]; then - mksquashfs "${DEF_CONFIG_DIR}" "${IMGROOT}/addons/overlay.sqfs" -noappend >/dev/null - else - mksquashfs "${DEF_CONFIG_DIR}" "${IMGROOT}/addons/overlay.sqfs" -noappend - fi + #echo "Creating default overlay..." + #if [ "${QUIET}" = "y" ]; then + # mksquashfs "${DEF_CONFIG_DIR}" "${work_dir}/addons/overlay.sqfs" -noappend >/dev/null + #else + # mksquashfs "${DEF_CONFIG_DIR}" "${work_dir}/addons/overlay.sqfs" -noappend + #fi } # command_squash path image command_squash () { - echo "====> Generating SquashFS image" - imagename="${IMGROOT}/archlive.sqfs" - if [ -e "${imagename}" ]; then + echo "====> Generating SquashFS image ${imgname}" + if [ -e "${imgname}" ]; then if [ "${FORCE}" = "y" ]; then echo -n "Removing old SquashFS image..." - rm "${imagename}" + rm "${imgname}" echo "done." else - echo "error: SquashFS image '${imagename}' already exists, aborting." + echo "error: SquashFS image '${imgname}' already exists, aborting." exit 1 fi fi - echo "Creating squashfs image. This may take some time..." + echo "Creating SquashFS image. This may take some time..." start=$(date +%s) if [ "${QUIET}" = "y" ]; then - mksquashfs "${INSTROOT}" "${imagename}" -noappend >/dev/null + mksquashfs "${work_dir}" "${imgname}" -noappend >/dev/null else - mksquashfs "${INSTROOT}" "${imagename}" -noappend + mksquashfs "${work_dir}" "${imgname}" -noappend fi minutes=$(echo $start $(date +%s) | awk '{ printf "%0.2f",($2-$1)/60 }') echo "Image creation done in $minutes minutes." @@ -206,7 +192,6 @@ command_squash () { command_img () { echo "====> Making bootable image" - [ "x${imgname}" = "x" ] && (echo "Bootable image name must be specified" && usage 1) if [ -e "${imgname}" ]; then if [ "${FORCE}" = "y" ]; then echo "Removing existing bootable image..." @@ -222,14 +207,14 @@ command_img () { fi kernelver=$(_kversion) - basedir=${INSTROOT} - [ "${INSTROOT:0:1}" != "/" ] && basedir="$(pwd)/${INSTROOT}" + basedir=${work_dir} + [ "${work_dir:0:1}" != "/" ] && basedir="$(pwd)/${work_dir}" echo "Generating initcpio for image..." if [ "${QUIET}" = "y" ]; then - mkinitcpio -c "${CPIOCONFIG}" -b "${basedir}" -k "${kernelver}" -g "${IMGROOT}/boot/archlive.img" >/dev/null + mkinitcpio -c "${CPIOCONFIG}" -b "${basedir}" -k "${kernelver}" -g "${work_dir}/boot/archiso.img" >/dev/null ret=$? else - mkinitcpio -c "${CPIOCONFIG}" -b "${basedir}" -k "${kernelver}" -g "${IMGROOT}/boot/archlive.img" + mkinitcpio -c "${CPIOCONFIG}" -b "${basedir}" -k "${kernelver}" -g "${work_dir}/boot/archiso.img" ret=$? fi if [ $ret -ne 0 ]; then @@ -237,21 +222,41 @@ command_img () { exit 1 fi - cp ${INSTROOT}/usr/lib/grub/i386-pc/* "${IMGROOT}/boot/grub" + USE_GRUB=1 + bootflags="" + if [ "$USE_GRUB" = "1" ]; then + _pacman grub #grub-gfx ?? + mkdir -p "${work_dir}/boot/grub" + cp "${work_dir}/usr/lib/grub/i386-pc/*" "${work_dir}/boot/grub" + + # copy over kernel and grub configs for boot + if [ -d "${work_dir}/boot" -a -e "${DEF_CONFIG_DIR}/boot" ]; then + rm -rf "${work_dir}/boot" + cp -r "${work_dir}/boot" "${work_dir}" + cp -rf "${DEF_CONFIG_DIR}/boot" "${work_dir}" + fi + bootflags="boot/grub/stage2_eltorito" + else + _pacman isolinux + bootflags="boot/whatever/isolinux" + fi if [ "x$IMG_TYPE" == "xdisk" ]; then echo "Creating DISK image..." - mkusbimg "${IMGROOT}" "${imgname}" + mkusbimg "${work_dir}" "${imgname}" else echo "Creating ISO image..." - q="" + if [ -z "$bootflags" ]; then + echo "Eeek, no boot flags found. This probably won't be bootable" + fi + qflag="" [ "${QUIET}" = "y" ] && qflag="-q" - mkisofs ${qflag} -r -l -b "boot/grub/stage2_eltorito" -uid 0 -gid 0 \ + mkisofs ${qflag} -r -l $bootflags -uid 0 -gid 0 \ -no-emul-boot -boot-load-size 4 -boot-info-table \ -publisher "Arch Linux <archlinux.org>" \ - -input-charset=UTF-8 -p "prepared by $NAME" \ + -input-charset=UTF-8 -p "prepared by mkarchiso" \ -A "Arch Linux Live/Rescue CD" \ - -o "${imgname}" "${IMGROOT}" + -o "${imgname}" "${work_dir}" fi } diff --git a/configs/default/Makefile b/configs/default/Makefile new file mode 100644 index 0000000..38d0533 --- /dev/null +++ b/configs/default/Makefile @@ -0,0 +1,41 @@ +ver=2008.09 +kver=2.6.26-ARCH +carch=i686 +FTPname=$(PWD)/archlinux-$(ver)-ftp-$(carch) +COREname=$(PWD)/archlinux-$(ver)-core-$(carch) + +all: core-iso core-usb ftp-iso ftp-usb + +core-usb: .work-core + mkinitcpio -c initcpio-ide -b .work-core/install -k $(kver) -g .work-core/img/boot/archiso-ide.img + mkarchiso -v -t disk -i initcpio-pata img .work-core $(COREname).img + +core-iso: .work-core + mkinitcpio -c initcpio-ide -b .work-core/install -k $(kver) -g .work-core/img/boot/archiso-ide.img + mkarchiso -v -t iso -i initcpio-pata img .work-core $(COREname).iso + +ftp-usb: .work-ftp + mkinitcpio -c initcpio-ide -b .work-ftp/install -k $(kver) -g .work-ftp/img/boot/archiso-ide.img + mkarchiso -v -t disk -i initcpio-pata img .work-ftp $(FTPname).img + +ftp-iso: .work-ftp + mkinitcpio -c initcpio-ide -b .work-ftp/install -k $(kver) -g .work-ftp/img/boot/archiso-ide.img + mkarchiso -v -t iso -i initcpio-pata img .work-ftp $(FTPname).iso + +.work-ftp: + chmod 0440 overlay/etc/sudoers + mkarchiso -v -P packages.list-$(carch) install .work-ftp + mkarchiso -v squash .work-ftp + +.work-core: addons/core-pkgs + chmod 0440 overlay/etc/sudoers + mkarchiso -v -a addons -P packages.list-$(carch) install .work-core + mkarchiso -v squash .work-core + +# hacky way to always pull +.PHONY: addons/core-pkgs +addons/core-pkgs: + wget --mirror -P addons/core-pkgs -nH --cut-dirs=3 ftp://ftp.archlinux.org/core/os/$(carch) + +clean: + rm -fr .work-ftp .work-core diff --git a/configs/default/overlay/boot/grub/menu.lst b/configs/default/overlay/boot/grub/menu.lst index 4885944..6755d09 100644 --- a/configs/default/overlay/boot/grub/menu.lst +++ b/configs/default/overlay/boot/grub/menu.lst @@ -3,9 +3,9 @@ default 0 color light-blue/blue black/light-grey splashimage=/boot/splash.xpm.gz -title Boot ArchLive +title Boot ArchLinux LiveCD kernel /boot/vmlinuz26 lang=en locale=en_US.UTF-8 ramdisk_size=75% -initrd /boot/archlive.img +initrd /boot/archiso.img title Tools... configfile /boot/grub/tools.lst diff --git a/configs/default/overlay/etc/rc.conf b/configs/default/overlay/etc/rc.conf index 5335ff8..6dec7d2 100644 --- a/configs/default/overlay/etc/rc.conf +++ b/configs/default/overlay/etc/rc.conf @@ -18,7 +18,7 @@ USECOLOR="yes" MOD_AUTOLOAD="yes" -HOSTNAME="archlive" +HOSTNAME="archiso" #TODO add more auto-daemons here, especially the live-cd specific stuff DAEMONS=(syslog-ng network crond) diff --git a/configs/install-iso/Makefile b/configs/install-iso/Makefile index 72de257..0a99075 100644 --- a/configs/install-iso/Makefile +++ b/configs/install-iso/Makefile @@ -1,5 +1,5 @@ -ver=2008.09 -kver=2.6.26-ARCH +ver=2008.10 +kver=2.6.27-ARCH carch=i686 FTPname=$(PWD)/archlinux-$(ver)-ftp-$(carch) COREname=$(PWD)/archlinux-$(ver)-core-$(carch) @@ -7,19 +7,19 @@ COREname=$(PWD)/archlinux-$(ver)-core-$(carch) all: core-iso core-usb ftp-iso ftp-usb core-usb: .work-core - mkinitcpio -c initcpio-ide -b .work-core/install -k $(kver) -g .work-core/img/boot/archlive-ide.img + mkinitcpio -c initcpio-ide -b .work-core/install -k $(kver) -g .work-core/img/boot/archiso-ide.img mkarchiso -v -t disk -i initcpio-pata img .work-core $(COREname).img core-iso: .work-core - mkinitcpio -c initcpio-ide -b .work-core/install -k $(kver) -g .work-core/img/boot/archlive-ide.img + mkinitcpio -c initcpio-ide -b .work-core/install -k $(kver) -g .work-core/img/boot/archiso-ide.img mkarchiso -v -t iso -i initcpio-pata img .work-core $(COREname).iso ftp-usb: .work-ftp - mkinitcpio -c initcpio-ide -b .work-ftp/install -k $(kver) -g .work-ftp/img/boot/archlive-ide.img + mkinitcpio -c initcpio-ide -b .work-ftp/install -k $(kver) -g .work-ftp/img/boot/archiso-ide.img mkarchiso -v -t disk -i initcpio-pata img .work-ftp $(FTPname).img ftp-iso: .work-ftp - mkinitcpio -c initcpio-ide -b .work-ftp/install -k $(kver) -g .work-ftp/img/boot/archlive-ide.img + mkinitcpio -c initcpio-ide -b .work-ftp/install -k $(kver) -g .work-ftp/img/boot/archiso-ide.img mkarchiso -v -t iso -i initcpio-pata img .work-ftp $(FTPname).iso .work-ftp: diff --git a/configs/install-iso/overlay/boot/grub/menu.lst b/configs/install-iso/overlay/boot/grub/menu.lst index 410e9d3..7d47842 100644 --- a/configs/install-iso/overlay/boot/grub/menu.lst +++ b/configs/install-iso/overlay/boot/grub/menu.lst @@ -3,13 +3,13 @@ default 0 color light-blue/blue black/light-grey splashimage=/boot/splash.xpm.gz -title Boot ArchLive +title Boot ArchLinux LiveCD kernel /boot/vmlinuz26 lang=en locale=en_US.UTF-8 ramdisk_size=75% -initrd /boot/archlive.img +initrd /boot/archiso.img -title Boot ArchLive [legacy IDE] +title Boot ArchLinux LiveCD [legacy IDE] kernel /boot/vmlinuz26 lang=en locale=en_US.UTF-8 ramdisk_size=75% ide-legacy -initrd /boot/archlive-ide.img +initrd /boot/archiso-ide.img title Tools... configfile /boot/grub/tools.lst diff --git a/configs/install-iso/overlay/etc/rc.conf b/configs/install-iso/overlay/etc/rc.conf index 5335ff8..6dec7d2 100644 --- a/configs/install-iso/overlay/etc/rc.conf +++ b/configs/install-iso/overlay/etc/rc.conf @@ -18,7 +18,7 @@ USECOLOR="yes" MOD_AUTOLOAD="yes" -HOSTNAME="archlive" +HOSTNAME="archiso" #TODO add more auto-daemons here, especially the live-cd specific stuff DAEMONS=(syslog-ng network crond) diff --git a/configs/xfce4/overlay/boot/grub/menu.lst b/configs/xfce4/overlay/boot/grub/menu.lst index 4885944..6755d09 100644 --- a/configs/xfce4/overlay/boot/grub/menu.lst +++ b/configs/xfce4/overlay/boot/grub/menu.lst @@ -3,9 +3,9 @@ default 0 color light-blue/blue black/light-grey splashimage=/boot/splash.xpm.gz -title Boot ArchLive +title Boot ArchLinux LiveCD kernel /boot/vmlinuz26 lang=en locale=en_US.UTF-8 ramdisk_size=75% -initrd /boot/archlive.img +initrd /boot/archiso.img title Tools... configfile /boot/grub/tools.lst diff --git a/configs/xfce4/overlay/etc/rc.conf b/configs/xfce4/overlay/etc/rc.conf index 45ff03e..aa83e1b 100644 --- a/configs/xfce4/overlay/etc/rc.conf +++ b/configs/xfce4/overlay/etc/rc.conf @@ -18,7 +18,7 @@ USECOLOR="yes" MOD_AUTOLOAD="yes" -HOSTNAME="archlive" +HOSTNAME="archiso" #TODO add more auto-daemons here, especially the live-cd specific stuff DAEMONS=(syslog-ng network crond @xfce4) |