summaryrefslogtreecommitdiff
path: root/archiso
diff options
context:
space:
mode:
Diffstat (limited to 'archiso')
-rw-r--r--archiso/initcpio/hooks/archiso18
-rw-r--r--archiso/initcpio/install/archiso1
-rwxr-xr-xarchiso/mkarchiso34
3 files changed, 47 insertions, 6 deletions
diff --git a/archiso/initcpio/hooks/archiso b/archiso/initcpio/hooks/archiso
index 3ef4eb1..9d38f07 100644
--- a/archiso/initcpio/hooks/archiso
+++ b/archiso/initcpio/hooks/archiso
@@ -1,5 +1,5 @@
# args: source, newroot, mountpoint
-_mnt_fs() {
+_mnt_dmsnapshot() {
local img="${1}"
local newroot="${2}"
local mnt="${3}"
@@ -37,6 +37,16 @@ _mnt_fs() {
echo $(readlink -f /dev/mapper/${dm_snap_name}) >> /run/archiso/used_block_devices
}
+# args: source, newroot, mountpoint
+_mnt_overlayfs() {
+ local src="${1}"
+ local newroot="${2}"
+ local mnt="${3}"
+ mkdir -p /run/archiso/cowspace/${cow_directory}/upperdir /run/archiso/cowspace/${cow_directory}/workdir
+ mount -t overlay -o lowerdir=${src},upperdir=/run/archiso/cowspace/${cow_directory}/upperdir,workdir=/run/archiso/cowspace/${cow_directory}/workdir airootfs "${newroot}${mnt}"
+}
+
+
# args: /path/to/image_file, mountpoint
_mnt_sfs() {
local img="${1}"
@@ -165,7 +175,11 @@ archiso_mount_handler() {
mkdir -p "/run/archiso/cowspace/${cow_directory}"
_mnt_sfs "/run/archiso/bootmnt/${archisobasedir}/${arch}/airootfs.sfs" "/run/archiso/sfs/airootfs"
- _mnt_fs "/run/archiso/sfs/airootfs/airootfs.img" "${newroot}" "/"
+ if [[ -f "/run/archiso/sfs/airootfs/airootfs.img" ]]; then
+ _mnt_dmsnapshot "/run/archiso/sfs/airootfs/airootfs.img" "${newroot}" "/"
+ else
+ _mnt_overlayfs "/run/archiso/sfs/airootfs" "${newroot}" "/"
+ fi
if [[ "${copytoram}" == "y" ]]; then
umount /run/archiso/bootmnt
diff --git a/archiso/initcpio/install/archiso b/archiso/initcpio/install/archiso
index e506271..300dfef 100644
--- a/archiso/initcpio/install/archiso
+++ b/archiso/initcpio/install/archiso
@@ -4,6 +4,7 @@ build() {
add_module "cdrom"
add_module "loop"
add_module "dm-snapshot"
+ add_module "overlay"
add_runscript
diff --git a/archiso/mkarchiso b/archiso/mkarchiso
index 5643525..0da02b0 100755
--- a/archiso/mkarchiso
+++ b/archiso/mkarchiso
@@ -16,6 +16,7 @@ iso_application="Arch Linux Live/Rescue CD"
install_dir="arch"
work_dir="work"
out_dir="out"
+sfs_mode="img"
sfs_comp="xz"
# Show an INFO message
@@ -87,6 +88,10 @@ _usage ()
echo " Default: '${work_dir}'"
echo " -o <out_dir> Set the output directory"
echo " Default: '${out_dir}'"
+ echo " -s <sfs_mode> Set SquashFS image mode (img or sfs)"
+ echo " img: prepare airootfs.sfs for dm-snapshot usage"
+ echo " sfs: prepare airootfs.sfs for overlayfs usage"
+ echo " Default: ${sfs_mode}"
echo " -c <comp_type> Set SquashFS compression type (gzip, lzma, lzo, xz)"
echo " Default: '${sfs_comp}'"
echo " -v Enable verbose output"
@@ -193,8 +198,8 @@ _cleanup () {
_msg_info "Done!"
}
-# Makes a filesystem from a source directory.
-_mkairootfs () {
+# Makes a ext4 filesystem inside a SquashFS from a source directory.
+_mkairootfs_img () {
if [[ ! -e "${work_dir}/airootfs" ]]; then
_msg_error "The path '${work_dir}/airootfs' does not exist" 1
fi
@@ -224,6 +229,22 @@ _mkairootfs () {
rm ${work_dir}/airootfs.img
}
+# Makes a SquashFS filesystem from a source directory.
+_mkairootfs_sfs () {
+ if [[ ! -e "${work_dir}/airootfs" ]]; then
+ _msg_error "The path '${work_dir}/airootfs' does not exist" 1
+ fi
+
+ mkdir -p "${work_dir}/iso/${install_dir}/${arch}"
+ _msg_info "Creating SquashFS image, this may take some time..."
+ if [[ "${quiet}" = "y" ]]; then
+ mksquashfs "${work_dir}/airootfs" "${work_dir}/iso/${install_dir}/${arch}/airootfs.sfs" -noappend -comp "${sfs_comp}" -no-progress &> /dev/null
+ else
+ mksquashfs "${work_dir}/airootfs" "${work_dir}/iso/${install_dir}/${arch}/airootfs.sfs" -noappend -comp "${sfs_comp}" -no-progress
+ fi
+ _msg_info "Done!"
+}
+
_mkchecksum () {
_msg_info "Creating checksum file for self-test..."
cd "${work_dir}/iso/${install_dir}/${arch}"
@@ -292,7 +313,11 @@ command_prepare () {
_show_config prepare
_cleanup
- _mkairootfs
+ if [[ ${sfs_mode} == "sfs" ]]; then
+ _mkairootfs_sfs
+ else
+ _mkairootfs_img
+ fi
_mkchecksum
}
@@ -330,7 +355,7 @@ if [[ ${EUID} -ne 0 ]]; then
_msg_error "This script must be run as root." 1
fi
-while getopts 'p:r:C:L:P:A:D:w:o:c:vh' arg; do
+while getopts 'p:r:C:L:P:A:D:w:o:s:c:vh' arg; do
case "${arg}" in
p) pkg_list="${pkg_list} ${OPTARG}" ;;
r) run_cmd="${OPTARG}" ;;
@@ -341,6 +366,7 @@ while getopts 'p:r:C:L:P:A:D:w:o:c:vh' arg; do
D) install_dir="${OPTARG}" ;;
w) work_dir="${OPTARG}" ;;
o) out_dir="${OPTARG}" ;;
+ s) sfs_mode="${OPTARG}" ;;
c) sfs_comp="${OPTARG}" ;;
v) quiet="n" ;;
h|?) _usage 0 ;;