forked from mirrored-repos/manjaro-tools
Merge branch 'master' into stable-0.12.x
This commit is contained in:
commit
e0dfc44134
8 changed files with 72 additions and 64 deletions
|
@ -22,7 +22,6 @@ import ${LIBDIR}/util.sh
|
|||
show_profile(){
|
||||
prepare_profile "$1"
|
||||
msg2 "pacman_conf: %s" "${pacman_conf}"
|
||||
# msg2 "mirrors_conf: %s" "${mirrors_conf}"
|
||||
if ${verbose};then
|
||||
msg2 "work_dir: %s" "${work_dir}"
|
||||
msg2 "iso_dir: %s" "${iso_dir}"
|
||||
|
@ -68,6 +67,7 @@ display_settings(){
|
|||
msg2 "build_list_iso: %s" "${build_list_iso}"
|
||||
msg2 "is_build_list: %s" "${is_build_list}"
|
||||
msg2 "build_mirror: %s" "${build_mirror}/${target_branch}"
|
||||
${verbose} && msg2 "run_dir: %s" "${run_dir}"
|
||||
|
||||
msg "OPTIONS:"
|
||||
msg2 "arch: %s" "${target_arch}"
|
||||
|
@ -82,12 +82,6 @@ display_settings(){
|
|||
msg2 "iso_only: %s" "${iso_only}"
|
||||
msg2 "sign: %s" "${sign}"
|
||||
|
||||
if ${verbose}; then
|
||||
msg "PATHS:"
|
||||
msg2 "run_dir: %s" "${run_dir}"
|
||||
msg2 "log_dir: %s" "${log_dir}"
|
||||
fi
|
||||
|
||||
msg "DIST SETTINGS:"
|
||||
msg2 "dist_name: %s" "${dist_name}"
|
||||
msg2 "dist_release: %s" "${dist_release}"
|
||||
|
@ -179,6 +173,8 @@ timer_start=$(get_timer)
|
|||
|
||||
check_root "$0" "${orig_argv[@]}"
|
||||
|
||||
prepare_dir "${tmp_dir}"
|
||||
|
||||
eval_build_list "${list_dir_iso}" "${build_list_iso}"
|
||||
|
||||
import ${LIBDIR}/util-iso.sh
|
||||
|
|
|
@ -57,14 +57,10 @@ display_settings(){
|
|||
msg2 "namcap: %s" "${namcap}"
|
||||
msg2 "sign: %s" "${sign}"
|
||||
msg2 "udev_root: %s" "${udev_root}"
|
||||
# msg2 "mkchroot_args: %s" "${mkchroot_args[*]}"
|
||||
|
||||
msg "PATHS:"
|
||||
msg2 "work_dir: %s" "${work_dir}"
|
||||
msg2 "pkg_dir: %s" "${pkg_dir}"
|
||||
# msg2 "mirrors_conf: %s" "${mirrors_conf}"
|
||||
# msg2 "pacman_conf: %s" "${pacman_conf}"
|
||||
# msg2 "makepkg_conf: %s" "${makepkg_conf}"
|
||||
|
||||
if ${clean_first};then
|
||||
msg "PKG:"
|
||||
|
@ -136,8 +132,12 @@ while getopts "${opts}" arg; do
|
|||
esac
|
||||
done
|
||||
|
||||
shift $(($OPTIND - 1))
|
||||
|
||||
check_root "$0" "${orig_argv[@]}"
|
||||
|
||||
prepare_dir "${tmp_dir}"
|
||||
|
||||
prepare_conf "${target_arch}"
|
||||
|
||||
mirrors_conf=$(get_pac_mirrors_conf "${target_branch}")
|
||||
|
|
|
@ -27,7 +27,9 @@ mount_image_custom(){
|
|||
|
||||
# $1: image path
|
||||
umount_image(){
|
||||
umount "${IMAGE_ACTIVE_MOUNTS[@]}"
|
||||
unset IMAGE_ACTIVE_MOUNTS
|
||||
find $1 -name '.wh.*' -delete &> /dev/null
|
||||
if [[ -n ${IMAGE_ACTIVE_MOUNTS[@]} ]];then
|
||||
umount "${IMAGE_ACTIVE_MOUNTS[@]}"
|
||||
unset IMAGE_ACTIVE_MOUNTS
|
||||
find $1 -name '.wh.*' -delete &> /dev/null
|
||||
fi
|
||||
}
|
||||
|
|
|
@ -18,11 +18,6 @@ copy_overlay(){
|
|||
fi
|
||||
}
|
||||
|
||||
copy_cache_mhwd(){
|
||||
msg2 "Copying mhwd package cache ..."
|
||||
rsync -v --files-from="$1/cache-packages.txt" /var/cache/pacman/pkg "$1/opt/live/pkgs"
|
||||
}
|
||||
|
||||
gen_pw(){
|
||||
echo $(perl -e 'print crypt($ARGV[0], "password")' ${password})
|
||||
}
|
||||
|
@ -423,7 +418,8 @@ make_repo(){
|
|||
|
||||
# $1: work dir
|
||||
# $2: pkglist
|
||||
download_to_cache(){
|
||||
copy_from_cache(){
|
||||
local list="${tmp_dir}"/mhwd-cache.list
|
||||
chroot-run \
|
||||
-r "${mountargs_ro}" \
|
||||
-w "${mountargs_rw}" \
|
||||
|
@ -435,9 +431,12 @@ download_to_cache(){
|
|||
-w "${mountargs_rw}" \
|
||||
-B "${build_mirror}/${target_branch}" \
|
||||
"$1" \
|
||||
pacman -v -Sp $2 --noconfirm > "$1"/cache-packages.txt
|
||||
sed -ni '/.pkg.tar.xz/p' "$1"/cache-packages.txt
|
||||
sed -i "s/.*\///" "$1"/cache-packages.txt
|
||||
pacman -v -Sp $2 --noconfirm > "$list"
|
||||
sed -ni '/.pkg.tar.xz/p' "$list"
|
||||
sed -i "s/.*\///" "$list"
|
||||
|
||||
msg2 "Copying mhwd package cache ..."
|
||||
rsync -v --files-from="$list" /var/cache/pacman/pkg "$1/opt/live/pkgs"
|
||||
}
|
||||
|
||||
# $1: image path
|
||||
|
@ -461,7 +460,6 @@ clean_up_image(){
|
|||
if [[ -d $path ]];then
|
||||
find "$path" -mindepth 0 -delete &> /dev/null
|
||||
fi
|
||||
rm -f "$1/cache-packages.txt"
|
||||
else
|
||||
|
||||
[[ -f "$1/etc/locale.gen.bak" ]] && \
|
||||
|
|
|
@ -28,8 +28,10 @@ mount_image_custom(){
|
|||
}
|
||||
|
||||
umount_image(){
|
||||
info "%s umount: [%s]" "${iso_fs}" "${IMAGE_ACTIVE_MOUNTS[@]}"
|
||||
umount "${IMAGE_ACTIVE_MOUNTS[@]}"
|
||||
unset IMAGE_ACTIVE_MOUNTS
|
||||
rm -rf "${work_dir}/work"
|
||||
if [[ -n ${IMAGE_ACTIVE_MOUNTS[@]} ]];then
|
||||
info "%s umount: [%s]" "${iso_fs}" "${IMAGE_ACTIVE_MOUNTS[@]}"
|
||||
umount "${IMAGE_ACTIVE_MOUNTS[@]}"
|
||||
unset IMAGE_ACTIVE_MOUNTS
|
||||
rm -rf "${work_dir}/work"
|
||||
fi
|
||||
}
|
||||
|
|
|
@ -29,8 +29,8 @@ error_function() {
|
|||
# $1: function
|
||||
run_log(){
|
||||
local func="$1"
|
||||
local tmpfile=/tmp/$func.ansi.log logfile=${log_dir}/$(gen_iso_fn).$func.log
|
||||
logpipe=$(mktemp -u "/tmp/$func.pipe.XXXXXXXX")
|
||||
local tmpfile=${tmp_dir}/$func.ansi.log logfile=${log_dir}/$(gen_iso_fn).$func.log
|
||||
logpipe=$(mktemp -u "${tmp_dir}/$func.pipe.XXXXXXXX")
|
||||
mkfifo "$logpipe"
|
||||
tee "$tmpfile" < "$logpipe" &
|
||||
local teepid=$!
|
||||
|
@ -72,8 +72,8 @@ make_sqfs() {
|
|||
msg "Generating SquashFS image for %s" "${1}"
|
||||
if [[ -f "${sq_img}" ]]; then
|
||||
local has_changed_dir=$(find ${1} -newer ${sq_img})
|
||||
msg2 "Possible changes for %s ..." "${1}" >> /tmp/buildiso.debug
|
||||
msg2 "%s" "${has_changed_dir}" >> /tmp/buildiso.debug
|
||||
msg2 "Possible changes for %s ..." "${1}" >> ${tmp_dir}/buildiso.debug
|
||||
msg2 "%s" "${has_changed_dir}" >> ${tmp_dir}/buildiso.debug
|
||||
if [[ -n "${has_changed_dir}" ]]; then
|
||||
msg2 "SquashFS image %s is not up to date, rebuilding..." "${sq_img}"
|
||||
rm "${sq_img}"
|
||||
|
@ -281,9 +281,7 @@ make_image_mhwd() {
|
|||
|
||||
reset_pac_conf "${path}"
|
||||
|
||||
download_to_cache "${path}" "${packages}"
|
||||
|
||||
copy_cache_mhwd "${work_dir}/mhwd-image"
|
||||
copy_from_cache "${path}" "${packages}"
|
||||
|
||||
if [[ -n "${packages_cleanup}" ]]; then
|
||||
for mhwd_clean in ${packages_cleanup}; do
|
||||
|
@ -479,13 +477,11 @@ load_pkgs(){
|
|||
_purge="s|>cleanup.*||g" \
|
||||
_purge_rm="s|>cleanup||g"
|
||||
|
||||
local list
|
||||
local list="$1"
|
||||
|
||||
if [[ $1 == "${packages_custom}" ]];then
|
||||
sort -u $(get_shared_list) ${packages_custom} > ${work_dir}/pkgs_merged
|
||||
list=${work_dir}/pkgs_merged
|
||||
else
|
||||
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" \
|
||||
|
@ -623,6 +619,15 @@ prepare_images(){
|
|||
show_elapsed_time "${FUNCNAME}" "${timer}"
|
||||
}
|
||||
|
||||
archive_logs(){
|
||||
local name=$(gen_iso_fn) ext=log.tar.xz src=${tmp_dir}/archives.list
|
||||
find ${log_dir} -maxdepth 1 -name "$name*.log" -printf "%f\n" > $src
|
||||
msg2 "Archiving log files [%s] ..." "$name.$ext"
|
||||
tar -cJf ${log_dir}/$name.$ext -C ${log_dir} -T $src
|
||||
msg2 "Cleaning log files ..."
|
||||
find ${log_dir} -maxdepth 1 -name "$name*.log" -delete
|
||||
}
|
||||
|
||||
make_profile(){
|
||||
msg "Start building [%s]" "${profile}"
|
||||
import ${LIBDIR}/util-iso-${iso_fs}.sh
|
||||
|
@ -630,15 +635,18 @@ make_profile(){
|
|||
if ${iso_only}; then
|
||||
[[ ! -d ${work_dir} ]] && die "Create images: buildiso -p %s -x" "${profile}"
|
||||
compress_images
|
||||
${verbose} && archive_logs
|
||||
exit 1
|
||||
fi
|
||||
if ${images_only}; then
|
||||
prepare_images
|
||||
${verbose} && archive_logs
|
||||
warning "Continue compress: buildiso -p %s -zc ..." "${profile}"
|
||||
exit 1
|
||||
else
|
||||
prepare_images
|
||||
compress_images
|
||||
${verbose} && archive_logs
|
||||
fi
|
||||
reset_profile
|
||||
msg "Finished building [%s]" "${profile}"
|
||||
|
@ -651,9 +659,8 @@ get_pacman_conf(){
|
|||
if [[ -f ${user_conf} ]];then
|
||||
info "detected: %s" "user-repos.conf"
|
||||
check_user_repos_conf "${user_conf}"
|
||||
conf=/tmp/custom-pacman.conf
|
||||
cat ${DATADIR}/pacman-$pac_arch.conf > "$conf"
|
||||
cat ${user_conf} >> "$conf"
|
||||
conf=${tmp_dir}/custom-pacman.conf
|
||||
cat ${DATADIR}/pacman-$pac_arch.conf ${user_conf} > "$conf"
|
||||
else
|
||||
conf="${DATADIR}/pacman-$pac_arch.conf"
|
||||
fi
|
||||
|
|
|
@ -22,8 +22,7 @@ load_compiler_settings(){
|
|||
}
|
||||
|
||||
get_makepkg_conf(){
|
||||
local conf_dir=/tmp conf
|
||||
conf="$conf_dir/makepkg-$1.conf"
|
||||
local conf="${tmp_dir}/makepkg-$1.conf"
|
||||
|
||||
cp "${DATADIR}/makepkg.conf" "$conf"
|
||||
|
||||
|
@ -245,22 +244,29 @@ sign_pkg(){
|
|||
}
|
||||
|
||||
move_to_cache(){
|
||||
msg2 "Moving [%s] -> [%s]" "${1##*/}" "${pkg_dir}"
|
||||
mv $1 ${pkg_dir}/
|
||||
${sign} && sign_pkg "${1##*/}"
|
||||
local src="$1"
|
||||
[[ -n $PKGDEST ]] && src="$PKGDEST/$1"
|
||||
msg2 "Moving [%s] -> [%s]" "${src##*/}" "${pkg_dir}"
|
||||
mv $src ${pkg_dir}/
|
||||
${sign} && sign_pkg "${src##*/}"
|
||||
chown -R "${OWNER}:users" "${pkg_dir}"
|
||||
|
||||
}
|
||||
|
||||
archive_logs(){
|
||||
local archive name="$1" ext=log.tar.xz ver src=/tmp/archives.list
|
||||
local archive name="$1" ext=log.tar.xz ver src=${tmp_dir}/archives.list
|
||||
ver=$(get_full_version "$name")
|
||||
archive="${name}-${ver}-${target_arch}"
|
||||
find . -maxdepth 1 -name "$archive*.log" > $src
|
||||
msg2 "Archiving log files [%s] ..." "$archive.$ext"
|
||||
tar -cJf $PWD/$archive.$ext -T $src
|
||||
tar -cJf ${log_dir}/$archive.$ext -T $src
|
||||
msg2 "Cleaning log files ..."
|
||||
find . -maxdepth 1 -name '*.log' -delete
|
||||
chown "${OWNER}:users" "$archive.$ext"
|
||||
if [[ -z $LOGDEST ]];then
|
||||
find . -maxdepth 1 -name "$archive*.log" -delete
|
||||
chown "${OWNER}:users" "$archive.$ext"
|
||||
else
|
||||
find $LOGDEST -maxdepth 1 -name "$archive*.log" -delete
|
||||
fi
|
||||
}
|
||||
|
||||
post_build(){
|
||||
|
@ -273,16 +279,11 @@ post_build(){
|
|||
esac
|
||||
local ver=$(get_full_version "$pkg") src
|
||||
src=$pkg-$ver-$tarch.$ext
|
||||
if [[ -n $PKGDEST ]];then
|
||||
move_to_cache "$PKGDEST/$src"
|
||||
else
|
||||
move_to_cache "$src"
|
||||
fi
|
||||
move_to_cache "$src"
|
||||
done
|
||||
if [[ -z $LOGDEST ]];then
|
||||
local name=${pkgbase:-$pkgname}
|
||||
archive_logs "$name"
|
||||
fi
|
||||
|
||||
local name=${pkgbase:-$pkgname}
|
||||
archive_logs "$name"
|
||||
}
|
||||
|
||||
chroot_init(){
|
||||
|
|
|
@ -63,8 +63,7 @@ check_user_repos_conf(){
|
|||
}
|
||||
|
||||
get_pac_mirrors_conf(){
|
||||
local conf_dir=/tmp conf
|
||||
conf="$conf_dir/pacman-mirrors-$1.conf"
|
||||
local conf="$tmp_dir/pacman-mirrors-$1.conf"
|
||||
cp "${DATADIR}/pacman-mirrors.conf" "$conf"
|
||||
sed -i "$conf" \
|
||||
-e "s|Branch = stable|Branch = $1|"
|
||||
|
@ -232,6 +231,8 @@ init_common(){
|
|||
[[ -z ${log_dir} ]] && log_dir='/var/log/manjaro-tools'
|
||||
|
||||
[[ -z ${build_mirror} ]] && build_mirror='http://mirror.netzspielplatz.de/manjaro/packages'
|
||||
|
||||
[[ -z ${tmp_dir} ]] && tmp_dir='/tmp/manjaro-tools'
|
||||
}
|
||||
|
||||
init_buildtree(){
|
||||
|
@ -517,6 +518,7 @@ show_config(){
|
|||
else
|
||||
msg2 "manjaro_tools_conf: %s" "${manjaro_tools_conf}"
|
||||
fi
|
||||
msg2 "log_dir: %s" "${log_dir}"
|
||||
}
|
||||
|
||||
# $1: chroot
|
||||
|
|
Loading…
Reference in a new issue