summaryrefslogtreecommitdiff
path: root/archiso
diff options
context:
space:
mode:
authorNicolás Reynolds <fauno@kiwwwi.com.ar>2011-08-05 20:10:40 -0300
committerNicolás Reynolds <fauno@kiwwwi.com.ar>2011-08-05 20:10:40 -0300
commit2eeb47c3b06e3362f171b28b0e4dff3be27d1784 (patch)
treec1d64d2616c3eda07b0676556218cbc3a569b219 /archiso
parent634566f98603ebc54f4794fbf9f7d257d62462e0 (diff)
Script para creación de ISOs
Diffstat (limited to 'archiso')
-rw-r--r--archiso/aitab2
-rwxr-xr-xarchiso/build.sh113
-rw-r--r--archiso/isolinux/isolinux.cfg5
-rw-r--r--archiso/mkinitcpio.conf2
-rw-r--r--archiso/root-image/etc/fstab2
-rw-r--r--archiso/syslinux/syslinux.cfg12
6 files changed, 136 insertions, 0 deletions
diff --git a/archiso/aitab b/archiso/aitab
new file mode 100644
index 0000000..fbd4d00
--- /dev/null
+++ b/archiso/aitab
@@ -0,0 +1,2 @@
+# <img> <mnt> <arch> <sfs_comp> <fs_type> <fs_size>
+root-image / %ARCH% xz ext4 50%
diff --git a/archiso/build.sh b/archiso/build.sh
new file mode 100755
index 0000000..e99d42e
--- /dev/null
+++ b/archiso/build.sh
@@ -0,0 +1,113 @@
+#!/bin/bash
+
+set -e -u
+
+name=parabola-radio
+iso_label="PARABOLA_$(date +%Y%m)"
+version=$(date +%Y.%m.%d)
+install_dir=radio
+arch=$(uname -m)
+work_dir=work
+verbose="n"
+
+# 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}"
+}
+
+# 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}
+ cp -Rf overlay/* ${work_dir}/root-image/
+
+ chroot ${work_dir}/root-image /usr/sbin/useradd -m -p "" -g users -G "audio,disk,optical,wheel,storage" radio
+ : > ${work_dir}/build.${FUNCNAME}
+ fi
+}
+
+# Copy mkinitcpio archiso hooks (root-image)
+make_setup_mkinitcpio() {
+ if [[ ! -e ${work_dir}/build.${FUNCNAME} ]]; then
+ cp /lib/initcpio/hooks/archiso ${work_dir}/root-image/lib/initcpio/hooks
+ cp /lib/initcpio/install/archiso ${work_dir}/root-image/lib/initcpio/install
+ : > ${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}
+ mkinitcpio \
+ -c ./mkinitcpio.conf \
+ -b ${work_dir}/root-image \
+ -k /boot/vmlinuz26 \
+ -g ${work_dir}/iso/${install_dir}/boot/${arch}/libreiso.img
+ cp ${work_dir}/root-image/boot/vmlinuz26 ${work_dir}/iso/${install_dir}/boot/${arch}
+ : > ${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_packages
+make_customize_root_image
+make_setup_mkinitcpio
+make_boot
+make_syslinux
+make_isolinux
+make_aitab
+make_prepare
+make_iso
diff --git a/archiso/isolinux/isolinux.cfg b/archiso/isolinux/isolinux.cfg
new file mode 100644
index 0000000..e7bbaa4
--- /dev/null
+++ b/archiso/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/archiso/mkinitcpio.conf b/archiso/mkinitcpio.conf
new file mode 100644
index 0000000..389ec51
--- /dev/null
+++ b/archiso/mkinitcpio.conf
@@ -0,0 +1,2 @@
+HOOKS="base udev archiso sata filesystems"
+COMPRESSION="xz"
diff --git a/archiso/root-image/etc/fstab b/archiso/root-image/etc/fstab
new file mode 100644
index 0000000..4b82b80
--- /dev/null
+++ b/archiso/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/archiso/syslinux/syslinux.cfg b/archiso/syslinux/syslinux.cfg
new file mode 100644
index 0000000..58c3209
--- /dev/null
+++ b/archiso/syslinux/syslinux.cfg
@@ -0,0 +1,12 @@
+DEFAULT menu.c32
+PROMPT 0
+MENU TITLE Parabola GNU/Linux-libre
+TIMEOUT 300
+
+LABEL libre
+MENU LABEL Parabola GNU/Linux-libre
+LINUX /%INSTALL_DIR%/boot/%ARCH%/vmlinuz26
+INITRD /%INSTALL_DIR%/boot/%ARCH%/libreiso.img
+APPEND archisobasedir=%INSTALL_DIR% archisolabel=%ARCHISO_LABEL%
+
+ONTIMEOUT libre