buildiso: enable the logger with -l arg

This commit is contained in:
udeved 2016-02-23 18:23:28 +01:00
parent c5058962a2
commit 64a143c5f7
5 changed files with 48 additions and 35 deletions

View file

@ -80,6 +80,7 @@ display_settings(){
msg2 "images_only: %s" "${images_only}" msg2 "images_only: %s" "${images_only}"
msg2 "iso_only: %s" "${iso_only}" msg2 "iso_only: %s" "${iso_only}"
msg2 "sign: %s" "${sign}" msg2 "sign: %s" "${sign}"
msg2 "is_log: %s" "${is_log}"
msg "DIST SETTINGS:" msg "DIST SETTINGS:"
msg2 "dist_name: %s" "${dist_name}" msg2 "dist_name: %s" "${dist_name}"
@ -115,6 +116,7 @@ images_only=false
iso_only=false iso_only=false
verbose=false verbose=false
sign=false sign=false
is_log=false
pacman_conf_arch='default' pacman_conf_arch='default'
@ -136,6 +138,7 @@ usage() {
echo ' -x Build images only' echo ' -x Build images only'
echo ' -z Generate iso only' echo ' -z Generate iso only'
echo ' Requires pre built images (-x)' echo ' Requires pre built images (-x)'
echo ' -l Log the build process'
echo ' -v Verbose output, show profies detail (-q)' echo ' -v Verbose output, show profies detail (-q)'
echo ' -q Query settings and pretend build' echo ' -q Query settings and pretend build'
echo ' -h This help' echo ' -h This help'
@ -146,7 +149,7 @@ usage() {
orig_argv=("$@") orig_argv=("$@")
opts='p:a:b:r:t:k:i:czxsvqh' opts='p:a:b:r:t:k:i:clzxsvqh'
while getopts "${opts}" arg; do while getopts "${opts}" arg; do
case "${arg}" in case "${arg}" in
@ -161,6 +164,7 @@ while getopts "${opts}" arg; do
c) clean_first=false ;; c) clean_first=false ;;
x) images_only=true ;; x) images_only=true ;;
z) iso_only=true ;; z) iso_only=true ;;
l) is_log=true ;;
v) verbose=true ;; v) verbose=true ;;
q) pretend=true ;; q) pretend=true ;;
h|?) usage 0 ;; h|?) usage 0 ;;

View file

