Merge pull request #87 from aadityabagga/master
[util-iso] allow configuring xorg and lng pkg cache cleanup via config + allow removal of local repo from pacman.conf
This commit is contained in:
commit
68498bb4fc
4 changed files with 53 additions and 3 deletions
|
@ -82,6 +82,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}"
|
||||
|
@ -119,8 +120,6 @@ load_config "${USER_CONFIG}/manjaro-tools.conf"
|
|||
load_config "${SYSCONFDIR}/manjaro-tools.conf"
|
||||
|
||||
clean_first=true
|
||||
clean_cache_xorg=true
|
||||
clean_cache_lng=true
|
||||
clean_cache_iso=true
|
||||
|
||||
pretend=false
|
||||
|
@ -135,6 +134,7 @@ usage() {
|
|||
echo " -a <arch> Arch [default: ${arch}]"
|
||||
echo " -b <branch> Branch [default: ${branch}]"
|
||||
echo ' -r <dir> Chroots directory'
|
||||
echo ' -k <repo> Custom pacman repo to keep'
|
||||
echo " [default: ${chroots_iso}]"
|
||||
echo ' -w Disable clean iso cache'
|
||||
echo ' -c Disable clean work dir'
|
||||
|
@ -152,7 +152,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
|
||||
|
@ -160,6 +160,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 ;;
|
||||
|
|
|
@ -53,6 +53,15 @@
|
|||
# default iso buildset; name without .set extension
|
||||
# buildset_iso=default
|
||||
|
||||
# clean xorg cache before building
|
||||
# clean_cache_xorg=true
|
||||
|
||||
# clean lng cache before building
|
||||
# clean_cache_lng=true
|
||||
|
||||
# custom pacman repo to keep
|
||||
# keep_repo=""
|
||||
|
||||
# unset defaults to given value
|
||||
# dist_name="Manjaro"
|
||||
|
||||
|
|
|
@ -525,6 +525,36 @@ compress_images(){
|
|||
msg3 "Time ${FUNCNAME}: $(elapsed_time ${timer}) minutes"
|
||||
}
|
||||
|
||||
clean_pacman_conf(){
|
||||
# set default values
|
||||
REPOS=()
|
||||
flag=0
|
||||
# Get repos from pacman_conf
|
||||
# sed is being used for removing 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" && flag=1 || return 1
|
||||
fi
|
||||
done
|
||||
if [[ $flag -eq 1 ]]; then
|
||||
msg "Custom repo $repo removed from pacman.conf"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
build_images(){
|
||||
local timer=$(get_timer)
|
||||
load_pkgs "Packages"
|
||||
|
@ -599,10 +629,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 ..
|
||||
|
|
|
@ -258,6 +258,14 @@ load_config(){
|
|||
buildset_iso='default'
|
||||
fi
|
||||
|
||||
if [[ -z ${clean_cache_xorg} ]];then
|
||||
clean_cache_xorg='true'
|
||||
fi
|
||||
|
||||
if [[ -z ${clean_cache_lng} ]];then
|
||||
clean_cache_lng='true'
|
||||
fi
|
||||
|
||||
##### iso settings #####
|
||||
|
||||
if [[ -z ${dist_release} ]];then
|
||||
|
|
Loading…
Reference in a new issue