* data: cleaning

* start 0.15.0

* buildiso: remove use_overlayfs setting

* buildiso: remove aufs support; die if kernel<4

* buildiso: make a new iso mount lib

* doc: upd mt.conf

* buildiso: add mkinitcpio.conf

* Makefile: remove aufs initcpio

* util: remove check for mkinitcpio.conf
This commit is contained in:
artoo 2017-03-09 12:23:07 +01:00 committed by GitHub
parent 6401beeda4
commit 5ed1df3f39
15 changed files with 46 additions and 406 deletions

View file

@ -1,4 +1,4 @@
Version=0.14.0
Version=0.15.0
PREFIX = /usr/local
SYSCONFDIR = /etc
@ -32,9 +32,6 @@ ARCH_CONF = \
data/make.conf.d/i686.conf \
data/make.conf.d/x86_64.conf \
data/make.conf.d/multilib.conf
# data/make.conf.d/aarch64.conf \
# data/make.conf.d/armv6h.conf \
# data/make.conf.d/armv7h.conf
BIN_PKG = \
bin/checkpkg \
@ -67,19 +64,18 @@ BIN_ISO = \
LIBS_ISO = \
lib/util-iso.sh \
lib/util-iso-aufs.sh \
lib/util-iso-overlayfs.sh \
lib/util-iso-mount.sh \
lib/util-iso-image.sh \
lib/util-iso-boot.sh \
lib/util-publish.sh
SHARED_ISO = \
data/pacman-mhwd.conf \
data/mkinitcpio.conf \
data/profile.conf.example
CPIOHOOKS = \
initcpio/hooks/miso \
initcpio/hooks/miso_aufs \
initcpio/hooks/miso_loop_mnt \
initcpio/hooks/miso_pxe_common \
initcpio/hooks/miso_pxe_http \
@ -89,7 +85,6 @@ CPIOHOOKS = \
CPIOINST = \
initcpio/install/miso \
initcpio/install/miso_aufs \
initcpio/install/miso_loop_mnt \
initcpio/install/miso_pxe_common \
initcpio/install/miso_pxe_http \
@ -186,14 +181,6 @@ install_iso:
install -dm0755 $(DESTDIR)$(PREFIX)/lib/manjaro-tools
install -m0644 ${LIBS_ISO} $(DESTDIR)$(PREFIX)/lib/manjaro-tools
# install -dm0755 $(DESTDIR)$(PREFIX)/lib/initcpio/hooks
# install -m0755 ${CPIOHOOKS} $(DESTDIR)$(PREFIX)/lib/initcpio/hooks
#
# install -dm0755 $(DESTDIR)$(PREFIX)/lib/initcpio/install
# install -m0755 ${CPIOINST} $(DESTDIR)$(PREFIX)/lib/initcpio/install
# install -m0755 ${CPIO} $(DESTDIR)$(PREFIX)/lib/initcpio
install -dm0755 $(DESTDIR)$(SYSCONFDIR)/initcpio/hooks
install -m0755 ${CPIOHOOKS} $(DESTDIR)$(SYSCONFDIR)/initcpio/hooks

View file

@ -103,10 +103,6 @@ overriding
# unset defaults to given value
# kernel="linux49"
# experimental; use overlayfs instead of aufs
# requires minimum 4.0 kernel on the build host and on iso in profile.conf
# use_overlayfs="false"
# gpg key; leave empty or commented to skip sfs signing
# gpgkey=""

View file

