buildiso: outsource live session code, write new live.conf file

This commit is contained in:
udeved 2016-08-01 19:01:06 +02:00
parent b99efd5a1e
commit 9901707976
2 changed files with 18 additions and 8 deletions

View file

@ -377,6 +377,23 @@ configure_custom_image(){
msg "Done configuring [%s-image]" "${profile}" msg "Done configuring [%s-image]" "${profile}"
} }
write_live_session_conf(){
msg2 "Configuring live session ..."
local path=$1${DATADIR}
[[ ! -d $path ]] && mkdir -p $path
local conf=$path/live.conf
echo '# live session configuration' > ${conf}
echo '' >> ${conf}
echo '# autologin' >> ${conf}
echo "autologin=${autologin}" >> ${conf}
echo '' >> ${conf}
echo '# live username' >> ${conf}
echo "username=${username}" >> ${conf}
echo '' >> ${conf}
echo '# live password' >> ${conf}
echo "password=${password}" >> ${conf}
}
configure_live_image(){ configure_live_image(){
msg "Configuring [live-image]" msg "Configuring [live-image]"
configure_hosts "$1" configure_hosts "$1"
@ -407,6 +424,7 @@ configure_live_image(){
esac esac
configure_services_live "$1" configure_services_live "$1"
configure_calamares "$1" configure_calamares "$1"
write_live_session_conf "$1"
msg "Done configuring [live-image]" msg "Done configuring [live-image]"
} }

View file

@ -123,20 +123,12 @@ get_timer(){
echo $(date +%s) echo $(date +%s)
} }
get_timer_ms(){
echo $(date +%s%3N)
}
# $1: start timer # $1: start timer
elapsed_time(){ elapsed_time(){
echo $(echo $1 $(get_timer) | awk '{ printf "%0.2f",($2-$1)/60 }') echo $(echo $1 $(get_timer) | awk '{ printf "%0.2f",($2-$1)/60 }')
} }
# $1: start timer
elapsed_time_ms(){
echo $(echo $1 $(get_timer_ms) | awk '{ printf "%0.3f",($2-$1)/1000 }')
}
show_elapsed_time(){ show_elapsed_time(){
info "Time %s: %s minutes" "$1" "$(elapsed_time $2)" info "Time %s: %s minutes" "$1" "$(elapsed_time $2)"
} }