diff --git a/Makefile b/Makefile index d74bf83..4de043b 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -Version=0.9.12 +Version=0.9.13 PREFIX = /usr/local SYSCONFDIR = /etc diff --git a/bin/buildpkg.in b/bin/buildpkg.in index 9343a3f..75f6c3a 100644 --- a/bin/buildpkg.in +++ b/bin/buildpkg.in @@ -164,7 +164,8 @@ pacman_conf="${PKGDATADIR}/pacman-${pacman_conf_arch}.conf" makepkg_conf="${PKGDATADIR}/makepkg-${arch}.conf" mirrors_conf="${PKGDATADIR}/pacman-mirrors-${branch}.conf" -mkchroot_args+=(-C ${pacman_conf} -M ${makepkg_conf} -S ${mirrors_conf} -B "${build_mirror}/${branch}") +chroot_run_args+=(-C ${pacman_conf} -M ${makepkg_conf} -S ${mirrors_conf} -B "${build_mirror}/${branch}") +mkchroot_args+=(-C ${pacman_conf} -M ${makepkg_conf} -S ${mirrors_conf} -B "${build_mirror}/${branch}" -L) mkchrootpkg_args+=(-r ${work_dir}) diff --git a/conf/base-devel_nosystemd b/conf/base-devel_nosystemd new file mode 100644 index 0000000..0463220 --- /dev/null +++ b/conf/base-devel_nosystemd @@ -0,0 +1,27 @@ +autoconf +automake +binutils +bison +eudev-systemdcompat +fakeroot +file +findutils +flex +gawk +gcc +gettext +grep +groff +gzip +libtool +m4 +make +pacman +patch +pkg-config +sed +sudo +texinfo +util-linux +which +lib32-flex diff --git a/conf/base_nosystemd b/conf/base_nosystemd new file mode 100644 index 0000000..110e94c --- /dev/null +++ b/conf/base_nosystemd @@ -0,0 +1,56 @@ +bash +bzip2 +coreutils +cryptsetup +device-mapper +dhcpcd +diffutils +eudev-systemdcompat +e2fsprogs +file +filesystem +findutils +gawk +gcc-libs +gettext +glibc +grep +gzip +inetutils +iproute2 +iputils +jfsutils +less +licenses +logrotate +lvm2 +man-db +man-pages +manjaro-hotfixes +manjaro-system +mdadm +mhwd +mhwd-db +nano +openrc-core +pacman +pciutils +pcmciautils +perl +procps-ng +psmisc +reiserfsprogs +s-nail +sed +shadow +sysfsutils +tar +texinfo +usbutils +util-linux +vi +which +xfsprogs +tcp_wrappers +lib32-tcp_wrappers + diff --git a/initcpio/hooks/miso b/initcpio/hooks/miso index 9ebff4c..eeabd27 100644 --- a/initcpio/hooks/miso +++ b/initcpio/hooks/miso @@ -257,7 +257,7 @@ miso_mount_handler() { done < "${isomounts}" if [ "${copytoram}" = "y" ]; then - /bin/umount /bootmnt + /bin/umount -d /bootmnt else _mnt_bind /bootmnt "${newroot}/bootmnt" fi diff --git a/initcpio/hooks/miso_loop_mnt b/initcpio/hooks/miso_loop_mnt index 6c16210..72ef9ea 100644 --- a/initcpio/hooks/miso_loop_mnt +++ b/initcpio/hooks/miso_loop_mnt @@ -35,6 +35,6 @@ miso_loop_mount_handler () { msg "::: Deataching loop device ${_dev_loop}" losetup -d ${_dev_loop} msg "::: Unmounting ${img_dev}" - umount ${img_dev} + umount -d ${img_dev} fi } diff --git a/initcpio/hooks/miso_overlayfs b/initcpio/hooks/miso_overlayfs index 249a669..640542e 100644 --- a/initcpio/hooks/miso_overlayfs +++ b/initcpio/hooks/miso_overlayfs @@ -248,7 +248,7 @@ miso_mount_handler() { mount -t overlay overlay -olowerdir="${overlayfs:1}",upperdir="/rw_branch/upper",workdir="/rw_branch/work" "${newroot}/" if [ "${copytoram}" = "y" ]; then - /bin/umount /bootmnt + /bin/umount -d /bootmnt else _mnt_bind /bootmnt "${newroot}/bootmnt" fi diff --git a/lib/util-iso-boot.sh b/lib/util-iso-boot.sh index b9ecab9..3975d8d 100644 --- a/lib/util-iso-boot.sh +++ b/lib/util-iso-boot.sh @@ -38,6 +38,7 @@ copy_initcpio(){ cp /usr/lib/initcpio/install/miso* $1/usr/lib/initcpio/install cp mkinitcpio.conf $1/etc/mkinitcpio-${iso_name}.conf set_mkinicpio_hooks "$1/etc/mkinitcpio-${iso_name}.conf" + sed -e 's|"$@"|"$@" >/dev/null 2>&1|' -i $1/usr/lib/initcpio/init } # $1: work_dir @@ -53,7 +54,7 @@ copy_efi_loaders(){ msg2 "Copying efi loaders ..." cp $1/usr/lib/prebootloader/PreLoader.efi $2/bootx64.efi cp $1/usr/lib/prebootloader/HashTool.efi $2/ - cp ${PKGDATADIR}/efi_shell/systemd-bootx64.efi $2/loader.efi + cp $1/usr/lib/systemd/boot/efi/systemd-bootx64.efi $2/loader.efi } copy_boot_images(){ diff --git a/lib/util-iso-calamares.sh b/lib/util-iso-calamares.sh index 7296533..c88b289 100644 --- a/lib/util-iso-calamares.sh +++ b/lib/util-iso-calamares.sh @@ -55,6 +55,13 @@ write_calamares_services_conf(){ echo 'targets:' >> "$conf" echo ' - name: "graphical"' >> "$conf" echo ' mandatory: false' >> "$conf" + echo '' >> "$conf" + echo 'disable:' >> "$conf" + for s in ${disable_openrc[@]};do + echo ' - name: '"$s" >> "$conf" + echo ' mandatory: false' >> "$conf" + echo '' >> "$conf" + done else echo 'services:' > "$conf" for s in ${start_systemd[@]};do @@ -65,6 +72,13 @@ write_calamares_services_conf(){ echo 'targets:' >> "$conf" echo ' - name: "graphical"' >> "$conf" echo ' mandatory: true' >> "$conf" + echo '' >> "$conf" + echo 'disable:' >> "$conf" + for s in ${disable_systemd[@]};do + echo ' - name: '"$s" >> "$conf" + echo ' mandatory: false' >> "$conf" + echo '' >> "$conf" + done fi } @@ -112,6 +126,7 @@ write_calamares_users_conf(){ unset IFS echo "autologinGroup: autologin" >> "$conf" echo "sudoersGroup: wheel" >> "$conf" + echo "setRootPassword: true" >> "$conf" } brand_calamares_settings_conf(){ diff --git a/lib/util-iso-image.sh b/lib/util-iso-image.sh index 3468e65..b426e4a 100644 --- a/lib/util-iso-image.sh +++ b/lib/util-iso-image.sh @@ -64,7 +64,6 @@ configure_services_live(){ ;; *) msg3 "Unsupported: [${initsys}]!" - break ;; esac } @@ -103,11 +102,12 @@ configure_services(){ msg2 "Setting $svc ..." chroot $1 systemctl enable $svc &> /dev/null done + sed -i 's/#\(HandleSuspendKey=\)suspend/\1ignore/' $1/etc/systemd/logind.conf + sed -i 's/#\(HandleLidSwitch=\)suspend/\1ignore/' $1/etc/systemd/logind.conf msg3 "Done configuring [${initsys}]" ;; *) msg3 "Unsupported: [${initsys}]!" - break ;; esac } @@ -268,7 +268,9 @@ configure_displaymanager(){ sed -i -e "s|^.*session=.*|session=/usr/bin/$default_desktop_executable|" ${conf} fi ;; - *) break ;; + *) + msg3 "Unsupported: [${displaymanager}]!" + ;; esac if [[ ${displaymanager} != "none" ]];then if [[ ${initsys} == 'openrc' ]];then @@ -347,7 +349,27 @@ configure_sysctl(){ fi } -# Remove pamac auto-update when the network is up, it causes problems when booting in the livecd +configure_time(){ + if [[ ${initsys} == 'openrc' ]];then + rm $1/etc/runlevels/boot/hwclock + fi +} + +# $1: chroot +configure_systemd_live(){ + if [[ ${initsys} == 'systemd' ]];then + msg2 "Configuring systemd for livecd" + sed -i 's/#\(Storage=\)auto/\1volatile/' $1/etc/systemd/journald.conf + sed -i 's/#\(HandleSuspendKey=\)suspend/\1ignore/' $1/etc/systemd/logind.conf + sed -i 's/#\(HandleHibernateKey=\)hibernate/\1ignore/' $1/etc/systemd/logind.conf + sed -i 's/#\(HandleLidSwitch=\)suspend/\1ignore/' $1/etc/systemd/logind.conf + # Prevent some services to be started in the livecd + echo 'File created by manjaro-tools. See systemd-update-done.service(8).' \ + | tee "${path}/etc/.updated" >"${path}/var/.updated" + fi +} + +# Remove pamac auto-update when the network is up, it locks de pacman db when booting in the livecd # $1: chroot configure_pamac_live() { rm -f $1/etc/NetworkManager/dispatcher.d/99_update_pamac_tray @@ -358,6 +380,7 @@ configure_root_image(){ configure_lsb "$1" configure_mhwd "$1" configure_sysctl "$1" + configure_time "$1" msg "Done configuring [root-image]" } @@ -377,6 +400,7 @@ configure_livecd_image(){ configure_accountsservice "$1" "${username}" configure_user "$1" configure_services_live "$1" + configure_systemd_live "$1" configure_calamares "$1" configure_thus "$1" configure_pamac_live "$1" diff --git a/lib/util-iso.sh b/lib/util-iso.sh index 6cc0642..84e62f6 100644 --- a/lib/util-iso.sh +++ b/lib/util-iso.sh @@ -139,7 +139,11 @@ squash_image_dir() { local highcomp="-b 256K -Xbcj x86" [[ "${iso_compression}" != "xz" ]] && highcomp="" msg2 "Creating SquashFS image. This may take some time..." - mksquashfs "${1}" "${sq_img}" -noappend -comp ${iso_compression} ${highcomp} || die "Exit ..." + if [[ "$(basename "$1")" == "mhwd-image" ]]; then + mksquashfs "${1}" "${sq_img}" -noappend -comp lz4 || die "Exit ..." + else + mksquashfs "${1}" "${sq_img}" -noappend -comp ${iso_compression} ${highcomp} || die "Exit ..." + fi msg3 "Time ${FUNCNAME}: $(elapsed_time ${timer}) minutes" } diff --git a/lib/util-livecd.sh b/lib/util-livecd.sh index a1804b4..0d2f0d0 100644 --- a/lib/util-livecd.sh +++ b/lib/util-livecd.sh @@ -106,11 +106,9 @@ configure_language(){ [[ -z "$KEYMAP" ]] && KEYMAP="us" [[ -z "$KBLAYOUT" ]] && KBLAYOUT="us" -# local FALLBACK="en_US" local TLANG=${LOCALE%.*} sed -i -r "s/#(${TLANG}.*UTF-8)/\1/g" $1/etc/locale.gen -# sed -i -r "s/#(${FALLBACK}.*UTF-8)/\1/g" $1/etc/locale.gen echo "LANG=${LOCALE}.UTF-8" >> $1/etc/environment @@ -122,11 +120,16 @@ configure_language(){ write_x11_config $1 -# echo "LANGUAGE=${LOCALE}:${FALLBACK}" >> $1/etc/locale.conf - loadkeys "${KEYMAP}" } +configure_clock(){ + if [[ -d /run/openrc ]];then + ln -sf /usr/share/zoneinfo/Europe/London /etc/localtime + echo "Europe/London" > /etc/timezone + fi +} + configure_translation_pkgs(){ # Determind which language we are using local LNG_INST=$(cat $1/etc/locale.conf | grep LANG= | cut -d= -f2 | cut -d. -f1) @@ -272,7 +275,6 @@ configure_translation_pkgs(){ } configure_alsa(){ - echo "configure alsa" >> /var/log/livecd.log # amixer binary local alsa_amixer="chroot $1 /usr/bin/amixer" @@ -328,23 +330,6 @@ configure_alsa(){ $alsa_amixer -c 0 sset "Audigy Analog/Digital Output Jack" off &>/dev/null } -rm_kalu(){ - local base_check_virtualbox=`dmidecode | grep innotek` - local base_check_vmware=`dmidecode | grep VMware` - local base_check_qemu=`dmidecode | grep QEMU` - local base_check_vpc=`dmidecode | grep Microsoft` - - if [ -n "$base_check_virtualbox" ]; then - pacman -R kalu --noconfirm --noprogressbar --root $1 &> /dev/null - elif [ -n "$base_check_vmware" ]; then - pacman -R kalu --noconfirm --noprogressbar --root $1 &> /dev/null - elif [ -n "$base_check_qemu" ]; then - pacman -R kalu --noconfirm --noprogressbar --root $1 &> /dev/null - elif [ -n "$base_check_vpc" ]; then - pacman -R kalu --noconfirm --noprogressbar --root $1 &> /dev/null - fi -} - ### end shared functions with cli installer configure_machine_id(){ @@ -382,16 +367,15 @@ configure_env(){ echo "BROWSER=/usr/bin/xdg-open" >> /etc/profile # add TERM var - if [ -e "/usr/bin/mate-session" ] ; then - echo "TERM=mate-terminal" >> /etc/environment - echo "TERM=mate-terminal" >> /etc/profile + echo "TERM=mate-terminal" >> /etc/environment + echo "TERM=mate-terminal" >> /etc/profile fi ## FIXME - Workaround to launch mate-terminal if [ -e "/usr/bin/mate-session" ] ; then - sed -i -e "s~^.*Exec=.*~Exec=mate-terminal -e 'sudo setup'~" "/etc/skel/Desktop/installer-launcher-cli.desktop" - sed -i -e "s~^.*Terminal=.*~Terminal=false~" "/etc/skel/Desktop/installer-launcher-cli.desktop" + sed -i -e "s~^.*Exec=.*~Exec=mate-terminal -e 'sudo setup'~" "/etc/skel/Desktop/installer-launcher-cli.desktop" + sed -i -e "s~^.*Terminal=.*~Terminal=false~" "/etc/skel/Desktop/installer-launcher-cli.desktop" fi } diff --git a/lib/util-pkg.sh b/lib/util-pkg.sh index d4bfec4..14f93c8 100644 --- a/lib/util-pkg.sh +++ b/lib/util-pkg.sh @@ -54,7 +54,7 @@ chroot_clean(){ chroot_update(){ msg "Updating chroot for [${branch}] (${arch})..." - chroot-run ${mkchroot_args[*]} \ + chroot-run ${chroot_run_args[*]} \ "${work_dir}/${OWNER}" \ pacman -Syu --noconfirm || abort diff --git a/lib/util.sh b/lib/util.sh index 6c94100..92c5b56 100644 --- a/lib/util.sh +++ b/lib/util.sh @@ -57,11 +57,20 @@ get_timer(){ echo $(date +%s) } +get_timer_ms(){ + echo $(date +%s%3N) +} + # $1: start timer elapsed_time(){ echo $(echo $1 $(get_timer) | awk '{ printf "%0.2f",($2-$1)/60 }') } +# $1: start timer +elapsed_time_ms(){ + echo $(echo $1 $(get_timer_ms) | awk '{ printf "%0.3f",($2-$1)/1000 }') +} + ## # usage : in_array( $needle, $haystack ) # return : 0 - found @@ -451,10 +460,18 @@ load_profile_config(){ start_systemd=('bluetooth' 'cronie' 'ModemManager' 'NetworkManager' 'org.cups.cupsd' 'tlp' 'tlp-sleep') fi + if [[ -z ${disable_systemd[@]} ]];then + disable_systemd=('pacman-init') + fi + if [[ -z ${start_openrc[@]} ]];then start_openrc=('acpid' 'bluetooth' 'consolekit' 'cronie' 'cupsd' 'dbus' 'syslog-ng' 'NetworkManager') fi + if [[ -z ${disable_openrc[@]} ]];then + disable_openrc=('pacman-init') + fi + if [[ -z ${start_systemd_live[@]} ]];then start_systemd_live=('livecd' 'mhwd-live' 'pacman-init') fi diff --git a/scripts/livecd b/scripts/livecd index 90ec0df..54ceaac 100755 --- a/scripts/livecd +++ b/scripts/livecd @@ -1,58 +1,59 @@ #!/bin/sh +livetimer=$(date +%s%3N) [[ -r /opt/livecd/util.sh ]] && source /opt/livecd/util.sh load_profile_config "/opt/livecd/profile.conf" [[ -r /opt/livecd/util-livecd.sh ]] && source /opt/livecd/util-livecd.sh +echo "Loaded scripts: $(elapsed_time_ms ${livetimer})ms" >> /var/log/livecd.log +livetimer=$(get_timer_ms) CONSOLEFONT="$(kernel_cmdline vconsole.font)" CONSOLEMAP="$(kernel_cmdline vconsole.font.map)" arch=$(uname -m) +echo "Got consolefont and arch: $(elapsed_time_ms ${livetimer})ms" >> /var/log/livecd.log -echo "update fstab for swap" > /var/log/livecd.log - -# scan_swap -## Systemd should do it -# should or should not? -# [[ -d /run/openrc ]] && configure_swap +# Activate swap +livetimer=$(get_timer_ms) configure_swap +echo "Activated swap and added to fstab: $(elapsed_time_ms ${livetimer})ms" >> /var/log/livecd.log -echo "set locale" >> /var/log/livecd.log - -# set language +livetimer=$(get_timer_ms) configure_language +echo "Languaged configured: $(elapsed_time_ms ${livetimer})ms" >> /var/log/livecd.log + +livetimer=$(get_timer_ms) locale-gen +echo "Ran locale-gen: $(elapsed_time_ms ${livetimer})ms" >> /var/log/livecd.log -echo "configure system" >> /var/log/livecd.log +configure_clock -# add BROWSER var +# Add BROWSER var in env and workaround for mate-terminal +livetimer=$(get_timer_ms) configure_env +echo "Configured env: $(elapsed_time_ms ${livetimer})ms" >> /var/log/livecd.log +livetimer=$(get_timer_ms) configure_machine_id +echo "Configured machine-id: $(elapsed_time_ms ${livetimer})ms" >> /var/log/livecd.log -echo "configure sudoers" >> /var/log/livecd.log - -# do_fix_perms +livetimer=$(get_timer_ms) configure_sudo +echo "Configured sudoers: $(elapsed_time_ms ${livetimer})ms" >> /var/log/livecd.log -echo "depmod extramodules" >> /var/log/livecd.log - -# depmod extramodules -depmod $(cat /usr/lib/modules/$(uname -r)/extramodules/version) - +livetimer=$(get_timer_ms) ${autologin} && configure_displaymanager_autologin +echo "Configured displaymanager autologin: $(elapsed_time_ms ${livetimer})ms" >> /var/log/livecd.log -echo "configure root password" >> /var/log/livecd.log - +livetimer=$(get_timer_ms) configure_user_root / cp -a /etc/skel/. /root/ +echo "Configured root user: $(elapsed_time_ms ${livetimer})ms" >> /var/log/livecd.log -# check if we are running inside a virtual machine and unistall kalu -[[ -e "/usr/bin/kalu" ]] && rm_kalu / - +livetimer=$(get_timer_ms) configure_alsa / - -# save settings +# Save settings alsactl -f /etc/asound.state store &>/dev/null +echo "Configured alsa: $(elapsed_time_ms ${livetimer})ms" >> /var/log/livecd.log diff --git a/scripts/mhwd-live b/scripts/mhwd-live index f2ceebc..65b63ef 100755 --- a/scripts/mhwd-live +++ b/scripts/mhwd-live @@ -6,42 +6,40 @@ USENONFREE="$(kernel_cmdline nonfree no)" VIDEO="$(kernel_cmdline xdriver no)" +# In a live session we should never have a database lock at boot, this is a bug! +# In the past pamac caused issues about that. +# Fixed here: https://github.com/manjaro/manjaro-tools/commit/57a039088ae4485bc5dc411e36a90c0753e670f1 seconds="0" while [ -e "/var/lib/pacman/db.lck" ]; do - echo 'Pacman is not ready yet. Will try again in 10 seconds.' >> /var/log/livecd.log - echo 'Pacman is not ready yet. Will try again in 10 seconds.' >> /var/log/livecd-debug.log - echo '----' >> /var/log/livecd-debug.log - ps -ef >> /var/log/livecd-debug.log - echo '----' >> /var/log/livecd-debug.log + echo 'Pacman is not ready yet. Will try again in 10 seconds.' >> /var/log/mhwd-live.log + echo '----' >> /var/log/mhwd-live.log + ps -ef >> /var/log/mhwd-live.log + echo '----' >> /var/log/mhwd-live.log seconds=$(($seconds + 10)) sleep 10 - if [[ "$seconds" == "60" ]]; then - # remove database lock after 60s - # this might be related to https://github.com/manjaro/pamac/issues/25 - # https://github.com/manjaro/manjaro-tools/issues/101 - echo 'Warning: removing pacman db.lck!' >> /var/log/livecd.log - echo 'Warning: removing pacman db.lck!' >> /var/log/livecd-debug.log + if [[ "$seconds" == "30" ]]; then + echo 'Warning: removing pacman db.lck!' >> /var/log/mhwd-live.log rm /var/lib/pacman/db.lck fi done # hwdetect_graphics if [[ -e "/opt/livecd/pacman-gfx.conf" ]]; then - echo "run mhwd" >> /var/log/livecd.log + echo "Running MHWD..." >> /var/log/mhwd-live.log if [[ "${USENONFREE}" == "yes" ]] || [[ "${USENONFREE}" == "true" ]]; then if [[ "${VIDEO}" == "vesa" ]]; then - mhwd --install pci video-vesa --pmconfig "/opt/livecd/pacman-gfx.conf" >> /var/log/livecd.log + mhwd --install pci video-vesa --pmconfig "/opt/livecd/pacman-gfx.conf" >> /var/log/mhwd-live.log else - mhwd --auto pci nonfree 0300 --pmconfig "/opt/livecd/pacman-gfx.conf" >> /var/log/livecd.log + mhwd --auto pci nonfree 0300 --pmconfig "/opt/livecd/pacman-gfx.conf" >> /var/log/mhwd-live.log fi else if [[ "${VIDEO}" == "vesa" ]]; then - mhwd --install pci video-vesa --pmconfig "/opt/livecd/pacman-gfx.conf" >> /var/log/livecd.log + mhwd --install pci video-vesa --pmconfig "/opt/livecd/pacman-gfx.conf" >> /var/log/mhwd-live.log else - mhwd --auto pci free 0300 --pmconfig "/opt/livecd/pacman-gfx.conf" >> /var/log/livecd.log + mhwd --auto pci free 0300 --pmconfig "/opt/livecd/pacman-gfx.conf" >> /var/log/mhwd-live.log fi fi fi -echo "MHWD DONE" >> /var/log/livecd.log +echo "MHWD DONE" >> /var/log/mhwd-live.log