@ -88,7 +88,6 @@ display_settings(){
msg "ISO INFO:"
msg2 "iso_label: %s" "${iso_label}"
msg2 "iso_fs: %s" "${iso_fs}"
msg "BUILD QUEUE:"
run show_profile "${build_list_iso}"
@ -176,6 +175,7 @@ prepare_dir "${tmp_dir}"
eval_build_list "${list_dir_iso}" "${build_list_iso}"
import ${LIBDIR}/util-iso.sh
import ${LIBDIR}/util-iso-mount.sh
check_requirements

View file

@ -1,5 +0,0 @@
# srv path : version attribute
release:none
development:alpha[0-9],beta[0-9],rc[0-9]

View file

@ -52,10 +52,6 @@
# unset defaults to given value
# kernel="linux49"
# experimental; use overlayfs instead of aufs
# requires minimum 4.0 kernel on the build host and on iso in profile.conf
# use_overlayfs="false"
# gpg key; leave empty or commented to skip sfs signing
# gpgkey=""

3
data/mkinitcpio.conf Normal file
View file

@ -0,0 +1,3 @@
MODULES="loop dm-snapshot"
HOOKS="base udev memdisk miso_shutdown miso miso_loop_mnt miso_pxe_common miso_pxe_http miso_pxe_nbd miso_pxe_nfs miso_kms modconf block pcmcia filesystems keyboard keymap"
COMPRESSION="xz"

View file

@ -119,13 +119,6 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>.
</para></listitem>
</varlistentry>
<!--<varlistentry>
<term><varname>host=</varname></term>
<listitem><para>Default url to be used for upload.
</para></listitem>
</varlistentry>-->
</variablelist>
</refsect1>
@ -252,6 +245,13 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>.
</para></listitem>
</varlistentry>
<varlistentry>
<term><varname>project=</varname></term>
<listitem><para>Default SF project name to be used for upload.
</para></listitem>
</varlistentry>
<varlistentry>
<term><varname>limit=</varname></term>

View file

@ -1,248 +0,0 @@
# args: source, newroot, mountpoint
_mnt_dmsnapshot() {
local img="${1}"
local mnt="${2}"
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
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}" "${mnt}" "-w" "defaults"
echo $(readlink -f /dev/mapper/${dm_snap_name}) >> /run/miso/used_block_devices
}
_mnt_overlayfs_root(){
local src="${1}"
local newroot="${2}"
local mnt="${3}"
msg ":: Mounting root (aufs) filesystem"
mount -t aufs -o dirs=${src}=rw union "${newroot}${mnt}"
}
# args: source, newroot, mountpoint
_mnt_overlayfs() {
local src="${1}"
local newroot="${2}"
local mnt="${3}"
msg ":: Adding new aufs branch: ${src} to ${newroot}${mnt}"
mount -t aufs -o remount,append:"${src}"=ro none "${newroot}${mnt}"
}
# args: /path/to/image_file, mountpoint
_mnt_sfs() {
local img="${1}"
local mnt="${2}"
local img_fullname="${img##*/}"
local sfs_dev
if [[ "${copytoram}" == "y" ]]; then
msg -n ":: Copying squashfs image to RAM..."
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="/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"
}
# 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
done
if mount -o "${opts}" "${flg}" "${dev}" "${mnt}"; then
msg ":: Device '${dev}' mounted successfully."
else
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 $1.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 $1.sfs.sig 2>/dev/null | grep -qE '^\[GNUPG:\] GOODSIG'
_status=$?
cd "${OLDPWD}"
return ${_status}
}
run_hook() {
[[ -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"
[[ -z "${overlay_root_size}" ]] && overlay_root_size="75%"
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
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"
}
# 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}"
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 [[ "${checksum}" == "y" ]]; then
for fs in rootfs desktopfs mhwdfs livefs;do
if [[ -f "/run/miso/bootmnt/${misobasedir}/${arch}/${fs}.sfs" ]]; then
if [[ -f "/run/miso/bootmnt/${misobasedir}/${arch}/${fs}.md5" ]]; then
msg -n ":: Self-test requested, please wait..."
if _verify_checksum "${fs}"; 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}/${fs}.md5 not found"
launch_interactive_shell
fi
fi
done
fi
if [[ "${verify}" == "y" ]]; then
for fs in rootfs desktopfs mhwdfs livefs;do
if [[ -f "/run/miso/bootmnt/${misobasedir}/${arch}/${fs}.sfs" ]]; then
if [[ -f "/run/miso/bootmnt/${misobasedir}/${arch}/${fs}.sfs.sig" ]]; then
msg -n ":: Signature verification requested, please wait..."
if _verify_signature "${fs}"; 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}/${fs}.sfs.sig not found"
launch_interactive_shell
fi
fi
done
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
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}"
msg -n ":: Mounting overlay root (tmpfs) filesystem, size=${overlay_root_size}..."
mkdir -p /run/miso/overlay_root
mount -t tmpfs -o "size=${overlay_root_size}",mode=0755 overlay_root /run/miso/overlay_root
local work_dir="/run/miso/overlay_root"
_mnt_overlayfs_root "${work_dir}" "${newroot}" "/"
local src="/run/miso/bootmnt/${misobasedir}/${arch}"
local dest_sfs="/run/miso/sfs" dest_img="/run/miso/img"
for sfs in livefs mhwdfs desktopfs rootfs;do
if [[ -f "${src}/${sfs}.sfs" ]]; then
_mnt_sfs "${src}/${sfs}.sfs" "${dest_sfs}/${sfs}"
if [[ -f "${dest_sfs}/${sfs}/${sfs}.img" ]]; then
mkdir -p ${dest_img}
_mnt_dmsnapshot "${dest_sfs}/${sfs}/${sfs}.img" "${dest_img}/${sfs}"
_mnt_overlayfs "${dest_img}/${sfs}" "${newroot}" "/"
else
_mnt_overlayfs "${dest_sfs}/${sfs}" "${newroot}" "/"
fi
fi
done
if [[ "${copytoram}" == "y" ]]; then
umount -d /run/miso/bootmnt
fi
}
# vim:ft=sh:ts=4:sw=4:et:

