batchpkg: add update option

master
artoo 2 years ago
parent 0b2973e802
commit bfb20645c6
  1. 32
      bin/pkg/batchpkg.in

@ -54,21 +54,28 @@ batch_create() {
done < $pkglist
}
# batch_upgrade() {
# local pkglist=${TREE_DIR_ARTIX}/pkg_upgrades.list
# [[ -f $pkglist ]] || die "%s does not exist!" "$pkglist"
# while read entry;do
# local pkg=${entry#*:}
# local dest=${entry%:*}
# echo "buildtree -i -p ${pkg}"
# echo "${dest}pkg -u -p ${pkg}"
# done < $pkglist
# }
batch_update() {
local name="${1:-pkg_upgrades}"
local pkglist=${TREE_DIR_ARTIX}/$name.list
[[ -f $pkglist ]] || die "%s does not exist!" "$pkglist"
while read entry;do
local pkg=${entry#*:}
local dest=${entry%:*}
if ${runlist}; then
buildtree -i -p "${pkg}"
"${dest}"pkg -u -p "${pkg}"
else
msg "buildtree -i -p ${pkg}"
msg2 "${dest}pkg -u -p ${pkg}"
fi
done < $pkglist
}
usage() {
echo "Usage: ${0##*/} [optional listname]"
echo ' -r Run generated commands'
echo ' -c Create subrepos from list'
echo ' -u Update subrepos from list'
echo ' -h This help'
echo ''
echo ''
@ -77,8 +84,9 @@ usage() {
runlist=false
create=false
update=false
opts='rch'
opts='rcuh'
while getopts "${opts}" arg; do
case "${arg}" in
@ -95,6 +103,8 @@ listname="$1"; shift
if ${create};then
batch_create "${listname}"
elif ${update};then
batch_update "${listname}"
else
batch_move "${listname}"
fi

Loading…
Cancel
Save