mirror of
https://github.com/moparisthebest/arch-ppa
synced 2024-12-18 04:32:15 -05:00
Introduce arch-chroot-helper, use it instead of clean-chroot-manager in ppa
This commit is contained in:
parent
8e7ffccd93
commit
1a849f0c3b
48
arch-chroot-helper
Executable file
48
arch-chroot-helper
Executable file
@ -0,0 +1,48 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# this is meant to be put in /usr/bin and allowed to use for for a user
|
||||||
|
# cp /home/ppa/arch-ppa/arch-chroot-helper /usr/bin/; chown root.root /usr/bin/arch-chroot-helper; chmod 555 /usr/bin/arch-chroot-helper
|
||||||
|
# then add this using visudo:
|
||||||
|
# ppa ALL= NOPASSWD: /usr/bin/arch-chroot-helper
|
||||||
|
|
||||||
|
ccm_root='/scratch/.chroot64'
|
||||||
|
|
||||||
|
prepare() {
|
||||||
|
if [ -d "${ccm_root}/root" ]; then
|
||||||
|
# this exists, so just update it
|
||||||
|
arch-nspawn "${ccm_root}/root" pacman -Syu --noconfirm
|
||||||
|
#yes | arch-nspawn "${ccm_root}/root" pacman -Scc
|
||||||
|
else
|
||||||
|
# does not exist, create it...
|
||||||
|
mkdir -p "${ccm_root}"
|
||||||
|
mkarchroot -C /etc/pacman.conf -M /etc/makepkg.conf "${ccm_root}/root" base-devel
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
nuke() {
|
||||||
|
rm -rf "${ccm_root}"
|
||||||
|
}
|
||||||
|
|
||||||
|
make() {
|
||||||
|
set -e
|
||||||
|
prepare
|
||||||
|
makechrootpkg -c -u -r "${ccm_root}"
|
||||||
|
}
|
||||||
|
|
||||||
|
case $1 in
|
||||||
|
prepare)
|
||||||
|
prepare
|
||||||
|
exit $?
|
||||||
|
;;
|
||||||
|
nuke)
|
||||||
|
nuke
|
||||||
|
exit $?
|
||||||
|
;;
|
||||||
|
make)
|
||||||
|
make
|
||||||
|
exit $?
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Must specify command: prepare, nuke, make"
|
||||||
|
exit 1
|
||||||
|
esac
|
37
ppa
37
ppa
@ -8,8 +8,6 @@ basedir="$(pwd)"
|
|||||||
src_dir="${basedir}/src"
|
src_dir="${basedir}/src"
|
||||||
repo_name=aur
|
repo_name=aur
|
||||||
pkg_dir="${basedir}/$repo_name"
|
pkg_dir="${basedir}/$repo_name"
|
||||||
ccm='sudo ccm64'
|
|
||||||
ccm_root='/scratch/chroot64'
|
|
||||||
aurweb='https://aur.archlinux.org'
|
aurweb='https://aur.archlinux.org'
|
||||||
|
|
||||||
if [ `whoami` == 'root' ]; then
|
if [ `whoami` == 'root' ]; then
|
||||||
@ -76,7 +74,6 @@ sign_packages() {
|
|||||||
build() {
|
build() {
|
||||||
cd "$src_dir"
|
cd "$src_dir"
|
||||||
if [ "$#" -gt 0 ]; then
|
if [ "$#" -gt 0 ]; then
|
||||||
$ccm d
|
|
||||||
failed=''
|
failed=''
|
||||||
# create .SRCINFO, so aurqueue can use it next
|
# create .SRCINFO, so aurqueue can use it next
|
||||||
for dir in "$@"
|
for dir in "$@"
|
||||||
@ -88,27 +85,31 @@ build() {
|
|||||||
for dir in $(aurqueue "$@")
|
for dir in $(aurqueue "$@")
|
||||||
do
|
do
|
||||||
cd $dir
|
cd $dir
|
||||||
$ccm s || failed="$failed $dir"
|
# delete any existing packages
|
||||||
|
grep '^pkgname = ' .SRCINFO | sed 's/^pkgname = //' | xargs -I {} sh -c 'rm -f {}*pkg.tar*'
|
||||||
|
sudo arch-chroot-helper make
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
# failed, append to failed string
|
||||||
|
failed="$failed $dir"
|
||||||
|
else
|
||||||
|
#list_of_packages="$(grep '^pkgname = ' .SRCINFO | sed 's/^pkgname = //' | sort -u | tr '\n' ' ')"
|
||||||
|
list_of_package_files="$(grep '^pkgname = ' .SRCINFO | sed 's/^pkgname = //' | xargs -I {} sh -c 'ls {}*pkg.tar*' 2>/dev/null | sort -u | tr '\n' ' ')"
|
||||||
|
mv $list_of_package_files "$pkg_dir"
|
||||||
|
cd "$pkg_dir"
|
||||||
|
sign_packages $list_of_package_files
|
||||||
|
# repose appears to work the same with both $list_of_packages and $list_of_package_files
|
||||||
|
repose -f -z $repo_name $list_of_package_files
|
||||||
|
sign_packages $repo_name.db $repo_name.files
|
||||||
|
fi
|
||||||
cd "$src_dir"
|
cd "$src_dir"
|
||||||
done
|
done
|
||||||
|
|
||||||
# save packages
|
|
||||||
cd "$pkg_dir"
|
|
||||||
for pkg in "$ccm_root"/root/repo/*pkg.tar*
|
|
||||||
do
|
|
||||||
mv "$pkg" .
|
|
||||||
sign_packages "$(basename "$pkg")"
|
|
||||||
done
|
|
||||||
repose -f -z $repo_name
|
|
||||||
sign_packages $repo_name.db $repo_name.files
|
|
||||||
|
|
||||||
if [ "$failed" == "" ]
|
if [ "$failed" == "" ]
|
||||||
then
|
then
|
||||||
# success!, nuke the chroot
|
# success!, nuke the chroot
|
||||||
echo $ccm n
|
echo sudo arch-chroot-helper nuke
|
||||||
else
|
else
|
||||||
# some failures, just delete the packages
|
# some failures
|
||||||
$ccm d
|
|
||||||
echo "failed packages:$failed"
|
echo "failed packages:$failed"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -119,7 +120,7 @@ build() {
|
|||||||
|
|
||||||
rebuild_db() {
|
rebuild_db() {
|
||||||
cd "$pkg_dir"
|
cd "$pkg_dir"
|
||||||
repose -f -z $repo_name
|
repose -v -f -z $repo_name
|
||||||
sign_packages $repo_name.db $repo_name.files
|
sign_packages $repo_name.db $repo_name.files
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,26 +0,0 @@
|
|||||||
# Maintainer: graysky <graysky AT archlinux DOT us>
|
|
||||||
|
|
||||||
pkgname=clean-chroot-manager
|
|
||||||
pkgver=2.96
|
|
||||||
pkgrel=1
|
|
||||||
pkgdesc='Wrapper for managing clean chroot builds with local repo therein.'
|
|
||||||
arch=('any')
|
|
||||||
url='https://github.com/graysky2/clean-chroot-manager'
|
|
||||||
license=('MIT')
|
|
||||||
depends=('devtools>=20180528-1' 'rsync' 'libarchive>=3.3.3')
|
|
||||||
conflicts=('clean_chroot_manager')
|
|
||||||
replaces=('clean_chroot_manager')
|
|
||||||
source=("$pkgname-$pkgver.tar.gz::https://github.com/graysky2/clean-chroot-manager/archive/v$pkgver.tar.gz")
|
|
||||||
sha256sums=('3bbe344f92914a490f61c6fcb95189f4c95dacee45da975bf9c530e8fe867806')
|
|
||||||
install=ccm.install
|
|
||||||
|
|
||||||
build() {
|
|
||||||
cd "$pkgname-$pkgver"
|
|
||||||
make
|
|
||||||
}
|
|
||||||
|
|
||||||
package() {
|
|
||||||
cd "$pkgname-$pkgver"
|
|
||||||
make DESTDIR="$pkgdir" install
|
|
||||||
install -Dm644 MIT "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
|
|
||||||
}
|
|
@ -1,16 +0,0 @@
|
|||||||
## arg 1: the new package version
|
|
||||||
## arg 2: the old package version
|
|
||||||
|
|
||||||
post_upgrade() {
|
|
||||||
for test in 2.92-1 2.87-1 2.81-1 2.73-1 2.72-1 2.55-1 2.17-1 2.22-1 2.69-1 2.93-1; do
|
|
||||||
if [ "$(vercmp $2 $test)" -lt 1 ]; then
|
|
||||||
echo
|
|
||||||
echo '--> Please check ~/.config/clean-chroot-manager.conf against the'
|
|
||||||
echo '--> provided /usr/share/clean-chroot-manager/ccm.skel to ensure it is'
|
|
||||||
echo '--> updated as the script does not do this automatically.'
|
|
||||||
exit 0
|
|
||||||
else
|
|
||||||
/bin/true
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user