more tweaks to switch later to a manjaro-tools folder in $HOME

This commit is contained in:
udeved 2015-01-13 01:32:31 +01:00
parent 4fa2f4ba7c
commit 1c87dfc0ed
5 changed files with 48 additions and 47 deletions

View file

@ -38,22 +38,24 @@ display_settings(){
msg "OPTIONS:"
msg2 "arch: ${arch}"
msg2 "branch: ${branch}"
msg2 "work_dir: ${work_dir}"
msg2 "target_dir: ${target_dir}"
msg2 "chroots_iso: ${chroots_iso}"
msg "ARGS:"
msg2 "clean_first: ${clean_first}"
# msg2 "auto_svc_conf: ${auto_svc_conf}"
# msg2 "high_compression: ${high_compression}"
msg2 "clean_cache_pkgs: ${clean_cache_pkgs}"
msg2 "clean_cache_lng: ${clean_cache_lng}"
# msg2 "images_only: ${images_only}"
# msg2 "iso_only: ${iso_only}"
msg2 "custom_pac_conf: ${custom_pac_conf}"
msg2 "images_only: ${images_only}"
msg2 "iso_only: ${iso_only}"
msg2 "auto_svc_conf: ${auto_svc_conf}"
msg2 "high_compression: ${high_compression}"
msg "PATHS:"
msg2 "work_dir: ${work_dir}"
msg2 "iso_dir: ${iso_dir}"
msg2 "cache_pkgs: ${cache_pkgs}"
msg2 "cache_lng: ${cache_lng}"
# msg2 "pacman_conf: ${pacman_conf}"
# msg2 "pacman_mirrors: ${mirrors_conf}"
@ -79,6 +81,7 @@ display_settings(){
msg2 "img_name: ${img_name}"
msg2 "install_dir: ${install_dir}"
msg2 "iso_file: ${iso_file}"
msg2 "compression: ${compression}"
msg "LIVECD:"
msg2 "username: ${username}"
@ -130,10 +133,10 @@ usage() {
echo " [default: ${arch}]"
echo ' -b <branch> Set branch'
echo " [default: ${branch}]"
echo ' -r <dir> Work directory'
echo " [default: ${work_dir}]"
echo ' -r <dir> Chroots directory'
echo " [default: ${chroots_iso}]"
echo ' -t <dir> Target iso directory'
echo " [default: ${target_dir}]"
echo " [default: ${iso_dir}]"
echo ' -v Verbose iso compression'
echo ' -q Query settings and pretend build'
echo ' -c Disable clean work dir and target dir iso'
@ -159,8 +162,8 @@ while getopts "${opts}" arg; do
case "${arg}" in
a) arch="$OPTARG" ;;
b) branch="$OPTARG" ;;
r) work_dir="$OPTARG" ;;
t) target_dir="$OPTARG" ;;
r) chroots_iso="$OPTARG" ;;
t) iso_dir="$OPTARG" ;;
v) verbose=true; mkiso_args+=(-v) ;;
B) images_only=true ;;
G) iso_only=true ;;
@ -177,8 +180,6 @@ done
shift $(($OPTIND - 1))
# work_dir=${work_dir}/${desktop}/${arch}
if [[ "$arch" == 'x86_64' ]]; then
pacman_conf_arch='multilib'
fi
@ -194,11 +195,11 @@ create_args+=(-v -a ${arch} -D ${install_dir} -C ${pacman_conf} -M ${mirrors_con
mkiso_args+=(-a ${arch} -D ${install_dir} -L ${iso_label} -c ${compression})
iso_file="${target_dir}/${img_name}-${desktop}-${iso_version}-${arch}.iso"
iso_file="${iso_dir}/${img_name}-${desktop}-${iso_version}-${arch}.iso"
iso_profile=${PWD##*/}
work_dir=${work_dir}/${iso_profile}/${arch}
work_dir=${chroots_iso}/${iso_profile}/${arch}
cache_lng="${cache_dir}/lng"

View file

@ -34,7 +34,7 @@ display_settings(){
msg "OPTIONS:"
msg2 "arch: ${arch}"
msg2 "branch: ${branch}"
msg2 "chroots: ${chroots}"
msg2 "chroots_pkg: ${chroots_pkg}"
msg "ARGS:"
# msg2 "mkchrootpkg_args: ${mkchrootpkg_args[*]}"
@ -45,7 +45,7 @@ display_settings(){
msg2 "sign: ${sign}"
msg "PATHS:"
msg2 "chroot_dir: ${chroot_dir}"
msg2 "work_dir: ${work_dir}"
msg2 "sets_dir: ${sets_dir}"
msg2 "pkg_dir: ${pkg_dir}"
# msg2 "pacman_conf: ${pacman_conf}"
@ -126,7 +126,7 @@ usage() {
echo " -p <profile> Set profile or pkg [default: ${profile}]"
echo " -a <arch> Set arch [default: ${arch}]"
echo " -b <branch> Set branch [default: ${branch}]"
echo " -r <dir> Chroots directory [default: ${chroots}]"
echo " -r <dir> Chroots directory [default: ${chroots_pkg}]"
echo ' -c Recreate chroot'
echo ' -w Clean up'
echo ' -n Install and run namcap check'
@ -147,7 +147,7 @@ while getopts "${opts}" arg; do
p) profile="$OPTARG" ;;
a) arch="$OPTARG" ;;
b) branch="$OPTARG" ;;
r) chroots="$OPTARG" ;;
r) chroots_pkg="$OPTARG" ;;
c) clean_first=true ;;
w) wipe_clean=true ;;
n) namcap=true; mkchrootpkg_args+=(-n) ;;
@ -163,7 +163,7 @@ if [[ "$arch" == 'multilib' ]]; then
arch='x86_64'
fi
chroot_dir=${chroots}/${branch}/${arch}
work_dir=${chroots_pkg}/${branch}/${arch}
pkg_dir="${cache_dir}/${branch}/${arch}"
@ -173,7 +173,7 @@ mirrors_conf="${PKGDATADIR}/pacman-mirrors-${branch}.conf"
mkchroot_args+=(-L -C ${pacman_conf} -M ${makepkg_conf} -S ${mirrors_conf})
mkchrootpkg_args+=(-r ${chroot_dir})
mkchrootpkg_args+=(-r ${work_dir})
makepkg_args+=("${@:$OPTIND}")

