Merge branch 'devel' of github.com:manjaro/manjaro-tools into devel
This commit is contained in:
commit
17286bc42d
13 changed files with 414 additions and 191 deletions
5
Makefile
5
Makefile
|
@ -1,4 +1,4 @@
|
||||||
Version=0.9.9
|
Version=0.9.10
|
||||||
|
|
||||||
PREFIX = /usr/local
|
PREFIX = /usr/local
|
||||||
SYSCONFDIR = /etc
|
SYSCONFDIR = /etc
|
||||||
|
@ -66,6 +66,7 @@ LIBS_PKG = \
|
||||||
LIBS_ISO = \
|
LIBS_ISO = \
|
||||||
lib/util-iso.sh \
|
lib/util-iso.sh \
|
||||||
lib/util-iso-aufs.sh \
|
lib/util-iso-aufs.sh \
|
||||||
|
lib/util-iso-overlayfs.sh \
|
||||||
lib/util-iso-image.sh \
|
lib/util-iso-image.sh \
|
||||||
lib/util-iso-calamares.sh \
|
lib/util-iso-calamares.sh \
|
||||||
lib/util-livecd.sh \
|
lib/util-livecd.sh \
|
||||||
|
@ -74,12 +75,14 @@ LIBS_ISO = \
|
||||||
|
|
||||||
CPIOHOOKS = \
|
CPIOHOOKS = \
|
||||||
initcpio/hooks/miso \
|
initcpio/hooks/miso \
|
||||||
|
initcpio/hooks/miso_overlayfs \
|
||||||
initcpio/hooks/miso_loop_mnt \
|
initcpio/hooks/miso_loop_mnt \
|
||||||
initcpio/hooks/miso_pxe_common \
|
initcpio/hooks/miso_pxe_common \
|
||||||
initcpio/hooks/miso_pxe_http
|
initcpio/hooks/miso_pxe_http
|
||||||
|
|
||||||
CPIOINST = \
|
CPIOINST = \
|
||||||
initcpio/inst/miso \
|
initcpio/inst/miso \
|
||||||
|
initcpio/inst/miso_overlayfs \
|
||||||
initcpio/inst/miso_loop_mnt \
|
initcpio/inst/miso_loop_mnt \
|
||||||
initcpio/inst/miso_pxe_common \
|
initcpio/inst/miso_pxe_common \
|
||||||
initcpio/inst/miso_pxe_http \
|
initcpio/inst/miso_pxe_http \
|
||||||
|
|
117
README.md
117
README.md
|
@ -1,7 +1,7 @@
|
||||||
manjaro-tools
|
manjaro-tools
|
||||||
=============
|
=============
|
||||||
|
|
||||||
Manjaro-tools-0.9.9
|
Manjaro-tools-0.9.10
|
||||||
|
|
||||||
User manual
|
User manual
|
||||||
|
|
||||||
|
@ -113,119 +113,12 @@ Specifying args will override manjaro-tools.conf settings.
|
||||||
|
|
||||||
# valid: md5, sha1, sha256, sha384, sha512
|
# valid: md5, sha1, sha256, sha384, sha512
|
||||||
# iso_checksum=md5
|
# iso_checksum=md5
|
||||||
|
|
||||||
|
# experimental; use overlayfs instead of aufs
|
||||||
|
# requires minimum 4.0 kernel on the build host and on iso in profile.conf
|
||||||
|
# use_overlayfs="false"
|
||||||
~~~
|
~~~
|
||||||
|
|
||||||
####Config files in iso profiles
|
|
||||||
|
|
||||||
Each iso profile must have these files or symlinks to shared:
|
|
||||||
|
|
||||||
|
|
||||||
######* profile.conf
|
|
||||||
|
|
||||||
~~~
|
|
||||||
##########################################
|
|
||||||
###### use this file in the profile ######
|
|
||||||
##########################################
|
|
||||||
|
|
||||||
# possible values: openrc,systemd
|
|
||||||
# initsys="systemd"
|
|
||||||
|
|
||||||
# use multilib packages; x86_64 only
|
|
||||||
# multilib="true"
|
|
||||||
|
|
||||||
# displaymanager="lightdm"
|
|
||||||
|
|
||||||
# Set to false to disable autologin in the livecd
|
|
||||||
# autologin="true"
|
|
||||||
|
|
||||||
# nonfree xorg drivers
|
|
||||||
# nonfree_xorg="true"
|
|
||||||
|
|
||||||
# use plymouth; initcpio hook
|
|
||||||
# plymouth_boot="true"
|
|
||||||
|
|
||||||
# use pxe boot; initcpio hook
|
|
||||||
# pxe_boot="true"
|
|
||||||
|
|
||||||
################ install ################
|
|
||||||
|
|
||||||
# unset defaults to given value
|
|
||||||
# kernel="linux319"
|
|
||||||
|
|
||||||
# unset defaults to given value
|
|
||||||
# efi_boot_loader="grub"
|
|
||||||
|
|
||||||
# set uefi partition size
|
|
||||||
# efi_part_size=32M
|
|
||||||
|
|
||||||
# unset defaults to given value
|
|
||||||
# plymouth_theme=manjaro-elegant
|
|
||||||
|
|
||||||
# unset defaults to given values
|
|
||||||
# names must match systemd service names
|
|
||||||
# start_systemd=('bluetooth' 'cronie' 'ModemManager' 'NetworkManager' 'org.cups.cupsd' 'tlp' 'tlp-sleep')
|
|
||||||
|
|
||||||
# unset defaults to given values,
|
|
||||||
# names must match openrc service names
|
|
||||||
# start_openrc=('acpid' 'bluetooth' 'consolekit' 'cronie' 'cupsd' 'dbus' 'syslog-ng' 'NetworkManager')
|
|
||||||
|
|
||||||
################# livecd #################
|
|
||||||
|
|
||||||
# unset defaults to given value
|
|
||||||
# hostname="manjaro"
|
|
||||||
|
|
||||||
# unset defaults to given value
|
|
||||||
# username="manjaro"
|
|
||||||
|
|
||||||
# unset defaults to given value
|
|
||||||
# password="manjaro"
|
|
||||||
|
|
||||||
# unset defaults to given values
|
|
||||||
# addgroups="video,audio,power,disk,storage,optical,network,lp,scanner,wheel"
|
|
||||||
|
|
||||||
# unset defaults to given values
|
|
||||||
# names must match systemd service names
|
|
||||||
# services in start_systemd array don't need to be listed here
|
|
||||||
# start_systemd_live=('livecd' 'mhwd-live' 'pacman-init' 'pacman-boot')
|
|
||||||
|
|
||||||
# unset defaults to given values,
|
|
||||||
# names must match openrc service names
|
|
||||||
# services in start_openrc array don't need to be listed here
|
|
||||||
# start_openrc_live=('livecd' 'mhwd-live' 'pacman-init' 'pacman-boot')
|
|
||||||
~~~
|
|
||||||
|
|
||||||
######* Packages
|
|
||||||
* Contains root image packages
|
|
||||||
* ideally no xorg
|
|
||||||
|
|
||||||
######* Packages-Custom/desktop
|
|
||||||
* Contains the custom image packages
|
|
||||||
* desktop environment packages go here
|
|
||||||
* this file is joined at build time with shared/Packages-Custom to pull in shared desktop packages
|
|
||||||
|
|
||||||
######* Packages-Xorg
|
|
||||||
* Contains the Xorg package repo
|
|
||||||
|
|
||||||
######* Packages-Livecd
|
|
||||||
* Contains packages you only want on livecd but not installed on the target system with installer
|
|
||||||
* default files are in shared folder and can be symlinked or defined in a real file
|
|
||||||
|
|
||||||
###### optional custom pacman.conf in profile
|
|
||||||
|
|
||||||
* for i686
|
|
||||||
|
|
||||||
~~~
|
|
||||||
pacman-default.conf
|
|
||||||
~~~
|
|
||||||
|
|
||||||
* for x86_64
|
|
||||||
|
|
||||||
~~~
|
|
||||||
pacman-multilib.conf
|
|
||||||
~~~
|
|
||||||
|
|
||||||
If you need a custom livecd-overlay, create overlay-livecd folder in profile, and symlink from shared/overlay-livecd/your_selection to the overlay-livecd folder.
|
|
||||||
|
|
||||||
###2. buildpkg
|
###2. buildpkg
|
||||||
|
|
||||||
buildpkg is the chroot build script of manjaro-tools.
|
buildpkg is the chroot build script of manjaro-tools.
|
||||||
|
|
|
@ -104,6 +104,7 @@ display_settings(){
|
||||||
msg2 "iso_app_id: ${iso_app_id}"
|
msg2 "iso_app_id: ${iso_app_id}"
|
||||||
msg2 "iso_compression: ${iso_compression}"
|
msg2 "iso_compression: ${iso_compression}"
|
||||||
msg2 "iso_checksum: ${iso_checksum}"
|
msg2 "iso_checksum: ${iso_checksum}"
|
||||||
|
msg2 "use_overlayfs: ${use_overlayfs}"
|
||||||
|
|
||||||
msg "BUILD QUEUE:"
|
msg "BUILD QUEUE:"
|
||||||
show_build_queue
|
show_build_queue
|
||||||
|
|
|
@ -77,3 +77,7 @@
|
||||||
|
|
||||||
# valid: md5, sha1, sha256, sha384, sha512
|
# valid: md5, sha1, sha256, sha384, sha512
|
||||||
# iso_checksum=md5
|
# iso_checksum=md5
|
||||||
|
|
||||||
|
# experimental; use overlayfs instead of aufs
|
||||||
|
# requires minimum 4.0 kernel on the build host and on iso in profile.conf
|
||||||
|
# use_overlayfs="false"
|
||||||
|
|
|
@ -61,9 +61,9 @@
|
||||||
# unset defaults to given values
|
# unset defaults to given values
|
||||||
# names must match systemd service names
|
# names must match systemd service names
|
||||||
# services in start_systemd array don't need to be listed here
|
# services in start_systemd array don't need to be listed here
|
||||||
# start_systemd_live=('livecd' 'mhwd-live' 'pacman-init' 'pacman-boot')
|
# start_systemd_live=('livecd' 'mhwd-live' 'pacman-init')
|
||||||
|
|
||||||
# unset defaults to given values,
|
# unset defaults to given values,
|
||||||
# names must match openrc service names
|
# names must match openrc service names
|
||||||
# services in start_openrc array don't need to be listed here
|
# services in start_openrc array don't need to be listed here
|
||||||
# start_openrc_live=('livecd' 'mhwd-live' 'pacman-init' 'pacman-boot')
|
# start_openrc_live=('livecd' 'mhwd-live' 'pacman-init')
|
||||||
|
|
257
initcpio/hooks/miso_overlayfs
Normal file
257
initcpio/hooks/miso_overlayfs
Normal file
|
@ -0,0 +1,257 @@
|
||||||
|
# kernel_cmdline <param> <default>
|
||||||
|
# Looks for a parameter on the kernel's boot-time command line.
|
||||||
|
#
|
||||||
|
# returns: 0 if param was found. Also prints its value if it was a K=V param.
|
||||||
|
# 1 if it was not. Also prints value passed as <default>
|
||||||
|
#
|
||||||
|
|
||||||
|
kernel_cmdline ()
|
||||||
|
{
|
||||||
|
for param in $(/bin/cat /proc/cmdline); do
|
||||||
|
case "${param}" in
|
||||||
|
$1=*) echo "${param##*=}"; return 0 ;;
|
||||||
|
$1) return 0 ;;
|
||||||
|
*) continue ;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
[ -n "${2}" ] && echo "${2}"
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# 1$ : kernel argument to check
|
||||||
|
overlay_arg_available() {
|
||||||
|
for arg in $(echo "$(kernel_cmdline overlay)" | /bin/sed 's/,/ /g')
|
||||||
|
do
|
||||||
|
[ "${arg}" == "$1" ] && return 0
|
||||||
|
done
|
||||||
|
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# args: source, mountpoint
|
||||||
|
_mnt_bind() {
|
||||||
|
local src="${1}"
|
||||||
|
local mnt="${2}"
|
||||||
|
msg "::: Binding ${src} to ${mnt}"
|
||||||
|
mkdir -p "${mnt}"
|
||||||
|
/bin/mount -o bind "${src}" "${mnt}"
|
||||||
|
}
|
||||||
|
|
||||||
|
# args: /path/to/image_file, mountpoint
|
||||||
|
_mnt_squashfs() {
|
||||||
|
local img="${1}"
|
||||||
|
local mnt="${2}"
|
||||||
|
local img_fullname="${img##*/}";
|
||||||
|
local img_name="${img_fullname%.*}"
|
||||||
|
local tmp_mnt="/ro_branch/${img_name}"
|
||||||
|
|
||||||
|
if [ "${copytoram}" = "y" ]; then
|
||||||
|
msg -n ":: Copying squashfs image to RAM..."
|
||||||
|
/bin/cp "${img}" "/copytoram/${img_fullname}"
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
echo ">> ERROR: while copy ${img} to /copytoram/${img_fullname}"
|
||||||
|
launch_interactive_shell
|
||||||
|
fi
|
||||||
|
img="/copytoram/${img_fullname}"
|
||||||
|
msg "done."
|
||||||
|
fi
|
||||||
|
|
||||||
|
mkdir -p "${tmp_mnt}"
|
||||||
|
/bin/mount -r -t squashfs "${img}" "${tmp_mnt}"
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
echo ">> ERROR: while mounting ${img} to ${tmp_mnt}"
|
||||||
|
launch_interactive_shell
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "/${mnt#/*/}" = "/" ]; then
|
||||||
|
overlayfs="${overlayfs}:${tmp_mnt}"
|
||||||
|
else
|
||||||
|
_mnt_bind "${tmp_mnt}" "${mnt}"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
run_hook() {
|
||||||
|
modprobe loop
|
||||||
|
if [ "x${arch}" = "x" ]; then
|
||||||
|
arch="$(uname -m)"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "x${rw_branch_size}" = "x" ]; then
|
||||||
|
rw_branch_size="75%"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "x${copytoram_size}" = "x" ]; then
|
||||||
|
copytoram_size="75%"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "x${misobasedir}" = "x" ]; then
|
||||||
|
misobasedir="manjaro"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "x${isomounts}" != "x" ]; then
|
||||||
|
isomounts="/bootmnt/${isomounts}"
|
||||||
|
else
|
||||||
|
isomounts="/bootmnt/${misobasedir}/isomounts"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# set mount handler for miso
|
||||||
|
mount_handler="miso_mount_handler"
|
||||||
|
}
|
||||||
|
|
||||||
|
testdevice() {
|
||||||
|
fstype=$( blkid -s TYPE -o value ${MDEV} )
|
||||||
|
mount -r -t ${fstype} -o noatime "${MDEV}" "/bootmnt" >/dev/null 2>/dev/null
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
if [ -f "/bootmnt/.miso" ]; then
|
||||||
|
msg "::: INFO: miso system at ${MDEV}"
|
||||||
|
found="yes"
|
||||||
|
else
|
||||||
|
/bin/umount "/bootmnt/" 2>/dev/null
|
||||||
|
msg "::: INFO: No miso system at ${MDEV}"
|
||||||
|
MDEV=""
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
msg ">> ERROR: Couldn't mount ${MDEV}"
|
||||||
|
MDEV=""
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
probedevice() {
|
||||||
|
|
||||||
|
if [[ -n "${ip}" && -n "${miso_http_srv}" && -f "${isomounts}" ]]; then
|
||||||
|
found="yes"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Loop device test every second up to some limit
|
||||||
|
if [ "x${usbdelay}" != "x" ]; then
|
||||||
|
waittime=${usbdelay}
|
||||||
|
else
|
||||||
|
waittime=35
|
||||||
|
fi
|
||||||
|
waitcount=0
|
||||||
|
while [ ${waittime} -ne ${waitcount} ]; do
|
||||||
|
# first we look for root, e.g. /dev/sda1 to see if .miso will be found
|
||||||
|
if [ "x${root}" != "x" ]; then
|
||||||
|
[ ${waitcount} -eq 0 ] && msg ":: Looking for ${root}"
|
||||||
|
if [ -e ${root} ]; then
|
||||||
|
MDEV=${root}
|
||||||
|
testdevice
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# if still not found, we will look for misolabel
|
||||||
|
if [ "x${misolabel}" != "x" ]; then
|
||||||
|
[ ${waitcount} -eq 0 ] && msg ":: Looking for LABEL ${misolabel}"
|
||||||
|
MDEV=$( blkid -L ${misolabel} )
|
||||||
|
if [ "x${MDEV}" != "x" ]; then
|
||||||
|
testdevice
|
||||||
|
else
|
||||||
|
msg "::: INFO: LABEL ${misolabel} is not valid!"
|
||||||
|
misolabel=""
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# still nothing found, we will look for boot device
|
||||||
|
if [ -z "${found}" ]; then
|
||||||
|
[ ${waitcount} -eq 0 ] && msg ":: Looking for boot device"
|
||||||
|
if [ "x${nocd}" = "x" ]; then
|
||||||
|
# Look for CD
|
||||||
|
cdroms=$( /bin/cat /proc/sys/dev/cdrom/info | { while read a b c; do
|
||||||
|
if [ "${a}" = "drive" -a "${b}" = "name:" ]; then
|
||||||
|
echo "${c}"
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
} )
|
||||||
|
for i in ${cdroms}; do
|
||||||
|
MDEV=/dev/${i}
|
||||||
|
testdevice
|
||||||
|
if [ "x${MDEV}" != "x" ]; then
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Test partitions
|
||||||
|
if [ "x${MDEV}" = "x" ]; then
|
||||||
|
for d in /dev/sd[a-z][0-9]*; do
|
||||||
|
MDEV=${d}
|
||||||
|
testdevice
|
||||||
|
if [ "x${MDEV}" != "x" ]; then
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
|
[ "x${MDEV}" != "x" ] && break
|
||||||
|
|
||||||
|
/bin/sleep 1
|
||||||
|
waitcount=$(( ${waitcount} + 1 ))
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
miso_mount_handler() {
|
||||||
|
local newroot="${1}"
|
||||||
|
local found
|
||||||
|
local overlayfs
|
||||||
|
|
||||||
|
# Probe all devices
|
||||||
|
probedevice
|
||||||
|
|
||||||
|
if [ -z "${found}" ]; then
|
||||||
|
echo ">> ERROR: unable to find boot device"
|
||||||
|
echo " Falling back to interactive prompt"
|
||||||
|
echo " You can try to fix the problem manually, log out when you are finished"
|
||||||
|
launch_interactive_shell
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "${copytoram}" = "y" ]; then
|
||||||
|
msg -n ":: Mounting /copytoram (tmpfs) filesystem, size=${copytoram_size}..."
|
||||||
|
mount -t tmpfs -o "size=${copytoram_size}",mode=0755 copytoram /copytoram
|
||||||
|
msg "done."
|
||||||
|
fi
|
||||||
|
|
||||||
|
msg -n ":: Mounting rw_branch (tmpfs) filesystem, size=${rw_branch_size}..."
|
||||||
|
mount -t tmpfs -o "size=${rw_branch_size}",mode=0755 rw_branch /rw_branch
|
||||||
|
msg "done."
|
||||||
|
|
||||||
|
msg ":: Mounting images"
|
||||||
|
while read img imgarch mountpoint type kernelarg; do
|
||||||
|
# check if this line is a comment (starts with #)
|
||||||
|
[ "${img#"#"}" != "${img}" ] && continue
|
||||||
|
|
||||||
|
[ "$imgarch" != "$arch" ] && continue
|
||||||
|
|
||||||
|
[ ! -r "/bootmnt/${misobasedir}/${img}" ] && continue
|
||||||
|
|
||||||
|
# check if the overlay should be loaded
|
||||||
|
overlay_arg_available "$kernelarg"
|
||||||
|
|
||||||
|
|
||||||
|
if [ $? == 1 ] && [ "$kernelarg" != "" ]; then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "${type}" = "bind" ]; then
|
||||||
|
_mnt_bind "/bootmnt/${misobasedir}/${img}" "${newroot}${mountpoint}"
|
||||||
|
elif [ "${type}" = "squashfs" ]; then
|
||||||
|
_mnt_squashfs "/bootmnt/${misobasedir}/${img}" "${newroot}${mountpoint}"
|
||||||
|
fi
|
||||||
|
done < "${isomounts}"
|
||||||
|
|
||||||
|
msg "Mounting ${overlayfs:1}"
|
||||||
|
mkdir -p "/rw_branch/upper"
|
||||||
|
mkdir -p "/rw_branch/work"
|
||||||
|
mount -t overlay overlay -olowerdir="${overlayfs:1}",upperdir="/rw_branch/upper",workdir="/rw_branch/work" "${newroot}/"
|
||||||
|
|
||||||
|
if [ "${copytoram}" = "y" ]; then
|
||||||
|
/bin/umount /bootmnt
|
||||||
|
else
|
||||||
|
_mnt_bind /bootmnt "${newroot}/bootmnt"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# vim:ft=sh:ts=4:sw=4:et:
|
31
initcpio/inst/miso_overlayfs
Normal file
31
initcpio/inst/miso_overlayfs
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
build() {
|
||||||
|
add_module "cdrom"
|
||||||
|
add_module "overlay"
|
||||||
|
add_module "squashfs"
|
||||||
|
add_module "isofs"
|
||||||
|
add_module "loop"
|
||||||
|
add_module "usb_storage"
|
||||||
|
add_module "sd_mod"
|
||||||
|
add_module "sr_mod"
|
||||||
|
add_module "virtio_pci"
|
||||||
|
add_module "virtio_blk"
|
||||||
|
|
||||||
|
add_dir /rw_branch
|
||||||
|
add_dir /ro_branch
|
||||||
|
add_dir /copytoram
|
||||||
|
add_dir /bootmnt
|
||||||
|
|
||||||
|
add_runscript
|
||||||
|
|
||||||
|
add_binary /usr/lib/udev/cdrom_id
|
||||||
|
add_binary blockdev
|
||||||
|
add_binary losetup
|
||||||
|
add_binary mountpoint
|
||||||
|
|
||||||
|
add_file /usr/lib/udev/rules.d/60-cdrom_id.rules
|
||||||
|
}
|
||||||
|
|
||||||
|
# vim: set ft=sh ts=4 sw=4 et:
|
||||||
|
|
|
@ -10,40 +10,21 @@
|
||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
|
|
||||||
# $1: new branch
|
# $1: new branch
|
||||||
aufs_mount_root_image(){
|
mount_root_image(){
|
||||||
msg2 "mount [root-image] on [${1##*/}]"
|
msg2 "mount [root-image] on [${1##*/}]"
|
||||||
mount -t aufs -o br="$1":${work_dir}/root-image=ro none "$1"
|
mount -t aufs -o br="$1":${work_dir}/root-image=ro none "$1"
|
||||||
}
|
}
|
||||||
|
|
||||||
# $1: add branch
|
mount_custom_image(){
|
||||||
aufs_append_root_image(){
|
|
||||||
msg2 "append [root-image] on [${1##*/}]"
|
|
||||||
mount -t aufs -o remount,append:${work_dir}/root-image=ro none "$1"
|
|
||||||
}
|
|
||||||
|
|
||||||
# $1: add branch
|
|
||||||
aufs_mount_custom_image(){
|
|
||||||
msg2 "mount [${1##*/}] on [${custom}-image]"
|
msg2 "mount [${1##*/}] on [${custom}-image]"
|
||||||
mount -t aufs -o br="$1":${work_dir}/${custom}-image=ro none "$1"
|
mount -t aufs -o br="$1":${work_dir}/${custom}-image=ro:${work_dir}/root-image=ro none "$1"
|
||||||
}
|
}
|
||||||
|
|
||||||
# $1: del branch
|
# $1: image path
|
||||||
aufs_remove_image(){
|
umount_image(){
|
||||||
if mountpoint -q "$1";then
|
if mountpoint -q "$1";then
|
||||||
msg2 "unmount ${1##*/}"
|
msg2 "unmount ${1##*/}"
|
||||||
umount $1
|
umount $1
|
||||||
fi
|
fi
|
||||||
}
|
|
||||||
|
|
||||||
# $1: image path
|
|
||||||
aufs_clean(){
|
|
||||||
find $1 -name '.wh.*' -delete &> /dev/null
|
find $1 -name '.wh.*' -delete &> /dev/null
|
||||||
}
|
}
|
||||||
|
|
||||||
umount_image_handler(){
|
|
||||||
aufs_remove_image "${work_dir}/livecd-image"
|
|
||||||
aufs_remove_image "${work_dir}/${custom}-image"
|
|
||||||
aufs_remove_image "${work_dir}/root-image"
|
|
||||||
aufs_remove_image "${work_dir}/pkgs-image"
|
|
||||||
aufs_remove_image "${work_dir}/boot-image"
|
|
||||||
}
|
|
||||||
|
|
|
@ -39,6 +39,9 @@ set_mkinicpio_hooks(){
|
||||||
if ! ${plymouth_boot};then
|
if ! ${plymouth_boot};then
|
||||||
sed -e 's/plymouth //' -i $1
|
sed -e 's/plymouth //' -i $1
|
||||||
fi
|
fi
|
||||||
|
if ${use_overlayfs};then
|
||||||
|
sed -e 's/miso /miso_overlayfs /' -i $1
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
copy_initcpio(){
|
copy_initcpio(){
|
||||||
|
|
|
@ -343,6 +343,12 @@ configure_sysctl(){
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Remove pamac auto-update when the network is up, it causes problems when booting in the livecd
|
||||||
|
# $1: chroot
|
||||||
|
configure_pamac_live() {
|
||||||
|
rm -f $1/etc/NetworkManager/dispatcher.d/99_update_pamac_tray
|
||||||
|
}
|
||||||
|
|
||||||
configure_root_image(){
|
configure_root_image(){
|
||||||
msg "Configuring [root-image]"
|
msg "Configuring [root-image]"
|
||||||
configure_lsb "$1"
|
configure_lsb "$1"
|
||||||
|
@ -369,6 +375,7 @@ configure_livecd_image(){
|
||||||
configure_services_live "$1"
|
configure_services_live "$1"
|
||||||
configure_calamares "$1"
|
configure_calamares "$1"
|
||||||
configure_thus "$1"
|
configure_thus "$1"
|
||||||
|
configure_pamac_live "$1"
|
||||||
msg "Done configuring [livecd-image]"
|
msg "Done configuring [livecd-image]"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -393,7 +400,6 @@ download_to_cache(){
|
||||||
pacman -v -Sp $2 --noconfirm > "$1"/cache-packages.txt
|
pacman -v -Sp $2 --noconfirm > "$1"/cache-packages.txt
|
||||||
sed -ni '/.pkg.tar.xz/p' "$1"/cache-packages.txt
|
sed -ni '/.pkg.tar.xz/p' "$1"/cache-packages.txt
|
||||||
sed -i "s/.*\///" "$1"/cache-packages.txt
|
sed -i "s/.*\///" "$1"/cache-packages.txt
|
||||||
rm -rf "$1/etc"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# $1: image path
|
# $1: image path
|
||||||
|
|
31
lib/util-iso-overlayfs.sh
Normal file
31
lib/util-iso-overlayfs.sh
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# This program is free software; you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation; version 2 of the License.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
|
||||||
|
# $1: new branch
|
||||||
|
mount_root_image(){
|
||||||
|
msg2 "mount [root-image] on [${1##*/}]"
|
||||||
|
mkdir -p "${work_dir}/work"
|
||||||
|
mount -t overlay overlay -olowerdir="${work_dir}/root-image",upperdir="$1",workdir="${work_dir}/work" "$1"
|
||||||
|
}
|
||||||
|
|
||||||
|
mount_custom_image(){
|
||||||
|
msg2 "mount [${1##*/}] on [${custom}-image]"
|
||||||
|
mkdir -p "${work_dir}/work"
|
||||||
|
mount -t overlay overlay -olowerdir="${work_dir}/${custom}-image":"${work_dir}/root-image",upperdir="$1",workdir="${work_dir}/work" "$1"
|
||||||
|
}
|
||||||
|
|
||||||
|
umount_image(){
|
||||||
|
if mountpoint -q "$1";then
|
||||||
|
msg2 "unmount ${1##*/}"
|
||||||
|
umount $1
|
||||||
|
rm -rf "${work_dir}/work"
|
||||||
|
fi
|
||||||
|
}
|
107
lib/util-iso.sh
107
lib/util-iso.sh
|
@ -12,14 +12,18 @@
|
||||||
import ${LIBDIR}/util-iso-image.sh
|
import ${LIBDIR}/util-iso-image.sh
|
||||||
import ${LIBDIR}/util-iso-boot.sh
|
import ${LIBDIR}/util-iso-boot.sh
|
||||||
import ${LIBDIR}/util-iso-calamares.sh
|
import ${LIBDIR}/util-iso-calamares.sh
|
||||||
|
|
||||||
|
if ${use_overlayfs};then
|
||||||
|
import ${LIBDIR}/util-iso-overlayfs.sh
|
||||||
|
else
|
||||||
import ${LIBDIR}/util-iso-aufs.sh
|
import ${LIBDIR}/util-iso-aufs.sh
|
||||||
|
fi
|
||||||
|
|
||||||
# $1: path
|
# $1: path
|
||||||
# $2: exit code
|
# $2: exit code
|
||||||
check_profile(){
|
check_profile(){
|
||||||
local keyfiles=('profile.conf' 'mkinitcpio.conf' 'Packages' 'Packages-Livecd')
|
local keyfiles=('profile.conf' 'mkinitcpio.conf' 'Packages' 'Packages-Livecd')
|
||||||
local keydirs=('overlay' 'overlay-livecd' 'isolinux')
|
local keydirs=('overlay' 'overlay-livecd' 'isolinux')
|
||||||
local err="Profile [$1] sanity check failed!"
|
|
||||||
local has_keyfiles=false has_keydirs=false
|
local has_keyfiles=false has_keydirs=false
|
||||||
for f in ${keyfiles[@]}; do
|
for f in ${keyfiles[@]}; do
|
||||||
if [[ -f $1/$f ]];then
|
if [[ -f $1/$f ]];then
|
||||||
|
@ -54,6 +58,14 @@ check_requirements(){
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
umount_image_handler(){
|
||||||
|
umount_image "${work_dir}/livecd-image"
|
||||||
|
umount_image "${work_dir}/${custom}-image"
|
||||||
|
umount_image "${work_dir}/root-image"
|
||||||
|
umount_image "${work_dir}/pkgs-image"
|
||||||
|
umount_image "${work_dir}/boot-image"
|
||||||
|
}
|
||||||
|
|
||||||
copy_overlay_root(){
|
copy_overlay_root(){
|
||||||
msg2 "Copying overlay ..."
|
msg2 "Copying overlay ..."
|
||||||
cp -a --no-preserve=ownership overlay/* $1
|
cp -a --no-preserve=ownership overlay/* $1
|
||||||
|
@ -108,7 +120,6 @@ copy_livecd_helpers(){
|
||||||
copy_cache_xorg(){
|
copy_cache_xorg(){
|
||||||
msg2 "Copying xorg package cache ..."
|
msg2 "Copying xorg package cache ..."
|
||||||
rsync -v --files-from="${work_dir}/pkgs-image/cache-packages.txt" /var/cache/pacman/pkg "${work_dir}/pkgs-image/opt/livecd/pkgs"
|
rsync -v --files-from="${work_dir}/pkgs-image/cache-packages.txt" /var/cache/pacman/pkg "${work_dir}/pkgs-image/opt/livecd/pkgs"
|
||||||
rm -f "${work_dir}/pkgs-image/cache-packages.txt"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# $1: image path
|
# $1: image path
|
||||||
|
@ -229,17 +240,20 @@ make_image_custom() {
|
||||||
msg "Prepare [${custom} installation] (${custom}-image)"
|
msg "Prepare [${custom} installation] (${custom}-image)"
|
||||||
local path="${work_dir}/${custom}-image"
|
local path="${work_dir}/${custom}-image"
|
||||||
mkdir -p ${path}
|
mkdir -p ${path}
|
||||||
umount_image_handler
|
|
||||||
aufs_mount_root_image "${path}"
|
mount_root_image "${path}"
|
||||||
|
|
||||||
chroot_create "${path}" "${packages}"
|
chroot_create "${path}" "${packages}"
|
||||||
clean_up_image "${path}"
|
|
||||||
pacman -Qr "${path}" > "${path}/${custom}-image-pkgs.txt"
|
pacman -Qr "${path}" > "${path}/${custom}-image-pkgs.txt"
|
||||||
cp "${path}/${custom}-image-pkgs.txt" ${cache_dir_iso}/${iso_name}-${custom}-${dist_release}-${arch}-pkgs.txt
|
cp "${path}/${custom}-image-pkgs.txt" ${cache_dir_iso}/${iso_name}-${custom}-${dist_release}-${arch}-pkgs.txt
|
||||||
[[ -d ${custom}-overlay ]] && copy_overlay_custom
|
[[ -d ${custom}-overlay ]] && copy_overlay_custom
|
||||||
configure_custom_image "${path}"
|
configure_custom_image "${path}"
|
||||||
${is_custom_pac_conf} && clean_pacman_conf "${path}"
|
${is_custom_pac_conf} && clean_pacman_conf "${path}"
|
||||||
umount_image_handler
|
|
||||||
aufs_clean "${path}"
|
umount_image "${path}"
|
||||||
|
|
||||||
|
clean_up_image "${path}"
|
||||||
: > ${work_dir}/build.${FUNCNAME}
|
: > ${work_dir}/build.${FUNCNAME}
|
||||||
msg "Done [${custom} installation] (${custom}-image)"
|
msg "Done [${custom} installation] (${custom}-image)"
|
||||||
fi
|
fi
|
||||||
|
@ -250,15 +264,15 @@ make_image_livecd() {
|
||||||
msg "Prepare [livecd installation] (livecd-image)"
|
msg "Prepare [livecd installation] (livecd-image)"
|
||||||
local path="${work_dir}/livecd-image"
|
local path="${work_dir}/livecd-image"
|
||||||
mkdir -p ${path}
|
mkdir -p ${path}
|
||||||
umount_image_handler
|
|
||||||
if [[ -n "${custom}" ]] ; then
|
if [[ -n "${custom}" ]] ; then
|
||||||
aufs_mount_custom_image "${path}"
|
mount_custom_image "${path}"
|
||||||
aufs_append_root_image "${path}"
|
|
||||||
else
|
else
|
||||||
aufs_mount_root_image "${path}"
|
mount_root_image "${path}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
chroot_create "${path}" "${packages}"
|
chroot_create "${path}" "${packages}"
|
||||||
clean_up_image "${path}"
|
|
||||||
pacman -Qr "${path}" > "${path}/livecd-image-pkgs.txt"
|
pacman -Qr "${path}" > "${path}/livecd-image-pkgs.txt"
|
||||||
copy_overlay_livecd "${path}"
|
copy_overlay_livecd "${path}"
|
||||||
# copy over setup helpers and config loader
|
# copy over setup helpers and config loader
|
||||||
|
@ -266,10 +280,12 @@ make_image_livecd() {
|
||||||
copy_startup_scripts "${path}/usr/bin"
|
copy_startup_scripts "${path}/usr/bin"
|
||||||
configure_livecd_image "${path}"
|
configure_livecd_image "${path}"
|
||||||
${is_custom_pac_conf} && clean_pacman_conf "${path}"
|
${is_custom_pac_conf} && clean_pacman_conf "${path}"
|
||||||
# Clean up GnuPG keys?
|
|
||||||
|
umount_image "${path}"
|
||||||
|
|
||||||
|
# Clean up GnuPG keys
|
||||||
rm -rf "${path}/etc/pacman.d/gnupg"
|
rm -rf "${path}/etc/pacman.d/gnupg"
|
||||||
umount_image_handler
|
clean_up_image "${path}"
|
||||||
aufs_clean "${path}"
|
|
||||||
: > ${work_dir}/build.${FUNCNAME}
|
: > ${work_dir}/build.${FUNCNAME}
|
||||||
msg "Done [livecd-image]"
|
msg "Done [livecd-image]"
|
||||||
fi
|
fi
|
||||||
|
@ -280,13 +296,15 @@ make_image_xorg() {
|
||||||
msg "Prepare [pkgs-image]"
|
msg "Prepare [pkgs-image]"
|
||||||
local path="${work_dir}/pkgs-image"
|
local path="${work_dir}/pkgs-image"
|
||||||
mkdir -p ${path}/opt/livecd/pkgs
|
mkdir -p ${path}/opt/livecd/pkgs
|
||||||
umount_image_handler
|
|
||||||
if [[ -n "${custom}" ]] ; then
|
if [[ -n "${custom}" ]] ; then
|
||||||
aufs_mount_custom_image "${path}"
|
mount_custom_image "${path}"
|
||||||
aufs_append_root_image "${path}"
|
|
||||||
else
|
else
|
||||||
aufs_mount_root_image "${path}"
|
mount_root_image "${path}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
${is_custom_pac_conf} && clean_pacman_conf "${path}"
|
||||||
|
|
||||||
download_to_cache "${path}" "${packages}"
|
download_to_cache "${path}" "${packages}"
|
||||||
copy_cache_xorg
|
copy_cache_xorg
|
||||||
if [[ -n "${packages_cleanup}" ]]; then
|
if [[ -n "${packages_cleanup}" ]]; then
|
||||||
|
@ -295,11 +313,15 @@ make_image_xorg() {
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
cp ${PKGDATADIR}/pacman-gfx.conf ${path}/opt/livecd
|
cp ${PKGDATADIR}/pacman-gfx.conf ${path}/opt/livecd
|
||||||
rm -r ${path}/var
|
|
||||||
make_repo "${path}/opt/livecd/pkgs/gfx-pkgs" "${path}/opt/livecd/pkgs"
|
make_repo "${path}/opt/livecd/pkgs/gfx-pkgs" "${path}/opt/livecd/pkgs"
|
||||||
configure_xorg_drivers "${path}"
|
configure_xorg_drivers "${path}"
|
||||||
umount_image_handler
|
|
||||||
aufs_clean "${path}"
|
umount_image "${path}"
|
||||||
|
|
||||||
|
rm -r ${path}/var
|
||||||
|
rm -rf "${path}/etc"
|
||||||
|
rm -f "${path}/cache-packages.txt"
|
||||||
|
|
||||||
: > ${work_dir}/build.${FUNCNAME}
|
: > ${work_dir}/build.${FUNCNAME}
|
||||||
msg "Done [pkgs-image]"
|
msg "Done [pkgs-image]"
|
||||||
fi
|
fi
|
||||||
|
@ -314,18 +336,20 @@ make_image_boot() {
|
||||||
cp ${work_dir}/root-image/boot/vmlinuz* ${path_iso}/${arch}/${iso_name}
|
cp ${work_dir}/root-image/boot/vmlinuz* ${path_iso}/${arch}/${iso_name}
|
||||||
local path="${work_dir}/boot-image"
|
local path="${work_dir}/boot-image"
|
||||||
mkdir -p ${path}
|
mkdir -p ${path}
|
||||||
umount_image_handler
|
|
||||||
if [[ -n "${custom}" ]] ; then
|
if [[ -n "${custom}" ]] ; then
|
||||||
aufs_mount_custom_image "${path}"
|
mount_custom_image "${path}"
|
||||||
aufs_append_root_image "${path}"
|
|
||||||
else
|
else
|
||||||
aufs_mount_root_image "${path}"
|
mount_root_image "${path}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
copy_initcpio "${path}" || die "Failed to copy initcpio."
|
copy_initcpio "${path}" || die "Failed to copy initcpio."
|
||||||
gen_boot_image "${path}"
|
gen_boot_image "${path}"
|
||||||
mv ${path}/boot/${iso_name}.img ${path_iso}/${arch}/${iso_name}.img
|
mv ${path}/boot/${iso_name}.img ${path_iso}/${arch}/${iso_name}.img
|
||||||
[[ -f ${path}/boot/intel-ucode.img ]] && copy_ucode "${path}" "${path_iso}"
|
[[ -f ${path}/boot/intel-ucode.img ]] && copy_ucode "${path}" "${path_iso}"
|
||||||
umount_image_handler
|
|
||||||
|
umount_image "${path}"
|
||||||
|
|
||||||
rm -R ${path}
|
rm -R ${path}
|
||||||
: > ${work_dir}/build.${FUNCNAME}
|
: > ${work_dir}/build.${FUNCNAME}
|
||||||
msg "Done [${iso_name}/boot]"
|
msg "Done [${iso_name}/boot]"
|
||||||
|
@ -474,28 +498,16 @@ load_pkgs(){
|
||||||
_purge="s|>cleanup.*||g" \
|
_purge="s|>cleanup.*||g" \
|
||||||
_purge_rm="s|>cleanup||g"
|
_purge_rm="s|>cleanup||g"
|
||||||
|
|
||||||
|
local list
|
||||||
|
|
||||||
if [[ $1 == "${packages_custom}" ]];then
|
if [[ $1 == "${packages_custom}" ]];then
|
||||||
local temp=/tmp/buildiso
|
sort -u ../shared/Packages-Desktop ${packages_custom} > ${work_dir}/${packages_custom}
|
||||||
prepare_dir ${temp}
|
list=${work_dir}/${packages_custom}
|
||||||
sort -u ../shared/Packages-Custom ${packages_custom} > ${temp}/${packages_custom}
|
|
||||||
packages=$(sed "$_com_rm" "${temp}/${packages_custom}" \
|
|
||||||
| sed "$_space" \
|
|
||||||
| sed "$_blacklist" \
|
|
||||||
| sed "$_purge" \
|
|
||||||
| sed "$_init" \
|
|
||||||
| sed "$_init_rm" \
|
|
||||||
| sed "$_arch" \
|
|
||||||
| sed "$_arch_rm" \
|
|
||||||
| sed "$_nonfree_default" \
|
|
||||||
| sed "$_multi" \
|
|
||||||
| sed "$_nonfree_i686" \
|
|
||||||
| sed "$_nonfree_x86_64" \
|
|
||||||
| sed "$_nonfree_multi" \
|
|
||||||
| sed "$_kernel" \
|
|
||||||
| sed "$_clean")
|
|
||||||
#rm ${temp}/${packages_custom}
|
|
||||||
else
|
else
|
||||||
packages=$(sed "$_com_rm" "$1" \
|
list=$1
|
||||||
|
fi
|
||||||
|
|
||||||
|
packages=$(sed "$_com_rm" "$list" \
|
||||||
| sed "$_space" \
|
| sed "$_space" \
|
||||||
| sed "$_blacklist" \
|
| sed "$_blacklist" \
|
||||||
| sed "$_purge" \
|
| sed "$_purge" \
|
||||||
|
@ -510,7 +522,6 @@ load_pkgs(){
|
||||||
| sed "$_nonfree_multi" \
|
| sed "$_nonfree_multi" \
|
||||||
| sed "$_kernel" \
|
| sed "$_kernel" \
|
||||||
| sed "$_clean")
|
| sed "$_clean")
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ $1 == 'Packages-Xorg' ]]; then
|
if [[ $1 == 'Packages-Xorg' ]]; then
|
||||||
packages_cleanup=$(sed "$_com_rm" "$1" \
|
packages_cleanup=$(sed "$_com_rm" "$1" \
|
||||||
|
|
|
@ -376,6 +376,8 @@ init_buildiso(){
|
||||||
[[ -z ${iso_compression} ]] && iso_compression='xz'
|
[[ -z ${iso_compression} ]] && iso_compression='xz'
|
||||||
|
|
||||||
[[ -z ${iso_checksum} ]] && iso_checksum='md5'
|
[[ -z ${iso_checksum} ]] && iso_checksum='md5'
|
||||||
|
|
||||||
|
[[ -z ${use_overlayfs} ]] && use_overlayfs='false'
|
||||||
}
|
}
|
||||||
|
|
||||||
load_config(){
|
load_config(){
|
||||||
|
@ -450,11 +452,11 @@ load_profile_config(){
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -z ${start_systemd_live[@]} ]];then
|
if [[ -z ${start_systemd_live[@]} ]];then
|
||||||
start_systemd_live=('livecd' 'mhwd-live' 'pacman-init' 'pacman-boot')
|
start_systemd_live=('livecd' 'mhwd-live' 'pacman-init')
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -z ${start_openrc_live[@]} ]];then
|
if [[ -z ${start_openrc_live[@]} ]];then
|
||||||
start_openrc_live=('livecd' 'mhwd-live' 'pacman-init' 'pacman-boot')
|
start_openrc_live=('livecd' 'mhwd-live' 'pacman-init')
|
||||||
fi
|
fi
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
|
|
Loading…
Reference in a new issue