Compare commits

..

7 Commits

Author SHA1 Message Date
artoo
1d3c77dc73 Merge pull request #62 from artix-linux/devel
deploypkg: simplify code in update_repo()
2018-04-07 12:03:33 +02:00
udeved
1cccece399 deploypkg: simplify code in update_repo() 2018-04-06 23:05:15 +02:00
artoo
cc8b47912e Merge pull request #61 from artix-linux/devel
Devel
2018-04-06 22:19:26 +02:00
udeved
f36cf35d9a deploypkg: enable checkpkg on add 2018-04-06 22:17:46 +02:00
udeved
cca5283db6 deploypkg: optimize pacman db access 2018-04-06 22:04:39 +02:00
udeved
d6bf8bcf12 util-pkg: check for PKGBUILD instead of checking for repo dir in find_repo() 2018-04-06 21:04:49 +02:00
udeved
88886de9e9 remove vbox from base Packages-Live 2018-03-31 11:19:53 +02:00
4 changed files with 52 additions and 102 deletions

View File

@@ -18,42 +18,36 @@ SYSCONFDIR='@sysconfdir@'
import ${LIBDIR}/util.sh
import ${LIBDIR}/util-pkg.sh
del_from_repo(){
local ver
local repo="$1"
local repo_path=${repos_root}/$repo/os/${target_arch}
update_repo(){
local repo="$1" pkgfile ver ext=db.tar.xz
local repo_path=${repos_root}/$repo/os/${target_arch} packages=()
source PKGBUILD
for name in ${pkgname[@]};do
[[ $arch == any ]] && CARCH=any
ver=$(get_full_version $name)
ver=$(get_full_version "$name")
if pkgfile=$(find_cached_package "$name" "$ver" "$CARCH");then
info "pkgfile: %s" "${pkgfile##*/}"
repo-remove -R $repo_path/$repo.db.tar.xz $name
[[ -e $repo_path/${pkgfile##*/} ]] && rm -v $repo_path/${pkgfile##*/}
[[ -e $repo_path/${pkgfile##*/}.sig ]] && rm -v $repo_path/${pkgfile##*/}.sig
fi
done
}
add_to_repo(){
local ver pkgfile=
local repo="$1"
local repo_path=${repos_root}/$repo/os/${target_arch}
source PKGBUILD
for name in ${pkgname[@]};do
[[ $arch == any ]] && CARCH=any
ver=$(get_full_version $name)
if pkgfile=$(find_cached_package "$name" "$ver" "$CARCH"); then
info "pkgfile: %s" "${pkgfile##*/}"
if ${sign_pkg};then
[[ -e ${pkgfile}.sig ]] && rm ${pkgfile}.sig
signfile ${pkgfile}
local pkg=${pkgfile##*/}
info "Found: %s" "$pkg"
if ${add_pkg};then
local action='add'
packages+=("$pkg")
# checkpkg $pkg
if ${sign_pkg};then
[[ -e ${pkgfile}.sig ]] && rm ${pkgfile}.sig
signfile ${pkgfile}
fi
ln -sf ${pkgfile}{,.sig} $repo_path/
elif ${del_pkg};then
local action='remove'
packages+=("$name")
[[ -e $repo_path/$pkg ]] && rm $repo_path/$pkg
[[ -e $repo_path/$pkg.sig ]] && rm $repo_path/$pkg.sig
fi
ln -sf ${pkgfile}{,.sig} $repo_path/
cd $repo_path
repo-add -R $repo.db.tar.xz ${pkgfile##*/}
fi
done
cd $repo_path
repo-$action -R $repo.$ext ${packages[@]}
return 0
}
display_settings(){
@@ -84,9 +78,9 @@ sign_pkg=false
usage() {
echo "Usage: ${0##*/} [options]"
echo " -d Destination repository [default:${repository}]"
echo ' -a Add package to repository'
echo ' -r Remove package from repository'
echo ' -s Sign package'
echo ' -a Add package(s) to repository'
echo ' -r Remove package(s) from repository'
echo ' -s Sign package(s)'
echo ' -q Query settings and pretend upload'
echo ' -h This help'
echo ''
@@ -101,8 +95,8 @@ opts='d:arsqh'
while getopts "${opts}" arg; do
case "${arg}" in
d) repository="$OPTARG" ;;
a) add_pkg=true ;;
r) del_pkg=true ;;
a) add_pkg=true; del_pkg=false ;;
r) del_pkg=true; add_pkg=false ;;
s) sign_pkg=true ;;
q) pretend=true ;;
h|?) usage 0 ;;
@@ -116,8 +110,4 @@ prepare_dir "${repos_root}"
${pretend} && display_settings && exit 1
${del_pkg} && del_from_repo "${repository}"
${add_pkg} && add_to_repo "${repository}"
exit 0
update_repo "${repository}"

View File

@@ -3,6 +3,4 @@ nbd
>openrc artix-live-openrc
squashfs-tools
artix-live-portable-efi
virtualbox-guest-modules-artix
virtualbox-guest-utils
linux-lts-headers

View File

@@ -1,38 +0,0 @@
#!/bin/ash
# /oldroot depends on things inside /oldroot/run/miso...
mkdir /oldrun
mount -n --move /oldroot/run /oldrun
# Unmount all mounts now.
#umount $(mount | awk '$3 ~/^\/oldroot/ {print $3}' | sort -r)
umount $(mount | awk '$3 ~/^\/oldroot/ {if($3 != "/run/miso/bootmnt") print $3}' | sort -r)
# Remove all dm-snapshot devices.
dmsetup remove_all
# Remove all loopback devices.
for _lup in $(grep ^/dev/loop /oldrun/miso/used_block_devices | tac); do
if ! losetup -d ${_lup} 2> /dev/null; then
umount -d ${_lup}
fi
done
# Unmount the space used to store *.cow.
umount /oldrun/miso/cowspace
# Unmount boot device if needed (no copytoram=y used)
if [[ ! -d /oldrun/miso/copytoram ]]; then
if [[ -d /oldrun/miso/img_dev ]]; then
umount /oldrun/miso/img_dev
else
umount /oldrun/miso/bootmnt
fi
fi
# reboot / poweroff / halt, depending on the argument passed by init
# if something invalid is passed, we halt
case "$1" in
reboot|poweroff|halt) "$1" -f ;;
*) halt -f;;
esac

View File

@@ -124,72 +124,72 @@ is_valid_repo(){
}
find_repo(){
local pkg="$1" unstable="$2" repo=
local pkg="$1" incl="$2" repo=
if [[ -d $pkg/repos/core-x86_64 ]];then
if [[ -f $pkg/repos/core-x86_64/PKGBUILD ]];then
repo=core-x86_64
elif [[ -d $pkg/repos/core-any ]];then
elif [[ -f $pkg/repos/core-any/PKGBUILD ]];then
repo=core-any
fi
if [[ -d $pkg/repos/extra-x86_64 ]];then
if [[ -f $pkg/repos/extra-x86_64/PKGBUILD ]];then
repo=extra-x86_64
elif [[ -d $pkg/repos/extra-any ]];then
elif [[ -f $pkg/repos/extra-any/PKGBUILD ]];then
repo=extra-any
fi
if [[ -d $pkg/repos/testing-x86_64 ]];then
if [[ -f $pkg/repos/testing-x86_64/PKGBUILD ]];then
repo=testing-x86_64
elif [[ -d $pkg/repos/testing-any ]];then
elif [[ -f $pkg/repos/testing-any/PKGBUILD ]];then
repo=testing-any
fi
if [[ -d $pkg/repos/staging-x86_64 ]];then
if [[ -f $pkg/repos/staging-x86_64/PKGBUILD ]];then
repo=staging-x86_64
elif [[ -d $pkg/repos/staging-any ]];then
elif [[ -f $pkg/repos/staging-any/PKGBUILD ]];then
repo=staging-any
fi
if [[ -d $pkg/repos/community-x86_64 ]];then
if [[ -f $pkg/repos/community-x86_64/PKGBUILD ]];then
repo=community-x86_64
elif [[ -d $pkg/repos/community-any ]];then
elif [[ -f $pkg/repos/community-any/PKGBUILD ]];then
repo=community-any
fi
if [[ -d $pkg/repos/community-testing-x86_64 ]];then
if [[ -f $pkg/repos/community-testing-x86_64/PKGBUILD ]];then
repo=community-testing-x86_64
elif [[ -d $pkg/repos/community-testing-any ]];then
elif [[ -f $pkg/repos/community-testing-any/PKGBUILD ]];then
repo=community-testing-any
fi
if [[ -d $pkg/repos/community-staging-x86_64 ]];then
if [[ -f $pkg/repos/community-staging-x86_64/PKGBUILD ]];then
repo=community-staging-x86_64
elif [[ -d $pkg/repos/community-staging-any ]];then
elif [[ -f $pkg/repos/community-staging-any/PKGBUILD ]];then
repo=community-staging-any
fi
if [[ -d $pkg/repos/multilib-x86_64 ]];then
if [[ -f $pkg/repos/multilib-x86_64/PKGBUILD ]];then
repo=multilib-x86_64
fi
if [[ -d $pkg/repos/multilib-testing-x86_64 ]];then
if [[ -f $pkg/repos/multilib-testing-x86_64/PKGBUILD ]];then
repo=multilib-testing-x86_64
fi
if [[ -d $pkg/repos/multilib-staging-x86_64 ]];then
if [[ -f $pkg/repos/multilib-staging-x86_64/PKGBUILD ]];then
repo=multilib-staging-x86_64
fi
if $unstable;then
if [[ -d $pkg/repos/gnome-unstable-x86_64 ]];then
if $incl;then
if [[ -f $pkg/repos/gnome-unstable-x86_64/PKGBUILD ]];then
repo=gnome-unstable-x86_64
elif [[ -d $pkg/repos/gnome-unstable-any ]];then
elif [[ -f $pkg/repos/gnome-unstable-any/PKGBUILD ]];then
repo=gnome-unstable-any
fi
if [[ -d $pkg/repos/kde-unstable-x86_64 ]];then
if [[ -f $pkg/repos/kde-unstable-x86_64/PKGBUILD ]];then
repo=kde-unstable-x86_64
elif [[ -d $pkg/repos/kde-unstable-any ]];then
elif [[ -f $pkg/repos/kde-unstable-any/PKGBUILD ]];then
repo=kde-unstable-any
fi
fi