View file

@ -1,30 +0,0 @@
#!/bin/bash
build() {
add_module "cdrom"
add_module "loop"
add_module "dm-snapshot"
add_module "aufs"
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:

View file

@ -1,45 +0,0 @@
#!/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.
track_fs() {
info "%s mount: [%s]" "${iso_fs}" "$6"
mount "$@" && FS_ACTIVE_MOUNTS=("$6" "${FS_ACTIVE_MOUNTS[@]}")
}
# $1: new branch
mount_fs_root(){
FS_ACTIVE_MOUNTS=()
track_fs -t aufs -o br="$1":${work_dir}/rootfs=ro none "$1"
}
mount_fs_desktop(){
FS_ACTIVE_MOUNTS=()
track_fs -t aufs -o br="$1":${work_dir}/desktopfs=ro:${work_dir}/rootfs=ro none "$1"
}
mount_fs_live(){
FS_ACTIVE_MOUNTS=()
track_fs -t aufs -o br="$1":${work_dir}/livefs=ro:${work_dir}/desktopfs=ro:${work_dir}/rootfs=ro none "$1"
}
mount_fs_net(){
FS_ACTIVE_MOUNTS=()
track_fs -t aufs -o br="$1":${work_dir}/livefs=ro:${work_dir}/rootfs=ro none "$1"
}
# $1: image path
umount_fs(){
if [[ -n ${FS_ACTIVE_MOUNTS[@]} ]];then
umount "${FS_ACTIVE_MOUNTS[@]}"
unset FS_ACTIVE_MOUNTS
find $1 -name '.wh.*' -delete &> /dev/null
fi
}

View file

@ -15,10 +15,6 @@ set_mkinicpio_hooks(){
sed -e 's/miso_pxe_common miso_pxe_http miso_pxe_nbd miso_pxe_nfs //' \
-e 's/memdisk //' -i $1
fi
if ! ${use_overlayfs};then
msg2 "Setting aufs hook"
sed -e 's/miso /miso_aufs /' -i $1
fi
}
prepare_initcpio(){
@ -29,14 +25,14 @@ prepare_initcpio(){
}
prepare_initramfs(){
cp $1/mkinitcpio.conf $2/etc/mkinitcpio-${iso_name}.conf
set_mkinicpio_hooks "$2/etc/mkinitcpio-${iso_name}.conf"
local _kernver=$(cat $2/usr/lib/modules/*/version)
cp ${DATADIR}/mkinitcpio.conf $1/etc/mkinitcpio-${iso_name}.conf
set_mkinicpio_hooks "$1/etc/mkinitcpio-${iso_name}.conf"
local _kernver=$(cat $1/usr/lib/modules/*/version)
if [[ -n ${gpgkey} ]]; then
su ${OWNER} -c "gpg --export ${gpgkey} >${USERCONFDIR}/gpgkey"
exec 17<>${USERCONFDIR}/gpgkey
fi
MISO_GNUPG_FD=${gpgkey:+17} chroot-run $2 \
MISO_GNUPG_FD=${gpgkey:+17} chroot-run $1 \
/usr/bin/mkinitcpio -k ${_kernver} \
-c /etc/mkinitcpio-${iso_name}.conf \
-g /boot/initramfs.img

View file

@ -20,26 +20,6 @@ copy_overlay(){
fi
}
track_img() {
info "mount: [%s]" "$2"
mount "$@" && IMG_ACTIVE_MOUNTS=("$2" "${IMG_ACTIVE_MOUNTS[@]}")
}
mount_img() {
IMG_ACTIVE_MOUNTS=()
mkdir -p "$2"
track_img "$1" "$2"
}
umount_img() {
if [[ -n ${IMG_ACTIVE_MOUNTS[@]} ]];then
info "umount: [%s]" "${IMG_ACTIVE_MOUNTS[@]}"
umount "${IMG_ACTIVE_MOUNTS[@]}"
unset IMG_ACTIVE_MOUNTS
rm -r "$1"
fi
}
add_svc_rc(){
if [[ -f $1/etc/init.d/$2 ]];then
msg2 "Setting %s ..." "$2"

View file

@ -9,8 +9,28 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
track_img() {
info "mount: [%s]" "$2"
mount "$@" && IMG_ACTIVE_MOUNTS=("$2" "${IMG_ACTIVE_MOUNTS[@]}")
}
mount_img() {
IMG_ACTIVE_MOUNTS=()
mkdir -p "$2"
track_img "$1" "$2"
}
umount_img() {
if [[ -n ${IMG_ACTIVE_MOUNTS[@]} ]];then
info "umount: [%s]" "${IMG_ACTIVE_MOUNTS[@]}"
umount "${IMG_ACTIVE_MOUNTS[@]}"
unset IMG_ACTIVE_MOUNTS
rm -r "$1"
fi
}
track_fs() {
info "%s mount: [%s]" "${iso_fs}" "$5"
info "overlayfs mount: [%s]" "$5"
mount "$@" && FS_ACTIVE_MOUNTS=("$5" "${FS_ACTIVE_MOUNTS[@]}")
}
@ -41,7 +61,7 @@ mount_fs_net(){
umount_fs(){
if [[ -n ${FS_ACTIVE_MOUNTS[@]} ]];then
info "%s umount: [%s]" "${iso_fs}" "${FS_ACTIVE_MOUNTS[@]}"
info "overlayfs umount: [%s]" "${FS_ACTIVE_MOUNTS[@]}"
umount "${FS_ACTIVE_MOUNTS[@]}"
unset FS_ACTIVE_MOUNTS
rm -rf "${mnt_dir}/work"

View file

@ -361,7 +361,7 @@ make_image_boot() {
fi
prepare_initcpio "${path}"
prepare_initramfs "${profile_dir}" "${path}"
prepare_initramfs "${path}"
mv ${path}/boot/initramfs.img ${boot}/${target_arch}/initramfs.img
prepare_boot_extras "${path}" "${boot}"
@ -448,17 +448,10 @@ check_requirements(){
fi
local iso_kernel=${kernel:5:1} host_kernel=$(uname -r)
if [[ ${iso_kernel} < "4" ]] || [[ ${host_kernel%%*.} < "4" ]];then
use_overlayfs='false'
if [[ ${iso_kernel} < "4" ]] \
|| [[ ${host_kernel%%*.} < "4" ]];then
die "The host and iso kernels must be version>=4.0!"
fi
if ${use_overlayfs};then
iso_fs="overlayfs"
else
iso_fs="aufs"
fi
import ${LIBDIR}/util-iso-${iso_fs}.sh
}
compress_images(){

View file

@ -315,8 +315,6 @@ init_buildiso(){
[[ -z ${kernel} ]] && kernel="linux49"
[[ -z ${use_overlayfs} ]] && use_overlayfs='true'
[[ -z ${gpgkey} ]] && gpgkey=''
mhwd_repo="/opt/pkg"
@ -423,7 +421,7 @@ load_profile_config(){
[[ -z ${login_shell} ]] && login_shell='/bin/bash'
if [[ -z ${addgroups} ]];then
addgroups="video,power,storage,optical,network,lp,scanner,wheel"
addgroups="video,power,storage,optical,network,lp,scanner,wheel,sys"
fi
if [[ -z ${enable_systemd[@]} ]];then
@ -508,8 +506,7 @@ reset_profile(){
}
check_profile(){
local keyfiles=("${profile_dir}/mkinitcpio.conf"
"${profile_dir}/Packages-Root"
local keyfiles=("${profile_dir}/Packages-Root"
"${profile_dir}/Packages-Live")
local keydirs=("${profile_dir}/root-overlay"