#!/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. version=@version@ LIBDIR='@libdir@' PKGDATADIR='@pkgdatadir@' SYSCONFDIR='@sysconfdir@' [[ -r ${LIBDIR}/util-msg.sh ]] && source ${LIBDIR}/util-msg.sh [[ -r ${LIBDIR}/util.sh ]] && source ${LIBDIR}/util.sh [[ -r ${LIBDIR}/util-iso.sh ]] && source ${LIBDIR}/util-iso.sh [[ -r ${LIBDIR}/util-livecd.sh ]] && source ${LIBDIR}/util-livecd.sh # [[ -r ${LIBDIR}/util-mount.sh ]] && source ${LIBDIR}/util-mount.sh display_settings(){ msg "manjaro-tools" msg2 "version: ${version}" msg2 "manjaro_tools_conf: ${manjaro_tools_conf}" if [[ -f ${USER_CONFIG}/manjaro-tools.conf ]]; then msg2 "user_config: ${USER_CONFIG}/manjaro-tools.conf" fi msg "OPTIONS:" msg2 "arch: ${arch}" msg2 "branch: ${branch}" msg2 "work_dir: ${work_dir}" msg2 "target_dir: ${target_dir}" msg2 "pacman_conf: ${pacman_conf}" msg "ARGS:" msg2 "xorg_overlays: ${xorg_overlays}" msg2 "kde_lng_packages: ${kde_lng_packages}" msg2 "high_compression: ${high_compression}" msg "ISO SETTINGS:" msg2 "iso_label: ${iso_label}" msg2 "iso_version: ${iso_version}" msg2 "manjaro_kernel: ${manjaro_kernel}" msg2 "manjaro_kernel_ver: ${manjaro_kernel_ver}" msg2 "manjaro_version: ${manjaro_version}" msg2 "manjaroiso: ${manjaroiso}" msg2 "code_name: ${code_name}" msg2 "img_name: ${img_name}" msg2 "install_dir: ${install_dir}" msg2 "plymouth_theme: ${plymouth_theme}" msg2 "compression: ${compression}" msg2 "cache_pkgs: ${cache_pkgs}" msg2 "cache_lng: ${cache_lng}" msg "LIVECD:" msg2 "username: ${username}" msg2 "password: ${password}" msg2 "encrypted password: $(gen_pw)" msg2 "addgroups: ${addgroups}" msg2 "hostname: ${hostname}" msg2 "pacman_mirrors: ${mirrors_conf}" if ${auto_svc_conf};then msg2 "startservices_systemd: ${startservices_systemd[*]}" msg2 "startservices_openrc: ${startservices_openrc[*]}" fi msg "ISOFILE:" msg2 "iso_file: ${iso_file}" } iso_owner=${SUDO_USER:-$USER} if [[ -n $SUDO_USER ]]; then eval "USER_HOME=~$SUDO_USER" else USER_HOME=$HOME fi USER_CONFIG="$USER_HOME/.config" load_config "${USER_CONFIG}/manjaro-tools.conf" load_config "${SYSCONFDIR}/manjaro-tools.conf" load_desktop_definitions clean_first=false pretend=false high_compression=false verbose=false overwrite=false xorg_overlays=false kde_lng_packages=false auto_svc_conf=false rebuild=false pacman_conf_arch='default' usage() { echo "Usage: ${0##*/} [options]" echo " -a Set arch [default: ${arch}]" echo " -b Set branch [default: ${branch}]" echo " -r Work directory [default: ${work_dir}]" echo " -t Target iso directory [default: ${target_dir}]" echo " -i Config file for pacman" echo " [default: ${PKGDATADIR}/pacman-${pacman_conf_arch}.conf]" echo ' -c Clean work dir' echo ' -v Verbose' echo ' -f Overwrite' echo ' -z High compression' echo ' -x Xorg overlays' echo ' -k kde lng packages' echo ' -A Let buildiso configure services(experimental)' echo ' -R Rebuild iso xorg and lng overlay will use a defined cache' echo ' The custom cache will be cleaned if not set' echo ' -q Query settings and pretend build' echo ' -h This help' echo '' echo '' exit 1 } orig_argv=("$@") opts='a:b:r:t:i:cvfzqxkARh' while getopts "${opts}" arg; do case "${arg}" in a) arch="$OPTARG" ;; b) branch="$OPTARG" ;; r) work_dir="$OPTARG" ;; t) target_dir="$OPTARG" ;; c) clean_first=true ;; v) verbose=true; iso_args+=(-v) ;; f) overwrite=true; iso_args+=(-f) ;; z) high_compression=true; iso_args+=(-x) ;; x) xorg_overlays=true ;; k) kde_lng_packages=true ;; i) pacman_conf="$OPTARG" ;; A) auto_svc_conf=true ;; R) rebuild=true ;; q) pretend=true ;; h) usage ;; esac done shift $(($OPTIND - 1)) work_dir=${work_dir}/${desktop}/${arch} if [[ "$arch" == 'x86_64' ]]; then pacman_conf_arch='multilib' fi load_pacman_conf "${pacman_conf}" load_pacman_conf "${PKGDATADIR}/pacman-${pacman_conf_arch}.conf" mirrors_conf="${PKGDATADIR}/pacman-mirrors-${branch}.conf" create_args+=(-v -a ${arch} -D ${install_dir} -C ${pacman_conf} -M ${mirrors_conf}) iso_args+=(-a ${arch} -D ${install_dir} -L ${iso_label} -c ${compression}) iso_file="${target_dir}/${img_name}-${desktop}-${iso_version}-${arch}.iso" iso_profile=${PWD##*/} check_root "$0" "${orig_argv[@]}" get_pkglist if [ -e Packages-Xorg ] ; then get_pkglist_xorg fi if [ -e Packages-Lng ] ; then get_pkglist_lng fi if [ -e "${pkgsfile}" ] ; then get_pkglist_de fi if [[ -f Packages-Livecd ]]; then get_pkglist_overlay fi ${pretend} && display_settings && exit 1 if ${clean_first};then clean_up fi prepare_buildiso if [[ ${rebuild} = "false" ]];then [[ $(check_cache pkgs-image) ]] && clean_cache_pkgs [[ $(check_cache lng-image) ]] && clean_cache_lng fi # install basic make_root_image # install DE(s) if [ -e "${pkgsfile}" ] ; then make_de_image fi # install xorg-drivers if [ -e Packages-Xorg ] ; then make_pkgs_image fi # install translations if [ -e Packages-Lng ] ; then make_lng_image fi # install common make_boot if [ "${arch}" == "x86_64" ]; then make_efi make_efiboot fi make_isolinux make_overlay_image make_isomounts make_iso