Merge branch 'master' of github.com:manjaro/manjaro-tools into stable-0.14.x

This commit is contained in:
udeved 2016-11-02 17:18:30 +01:00
commit db4cab5241
8 changed files with 110 additions and 112 deletions

View file

@ -90,7 +90,6 @@ display_settings(){
msg2 "images_only: %s" "${images_only}"
msg2 "iso_only: %s" "${iso_only}"
msg2 "persist: %s" "${persist}"
# msg2 "sign: %s" "${sign}"
msg2 "torrent: %s" "${torrent}"
msg "DIST SETTINGS:"
@ -123,7 +122,6 @@ pretend=false
images_only=false
iso_only=false
verbose=false
# sign=false
torrent=false
persist=false
@ -141,7 +139,6 @@ usage() {
echo ' -i <name> Init system to use'
echo " [default: ${initsys}]"
echo ' -m Set SquashFS image mode to persistence'
# echo ' -s Sign the sfs images'
echo ' -c Disable clean work dir'
echo ' -x Build images only'
echo ' -z Generate iso only'
@ -168,7 +165,6 @@ while getopts "${opts}" arg; do
t) cache_dir_iso="$OPTARG" ;;
k) kernel="$OPTARG" ;;
i) initsys="$OPTARG" ;;
# s) sign=true ;;
c) clean_first=false ;;
x) images_only=true ;;
z) iso_only=true ;;

View file

@ -38,7 +38,7 @@
################ buildiso ################
# the name of the profiles directory
# profile_repo='manjaro-tools-iso-profiles'
# profile_repo='iso-profiles'
# default iso build list; name without .list extension
# build_list_iso=default

View file

@ -38,7 +38,7 @@
# netinstall="false"
# the default url for the netinstall.yaml
# netgroups="https://raw.githubusercontent.com/manjaro/manjaro-tools-iso-profiles/master/shared/netinst"
# netgroups="https://raw.githubusercontent.com/manjaro/iso-profiles/master/shared/netgroups"
# configure calamares to use chrootcfg instead of unpackfs; default: unpackfs
# chrootcfg="false"

View file

