[util-iso] use reset_pac_conf()

This commit is contained in:
udeved 2016-05-20 19:42:16 +02:00
parent f670c36d20
commit 577d1acac8
2 changed files with 32 additions and 21 deletions

View file

@ -59,25 +59,6 @@ run_safe() {
set +e set +e
} }
# clean_pacman_conf(){
# local repositories=$(get_repos "${pacman_conf}") uri='file://'
# msg "Cleaning [%s/etc/pacman.conf] ..." "$1"
# for repo in ${repositories[@]}; do
# case ${repo} in
# 'options'|'core'|'extra'|'community'|'multilib') continue ;;
# *)
# msg2 "parsing [%s] ..." "${repo}"
# parse_section "${repo}" "${pacman_conf}"
# if [[ ${pc_value} == $uri* ]]; then
# msg2 "Removing local repo [%s] ..." "${repo}"
# sed -i "/^\[${repo}/,/^Server/d" $1/etc/pacman.conf
# fi
# ;;
# esac
# done
# msg "Done cleaning [%s/etc/pacman.conf]" "$1"
# }
# $1: image path # $1: image path
make_sqfs() { make_sqfs() {
if [[ ! -d "$1" ]]; then if [[ ! -d "$1" ]]; then
@ -217,6 +198,9 @@ make_image_root() {
copy_overlay "${profile_dir}/root-overlay" "${path}" copy_overlay "${profile_dir}/root-overlay" "${path}"
configure_root_image "${path}" configure_root_image "${path}"
# ${is_custom_pac_conf} && clean_pacman_conf "${path}" # ${is_custom_pac_conf} && clean_pacman_conf "${path}"
reset_pac_conf "${path}"
clean_up_image "${path}" clean_up_image "${path}"
: > ${work_dir}/build.${FUNCNAME} : > ${work_dir}/build.${FUNCNAME}
msg "Done [Base installation] (root-image)" msg "Done [Base installation] (root-image)"
@ -239,6 +223,8 @@ make_image_custom() {
configure_custom_image "${path}" configure_custom_image "${path}"
# ${is_custom_pac_conf} && clean_pacman_conf "${path}" # ${is_custom_pac_conf} && clean_pacman_conf "${path}"
reset_pac_conf "${path}"
umount_image umount_image
clean_up_image "${path}" clean_up_image "${path}"
: > ${work_dir}/build.${FUNCNAME} : > ${work_dir}/build.${FUNCNAME}
@ -269,6 +255,8 @@ make_image_live() {
configure_live_image "${path}" configure_live_image "${path}"
# ${is_custom_pac_conf} && clean_pacman_conf "${path}" # ${is_custom_pac_conf} && clean_pacman_conf "${path}"
reset_pac_conf "${path}"
umount_image umount_image
# Clean up GnuPG keys # Clean up GnuPG keys
@ -289,6 +277,8 @@ make_image_mhwd() {
# ${is_custom_pac_conf} && clean_pacman_conf "${path}" # ${is_custom_pac_conf} && clean_pacman_conf "${path}"
reset_pac_conf "${path}"
download_to_cache "${path}" "${packages}" download_to_cache "${path}" "${packages}"
copy_cache_mhwd "${work_dir}/mhwd-image" copy_cache_mhwd "${work_dir}/mhwd-image"

View file

@ -53,10 +53,31 @@
# echo ${repos[@]} # echo ${repos[@]}
# } # }
# clean_pacman_conf(){
# local repositories=$(get_repos "${pacman_conf}") uri='file://'
# msg "Cleaning [%s/etc/pacman.conf] ..." "$1"
# for repo in ${repositories[@]}; do
# case ${repo} in
# 'options'|'core'|'extra'|'community'|'multilib') continue ;;
# *)
# msg2 "parsing [%s] ..." "${repo}"
# parse_section "${repo}" "${pacman_conf}"
# if [[ ${pc_value} == $uri* ]]; then
# msg2 "Removing local repo [%s] ..." "${repo}"
# sed -i "/^\[${repo}/,/^Server/d" $1/etc/pacman.conf
# fi
# ;;
# esac
# done
# msg "Done cleaning [%s/etc/pacman.conf]" "$1"
# }
reset_pac_conf(){ reset_pac_conf(){
local conf=$1 msg "Restoring [%s/etc/pacman.conf] ..." "$1"
sed -e "s|^.*HoldPkg = pacman glibc|HoldPkg = pacman glibc manjaro-system|" \ sed -e "s|^.*HoldPkg = pacman glibc|HoldPkg = pacman glibc manjaro-system|" \
-e "s|^.*#CheckSpace|CheckSpace|" -i "$1" -e "s|^.*#CheckSpace|CheckSpace|" \
-i "$1/etc/pacman.conf"
msg "Done restoring [%s/etc/pacman.conf]" "$1"
} }
read_set(){ read_set(){