forked from mirrored-repos/manjaro-tools
initcpio: add persistence option; aufs probably doesn't work(wip)
This commit is contained in:
parent
b53e070f39
commit
914566c553
10 changed files with 379 additions and 493 deletions
6
Makefile
6
Makefile
|
@ -90,7 +90,8 @@ CPIOHOOKS = \
|
|||
initcpio/hooks/miso_pxe_common \
|
||||
initcpio/hooks/miso_pxe_http \
|
||||
initcpio/hooks/miso_pxe_nbd \
|
||||
initcpio/hooks/miso_pxe_nfs
|
||||
initcpio/hooks/miso_pxe_nfs \
|
||||
initcpio/hooks/miso_shutdown
|
||||
|
||||
CPIOINST = \
|
||||
initcpio/install/miso \
|
||||
|
@ -100,7 +101,8 @@ CPIOINST = \
|
|||
initcpio/install/miso_pxe_http \
|
||||
initcpio/install/miso_pxe_nbd \
|
||||
initcpio/install/miso_pxe_nfs \
|
||||
initcpio/install/miso_kms
|
||||
initcpio/install/miso_kms \
|
||||
initcpio/install/miso_shutdown
|
||||
|
||||
MAN_XML = \
|
||||
buildpkg.xml \
|
||||
|
|
|
@ -1,257 +1,221 @@
|
|||
# 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>
|
||||
#
|
||||
# args: source, newroot, mountpoint
|
||||
_mnt_dmsnapshot() {
|
||||
local img="${1}"
|
||||
local newroot="${2}"
|
||||
local mnt="${3}"
|
||||
local img_fullname="${img##*/}";
|
||||
local img_name="${img_fullname%%.*}"
|
||||
local dm_snap_name="${dm_snap_prefix}_${img_name}"
|
||||
local ro_dev ro_dev_size rw_dev
|
||||
|
||||
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
|
||||
ro_dev=$(losetup --find --show --read-only "${img}")
|
||||
echo ${ro_dev} >> /run/miso/used_block_devices
|
||||
ro_dev_size=$(blockdev --getsz ${ro_dev})
|
||||
|
||||
if [[ "${cow_persistent}" == "P" ]]; then
|
||||
if [[ -f "/run/miso/cowspace/${cow_directory}/${img_name}.cow" ]]; then
|
||||
msg ":: Found '/run/miso/cowspace/${cow_directory}/${img_name}.cow', using as persistent."
|
||||
else
|
||||
msg ":: Creating '/run/miso/cowspace/${cow_directory}/${img_name}.cow' as persistent."
|
||||
truncate -s "${cow_spacesize}" "/run/miso/cowspace/${cow_directory}/${img_name}.cow"
|
||||
fi
|
||||
else
|
||||
if [[ -f "/run/miso/cowspace/${cow_directory}/${img_name}.cow" ]]; then
|
||||
msg ":: Found '/run/miso/cowspace/${cow_directory}/${img_name}.cow' but non-persistent requested, removing."
|
||||
rm -f "/run/miso/cowspace/${cow_directory}/${img_name}.cow"
|
||||
fi
|
||||
msg ":: Creating '/run/miso/cowspace/${cow_directory}/${img_name}.cow' as non-persistent."
|
||||
truncate -s "${cow_spacesize}" "/run/miso/cowspace/${cow_directory}/${img_name}.cow"
|
||||
fi
|
||||
|
||||
rw_dev=$(losetup --find --show "/run/miso/cowspace/${cow_directory}/${img_name}.cow")
|
||||
echo ${rw_dev} >> /run/miso/used_block_devices
|
||||
|
||||
dmsetup create ${dm_snap_name} --table "0 ${ro_dev_size} snapshot ${ro_dev} ${rw_dev} ${cow_persistent} ${cow_chunksize}"
|
||||
|
||||
_mnt_dev "/dev/mapper/${dm_snap_name}" "${newroot}${mnt}" "-w" "defaults"
|
||||
echo $(readlink -f /dev/mapper/${dm_snap_name}) >> /run/miso/used_block_devices
|
||||
}
|
||||
|
||||
# 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_aufs() {
|
||||
# args: source, newroot, mountpoint
|
||||
_mnt_overlayfs() {
|
||||
local src="${1}"
|
||||
local mnt="${2}"
|
||||
msg "::: Adding new aufs branch: ${src} to ${mnt}"
|
||||
mkdir -p "${mnt}"
|
||||
/bin/mount -t aufs -o remount,append:"${src}"=ro none "${mnt}"
|
||||
}
|
||||
local newroot="${2}"
|
||||
local mnt="${3}"
|
||||
local work_dir=/run/miso/cowspace/${cow_directory}/aufs
|
||||
mkdir -p ${work_dir}
|
||||
|
||||
# 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}"
|
||||
mount -t aufs -o br=${work_dir}=rw:"${src}"=ro none "${newroot}${mnt}"
|
||||
}
|
||||
|
||||
# args: /path/to/image_file, mountpoint
|
||||
_mnt_squashfs() {
|
||||
_mnt_sfs() {
|
||||
local img="${1}"
|
||||
local mnt="${2}"
|
||||
local img_fullname="${img##*/}";
|
||||
local img_name="${img_fullname%.*}"
|
||||
local tmp_mnt="/ro_branch/${img_name}"
|
||||
local img_fullname="${img##*/}"
|
||||
local sfs_dev
|
||||
|
||||
if [ "${copytoram}" = "y" ]; then
|
||||
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}"
|
||||
if ! cp "${img}" "/run/miso/copytoram/${img_fullname}" ; then
|
||||
echo "ERROR: while copy '${img}' to '/run/miso/copytoram/${img_fullname}'"
|
||||
launch_interactive_shell
|
||||
fi
|
||||
img="/copytoram/${img_fullname}"
|
||||
img="/run/miso/copytoram/${img_fullname}"
|
||||
msg "done."
|
||||
fi
|
||||
sfs_dev=$(losetup --find --show --read-only "${img}")
|
||||
echo ${sfs_dev} >> /run/miso/used_block_devices
|
||||
_mnt_dev "${sfs_dev}" "${mnt}" "-r" "defaults"
|
||||
}
|
||||
|
||||
mkdir -p "${tmp_mnt}"
|
||||
/bin/mount -r -t squashfs "${img}" "${tmp_mnt}"
|
||||
if [ $? -ne 0 ]; then
|
||||
echo ">> ERROR: while mounting ${img} to ${tmp_mnt}"
|
||||
# args: device, mountpoint, flags, opts
|
||||
_mnt_dev() {
|
||||
local dev="${1}"
|
||||
local mnt="${2}"
|
||||
local flg="${3}"
|
||||
local opts="${4}"
|
||||
|
||||
mkdir -p "${mnt}"
|
||||
|
||||
msg ":: Mounting '${dev}' to '${mnt}'"
|
||||
|
||||
while ! poll_device "${dev}" 30; do
|
||||
echo "ERROR: '${dev}' device did not show up after 30 seconds..."
|
||||
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
|
||||
done
|
||||
|
||||
if [ "/${mnt#/*/}" = "/" ]; then
|
||||
_mnt_aufs "${tmp_mnt}" "${mnt}"
|
||||
if mount -o "${opts}" "${flg}" "${dev}" "${mnt}"; then
|
||||
msg ":: Device '${dev}' mounted successfully."
|
||||
else
|
||||
_mnt_bind "${tmp_mnt}" "${mnt}"
|
||||
echo "ERROR; Failed to mount '${dev}'"
|
||||
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
|
||||
}
|
||||
|
||||
_verify_checksum() {
|
||||
local _status
|
||||
cd "/run/miso/bootmnt/${misobasedir}/${arch}"
|
||||
md5sum -c airootfs.md5 > /tmp/checksum.log 2>&1
|
||||
_status=$?
|
||||
cd "${OLDPWD}"
|
||||
return ${_status}
|
||||
}
|
||||
|
||||
_verify_signature() {
|
||||
local _status
|
||||
cd "/run/miso/bootmnt/${misobasedir}/${arch}"
|
||||
gpg --homedir /gpg --status-fd 1 --verify airootfs.sfs.sig 2>/dev/null | grep -qE '^\[GNUPG:\] GOODSIG'
|
||||
_status=$?
|
||||
cd "${OLDPWD}"
|
||||
return ${_status}
|
||||
}
|
||||
|
||||
run_hook() {
|
||||
modprobe loop
|
||||
if [ "x${arch}" = "x" ]; then
|
||||
arch="$(uname -m)"
|
||||
fi
|
||||
[[ -z "${arch}" ]] && arch="$(uname -m)"
|
||||
[[ -z "${copytoram_size}" ]] && copytoram_size="75%"
|
||||
[[ -z "${misobasedir}" ]] && misobasedir="arch"
|
||||
[[ -z "${dm_snap_prefix}" ]] && dm_snap_prefix="arch"
|
||||
[[ -z "${misodevice}" ]] && misodevice="/dev/disk/by-label/${misolabel}"
|
||||
[[ -z "${cow_spacesize}" ]] && cow_spacesize="256M"
|
||||
|
||||
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}"
|
||||
if [[ -n "${cow_label}" ]]; then
|
||||
cow_device="/dev/disk/by-label/${cow_label}"
|
||||
[[ -z "${cow_persistent}" ]] && cow_persistent="P"
|
||||
elif [[ -n "${cow_device}" ]]; then
|
||||
[[ -z "${cow_persistent}" ]] && cow_persistent="P"
|
||||
else
|
||||
isomounts="/bootmnt/${misobasedir}/isomounts"
|
||||
cow_persistent="N"
|
||||
fi
|
||||
|
||||
[[ -z "${cow_flags}" ]] && cow_flags="defaults"
|
||||
[[ -z "${cow_directory}" ]] && cow_directory="persistent_${misolabel}/${arch}"
|
||||
[[ -z "${cow_chunksize}" ]] && cow_chunksize="8"
|
||||
|
||||
# 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() {
|
||||
|
||||
# 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
|
||||
[ ${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
|
||||
|
||||
[ "x${MDEV}" != "x" ] && break
|
||||
|
||||
/bin/sleep 1
|
||||
waitcount=$(( ${waitcount} + 1 ))
|
||||
done
|
||||
}
|
||||
|
||||
# This function is called normally from init script, but it can be called
|
||||
# as chain from other mount handlers.
|
||||
# args: /path/to/newroot
|
||||
miso_mount_handler() {
|
||||
local newroot="${1}"
|
||||
local found
|
||||
|
||||
# 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 root (aufs) filesystem"
|
||||
/bin/mount -t aufs -o dirs=/rw_branch=rw union "${newroot}"
|
||||
if [ $? -ne 0 ]; then
|
||||
echo ">> ERROR: while mounting root (aufs) filesystem."
|
||||
launch_interactive_shell
|
||||
fi
|
||||
|
||||
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
|
||||
if ! mountpoint -q "/run/miso/bootmnt"; then
|
||||
_mnt_dev "${misodevice}" "/run/miso/bootmnt" "-r" "defaults"
|
||||
if [[ "${copytoram}" != "y" ]]; then
|
||||
echo $(readlink -f ${misodevice}) >> /run/miso/used_block_devices
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "${type}" = "bind" ]; then
|
||||
_mnt_bind "/bootmnt/${misobasedir}/${img}" "${newroot}${mountpoint}"
|
||||
elif [ "${type}" = "squashfs" ]; then
|
||||
_mnt_squashfs "/bootmnt/${misobasedir}/${img}" "${newroot}${mountpoint}"
|
||||
if [[ "${checksum}" == "y" ]]; then
|
||||
if [[ -f "/run/miso/bootmnt/${misobasedir}/${arch}/airootfs.md5" ]]; then
|
||||
msg -n ":: Self-test requested, please wait..."
|
||||
if _verify_checksum; then
|
||||
msg "done. Checksum is OK, continue booting."
|
||||
else
|
||||
echo "ERROR: one or more files are corrupted"
|
||||
echo "see /tmp/checksum.log for details"
|
||||
launch_interactive_shell
|
||||
fi
|
||||
else
|
||||
echo "ERROR: checksum=y option specified but ${misobasedir}/${arch}/airootfs.md5 not found"
|
||||
launch_interactive_shell
|
||||
fi
|
||||
done < "${isomounts}"
|
||||
fi
|
||||
|
||||
if [ "${copytoram}" = "y" ]; then
|
||||
/bin/umount -d /bootmnt
|
||||
if [[ "${verify}" == "y" ]]; then
|
||||
if [[ -f "/run/miso/bootmnt/${misobasedir}/${arch}/airootfs.sfs.sig" ]]; then
|
||||
msg -n ":: Signature verification requested, please wait..."
|
||||
if _verify_signature; then
|
||||
msg "done. Signature is OK, continue booting."
|
||||
else
|
||||
echo "ERROR: one or more files are corrupted"
|
||||
launch_interactive_shell
|
||||
fi
|
||||
else
|
||||
echo "ERROR: verify=y option specified but ${misobasedir}/${arch}/airootfs.sfs.sig not found"
|
||||
launch_interactive_shell
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ "${copytoram}" == "y" ]]; then
|
||||
msg ":: Mounting /run/miso/copytoram (tmpfs) filesystem, size=${copytoram_size}"
|
||||
mkdir -p /run/miso/copytoram
|
||||
mount -t tmpfs -o "size=${copytoram_size}",mode=0755 copytoram /run/miso/copytoram
|
||||
fi
|
||||
|
||||
if [[ -n "${cow_device}" ]]; then
|
||||
_mnt_dev "${cow_device}" "/run/miso/cowspace" "-r" "${cow_flags}"
|
||||
echo $(readlink -f ${cow_device}) >> /run/miso/used_block_devices
|
||||
mount -o remount,rw "/run/miso/cowspace"
|
||||
else
|
||||
_mnt_bind /bootmnt "${newroot}/bootmnt"
|
||||
msg ":: Mounting /run/miso/cowspace (tmpfs) filesystem, size=${cow_spacesize}..."
|
||||
mkdir -p /run/miso/cowspace
|
||||
mount -t tmpfs -o "size=${cow_spacesize}",mode=0755 cowspace /run/miso/cowspace
|
||||
fi
|
||||
mkdir -p -m 0700 "/run/miso/cowspace/${cow_directory}"
|
||||
|
||||
local _src=/run/miso/bootmnt/${misobasedir}/${arch}
|
||||
|
||||
for fs in livefs mhwdfs desktopfs rootfs;do
|
||||
if [[ -f "${_src}/${fs}.sfs" ]]; then
|
||||
_mnt_sfs "${_src}/${fs}.sfs" "/run/miso/sfs/${fs}"
|
||||
if [[ -f "/run/miso/sfs/${fs}/${fs}.img" ]]; then
|
||||
_mnt_dmsnapshot "/run/miso/sfs/${fs}/${fs}.img" "${newroot}" "/"
|
||||
else
|
||||
_mnt_overlayfs "/run/miso/sfs/${fs}" "${newroot}" "/"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
if [[ "${copytoram}" == "y" ]]; then
|
||||
umount -d /run/miso/bootmnt
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
# vim: set ft=sh:
|
||||
|
||||
run_hook () {
|
||||
if [ -n "${img_dev}" ] && [ -n "${img_loop}" ]; then
|
||||
[[ -n "${img_label}" ]] && img_dev="/dev/disk/by-label/${img_label}"
|
||||
[[ -z "${img_flags}" ]] && img_flags="defaults"
|
||||
if [[ -n "${img_dev}" && -n "${img_loop}" ]]; then
|
||||
mount_handler="miso_loop_mount_handler"
|
||||
fi
|
||||
}
|
||||
|
@ -9,32 +11,25 @@ run_hook () {
|
|||
miso_loop_mount_handler () {
|
||||
newroot="${1}"
|
||||
|
||||
imgdev=$(resolve_device "$img_dev") && img_dev=$imgdev
|
||||
unset imgdev
|
||||
local _dev_loop
|
||||
|
||||
msg ":: Waiting for boot device..."
|
||||
while ! poll_device ${img_dev} 30; do
|
||||
echo "ERROR: boot device didn't show up after 30 seconds..."
|
||||
echo " Falling back to interactive prompt"
|
||||
echo " You can try to fix the problem manually, log out when you are finished"
|
||||
msg ":: Setup a loop device from ${img_loop} located at device ${img_dev}"
|
||||
_mnt_dev "${img_dev}" "/run/miso/img_dev" "-r" "${img_flags}"
|
||||
if [[ "${copytoram}" != "y" ]]; then
|
||||
echo $(readlink -f ${img_dev}) >> /run/miso/used_block_devices
|
||||
fi
|
||||
|
||||
if _dev_loop=$(losetup --find --show --read-only "/run/miso/img_dev/${img_loop}"); then
|
||||
misodevice="${_dev_loop}"
|
||||
else
|
||||
echo "ERROR: Setting loopback device for file '/run/miso/img_dev/${img_loop}'"
|
||||
launch_interactive_shell
|
||||
done
|
||||
|
||||
msg "::: Setup a loop device from ${img_loop} located at device ${img_dev}"
|
||||
FSTYPE=$(blkid -o value -s TYPE -p ${img_dev} 2> /dev/null)
|
||||
if [ -n "${FSTYPE}" ]; then
|
||||
if mount -r -t "${FSTYPE}" ${img_dev} /img_dev > /dev/null 2>&1; then
|
||||
_dev_loop=$(losetup -f)
|
||||
losetup ${_dev_loop} /img_dev/${img_loop}
|
||||
fi
|
||||
fi
|
||||
|
||||
miso_mount_handler ${newroot}
|
||||
|
||||
if [ "${copytoram}" = "y" ]; then
|
||||
msg "::: Deataching loop device ${_dev_loop}"
|
||||
losetup -d ${_dev_loop}
|
||||
msg "::: Unmounting ${img_dev}"
|
||||
umount -d ${img_dev}
|
||||
if [[ "${copytoram}" == "y" ]]; then
|
||||
losetup -d ${_dev_loop} 2>/dev/null
|
||||
umount /run/miso/img_dev
|
||||
fi
|
||||
}
|
||||
|
|
|
@ -1,248 +1,173 @@
|
|||
# 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>
|
||||
#
|
||||
# args: source, newroot, mountpoint
|
||||
_mnt_dmsnapshot() {
|
||||
local img="${1}"
|
||||
local newroot="${2}"
|
||||
local mnt="${3}"
|
||||
local img_fullname="${img##*/}";
|
||||
local img_name="${img_fullname%%.*}"
|
||||
local dm_snap_name="${dm_snap_prefix}_${img_name}"
|
||||
local ro_dev ro_dev_size rw_dev
|
||||
|
||||
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
|
||||
ro_dev=$(losetup --find --show --read-only "${img}")
|
||||
echo ${ro_dev} >> /run/miso/used_block_devices
|
||||
ro_dev_size=$(blockdev --getsz ${ro_dev})
|
||||
|
||||
if [[ "${cow_persistent}" == "P" ]]; then
|
||||
if [[ -f "/run/miso/cowspace/${cow_directory}/${img_name}.cow" ]]; then
|
||||
msg ":: Found '/run/miso/cowspace/${cow_directory}/${img_name}.cow', using as persistent."
|
||||
else
|
||||
msg ":: Creating '/run/miso/cowspace/${cow_directory}/${img_name}.cow' as persistent."
|
||||
truncate -s "${cow_spacesize}" "/run/miso/cowspace/${cow_directory}/${img_name}.cow"
|
||||
fi
|
||||
else
|
||||
if [[ -f "/run/miso/cowspace/${cow_directory}/${img_name}.cow" ]]; then
|
||||
msg ":: Found '/run/miso/cowspace/${cow_directory}/${img_name}.cow' but non-persistent requested, removing."
|
||||
rm -f "/run/miso/cowspace/${cow_directory}/${img_name}.cow"
|
||||
fi
|
||||
msg ":: Creating '/run/miso/cowspace/${cow_directory}/${img_name}.cow' as non-persistent."
|
||||
truncate -s "${cow_spacesize}" "/run/miso/cowspace/${cow_directory}/${img_name}.cow"
|
||||
fi
|
||||
|
||||
rw_dev=$(losetup --find --show "/run/miso/cowspace/${cow_directory}/${img_name}.cow")
|
||||
echo ${rw_dev} >> /run/miso/used_block_devices
|
||||
|
||||
dmsetup create ${dm_snap_name} --table "0 ${ro_dev_size} snapshot ${ro_dev} ${rw_dev} ${cow_persistent} ${cow_chunksize}"
|
||||
|
||||
_mnt_dev "/dev/mapper/${dm_snap_name}" "${newroot}${mnt}" "-w" "defaults"
|
||||
echo $(readlink -f /dev/mapper/${dm_snap_name}) >> /run/miso/used_block_devices
|
||||
}
|
||||
|
||||
# 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: source, newroot, mountpoint
|
||||
_mnt_overlayfs() {
|
||||
local lower_dir="${1}"
|
||||
local newroot="${2}"
|
||||
local mnt="${3}"
|
||||
local work_dir=/run/miso/cowspace/${cow_directory}/workdir
|
||||
local upper_dir=/run/miso/cowspace/${cow_directory}/upperdir
|
||||
mkdir -p ${upper_dir} ${work_dir}
|
||||
mount -t overlay misofs -o lowerdir=${lower_dir},upperdir=${upper_dir},workdir=${work_dir} "${newroot}${mnt}"
|
||||
}
|
||||
|
||||
# args: /path/to/image_file, mountpoint
|
||||
_mnt_squashfs() {
|
||||
_mnt_sfs() {
|
||||
local img="${1}"
|
||||
local mnt="${2}"
|
||||
local img_fullname="${img##*/}";
|
||||
local img_name="${img_fullname%.*}"
|
||||
local tmp_mnt="/ro_branch/${img_name}"
|
||||
local img_fullname="${img##*/}"
|
||||
local sfs_dev
|
||||
|
||||
if [ "${copytoram}" = "y" ]; then
|
||||
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}"
|
||||
if ! cp "${img}" "/run/miso/copytoram/${img_fullname}" ; then
|
||||
echo "ERROR: while copy '${img}' to '/run/miso/copytoram/${img_fullname}'"
|
||||
launch_interactive_shell
|
||||
fi
|
||||
img="/copytoram/${img_fullname}"
|
||||
img="/run/miso/copytoram/${img_fullname}"
|
||||
msg "done."
|
||||
fi
|
||||
sfs_dev=$(losetup --find --show --read-only "${img}")
|
||||
echo ${sfs_dev} >> /run/miso/used_block_devices
|
||||
_mnt_dev "${sfs_dev}" "${mnt}" "-r" "defaults"
|
||||
}
|
||||
|
||||
mkdir -p "${tmp_mnt}"
|
||||
/bin/mount -r -t squashfs "${img}" "${tmp_mnt}"
|
||||
if [ $? -ne 0 ]; then
|
||||
echo ">> ERROR: while mounting ${img} to ${tmp_mnt}"
|
||||
# args: device, mountpoint, flags, opts
|
||||
_mnt_dev() {
|
||||
local dev="${1}"
|
||||
local mnt="${2}"
|
||||
local flg="${3}"
|
||||
local opts="${4}"
|
||||
|
||||
mkdir -p "${mnt}"
|
||||
|
||||
msg ":: Mounting '${dev}' to '${mnt}'"
|
||||
|
||||
while ! poll_device "${dev}" 30; do
|
||||
echo "ERROR: '${dev}' device did not show up after 30 seconds..."
|
||||
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
|
||||
done
|
||||
|
||||
if [ "/${mnt#/*/}" = "/" ]; then
|
||||
overlayfs="${overlayfs}:${tmp_mnt}"
|
||||
if mount -o "${opts}" "${flg}" "${dev}" "${mnt}"; then
|
||||
msg ":: Device '${dev}' mounted successfully."
|
||||
else
|
||||
_mnt_bind "${tmp_mnt}" "${mnt}"
|
||||
echo "ERROR; Failed to mount '${dev}'"
|
||||
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
|
||||
}
|
||||
|
||||
run_hook() {
|
||||
modprobe loop
|
||||
if [ "x${arch}" = "x" ]; then
|
||||
arch="$(uname -m)"
|
||||
fi
|
||||
[[ -z "${arch}" ]] && arch="$(uname -m)"
|
||||
[[ -z "${copytoram_size}" ]] && copytoram_size="75%"
|
||||
[[ -z "${misobasedir}" ]] && misobasedir="manjaro"
|
||||
|
||||
if [ "x${rw_branch_size}" = "x" ]; then
|
||||
rw_branch_size="75%"
|
||||
fi
|
||||
[[ -z "${dm_snap_prefix}" ]] && dm_snap_prefix="arch"
|
||||
[[ -z "${misodevice}" ]] && misodevice="/dev/disk/by-label/${misolabel}"
|
||||
[[ -z "${cow_spacesize}" ]] && cow_spacesize="256M"
|
||||
|
||||
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}"
|
||||
if [[ -n "${cow_label}" ]]; then
|
||||
cow_device="/dev/disk/by-label/${cow_label}"
|
||||
[[ -z "${cow_persistent}" ]] && cow_persistent="P"
|
||||
elif [[ -n "${cow_device}" ]]; then
|
||||
[[ -z "${cow_persistent}" ]] && cow_persistent="P"
|
||||
else
|
||||
isomounts="/bootmnt/${misobasedir}/isomounts"
|
||||
cow_persistent="N"
|
||||
fi
|
||||
|
||||
[[ -z "${cow_flags}" ]] && cow_flags="defaults"
|
||||
[[ -z "${cow_directory}" ]] && cow_directory="persistent_${misolabel}/${arch}"
|
||||
[[ -z "${cow_chunksize}" ]] && cow_chunksize="8"
|
||||
|
||||
# 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() {
|
||||
|
||||
# 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
|
||||
[ ${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
|
||||
|
||||
[ "x${MDEV}" != "x" ] && break
|
||||
|
||||
/bin/sleep 1
|
||||
waitcount=$(( ${waitcount} + 1 ))
|
||||
done
|
||||
}
|
||||
|
||||
# This function is called normally from init script, but it can be called
|
||||
# as chain from other mount handlers.
|
||||
# args: /path/to/newroot
|
||||
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
|
||||
if ! mountpoint -q "/run/miso/bootmnt"; then
|
||||
_mnt_dev "${misodevice}" "/run/miso/bootmnt" "-r" "defaults"
|
||||
if [[ "${copytoram}" != "y" ]]; then
|
||||
echo $(readlink -f ${misodevice}) >> /run/miso/used_block_devices
|
||||
fi
|
||||
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."
|
||||
if [[ "${copytoram}" == "y" ]]; then
|
||||
msg ":: Mounting /run/miso/copytoram (tmpfs) filesystem, size=${copytoram_size}"
|
||||
mkdir -p /run/miso/copytoram
|
||||
mount -t tmpfs -o "size=${copytoram_size}",mode=0755 copytoram /run/miso/copytoram
|
||||
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 -d /bootmnt
|
||||
if [[ -n "${cow_device}" ]]; then
|
||||
_mnt_dev "${cow_device}" "/run/miso/cowspace" "-r" "${cow_flags}"
|
||||
echo $(readlink -f ${cow_device}) >> /run/miso/used_block_devices
|
||||
mount -o remount,rw "/run/miso/cowspace"
|
||||
else
|
||||
_mnt_bind /bootmnt "${newroot}/bootmnt"
|
||||
msg ":: Mounting /run/miso/cowspace (tmpfs) filesystem, size=${cow_spacesize}..."
|
||||
mkdir -p /run/miso/cowspace
|
||||
mount -t tmpfs -o "size=${cow_spacesize}",mode=0755 cowspace /run/miso/cowspace
|
||||
fi
|
||||
mkdir -p -m 0700 "/run/miso/cowspace/${cow_directory}"
|
||||
|
||||
local _src=/run/miso/bootmnt/${misobasedir}/${arch}
|
||||
|
||||
for fs in livefs mhwdfs desktopfs rootfs cowfs;do
|
||||
if [[ -f "${_src}/${fs}.sfs" ]]; then
|
||||
_mnt_sfs "${_src}/${fs}.sfs" "/run/miso/sfs/${fs}"
|
||||
if [[ -f "/run/miso/sfs/${fs}/${fs}.img" ]]; then
|
||||
_mnt_dmsnapshot "/run/miso/sfs/${fs}/${fs}.img" "${newroot}" "/"
|
||||
else
|
||||
_mnt_overlayfs "/run/miso/sfs/${fs}" "${newroot}" "/"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
if [[ "${copytoram}" == "y" ]]; then
|
||||
umount -d /run/miso/bootmnt
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
# vim: set ft=sh:
|
||||
|
||||
run_hook () {
|
||||
local i net_mac bootif_mac bootif_dev
|
||||
# Do *not* declare 'bootif_dev' local! We need it in run_latehook().
|
||||
local i net_mac bootif_mac
|
||||
# These variables will be parsed from /tmp/net-*.conf generated by ipconfig
|
||||
local DEVICE
|
||||
local IPV4ADDR IPV4BROADCAST IPV4NETMASK IPV4GATEWAY IPV4DNS0 IPV4DNS1
|
||||
|
@ -25,7 +26,12 @@ run_hook () {
|
|||
fi
|
||||
|
||||
# setup network and save some values
|
||||
ipconfig "ip=${ip}"
|
||||
if ! ipconfig "ip=${ip}"; then
|
||||
echo "ERROR; Failed to configure network"
|
||||
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
|
||||
|
||||
. /tmp/net-*.conf
|
||||
|
||||
|
@ -42,9 +48,16 @@ run_hook () {
|
|||
}
|
||||
|
||||
run_latehook () {
|
||||
[[ -z "${copy_resolvconf}" ]] && copy_resolvconf="y"
|
||||
if [[ -n "${ip}" ]]; then
|
||||
[[ -z "${copy_resolvconf}" ]] && copy_resolvconf="y"
|
||||
|
||||
if [[ "${copy_resolvconf}" != "n" && -f /etc/resolv.conf ]]; then
|
||||
cp /etc/resolv.conf /new_root/etc/resolv.conf
|
||||
if [[ "${copytoram}" == "y" ]]; then
|
||||
if [[ -n "${bootif_dev}" ]]; then
|
||||
ip addr flush dev "${bootif_dev}"
|
||||
ip link set "${bootif_dev}" down
|
||||
fi
|
||||
elif [[ "${copy_resolvconf}" != "n" && -f /etc/resolv.conf ]]; then
|
||||
cp /etc/resolv.conf /new_root/etc/resolv.conf
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
|
|
@ -30,27 +30,21 @@ _curl_get() {
|
|||
miso_pxe_http_mount_handler () {
|
||||
newroot="${1}"
|
||||
|
||||
# _curl_get "${miso_http_srv}${misobasedir}/isomounts" "${isomounts}"
|
||||
#
|
||||
# msg ":: Retrieving images"
|
||||
# while read img imgarch mountpoint type kernelarg; do
|
||||
# # check if this line is a comment (starts with #)
|
||||
# [ "${img#"#"}" != "${img}" ] && continue
|
||||
#
|
||||
# [ "$imgarch" != "$arch" ] && continue
|
||||
#
|
||||
# _curl_get "${miso_http_srv}${misobasedir}/${img}" "/bootmnt/${misobasedir}/${img}"
|
||||
#
|
||||
# done < "${isomounts}"
|
||||
msg ":: Mounting /run/miso/httpspace (tmpfs) filesystem, size='${miso_http_spc}'"
|
||||
mkdir -p "/run/miso/httpspace"
|
||||
mount -t tmpfs -o size="${miso_http_spc}",mode=0755 httpspace "/run/miso/httpspace"
|
||||
|
||||
_curl_get "${miso_http_srv}${misobasedir}/${arch}/root-image.sqfs" "/${arch}"
|
||||
_curl_get "${miso_http_srv}${misobasedir}/${arch}/airootfs.sfs" "/${arch}"
|
||||
|
||||
if [[ "${checksum}" == "y" ]]; then
|
||||
_curl_get "${miso_http_srv}${misobasedir}/${arch}/airootfs.md5" "/${arch}"
|
||||
fi
|
||||
if [[ "${verify}" == "y" ]]; then
|
||||
_curl_get "${miso_http_srv}${misobasedir}/${arch}/airootfs.sfs.sig" "/${arch}"
|
||||
fi
|
||||
|
||||
mkdir -p "/run/miso/bootmnt"
|
||||
mount -o bind /run/miso/httpspace /run/miso/bootmnt
|
||||
|
||||
miso_mount_handler ${newroot}
|
||||
}
|
||||
|
||||
|
|
|
@ -2,30 +2,29 @@
|
|||
|
||||
build() {
|
||||
add_module "cdrom"
|
||||
add_module "aufs"
|
||||
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_module "dm-snapshot"
|
||||
add_module "overlay"
|
||||
|
||||
add_runscript
|
||||
|
||||
add_binary /usr/lib/udev/cdrom_id
|
||||
add_binary blockdev
|
||||
add_binary dmsetup
|
||||
add_binary losetup
|
||||
add_binary mountpoint
|
||||
add_binary truncate
|
||||
add_binary gpg
|
||||
add_binary grep
|
||||
|
||||
add_file /usr/lib/udev/rules.d/60-cdrom_id.rules
|
||||
add_file /usr/lib/udev/rules.d/10-dm.rules
|
||||
add_file /usr/lib/udev/rules.d/95-dm-notify.rules
|
||||
add_file /usr/lib/initcpio/udev/11-dm-initramfs.rules /usr/lib/udev/rules.d/11-dm-initramfs.rules
|
||||
if [[ $miso_GNUPG_FD ]]; then
|
||||
mkdir -p "$BUILDROOT$dest"/gpg
|
||||
gpg --homedir "$BUILDROOT$dest"/gpg --import <&$miso_GNUPG_FD
|
||||
fi
|
||||
}
|
||||
|
||||
# vim: set ft=sh ts=4 sw=4 et:
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
#!/bin/bash
|
||||
|
||||
build() {
|
||||
add_dir /img_dev
|
||||
add_runscript
|
||||
}
|
||||
|
||||
|
@ -12,4 +11,3 @@ HELPEOF
|
|||
}
|
||||
|
||||
# vim: set ft=sh ts=4 sw=4 et:
|
||||
|
||||
|
|
|
@ -2,30 +2,24 @@
|
|||
|
||||
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_module "dm-snapshot"
|
||||
add_module "overlay"
|
||||
|
||||
add_runscript
|
||||
|
||||
add_binary /usr/lib/udev/cdrom_id
|
||||
add_binary blockdev
|
||||
add_binary dmsetup
|
||||
add_binary losetup
|
||||
add_binary mountpoint
|
||||
add_binary truncate
|
||||
add_binary grep
|
||||
|
||||
add_file /usr/lib/udev/rules.d/60-cdrom_id.rules
|
||||
add_file /usr/lib/udev/rules.d/10-dm.rules
|
||||
add_file /usr/lib/udev/rules.d/95-dm-notify.rules
|
||||
add_file /usr/lib/initcpio/udev/11-dm-initramfs.rules /usr/lib/udev/rules.d/11-dm-initramfs.rules
|
||||
}
|
||||
|
||||
# vim: set ft=sh ts=4 sw=4 et:
|
||||
|
||||
|
|
|
@ -22,3 +22,5 @@ cat<<HELPEOF
|
|||
This hook loads the necessary modules for boot via PXE.
|
||||
HELPEOF
|
||||
}
|
||||
|
||||
# vim: set ft=sh ts=4 sw=4 et:
|
||||
|
|
Loading…
Reference in a new issue