View file

@ -19,7 +19,7 @@
# sets_dir=/etc/manjaro-tools/sets
# default chroot path
# chroots=/opt/buildpkg
# chroots_pkg=/opt/buildpkg
# default set; name without .set extension
# profile=default
@ -39,10 +39,10 @@
##########################################
# default work dir where the image chroots are located
# work_dir=/opt/buildiso
# chroots_iso=/opt/buildiso
# default iso target dir where the iso file will be stored
# target_dir=/opt/manjaro-iso
# default iso dir where the iso file will be stored
# iso_dir=/opt/manjaro-iso
##########################################
############## iso settings ##############

View file

@ -18,15 +18,15 @@ eval_profile(){
chroot_create(){
msg "Creating chroot for [${branch}] (${arch})..."
mkdir -p "${chroot_dir}"
mkdir -p "${work_dir}"
setarch "${arch}" mkchroot \
${mkchroot_args[*]} \
"${chroot_dir}/root" \
"${work_dir}/root" \
${base_packages[*]} || abort
}
chroot_clean(){
for copy in "${chroot_dir}"/*; do
for copy in "${work_dir}"/*; do
[[ -d ${copy} ]] || continue
msg2 "Deleting chroot copy '$(basename "${copy}")'..."
@ -39,14 +39,14 @@ chroot_clean(){
done
exec 9>&-
rm -rf --one-file-system "${chroot_dir}"
rm -rf --one-file-system "${work_dir}"
}
chroot_update(){
msg "Updating chroot for [${branch}] (${arch})..."
lock 9 "${chroot_dir}/root.lock" "Locking clean chroot"
lock 9 "${work_dir}/root.lock" "Locking clean chroot"
chroot-run ${mkchroot_args[*]} \
"${chroot_dir}/root" \
"${work_dir}/root" \
pacman -Syu --noconfirm || abort
}
@ -96,7 +96,7 @@ chroot_build(){
for pkg in $(cat ${sets_dir}/${profile}.set); do
cd $pkg
for p in ${blacklist_trigger[@]}; do
[[ $pkg == $p ]] && blacklist_pkg "${chroot_dir}"
[[ $pkg == $p ]] && blacklist_pkg "${work_dir}"
done
setarch "${arch}" \
mkchrootpkg ${mkchrootpkg_args[*]} -- ${makepkg_args[*]} || break
@ -107,7 +107,7 @@ chroot_build(){
else
cd ${profile}
for p in ${blacklist_trigger[@]}; do
[[ ${profile} == $p ]] && blacklist_pkg "${chroot_dir}"
[[ ${profile} == $p ]] && blacklist_pkg "${work_dir}"
done
setarch "${arch}" \
mkchrootpkg ${mkchrootpkg_args[*]} -- ${makepkg_args[*]} || abort
@ -120,7 +120,7 @@ chroot_init(){
if ${clean_first}; then
chroot_clean
chroot_create
elif [[ ! -d "${chroot_dir}" ]]; then
elif [[ ! -d "${work_dir}" ]]; then
chroot_create
else
chroot_update

View file

@ -207,10 +207,10 @@ load_config(){
profile='default'
fi
if [[ -n ${chroots} ]];then
chroots=${chroots}
if [[ -n ${chroots_pkg} ]];then
chroots_pkg=${chroots_pkg}
else
chroots='/opt/buildpkg'
chroots_pkg='/opt/buildpkg'
fi
if [[ -n ${blacklist_trigger[@]} ]];then
@ -229,16 +229,16 @@ load_config(){
# buildiso
###################
if [[ -n ${work_dir} ]];then
work_dir=${work_dir}
if [[ -n ${chroots_iso} ]];then
chroots_iso=${chroots_iso}
else
work_dir='/opt/buildiso' #${PWD}
chroots_iso='/opt/buildiso' #${PWD}
fi
if [[ -n ${target_dir} ]];then
target_dir=${target_dir}
if [[ -n ${iso_dir} ]];then
iso_dir=${iso_dir}
else
target_dir='/opt/manjaro-iso' #${PWD}
iso_dir='/opt/manjaro-iso' #${PWD}
fi
if [[ -n ${iso_label} ]];then