2014-12-04 19:19:54 +01:00
|
|
|
#!/bin/bash
|
2014-12-04 19:20:28 +01:00
|
|
|
#
|
|
|
|
# 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.
|
2014-12-04 19:19:54 +01:00
|
|
|
|
2014-12-04 19:20:28 +01:00
|
|
|
version=@version@
|
2014-12-04 19:19:54 +01:00
|
|
|
|
2014-12-14 07:57:34 +01:00
|
|
|
BINDIR='@bindir@'
|
2014-12-14 03:48:46 +01:00
|
|
|
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
|
2014-12-04 19:19:54 +01:00
|
|
|
|
2014-12-04 20:05:33 +01:00
|
|
|
display_settings(){
|
|
|
|
msg "manjaro-tools"
|
|
|
|
msg2 "version: ${version}"
|
2014-12-17 19:40:28 +01:00
|
|
|
|
2014-12-14 03:48:46 +01:00
|
|
|
if [[ -f ${USER_CONFIG}/manjaro-tools.conf ]]; then
|
|
|
|
msg2 "user_config: ${USER_CONFIG}/manjaro-tools.conf"
|
2014-12-17 19:40:28 +01:00
|
|
|
else
|
|
|
|
msg2 "manjaro_tools_conf: ${manjaro_tools_conf}"
|
2014-12-10 04:16:30 +01:00
|
|
|
fi
|
2014-12-31 01:56:33 +01:00
|
|
|
msg2 "iso_profile: ${iso_profile}"
|
2015-01-06 23:41:39 +01:00
|
|
|
msg2 "initsys: ${initsys}"
|
2014-12-04 20:05:33 +01:00
|
|
|
|
|
|
|
msg "OPTIONS:"
|
|
|
|
msg2 "arch: ${arch}"
|
|
|
|
msg2 "branch: ${branch}"
|
|
|
|
msg2 "work_dir: ${work_dir}"
|
2014-12-04 22:54:23 +01:00
|
|
|
msg2 "target_dir: ${target_dir}"
|
2014-12-31 01:30:33 +01:00
|
|
|
|
2014-12-04 20:05:33 +01:00
|
|
|
msg "ARGS:"
|
2014-12-17 02:37:01 +01:00
|
|
|
msg2 "clean_first: ${clean_first}"
|
|
|
|
msg2 "auto_svc_conf: ${auto_svc_conf}"
|
|
|
|
msg2 "high_compression: ${high_compression}"
|
2014-12-18 06:03:21 +01:00
|
|
|
msg2 "clean_cache_pkgs: ${clean_cache_pkgs}"
|
|
|
|
msg2 "clean_cache_lng: ${clean_cache_lng}"
|
2014-12-16 01:57:59 +01:00
|
|
|
msg2 "images_only: ${images_only}"
|
2014-12-17 02:14:15 +01:00
|
|
|
msg2 "iso_only: ${iso_only}"
|
2014-12-31 01:30:33 +01:00
|
|
|
msg2 "custom_pac_conf: ${custom_pac_conf}"
|
|
|
|
|
|
|
|
msg "PATHS:"
|
|
|
|
msg2 "cache_pkgs: ${cache_pkgs}"
|
|
|
|
msg2 "cache_lng: ${cache_lng}"
|
|
|
|
msg2 "pacman_conf: ${pacman_conf}"
|
|
|
|
msg2 "pacman_mirrors: ${mirrors_conf}"
|
2014-12-17 02:14:15 +01:00
|
|
|
|
|
|
|
msg "IMAGES SETTINGS:"
|
2014-12-04 22:12:00 +01:00
|
|
|
msg2 "manjaro_kernel: ${manjaro_kernel}"
|
|
|
|
msg2 "manjaro_version: ${manjaro_version}"
|
2014-12-17 01:20:53 +01:00
|
|
|
msg2 "displaymanager: ${displaymanager}"
|
2014-12-17 02:37:01 +01:00
|
|
|
msg2 "plymouth_theme: ${plymouth_theme}"
|
|
|
|
|
|
|
|
if ${auto_svc_conf};then
|
2015-01-06 23:41:39 +01:00
|
|
|
if [ ${initsys} == "systemd" ];then
|
2014-12-17 18:15:44 +01:00
|
|
|
msg2 "start_systemd: ${start_systemd[*]}"
|
|
|
|
else
|
|
|
|
msg2 "start_openrc: ${start_openrc[*]}"
|
|
|
|
fi
|
2014-12-17 02:37:01 +01:00
|
|
|
fi
|
2014-12-04 22:12:00 +01:00
|
|
|
|
|
|
|
msg "ISO SETTINGS:"
|
|
|
|
msg2 "iso_label: ${iso_label}"
|
|
|
|
msg2 "iso_version: ${iso_version}"
|
|
|
|
msg2 "manjaroiso: ${manjaroiso}"
|
|
|
|
msg2 "code_name: ${code_name}"
|
|
|
|
msg2 "img_name: ${img_name}"
|
|
|
|
msg2 "install_dir: ${install_dir}"
|
2014-12-07 06:36:46 +01:00
|
|
|
msg2 "iso_file: ${iso_file}"
|
2014-12-04 20:05:33 +01:00
|
|
|
|
2014-12-11 04:03:12 +01:00
|
|
|
msg "LIVECD:"
|
2014-12-11 04:04:51 +01:00
|
|
|
msg2 "username: ${username}"
|
2014-12-11 04:03:12 +01:00
|
|
|
msg2 "password: ${password}"
|
|
|
|
msg2 "addgroups: ${addgroups}"
|
|
|
|
msg2 "hostname: ${hostname}"
|
2014-12-12 21:29:37 +01:00
|
|
|
|
|
|
|
if ${auto_svc_conf};then
|
2015-01-06 23:41:39 +01:00
|
|
|
if [ ${initsys} == "systemd" ];then
|
2014-12-17 18:15:44 +01:00
|
|
|
msg2 "start_systemd_live: ${start_systemd_live[*]}"
|
2014-12-09 00:40:46 +01:00
|
|
|
else
|
2014-12-17 18:15:44 +01:00
|
|
|
msg2 "start_openrc_live: ${start_openrc_live[*]}"
|
2014-12-09 00:40:46 +01:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2014-12-08 22:16:06 +01:00
|
|
|
iso_owner=${SUDO_USER:-$USER}
|
|
|
|
|
|
|
|
if [[ -n $SUDO_USER ]]; then
|
|
|
|
eval "USER_HOME=~$SUDO_USER"
|
|
|
|
else
|
|
|
|
USER_HOME=$HOME
|
|
|
|
fi
|
|
|
|
|
2014-12-14 03:48:46 +01:00
|
|
|
USER_CONFIG="$USER_HOME/.config"
|
|
|
|
|
|
|
|
load_config "${USER_CONFIG}/manjaro-tools.conf"
|
|
|
|
load_config "${SYSCONFDIR}/manjaro-tools.conf"
|
2014-12-08 22:16:06 +01:00
|
|
|
|
2014-12-15 20:28:37 +01:00
|
|
|
load_desktop_definition
|
2014-12-08 22:16:06 +01:00
|
|
|
|
2014-12-18 02:03:40 +01:00
|
|
|
clean_first=true
|
|
|
|
auto_svc_conf=true
|
2014-12-18 01:34:53 +01:00
|
|
|
high_compression=true
|
2014-12-18 06:03:21 +01:00
|
|
|
clean_cache_pkgs=true
|
|
|
|
clean_cache_lng=true
|
|
|
|
|
2014-12-18 02:03:40 +01:00
|
|
|
pretend=false
|
2014-12-07 06:36:46 +01:00
|
|
|
verbose=false
|
2014-12-14 21:15:59 +01:00
|
|
|
images_only=false
|
2014-12-14 17:22:47 +01:00
|
|
|
iso_only=false
|
2014-12-31 01:02:43 +01:00
|
|
|
custom_pac_conf=false
|
2014-12-07 06:36:46 +01:00
|
|
|
|
2014-12-08 22:16:06 +01:00
|
|
|
pacman_conf_arch='default'
|
|
|
|
|
2014-12-07 06:36:46 +01:00
|
|
|
usage() {
|
|
|
|
echo "Usage: ${0##*/} [options]"
|
2014-12-17 18:15:44 +01:00
|
|
|
echo ' -a <arch> Set arch'
|
|
|
|
echo " [default: ${arch}]"
|
|
|
|
echo ' -b <branch> Set branch'
|
|
|
|
echo " [default: ${branch}]"
|
|
|
|
echo ' -r <dir> Work directory'
|
|
|
|
echo " [default: ${work_dir}]"
|
|
|
|
echo ' -t <dir> Target iso directory'
|
|
|
|
echo " [default: ${target_dir}]"
|
2014-12-18 02:03:40 +01:00
|
|
|
echo ' -v Verbose iso compression'
|
2014-12-07 06:36:46 +01:00
|
|
|
echo ' -q Query settings and pretend build'
|
2014-12-18 02:03:40 +01:00
|
|
|
echo ' -c Disable clean work dir and target dir iso'
|
|
|
|
echo ' -z Disable high compression'
|
2014-12-18 06:03:21 +01:00
|
|
|
echo ' -A Disable auto configure services'
|
2014-12-17 18:15:44 +01:00
|
|
|
echo ' -B Build images only'
|
2014-12-14 17:22:47 +01:00
|
|
|
echo ' -G Generate iso only'
|
2014-12-17 18:15:44 +01:00
|
|
|
echo ' Requires pre built images'
|
2014-12-18 06:03:21 +01:00
|
|
|
echo ' -P Disable clean pkgs cache'
|
|
|
|
echo ' -L Disable clean lng cache'
|
2014-12-31 01:56:33 +01:00
|
|
|
echo " -C Use custom pacman.conf in iso profile"
|
2014-12-07 06:36:46 +01:00
|
|
|
echo ' -h This help'
|
|
|
|
echo ''
|
|
|
|
echo ''
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
|
|
|
orig_argv=("$@")
|
|
|
|
|
2014-12-31 01:56:33 +01:00
|
|
|
opts='a:b:r:t:cvzqABGPLCh'
|
2014-12-07 06:36:46 +01:00
|
|
|
|
|
|
|
while getopts "${opts}" arg; do
|
|
|
|
case "${arg}" in
|
|
|
|
a) arch="$OPTARG" ;;
|
|
|
|
b) branch="$OPTARG" ;;
|
|
|
|
r) work_dir="$OPTARG" ;;
|
|
|
|
t) target_dir="$OPTARG" ;;
|
2014-12-18 02:03:40 +01:00
|
|
|
v) verbose=true; iso_args+=(-v) ;;
|
2014-12-17 18:15:44 +01:00
|
|
|
B) images_only=true ;;
|
2014-12-14 17:22:47 +01:00
|
|
|
G) iso_only=true ;;
|
2014-12-07 06:36:46 +01:00
|
|
|
q) pretend=true ;;
|
2014-12-31 01:02:43 +01:00
|
|
|
C) custom_pac_conf=true ;;
|
2014-12-18 06:03:21 +01:00
|
|
|
P) clean_cache_pkgs=false ;;
|
|
|
|
L) clean_cache_lng=false ;;
|
|
|
|
c) clean_first=false ;;
|
|
|
|
z) high_compression=false ;;
|
|
|
|
A) auto_svc_conf=false ;;
|
2014-12-07 06:36:46 +01:00
|
|
|
h) usage ;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
|
|
|
shift $(($OPTIND - 1))
|
|
|
|
|
|
|
|
work_dir=${work_dir}/${desktop}/${arch}
|
|
|
|
|
2014-12-09 23:23:54 +01:00
|
|
|
if [[ "$arch" == 'x86_64' ]]; then
|
|
|
|
pacman_conf_arch='multilib'
|
|
|
|
fi
|
|
|
|
|
2014-12-31 01:02:43 +01:00
|
|
|
if ${custom_pac_conf};then
|
|
|
|
pacman_conf="${PWD}/pacman-${pacman_conf_arch}.conf"
|
|
|
|
else
|
|
|
|
pacman_conf="${PKGDATADIR}/pacman-${pacman_conf_arch}.conf"
|
|
|
|
fi
|
2014-12-14 03:48:46 +01:00
|
|
|
mirrors_conf="${PKGDATADIR}/pacman-mirrors-${branch}.conf"
|
2014-12-08 23:17:56 +01:00
|
|
|
|
2014-12-11 03:54:02 +01:00
|
|
|
create_args+=(-v -a ${arch} -D ${install_dir} -C ${pacman_conf} -M ${mirrors_conf})
|
2014-12-07 06:36:46 +01:00
|
|
|
|
|
|
|
iso_args+=(-a ${arch} -D ${install_dir} -L ${iso_label} -c ${compression})
|
|
|
|
|
2014-12-08 01:35:22 +01:00
|
|
|
iso_file="${target_dir}/${img_name}-${desktop}-${iso_version}-${arch}.iso"
|
2014-12-07 06:36:46 +01:00
|
|
|
|
2014-12-10 07:02:25 +01:00
|
|
|
iso_profile=${PWD##*/}
|
|
|
|
|
2015-01-06 23:41:39 +01:00
|
|
|
displaymanager=$(cat ${PWD}/displaymanager)
|
|
|
|
initsys=$(cat ${PWD}/initsys)
|
|
|
|
|
2014-12-18 01:34:53 +01:00
|
|
|
${high_compression} && iso_args+=(-x)
|
2014-12-18 02:03:40 +01:00
|
|
|
${clean_first} && iso_args+=(-f)
|
2014-12-18 01:34:53 +01:00
|
|
|
|
2014-12-07 06:36:46 +01:00
|
|
|
check_root "$0" "${orig_argv[@]}"
|
|
|
|
|
2014-12-31 01:02:43 +01:00
|
|
|
load_packages
|
2014-12-07 06:36:46 +01:00
|
|
|
|
2014-12-04 20:05:33 +01:00
|
|
|
${pretend} && display_settings && exit 1
|
|
|
|
|
2014-12-15 23:12:04 +01:00
|
|
|
if ${iso_only}; then
|
2014-12-31 01:56:33 +01:00
|
|
|
[[ ! -d ${work_dir} ]] && die "You need to create images first eg. buildiso -B"
|
2014-12-15 23:12:04 +01:00
|
|
|
compress_images
|
|
|
|
exit 1
|
|
|
|
fi
|
2014-12-14 07:10:36 +01:00
|
|
|
|
2014-12-07 21:48:49 +01:00
|
|
|
${clean_first} && clean_up
|
2014-12-05 02:22:14 +01:00
|
|
|
|
2014-12-18 06:03:21 +01:00
|
|
|
${clean_cache_pkgs} && clean_cache "${cache_pkgs}"
|
|
|
|
${clean_cache_lng} && clean_cache "${cache_lng}"
|
|
|
|
|
2014-12-14 21:42:52 +01:00
|
|
|
prepare_buildiso
|
2014-12-04 22:12:00 +01:00
|
|
|
|
2014-12-14 21:15:59 +01:00
|
|
|
if ${images_only}; then
|
|
|
|
make_images
|
2014-12-17 19:09:32 +01:00
|
|
|
warning "Continue with eg. buildiso -Gv ..."
|
2014-12-15 23:12:04 +01:00
|
|
|
exit 1
|
2014-12-14 17:22:47 +01:00
|
|
|
else
|
2014-12-14 21:15:59 +01:00
|
|
|
make_images
|
2014-12-04 19:19:54 +01:00
|
|
|
fi
|
2014-12-14 17:22:47 +01:00
|
|
|
|
2014-12-14 21:42:52 +01:00
|
|
|
compress_images
|