@ -170,22 +170,24 @@ brand_calamares_settings_conf(){
configure_calamares(){ configure_calamares(){
msg2 "Configuring Calamares ..." msg2 "Configuring Calamares ..."
mkdir -p $1/etc/calamares/modules mkdir -p $1/etc/calamares/modules
write_calamares_bootloader_conf $1 write_calamares_bootloader_conf "$1"
write_calamares_unpack_conf $1 write_calamares_unpack_conf "$1"
write_calamares_displaymanager_conf $1 write_calamares_displaymanager_conf "$1"
write_calamares_initcpio_conf $1 write_calamares_initcpio_conf "$1"
brand_calamares_settings_conf $1 brand_calamares_settings_conf "$1"
if [[ ${initsys} == 'openrc' ]];then if [[ ${initsys} == 'openrc' ]];then
write_calamares_machineid_conf $1 write_calamares_machineid_conf "$1"
write_calamares_finished_conf $1 write_calamares_finished_conf "$1"
fi fi
write_calamares_services_conf $1 write_calamares_services_conf "$1"
write_calamares_users_conf $1 write_calamares_users_conf "$1"
if [[ -f $1/usr/share/applications/calamares.desktop && -f $1/usr/bin/kdesu ]];then if [[ -f $1/usr/share/applications/calamares.desktop && -f $1/usr/bin/kdesu ]];then
sed -i -e 's|sudo|kdesu|g' $1/usr/share/applications/calamares.desktop sed -i -e 's|sudo|kdesu|g' $1/usr/share/applications/calamares.desktop
fi fi
[[ "${edition}" == 'sonar' ]] && write_calamares_branding_desc $1 if [[ "${edition}" == 'sonar' ]]; then
write_calamares_branding_desc "$1"
fi
} }
configure_thus(){ configure_thus(){

View file

@ -436,10 +436,10 @@ clean_up_image(){
find "$1/var/lib/pacman" -maxdepth 1 -type f -delete &> /dev/null find "$1/var/lib/pacman" -maxdepth 1 -type f -delete &> /dev/null
find "$1/var/lib/pacman/sync" -type f -delete &> /dev/null find "$1/var/lib/pacman/sync" -type f -delete &> /dev/null
find "$1/var/cache/pacman/pkg" -type f -delete &> /dev/null #find "$1/var/cache/pacman/pkg" -type f -delete &> /dev/null
find "$1/var/log" -type f -delete &> /dev/null find "$1/var/log" -type f -delete &> /dev/null
find "$1/var/tmp" -mindepth 1 -delete &> /dev/null #find "$1/var/tmp" -mindepth 1 -delete &> /dev/null
find "$1/tmp" -mindepth 1 -delete &> /dev/null #find "$1/tmp" -mindepth 1 -delete &> /dev/null
# find "${work_dir}" -name *.pacnew -name *.pacsave -name *.pacorig -delete # find "${work_dir}" -name *.pacnew -name *.pacsave -name *.pacorig -delete
} }

View file

@ -23,7 +23,8 @@ error_function() {
# $1: function # $1: function
run_log(){ run_log(){
local logfile=${iso_dir}/$(gen_iso_fn).log shellopts=$(shopt -p) if ${is_log};then
local logfile=${iso_dir}/$(gen_iso_fn).$1.log shellopts=$(shopt -p)
logpipe=$(mktemp -u "/tmp/logpipe.XXXXXXXX") logpipe=$(mktemp -u "/tmp/logpipe.XXXXXXXX")
mkfifo "$logpipe" mkfifo "$logpipe"
tee "$logfile" < "$logpipe" & tee "$logfile" < "$logpipe" &
@ -32,6 +33,9 @@ run_log(){
wait $teepid wait $teepid
rm "$logpipe" rm "$logpipe"
eval "$shellopts" eval "$shellopts"
else
$1
fi
} }
run_safe() { run_safe() {

View file

@ -13,6 +13,7 @@ import ${LIBDIR}/util-iso-image.sh
import ${LIBDIR}/util-iso-boot.sh import ${LIBDIR}/util-iso-boot.sh
import ${LIBDIR}/util-iso-calamares.sh import ${LIBDIR}/util-iso-calamares.sh
import ${LIBDIR}/util-pac-conf.sh import ${LIBDIR}/util-pac-conf.sh
import ${LIBDIR}/util-iso-log.sh
# $1: image path # $1: image path
squash_image_dir() { squash_image_dir() {
@ -459,13 +460,15 @@ load_pkgs(){
| sed "$_kernel" \ | sed "$_kernel" \
| sed "$_clean") | sed "$_clean")
if [[ ${1##*/} == 'Packages-Mhwd' ]]; then if [[ $1 == "${packages_mhwd}" ]]; then
packages_cleanup=$(sed "$_com_rm" "$1" \ packages_cleanup=$(sed "$_com_rm" "$1" \
| grep cleanup \ | grep cleanup \
| sed "$_purge_rm" \ | sed "$_purge_rm" \
| sed "$_kernel" \ | sed "$_kernel" \
| sed "$_clean") | sed "$_clean")
[[ ${_used_kernel} < "42" ]] && packages_cleanup="$packages_cleanup xf86-video-amdgpu" if [[ ${_used_kernel} < "42" ]]; then
packages_cleanup="$packages_cleanup xf86-video-amdgpu"
fi
fi fi
} }
@ -604,26 +607,26 @@ compress_images(){
build_images(){ build_images(){
local timer=$(get_timer) local timer=$(get_timer)
load_pkgs "${profile_dir}/Packages-Root" load_pkgs "${profile_dir}/Packages-Root"
make_image_root run_safe make_image_root
if [[ -f "${packages_custom}" ]] ; then if [[ -f "${packages_custom}" ]] ; then
load_pkgs "${packages_custom}" load_pkgs "${packages_custom}"
make_image_custom run_safe make_image_custom
fi fi
if [[ -f ${profile_dir}/Packages-Live ]]; then if [[ -f ${profile_dir}/Packages-Live ]]; then
load_pkgs "${profile_dir}/Packages-Live" load_pkgs "${profile_dir}/Packages-Live"
make_image_live run_safe make_image_live
fi fi
if [[ -f ${profile_dir}/Packages-Mhwd ]] ; then if [[ -f ${packages_mhwd} ]] ; then
load_pkgs "${profile_dir}/Packages-Mhwd" load_pkgs "${profile_dir}/Packages-Mhwd"
make_image_mhwd run_safe make_image_mhwd
fi fi
make_image_boot run_safe make_image_boot
if [[ "${arch}" == "x86_64" ]]; then if [[ "${arch}" == "x86_64" ]]; then
make_efi run_safe make_efi
make_efiboot run_safe make_efiboot
fi fi
make_isolinux run_safe make_isolinux
make_isomounts run_safe make_isomounts
show_elapsed_time "${FUNCNAME}" "${timer_start}" show_elapsed_time "${FUNCNAME}" "${timer_start}"
} }