diff options
-rw-r--r-- | archiso2dual/Makefile | 13 | ||||
-rw-r--r-- | archiso2dual/README | 49 | ||||
-rwxr-xr-x | archiso2dual/archiso2dual | 457 | ||||
-rw-r--r-- | archiso2dual/isolinux.cfg | 91 | ||||
-rw-r--r-- | archiso2dual/isomounts.i686 | 5 | ||||
-rw-r--r-- | archiso2dual/isomounts.x86_64 | 5 | ||||
-rw-r--r-- | archiso2dual/isomounts.x86_64-i686 | 5 |
7 files changed, 625 insertions, 0 deletions
diff --git a/archiso2dual/Makefile b/archiso2dual/Makefile new file mode 100644 index 0000000..fc29dae --- /dev/null +++ b/archiso2dual/Makefile @@ -0,0 +1,13 @@ +all: + +install: all + install -D -m 755 archiso2dual $(DESTDIR)/usr/sbin/archiso2dual + install -d -m 644 $(DESTDIR)/usr/share/archiso2dual/ + install -D -m 644 isomounts.i686 $(DESTDIR)/usr/share/archiso2dual/isomounts.i686 + install -D -m 644 isomounts.x86_64 $(DESTDIR)/usr/share/archiso2dual/isomounts.x86_64 + install -D -m 644 isomounts.x86_64-i686 $(DESTDIR)/usr/share/archiso2dual/isomounts.x86_64-i686 + install -D -m 644 isolinux.cfg $(DESTDIR)/usr/share/archiso2dual/isolinux.cfg + +uninstall: + rm -f $(DESTDIR)/usr/sbin/archiso2dual + rm -rf $(DESTDIR)/usr/share/archiso2dual diff --git a/archiso2dual/README b/archiso2dual/README new file mode 100644 index 0000000..acbeffc --- /dev/null +++ b/archiso2dual/README @@ -0,0 +1,49 @@ +Tree structure of an iso image archlinux-2010.02.25-core-dual.iso (652MB) +running with profile "full": + +# tree -h -I *.c32 +. +|-- [ 92] any +| `-- [ 29M] usrshare.sqfs +|-- [ 496] boot +| |-- [ 140] i686 +| | |-- [5.6M] archiso.img +| | `-- [1.7M] vmlinuz26 +| |-- [1.6K] isolinux +| | |-- [ 0] boot.cat +| | |-- [ 14K] isolinux.bin +| | |-- [2.5K] isolinux.cfg +| | `-- [ 25K] memdisk +| |-- [157K] memtest +| |-- [ 18K] memtest.COPYING +| |-- [ 70] releasenotes.txt +| |-- [ 44K] splash.png +| |-- [ 140] x86_64 +| | |-- [5.7M] archiso.img +| | `-- [1.9M] vmlinuz26 +| |-- [ 38K] x86test +| `-- [ 18K] x86test.COPYING +|-- [ 260] i686 +| |-- [209M] core-pkgs.sqfs +| |-- [ 24M] libmodules.sqfs +| |-- [8.0K] overlay.sqfs +| `-- [ 58M] root-image.sqfs +|-- [ 210] isomounts.i686 +|-- [ 228] isomounts.x86_64 +|-- [ 226] isomounts.x86_64-i686 +`-- [ 260] x86_64 + |-- [222M] core-pkgs.sqfs + |-- [ 25M] libmodules.sqfs + |-- [8.0K] overlay.sqfs + `-- [ 66M] root-image.sqfs + +7 directories, 26 files + +# ls -1sh +total 1.9G +652M archlinux-2010.02.25-core-dual.iso +363M archlinux-2010.02.25-core-i686.iso +385M archlinux-2010.02.25-core-x86_64.iso +220M archlinux-2010.02.25-netinstall-dual.iso +153M archlinux-2010.02.25-netinstall-i686.iso +163M archlinux-2010.02.25-netinstall-x86_64.iso diff --git a/archiso2dual/archiso2dual b/archiso2dual/archiso2dual new file mode 100755 index 0000000..d84d7d8 --- /dev/null +++ b/archiso2dual/archiso2dual @@ -0,0 +1,457 @@ +#!/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" +isolinuxcfg_file="/usr/share/archiso2dual/isolinux.cfg" +appname=${0##*/} +_error="0" +_confirm="n" +_v="" + +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/boot/archiso.img $work_dir/iso/boot/${_arch}/archiso.img + cp ${_v} $work_dir/${_arch}/mnt/boot/vmlinuz26 $work_dir/iso/boot/${_arch}/vmlinuz26 + done +} + +isolinux_copy() { + echo "Executing: ${FUNCNAME}" + cp ${_v} $work_dir/i686/mnt/boot/{memtest*,releasenotes.txt,splash.png,x86test*} $work_dir/iso/boot/ + cp ${_v} $work_dir/i686/mnt/boot/isolinux/*.c32 $work_dir/iso/boot/isolinux/ + cp ${_v} $work_dir/i686/mnt/boot/isolinux/memdisk $work_dir/iso/boot/isolinux/ + cp ${_v} $work_dir/i686/mnt/boot/isolinux/isolinux.bin $work_dir/iso/boot/isolinux/ +} + +isolinuxcfg_copy() { + echo "Executing: ${FUNCNAME}" + sed "s|XXX|${label}|g" ${isolinuxcfg_file} > $work_dir/iso/boot/isolinux/isolinux.cfg +} + +isomounts_copy() { + echo "Executing: ${FUNCNAME}" + cp ${_v} ${isomounts_file}.i686 $work_dir/iso/ + cp ${_v} ${isomounts_file}.x86_64 $work_dir/iso/ + cp ${_v} ${isomounts_file}.x86_64-i686 $work_dir/iso/ +} + +squashfs_copy() { + echo "Executing: ${FUNCNAME}" + for _arch in i686 x86_64; do + cp ${_v} $work_dir/${_arch}/mnt/*.sqfs $work_dir/iso/${_arch}/ + done +} + +make_iso() { + echo "Executing: ${FUNCNAME}" + if [ "${quiet}" = "y" ]; then + _qflag="-quiet" + else + _qflag="" + fi + mkisofs ${_v} ${_qflag} -r -l \ + -b boot/isolinux/isolinux.bin -c boot/isolinux/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 -offset 1 "${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/${arch}/${img}.sqfs > /dev/null + else + unsquashfs -d ${work_dir}/tmp/${arch}/${img} $work_dir/iso/${arch}/${img}.sqfs + fi +} + +mksquashfs_image() { + echo "Executing: ${FUNCNAME}" + img=${1} + arch=${2} + rm -f ${work_dir}/iso/${arch}/${img}.sqfs + if [ "${quiet}" = "y" ]; then + mksquashfs ${work_dir}/tmp/${arch}/${img} ${work_dir}/iso/${arch}/${img}.sqfs > /dev/null + else + mksquashfs ${work_dir}/tmp/${arch}/${img} ${work_dir}/iso/${arch}/${img}.sqfs + fi +} + +usrshare_copy_from_root_image() { + echo "Executing: ${FUNCNAME}" + cp -a ${work_dir}/tmp/i686/root-image/usr/share ${work_dir}/tmp/any/usrshare +} + +usrshare_purge() { + echo "Executing: ${FUNCNAME}" + rm -rf ${work_dir}/tmp/any/usrshare/man + rm -rf ${work_dir}/tmp/any/usrshare/info + rm -rf ${work_dir}/tmp/any/usrshare/doc +} + +usrshare_make_image() { + echo "Executing: ${FUNCNAME}" + mksquashfs_image usrshare any +} + +libmodules_make_image() { + echo "Executing: ${FUNCNAME}" + for _arch in i686 x86_64; do + mksquashfs_image libmodules ${_arch} + done +} + +libmodules_copy_from_root_image() { + echo "Executing: ${FUNCNAME}" + for _arch in i686 x86_64; do + cp -a ${work_dir}/tmp/${_arch}/root-image/lib/modules ${work_dir}/tmp/${_arch}/libmodules + done +} + +root_image_extract() { + echo "Executing: ${FUNCNAME}" + for _arch in i686 x86_64; do + unsquashfs_image root-image ${_arch} + done +} + +root_image_make_image() { + echo "Executing: ${FUNCNAME}" + for _arch in i686 x86_64; do + mksquashfs_image root-image ${_arch} + done +} + +root_image_remove_usrshare() { + echo "Executing: ${FUNCNAME}" + for _arch in i686 x86_64; do + rm -rf ${work_dir}/tmp/${_arch}/root-image/usr/share + done +} + +root_image_remove_libmodules() { + echo "Executing: ${FUNCNAME}" + for _arch in i686 x86_64; do + rm -rf ${work_dir}/tmp/${_arch}/root-image/lib/modules + done +} + +root_image_purge() { + echo "Executing: ${FUNCNAME}" + for _arch in i686 x86_64; do + rm -rf ${work_dir}/tmp/${_arch}/root-image/boot + rm -rf ${work_dir}/tmp/${_arch}/root-image/usr/include + rm -rf ${work_dir}/tmp/${_arch}/root-image/usr/src + done +} + +make_workspace() { + echo "Executing: ${FUNCNAME}" + for _arch in i686 x86_64; do + mkdir ${_v} -p ${work_dir}/iso/${_arch} + mkdir ${_v} -p ${work_dir}/iso/boot/${_arch} + mkdir ${_v} -p ${work_dir}/${_arch}/mnt + mkdir ${_v} -p ${work_dir}/tmp/${_arch} + done + mkdir ${_v} -p ${work_dir}/iso/boot/isolinux + mkdir ${_v} -p ${work_dir}/iso/any + mkdir ${_v} -p ${work_dir}/tmp/any +} + +do_common_begin() { + make_workspace + + iso_mount + + kernel_copy + isolinux_copy + squashfs_copy + + iso_umount + + isolinuxcfg_copy + isomounts_copy +} + +do_common_end() { + make_iso +} + +do_basic() { + do_common_begin + do_common_end +} + +do_split_us() { + do_common_begin + + root_image_extract + + usrshare_copy_from_root_image + usrshare_make_image + + root_image_remove_usrshare + root_image_make_image + + do_common_end +} + +do_split_lm() { + do_common_begin + + root_image_extract + + usrshare_copy_from_root_image + usrshare_make_image + + libmodules_copy_from_root_image + libmodules_make_image + + root_image_remove_usrshare + root_image_remove_libmodules + root_image_make_image + + do_common_end +} + +do_purge_us() { + do_common_begin + + root_image_extract + + usrshare_copy_from_root_image + usrshare_purge + usrshare_make_image + + libmodules_copy_from_root_image + libmodules_make_image + + root_image_remove_usrshare + root_image_remove_libmodules + root_image_make_image + + do_common_end +} + +do_full() { + do_common_begin + + root_image_extract + + usrshare_copy_from_root_image + usrshare_purge + usrshare_make_image + + libmodules_copy_from_root_image + libmodules_make_image + + root_image_remove_usrshare + root_image_remove_libmodules + root_image_purge + root_image_make_image + + do_common_end +} + + + +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 files [basename] + (default to '${isomounts_file}'" + echo " -S <isolinux> Path to isolinux.cfg file + (default to '${isolinuxcfg_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 *.sqfs + split_us: 'basic' + split usr/share/ + split_lm: 'split_us' + split lib/modules/ + purge_us: 'split_us' + prune usr/share/{doc,info,man}/ + full: 'purge_us' + prune boot/ usr/include/ usr/src/ + (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 " -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 " isomounts file: ${isomounts_file}.{i686,x86_64,x86_64-i686}" + echo " isolinux.cfg file: ${isolinuxcfg_file}" + echo " working directory: ${work_dir}" + echo " profile: ${profile_type}" + echo " label: ${label}" + echo " publisher: ${publisher}" + echo " application: ${application}" + echo +} + +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}.i686" ]; then + echo "*ERROR*: ${isomounts_file}.i686 does not exist, , specify one with -M option" + _error="1" + fi + + if [ ! -f "${isomounts_file}.x86_64" ]; then + echo "*ERROR*: ${isomounts_file}.x86_64 does not exist, , specify one with -M option" + _error="1" + fi + + if [ ! -f "${isomounts_file}.x86_64-i686" ]; then + echo "*ERROR*: ${isomounts_file}.x86_64-i686 does not exist, , specify one with -M option" + _error="1" + fi + + if [ ! -f "${isolinuxcfg_file}" ]; then + echo "*ERROR*: ${isolinuxcfg_file} does not exist, specify one with -S 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:L:P:A:yvh' arg; do + case "${arg}" in + 3) isofile_i686="${OPTARG}" ;; + 6) isofile_x86_64="${OPTARG}" ;; + o) imgname="${OPTARG}" ;; + T) case "${OPTARG}" in + "basic"|"split_us"|"split_lm"|"purge_us"|"full") profile_type="${OPTARG}" ;; + *) echo; echo "*ERROR*: invalid argument in -T option: ${profile_type}"; show_help 1 ;; + esac + ;; + M) isomounts_file="${OPTARG}" ;; + S) isolinuxcfg_file="${OPTARG}" ;; + L) label="${OPTARG}" ;; + P) publisher="${OPTARG}" ;; + A) application="${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 + +# wiiiiiipuuuuu :) +do_${profile_type} diff --git a/archiso2dual/isolinux.cfg b/archiso2dual/isolinux.cfg new file mode 100644 index 0000000..80ff612 --- /dev/null +++ b/archiso2dual/isolinux.cfg @@ -0,0 +1,91 @@ +DEFAULT vesamenu.c32 +PROMPT 0 +MENU TITLE Arch Linux +MENU BACKGROUND /boot/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 8 +MENU VSHIFT 10 +MENU TIMEOUTROW 13 +MENU TABMSGROW 11 +MENU CMDLINEROW 11 +MENU HELPMSGROW 16 +MENU HELPMSGENDROW 29 + +# Refer to http://syslinux.zytor.com/wiki/index.php/Doc/menu + +MENU COLOR border 30;44 #40ffffff #a0000000 std +MENU COLOR title 1;36;44 #9033ccff #a0000000 std +MENU COLOR sel 7;37;40 #e0ffffff #20ffffff all +MENU COLOR unsel 37;44 #50ffffff #a0000000 std +MENU COLOR help 37;40 #c0ffffff #a0000000 std +MENU COLOR timeout_msg 37;40 #80ffffff #00000000 std +MENU COLOR timeout 1;37;40 #c0ffffff #00000000 std +MENU COLOR msg07 37;40 #90ffffff #a0000000 std +MENU COLOR tabmsg 31;40 #30ffffff #00000000 std + +LABEL arch32 +TEXT HELP +Boot the Arch Linux (i686) live medium. It allows you to install Arch Linux or +perform system maintenance. +ENDTEXT +MENU LABEL Boot Arch Linux (i686) +KERNEL /boot/i686/vmlinuz26 +APPEND initrd=/boot/i686/archiso.img archisolabel=XXX isomounts=isomounts.i686 tmpfs_size=75% locale=en_US.UTF-8 + +LABEL arch64 +TEXT HELP +Boot the Arch Linux (x86_64) live medium. It allows you to install Arch Linux or +perform system maintenance. +ENDTEXT +MENU LABEL Boot Arch Linux (x86_64) +KERNEL /boot/x86_64/vmlinuz26 +APPEND initrd=/boot/x86_64/archiso.img archisolabel=XXX isomounts=isomounts.x86_64 tmpfs_size=75% locale=en_US.UTF-8 + +LABEL arch64-32 +TEXT HELP +Boot the Arch Linux (x86_64 kernel / i686 userspace ) live medium. It allows you to install Arch Linux or +perform system maintenance. +ENDTEXT +MENU LABEL Boot Arch Linux (x86_64/i686) +KERNEL /boot/x86_64/vmlinuz26 +APPEND initrd=/boot/x86_64/archiso.img archisolabel=XXX isomounts=isomounts.x86_64-i686 tmpfs_size=75% locale=en_US.UTF-8 + +LABEL normal +TEXT HELP +Continue normal booting procedure. +ENDTEXT +MENU LABEL Boot normally +LOCALBOOT + +LABEL existing +TEXT HELP +Boot an existing operating system. Press TAB to edit the disk and partition +number to boot. +ENDTEXT +MENU LABEL Boot existing OS +KERNEL chain.c32 +APPEND hd0 0 + +# http://www.memtest.org/ +LABEL memtest +MENU LABEL Run Memtest86+ (RAM test) +KERNEL /boot/memtest + +# http://www.vortex.prodigynet.co.uk/x86test/ +LABEL x86test +MENU LABEL Run x86test (CPU test) +KERNEL /boot/x86test + +LABEL reboot +MENU LABEL Reboot +KERNEL reboot.c32 + +ONTIMEOUT arch32 diff --git a/archiso2dual/isomounts.i686 b/archiso2dual/isomounts.i686 new file mode 100644 index 0000000..0535d74 --- /dev/null +++ b/archiso2dual/isomounts.i686 @@ -0,0 +1,5 @@ +i686/overlay.sqfs i686 / squashfs +i686/core-pkgs.sqfs i686 /src/core/pkg squashfs +any/usrshare.sqfs i686 /usr/share squashfs +i686/libmodules.sqfs i686 /lib/modules squashfs +i686/root-image.sqfs i686 / squashfs diff --git a/archiso2dual/isomounts.x86_64 b/archiso2dual/isomounts.x86_64 new file mode 100644 index 0000000..c79df6f --- /dev/null +++ b/archiso2dual/isomounts.x86_64 @@ -0,0 +1,5 @@ +x86_64/overlay.sqfs x86_64 / squashfs +x86_64/core-pkgs.sqfs x86_64 /src/core/pkg squashfs +any/usrshare.sqfs x86_64 /usr/share squashfs +x86_64/libmodules.sqfs x86_64 /lib/modules squashfs +x86_64/root-image.sqfs x86_64 / squashfs diff --git a/archiso2dual/isomounts.x86_64-i686 b/archiso2dual/isomounts.x86_64-i686 new file mode 100644 index 0000000..8bb1735 --- /dev/null +++ b/archiso2dual/isomounts.x86_64-i686 @@ -0,0 +1,5 @@ +x86_64/overlay.sqfs x86_64 / squashfs +x86_64/core-pkgs.sqfs x86_64 /src/core/pkg squashfs +any/usrshare.sqfs x86_64 /usr/share squashfs +x86_64/libmodules.sqfs x86_64 /lib/modules squashfs +i686/root-image.sqfs x86_64 / squashfs |