forked from mirrored-repos/manjaro-tools
[util-iso] try to remove custom repo in pacman.conf, unless specified otherwise
This commit is contained in:
parent
91f019493c
commit
851f56f6c0
3 changed files with 35 additions and 1 deletions
|
@ -81,6 +81,7 @@ display_settings(){
|
|||
msg2 "arch: ${arch}"
|
||||
msg2 "branch: ${branch}"
|
||||
msg2 "chroots_iso: ${chroots_iso}"
|
||||
msg2 "custom repo to keep: ${keep_repo}"
|
||||
|
||||
msg "ARGS:"
|
||||
msg2 "clean_first: ${clean_first}"
|
||||
|
@ -132,6 +133,7 @@ usage() {
|
|||
echo " -a <arch> Arch [default: ${arch}]"
|
||||
echo " -b <branch> Branch [default: ${branch}]"
|
||||
echo ' -r <dir> Chroots directory'
|
||||
echo ' -k <repo> Custom repo to keep from pacman.conf'
|
||||
echo " [default: ${chroots_iso}]"
|
||||
echo ' -w Disable clean iso cache'
|
||||
echo ' -c Disable clean work dir'
|
||||
|
@ -149,7 +151,7 @@ usage() {
|
|||
|
||||
orig_argv=("$@")
|
||||
|
||||
opts='p:a:b:r:cxlisqwLh'
|
||||
opts='p:a:b:r:k:cxlisqwLh'
|
||||
|
||||
while getopts "${opts}" arg; do
|
||||
case "${arg}" in
|
||||
|
@ -157,6 +159,7 @@ while getopts "${opts}" arg; do
|
|||
a) arch="$OPTARG" ;;
|
||||
b) branch="$OPTARG" ;;
|
||||
r) chroots_iso="$OPTARG" ;;
|
||||
k) keep_repo="$OPTARG" ;;
|
||||
c) clean_first=false ;;
|
||||
w) clean_cache_iso=false;;
|
||||
x) clean_cache_xorg=false ;;
|
||||
|
|
|
@ -59,6 +59,9 @@
|
|||
# clean lng cache before building
|
||||
# clean_cache_lng=true
|
||||
|
||||
# custom pacman repo to keep
|
||||
# keep_repo=""
|
||||
|
||||
# unset defaults to given value
|
||||
# dist_name="Manjaro"
|
||||
|
||||
|
|
|
@ -510,6 +510,32 @@ compress_images(){
|
|||
msg3 "Time ${FUNCNAME}: $(elapsed_time ${timer}) minutes"
|
||||
}
|
||||
|
||||
clean_pacman_conf(){
|
||||
REPOS=() # set default value
|
||||
# Get repos from pacman_conf
|
||||
# sed is being used for filtering comments and repo brackets []
|
||||
REPOS=($(grep "\[*\]" "$pacman_conf" | sed -e '/^\s*#/d' -e 's/\[//' -e 's/\]//'))
|
||||
# Set valid repos
|
||||
if [[ $arch = x86_64 ]]; then
|
||||
VALID=('options' 'core' 'extra' 'community' 'multilib')
|
||||
else
|
||||
VALID=('options' 'core' 'extra' 'community')
|
||||
fi
|
||||
# Remove extra repos from pacman.conf
|
||||
for repo in "${REPOS[@]}"; do
|
||||
if [[ ! $(echo "${VALID[*]}" | grep "$repo") ]] && [[ ! $(echo "$keep_repo" | grep "$repo") ]]; then
|
||||
# Remove custom repo
|
||||
for file in $work_dir/{livecd,root,$custom}-image/etc/pacman.conf; do
|
||||
if [[ -f $file ]]; then
|
||||
msg2 "Editing $file"
|
||||
sed -i "/^\[$repo/,/^Server/d" "$file" || exit 1
|
||||
fi
|
||||
done
|
||||
msg "Custom repo $repo removed from pacman.conf"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
build_images(){
|
||||
local timer=$(get_timer)
|
||||
load_pkgs "Packages"
|
||||
|
@ -554,10 +580,12 @@ make_profile(){
|
|||
fi
|
||||
if ${images_only}; then
|
||||
build_images
|
||||
clean_pacman_conf
|
||||
warning "Continue compress: buildiso -p ${buildset_iso} -sc ..."
|
||||
exit 1
|
||||
else
|
||||
build_images
|
||||
clean_pacman_conf
|
||||
compress_images
|
||||
fi
|
||||
cd ..
|
||||
|
|
Loading…
Reference in a new issue