summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/build68
-rwxr-xr-xscripts/clean22
-rwxr-xr-xscripts/config65
3 files changed, 155 insertions, 0 deletions
diff --git a/scripts/build b/scripts/build
new file mode 100755
index 0000000..94333ec
--- /dev/null
+++ b/scripts/build
@@ -0,0 +1,68 @@
+#!/bin/sh
+
+# set -x
+
+BASEDIR="`dirname $0`/.."
+. "${BASEDIR}/config/amnesia"
+if [ -e "${BASEDIR}/config/amnesia.local" ] ; then
+ . "${BASEDIR}/config/amnesia.local"
+fi
+
+extract_home () {
+ tar \
+ jxf home/home.tar.bz2 \
+ --atime-preserve --same-permissions \
+ --directory="config/chroot_local-includes/"
+}
+
+# a clean starting point
+rm -rf cache/stages_rootfs
+
+# home
+[ "${AMNESIA_REFRESH_HOME}" = "no" ] || ./home-refresh
+
+# build all configured image types
+for BUILD_TYPE in ${AMNESIA_IMAGES} ; do
+
+ case "$BUILD_TYPE" in
+ iso)
+ BUILD_FILENAME_EXT=iso
+ BUILD_FILENAME=binary
+ ;;
+ tar)
+ BUILD_FILENAME_EXT=tar.gz
+ BUILD_FILENAME=binary-tar
+ ;;
+ usb-hdd)
+ BUILD_FILENAME_EXT=img
+ BUILD_FILENAME=binary
+ ;;
+ *)
+ echo "Image type ${BUILD_TYPE} is not supported." >&2
+ exit 1
+ ;;
+ esac
+ . config/chroot # get LH_LANGUAGE
+ BUILD_BASENAME="amnesia-${AMNESIA_BASE}-${LH_LANGUAGE}-${AMNESIA_TODAY}"
+ BUILD_DEST_FILENAME="${BUILD_BASENAME}.${BUILD_FILENAME_EXT}"
+ BUILD_LOG="build-${BUILD_BASENAME}.log"
+
+ echo "Cleaning binary stage..."
+ lh clean noautoconfig --binary
+
+ echo "Running lh config..."
+ lh config noautoconfig --binary-images "${BUILD_TYPE}"
+
+ echo "Extracting home.tar.bz2 to chroot ..."
+ extract_home
+
+ echo "Building $BUILD_TYPE image ${BUILD_BASENAME}..."
+ if lh build noautoconfig ${@} 2>&1 | tee "${BUILD_LOG}" ; then
+ echo "Image was successfully created, moving it to ${BUILD_DEST_FILENAME}"
+ mv -i "${BUILD_FILENAME}.${BUILD_FILENAME_EXT}" "${BUILD_DEST_FILENAME}"
+ else
+ echo "lh build failed." >&2
+ exit 1
+ fi
+
+done
diff --git a/scripts/clean b/scripts/clean
new file mode 100755
index 0000000..78885b6
--- /dev/null
+++ b/scripts/clean
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+for dir in chroot/{dev/pts,proc,sys} ; do
+ if mountpoint -q "$dir" ; then
+ umount "$dir"
+ fi
+done
+
+lh clean noautoconfig ${@}
+
+# rm -f build-*.log
+
+# Remove generated files
+rm -f config/binary config/bootstrap config/chroot config/common config/source
+
+# Remove empty directories in config tree
+if ls config/*/ > /dev/null 2>&1 ; then
+ rmdir --ignore-fail-on-non-empty config/*/
+fi
+
+# Remove unpacked /home/amnesia
+rm -rf config/chroot_local-includes/home/
diff --git a/scripts/config b/scripts/config
new file mode 100755
index 0000000..69e83e3
--- /dev/null
+++ b/scripts/config
@@ -0,0 +1,65 @@
+#! /bin/sh
+# automatically run by lh_config
+
+BASEDIR="`dirname $0`/.."
+. "${BASEDIR}/config/amnesia"
+if [ -e "${BASEDIR}/config/amnesia.local" ] ; then
+ . "${BASEDIR}/config/amnesia.local"
+fi
+
+RUN_LH_CONFIG="lh config noautoconfig"
+
+# init config/ with defaults
+$RUN_LH_CONFIG ${@}
+
+# set Amnesia's general options
+$RUN_LH_CONFIG \
+ --apt-recommends disabled \
+ --cache-stages "bootstrap rootfs" \
+ --categories "main non-free" \
+ --distribution lenny \
+ --hostname="amnesia" \
+ --iso-application="Amnesia live system" \
+ --iso-publisher="https://amnesia.boum.org/" \
+ --iso-volume="Amnesia ${AMNESIA_TODAY}" \
+ --memtest none \
+ --username="amnesia" \
+ --syslinux-timeout 4 \
+ ${@}
+
+# build i386 images on amd64 as well,
+# include only 686 kernel when building for i386
+hw_arch="`dpkg --print-architecture`"
+if [ "$hw_arch" = i386 -o "$hw_arch" = amd64 ]; then
+ $RUN_LH_CONFIG \
+ --architecture i386 \
+ --linux-flavours 686 \
+ ${@}
+fi
+
+# locale-dependent configuration
+. "${BASEDIR}/config/chroot"
+case "${LH_LANGUAGE}" in
+ de)
+ AMNESIA_APPEND="${AMNESIA_APPEND} locale=de_DE.UTF-8 keyb=de timezone=Europe/Berlin"
+ ;;
+ fr)
+ AMNESIA_APPEND="${AMNESIA_APPEND} locale=fr_FR.UTF-8 keyb=fr timezone=Europe/Paris"
+ ;;
+ *)
+ ;;
+esac
+$RUN_LH_CONFIG --bootappend-live "${AMNESIA_APPEND}" ${@}
+
+case "${LH_LANGUAGE}" in
+ de|fr)
+ PACKAGES_LISTS="standard amnesia-common amnesia-${AMNESIA_BASE} amnesia-${LH_LANGUAGE}"
+ ;;
+ *)
+ PACKAGES_LISTS="standard amnesia-common amnesia-${AMNESIA_BASE}"
+ ;;
+esac
+$RUN_LH_CONFIG --packages-lists="$PACKAGES_LISTS" ${@}
+
+# version
+echo "${AMNESIA_TODAY}" > "${BASEDIR}/config/chroot_local-includes/etc/amnesia/version"