@ -42,21 +42,17 @@ prepare_initcpio(){
sed -e "s|/usr/lib/initcpio/|/etc/initcpio/|" -i $1/etc/initcpio/install/miso_shutdown
}
gen_boot_initramfs(){
prepare_initramfs(){
cp $1/mkinitcpio.conf $2/etc/mkinitcpio-${iso_name}.conf
set_mkinicpio_hooks "$2/etc/mkinitcpio-${iso_name}.conf"
}
# $1: work_dir
gen_boot_image(){
local _kernver=$(cat $1/usr/lib/modules/*/version)
chroot-run $1 \
local _kernver=$(cat $2/usr/lib/modules/*/version)
chroot-run $2 \
/usr/bin/mkinitcpio -k ${_kernver} \
-c /etc/mkinitcpio-${iso_name}.conf \
-g /boot/initramfs.img
}
copy_boot_extra(){
prepare_boot_extras(){
cp $1/boot/intel-ucode.img $2/intel_ucode.img
cp $1/usr/share/licenses/intel-ucode/LICENSE $2/intel_ucode.LICENSE
cp $1/boot/memtest86+/memtest.bin $2/memtest

View file

@ -20,6 +20,26 @@ 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
}
configure_plymouth(){
if ${plymouth_boot};then
msg2 "Configuring plymouth: %s" "${plymouth_theme}"

View file

@ -23,6 +23,7 @@ error_function() {
plain "Aborting..."
fi
umount_image
umount_img
exit 2
}
@ -67,38 +68,11 @@ trap_exit() {
kill "-$sig" "$$"
}
mount_img() {
mkdir -p "$2"
info "mount: [%s]" "$1"
mount "$1" "$2"
}
umount_img() {
info "umount: [%s]" "$1"
umount -d "$1"
rm -r "$1"
}
prepare_ext4_img(){
local size=32G
local src="$1"
local name=${src##*/}
local mnt="${mnt_dir}/${name}"
msg2 "Creating ext4 image of %s ..." "${size}"
truncate -s ${size} "${src}.img"
local ext4_args=()
${verbose} && ext4_args+=(-q)
ext4_args+=(-O ^has_journal,^resize_inode -E lazy_itable_init=0 -m 0)
mkfs.ext4 ${ext4_args[@]} -F "${src}.img" &>/dev/null
tune2fs -c 0 -i 0 "${src}.img" &> /dev/null
mount_img "${work_dir}/${name}.img" "${mnt}"
msg2 "Copying %s ..." "${src}/"
cp -aT "${src}/" "${mnt}/"
umount_img "${mnt}"
}
sign_iso(){
su ${OWNER} -c "signfile ${iso_dir}/$1"
make_sig () {
msg2 "Creating signature file..."
cd "$1"
gpg --detach-sign --default-key ${gpg_key} $2.sfs
cd ${OLDPWD}
}
# $1: file
@ -134,7 +108,22 @@ make_sfs() {
fi
fi
${persist} && prepare_ext4_img "${src}"
if ${persist};then
local size=32G
local mnt="${mnt_dir}/${name}"
msg2 "Creating ext4 image of %s ..." "${size}"
truncate -s ${size} "${src}.img"
local ext4_args=()
${verbose} && ext4_args+=(-q)
ext4_args+=(-O ^has_journal,^resize_inode -E lazy_itable_init=0 -m 0)
mkfs.ext4 ${ext4_args[@]} -F "${src}.img" &>/dev/null
tune2fs -c 0 -i 0 "${src}.img" &> /dev/null
mount_img "${work_dir}/${name}.img" "${mnt}"
msg2 "Copying %s ..." "${src}/"
cp -aT "${src}/" "${mnt}/"
umount_img "${mnt}"
fi
msg2 "Creating SquashFS image, this may take some time..."
local used_kernel=${kernel:5:1} mksfs_args=()
@ -271,7 +260,7 @@ make_image_desktop() {
pacman -Qr "${path}" > "${path}/desktopfs-pkgs.txt"
cp "${path}/desktopfs-pkgs.txt" ${iso_dir}/$(gen_iso_fn)-pkgs.txt
[[ -e ${profile_dir}/${profile}-overlay ]] && copy_overlay "${profile_dir}/${profile}-overlay" "${path}"
[[ -e ${profile_dir}/desktop-overlay ]] && copy_overlay "${profile_dir}/desktop-overlay" "${path}"
reset_pac_conf "${path}"
@ -283,7 +272,7 @@ make_image_desktop() {
}
mount_image_select(){
if [[ -f "${packages_custom}" ]]; then
if [[ -f "${packages_desktop}" ]]; then
mount_image_custom "$1"
else
mount_image "$1"
@ -358,12 +347,20 @@ make_image_boot() {
mount_image_live "${path}"
configure_plymouth "${path}"
gen_boot_initramfs "${profile_dir}" "${path}"
# if [[ ${gpg_key} ]]; then
# gpg --export ${gpg_key} >${work_dir}/gpgkey
# exec 17<>${work_dir}/gpgkey
# fi
# MISO_GNUPG_FD=${gpg_key:+17}
gen_boot_image "${path}"
prepare_initramfs "${profile_dir}" "${path}"
# if [[ ${gpg_key} ]]; then
# exec 17<&-
# fi
mv ${path}/boot/initramfs.img ${boot}/${target_arch}/initramfs.img
copy_boot_extra "${path}" "${boot}"
prepare_boot_extras "${path}" "${boot}"
umount_image
@ -383,22 +380,6 @@ make_efi_usb() {
fi
}
prepare_fat_img(){
local size=31M
local src="$1"
local mnt="${mnt_dir}/efiboot"
local img="${src}/efiboot.img"
${pxe_boot} && size=40M
msg2 "Creating fat image of %s ..." "${size}"
truncate -s ${size} "${img}"
mkfs.fat -n MISO_EFI "${img}" &>/dev/null
mkdir -p "${mnt}"
mount_img "${img}" "${mnt}"
prepare_efiboot_image "${mnt}" "${iso_root}"
prepare_efi_loader "${work_dir}/livefs" "${mnt}" "dvd"
umount_img "${mnt}"
}
# Prepare kernel.img::/EFI for "El Torito" EFI boot mode
make_efi_dvd() {
if [[ ! -e ${work_dir}/build.${FUNCNAME} ]]; then
@ -406,7 +387,17 @@ make_efi_dvd() {
local src="${iso_root}/EFI/miso"
mkdir -p "${src}"
prepare_fat_img "${src}"
local size=31M
local mnt="${mnt_dir}/efiboot" img="${src}/efiboot.img"
${pxe_boot} && size=40M
msg2 "Creating fat image of %s ..." "${size}"
truncate -s ${size} "${img}"
mkfs.fat -n MISO_EFI "${img}" &>/dev/null
mkdir -p "${mnt}"
mount_img "${img}" "${mnt}"
prepare_efiboot_image "${mnt}" "${iso_root}"
prepare_efi_loader "${work_dir}/livefs" "${mnt}" "dvd"
umount_img "${mnt}"
: > ${work_dir}/build.${FUNCNAME}
msg "Done [/efiboot/EFI]"
@ -482,12 +473,24 @@ compress_images(){
show_elapsed_time "${FUNCNAME}" "${timer}"
}
# prepare_boot_loaders(){
# local timer=$(get_timer)
# run_safe "make_image_boot"
# run_safe "make_isolinux"
# run_safe "make_syslinux"
# if [[ "${target_arch}" == "x86_64" ]]; then
# run_safe "make_efi_usb"
# run_safe "make_efi_dvd"
# fi
# show_elapsed_time "${FUNCNAME}" "${timer}"
# }
prepare_images(){
local timer=$(get_timer)
load_pkgs "${profile_dir}/Packages-Root"
run_safe "make_image_root"
if [[ -f "${packages_custom}" ]] ; then
load_pkgs "${packages_custom}"
if [[ -f "${packages_desktop}" ]] ; then
load_pkgs "${packages_desktop}"
run_safe "make_image_desktop"
fi
if [[ -f ${profile_dir}/Packages-Live ]]; then
@ -526,6 +529,10 @@ make_profile(){
${verbose} && archive_logs
exit 1
fi
# if ${boot_only}; then
# prepare_boot_loaders
# exit 1
# fi
if ${images_only}; then
prepare_images
${verbose} && archive_logs

View file

@ -135,7 +135,7 @@ write_unpack_conf(){
echo " - source: \"/run/miso/bootmnt/${iso_name}/${target_arch}/rootfs.sfs\"" >> "$conf"
echo " sourcefs: \"squashfs\"" >> "$conf"
echo " destination: \"\"" >> "$conf"
if [[ -f "${packages_custom}" ]] ; then
if [[ -f "${packages_desktop}" ]] ; then
echo " - source: \"/run/miso/bootmnt/${iso_name}/${target_arch}/desktopfs.sfs\"" >> "$conf"
echo " sourcefs: \"squashfs\"" >> "$conf"
echo " destination: \"\"" >> "$conf"
@ -152,9 +152,11 @@ write_users_conf(){
echo " - $g" >> "$conf"
done
unset IFS
echo "autologinGroup: autologin" >> "$conf"
echo "sudoersGroup: wheel" >> "$conf"
echo "setRootPassword: true" >> "$conf"
echo "autologinGroup: autologin" >> "$conf"
echo "doAutologin: ${autologin}" >> "$conf"
echo "sudoersGroup: wheel" >> "$conf"
echo "setRootPassword: false" >> "$conf"
echo "availableShells: /bin/bash, /bin/zsh" >> "$conf"
}
write_packages_conf(){
@ -211,7 +213,7 @@ write_mhwdcfg_conf(){
echo "driver: ${drv}" >> "$conf"
echo '' >> "$conf"
local switch='true'
${chrootcfg} && switch='false'
${netinstall} && switch='false'
echo "local: ${switch}" >> "$conf"
echo '' >> "$conf"
echo 'repo: /opt/pacman-mhwd.conf' >> "$conf"
@ -232,18 +234,18 @@ write_postcfg_conf(){
}
get_yaml(){
local args=() ext="yaml" yaml
local args=() yaml
if ${chrootcfg};then
args+=('netinstall')
args+=('chrootcfg')
else
args+=("hybrid")
args+=("${profile}/packages")
fi
args+=("${initsys}")
[[ ${edition} == 'sonar' ]] && args+=("${edition}")
for arg in ${args[@]};do
yaml=${yaml:-}${yaml:+-}${arg}
done
echo "${yaml}.${ext}"
echo "${yaml}.yaml"
}
write_netinstall_conf(){
@ -419,9 +421,9 @@ make_profile_yaml(){
prepare_check "$1"
load_pkgs "${profile_dir}/Packages-Root"
write_netgroup_yaml "$1" "$(gen_fn "Packages-Root")"
if [[ -f "${packages_custom}" ]]; then
load_pkgs "${packages_custom}"
write_netgroup_yaml "$1" "$(gen_fn "${packages_custom##*/}")"
if [[ -f "${packages_desktop}" ]]; then
load_pkgs "${packages_desktop}"
write_netgroup_yaml "$1" "$(gen_fn "Packages-Desktop")"
fi
${calamares} && write_calamares_yaml "$1"
user_own "${cache_dir_netinstall}/$1" "-R"

View file

@ -307,7 +307,7 @@ init_buildiso(){
[[ -z ${use_overlayfs} ]] && use_overlayfs='true'
[[ -z ${profile_repo} ]] && profile_repo='manjaro-tools-iso-profiles'
[[ -z ${profile_repo} ]] && profile_repo='iso-profiles'
mhwd_repo="/opt/pkg"
}
@ -456,7 +456,7 @@ load_profile_config(){
#[[ -z ${netgroups} ]] && -- needs to be hardcoded for now, until a standard has been established
# will be unlocked again after everything has been established.
netgroups="https://raw.githubusercontent.com/manjaro/manjaro-tools-iso-profiles/master/shared/netinst"
netgroups="https://raw.githubusercontent.com/manjaro/calamares-netgroups/master"
[[ -z ${geoip} ]] && geoip='true'
@ -493,7 +493,7 @@ reset_profile(){
unset disable_openrc
unset enable_systemd_live
unset enable_openrc_live
unset packages_custom
unset packages_desktop
unset packages_mhwd
unset login_shell
unset tracker_url
@ -533,13 +533,7 @@ check_profile(){
die "Profile [%s] sanity check failed!" "${profile_dir}"
fi
local files=$(ls ${profile_dir}/Packages*)
for f in ${files[@]};do
case $f in
${profile_dir}/Packages-Root|${profile_dir}/Packages-Live|${profile_dir}/Packages-Mhwd) continue ;;
*) packages_custom="$f" ;;
esac
done
[[ -f "${profile_dir}/Packages-Desktop" ]] && packages_desktop=${profile_dir}/Packages-Desktop
[[ -f "${profile_dir}/Packages-Mhwd" ]] && packages_mhwd=${profile_dir}/Packages-Mhwd
@ -548,15 +542,6 @@ check_profile(){
fi
}
get_shared_list(){
local path
case ${edition} in
sonar|netrunner) path=${run_dir}/shared/${edition}/Packages-Desktop ;;
*) path=${run_dir}/shared/manjaro/Packages-Desktop ;;
esac
echo $path
}
# $1: file name
load_pkgs(){
info "Loading Packages: [%s] ..." "${1##*/}"
@ -641,14 +626,7 @@ load_pkgs(){
_purge="s|>cleanup.*||g" \
_purge_rm="s|>cleanup||g"
local list="$1"
if [[ "$list" == "${packages_custom}" ]];then
sort -u $(get_shared_list) ${packages_custom} > ${tmp_dir}/packages-desktop.list
list=${tmp_dir}/packages-desktop.list
fi
packages=$(sed "$_com_rm" "$list" \
packages=$(sed "$_com_rm" "$1" \
| sed "$_space" \
| sed "$_blacklist" \
| sed "$_purge" \
@ -668,8 +646,7 @@ load_pkgs(){
if [[ $1 == "${packages_mhwd}" ]]; then
local _used_kernel=${kernel:5:2}
[[ ${_used_kernel} < "42" ]] && local _amd="s|xf86-video-amdgpu||g"
[[ ${_used_kernel} < "42" ]] && local _amd="s|xf86-video-amdgpu||g"
packages_cleanup=$(sed "$_com_rm" "$1" \
| grep cleanup \