~sirn/aur-clean-chroot-manager-artix

079426776f489ee5653a6697e4d0ffd39cc3c60a — Kridsada Thanabulpong 7 months ago
Initial commit
4 files changed, 191 insertions(+), 0 deletions(-)

A .gitignore
A PKGBUILD
A ccm.install
A patch_common_clean-chroot-manager64_in.patch
A  => .gitignore +4 -0
@@ 1,4 @@
*.tar.xz
*.tar.gz
src/
pkg/

A  => PKGBUILD +33 -0
@@ 1,33 @@
# Maintainer: graysky <graysky AT archlinux DOT us>

_pkgname=clean-chroot-manager
pkgname=$_pkgname-artix
replaces=
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=('artools-base' 'rsync' 'libarchive>=3.3.3')
provides=('clean-chroot-manager')
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"
        "patch_common_clean-chroot-manager64_in.patch")
sha256sums=('3bbe344f92914a490f61c6fcb95189f4c95dacee45da975bf9c530e8fe867806'
            '77953dded8dfce66a32ba1dcfcac87b99b3e895f26da40e3c659ec920901144e')
install=ccm.install

build() {
  cd "$_pkgname-$pkgver"
  ls -alh
  patch -p0 -i "$srcdir/patch_common_clean-chroot-manager64_in.patch"
  make
}

package() {
  cd "$_pkgname-$pkgver"
  make DESTDIR="$pkgdir" install
  install -Dm644 MIT "$pkgdir/usr/share/licenses/$_pkgname/LICENSE"
}

A  => ccm.install +16 -0
@@ 1,16 @@
## 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
}

A  => patch_common_clean-chroot-manager64_in.patch +138 -0
@@ 1,138 @@
--- common/clean-chroot-manager64.in.orig	2019-07-26 03:38:28.100255910 +0700
+++ common/clean-chroot-manager64.in	2019-07-26 03:37:31.803591370 +0700
@@ -53,8 +53,8 @@
 CFGFILE=${CFGFILE:-$HOMEDIR/.config/$PKG.conf}
 
 # dependency checks probably not needed but they do not hurt
-command -v mkarchroot >/dev/null 2>&1 || {
-mesg="devtools is required to use this script. Aborting."
+command -v mkchroot >/dev/null 2>&1 || {
+mesg="artools is required to use this script. Aborting."
 echo -e "${RED}==> ERROR:${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}"
 exit 1; }
 
@@ -126,7 +126,7 @@
 }
 
 create() {
-  if [[ -f "$CHROOTPATH64"/root/.arch-chroot ]]; then
+  if [[ -f "$CHROOTPATH64"/root/.artools ]]; then
     local mesg="Working directory $CHROOTPATH64 already exists."
     echo -e "${RED}==> ERROR:${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}" && exit 1
   fi
@@ -142,13 +142,13 @@
     if [[ $(uname -m) = "x86_64" ]]; then
       # note that makepkg will check for the distcc bin so just install
       # the package rather than modifying makepkg within the chroot
-      if ! mkarchroot "$CHROOTPATH64"/root base-devel distcc; then
+      if ! mkchroot "$CHROOTPATH64"/root base-devel distcc; then
         exit 1
       fi
     fi
   else
     # not asking to use distcc so proceed with normal chroot
-    if ! mkarchroot "$CHROOTPATH64"/root base-devel; then
+    if ! mkchroot "$CHROOTPATH64"/root base-devel; then
       exit 1
     fi
   fi
@@ -202,7 +202,7 @@
 }
 
 check2() {
-  if [[ ! -f "$CHROOTPATH64"/root/.arch-chroot ]]; then
+  if [[ ! -f "$CHROOTPATH64"/root/.artools ]]; then
     local mesg="No chroot found. Create a chroot first using the 'c' option and try again."
     echo -e "${RED}==>${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}"
     exit 1
@@ -223,11 +223,11 @@
   echo -e "${YELLOW}---->${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}"
 
   if [[ -z "$RUNNAMCAP" ]]; then
-    if ! PACKAGER=$PACKAGER MAKEFLAGS=-j$THREADS nice -19 makechrootpkg -c -u -r "$CHROOTPATH64"; then
+    if ! PACKAGER=$PACKAGER MAKEFLAGS=-j$THREADS nice -19 mkchrootpkg -c -u -r "$CHROOTPATH64"; then
       exit 1
     fi
   else
-    if ! PACKAGER=$PACKAGER MAKEFLAGS=-j$THREADS nice -19 makechrootpkg -c -u -n -r "$CHROOTPATH64"; then
+    if ! PACKAGER=$PACKAGER MAKEFLAGS=-j$THREADS nice -19 mkchrootpkg -c -u -n -r "$CHROOTPATH64"; then
       exit 1
     fi
   fi
@@ -243,11 +243,11 @@
   echo -e "${YELLOW}---->${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}"
 
   if [[ -z "$RUNNAMCAP" ]]; then
-    if ! PACKAGER=$PACKAGER MAKEFLAGS=-j$THREADS nice -19 makechrootpkg -u -r "$CHROOTPATH64"; then
+    if ! PACKAGER=$PACKAGER MAKEFLAGS=-j$THREADS nice -19 mkchrootpkg -u -r "$CHROOTPATH64"; then
       exit 1
     fi
   else
-    if ! PACKAGER=$PACKAGER MAKEFLAGS=-j$THREADS nice -19 makechrootpkg -u -n -r "$CHROOTPATH64"; then
+    if ! PACKAGER=$PACKAGER MAKEFLAGS=-j$THREADS nice -19 mkchrootpkg -u -n -r "$CHROOTPATH64"; then
       exit 1
     fi
   fi
@@ -263,11 +263,11 @@
   echo -e "${YELLOW}---->${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}"
 
   if [[ -z "$RUNNAMCAP" ]]; then
-    if ! PACKAGER=$PACKAGER MAKEFLAGS=-j$THREADS nice -19 makechrootpkg -u -r "$CHROOTPATH64" -- -R; then
+    if ! PACKAGER=$PACKAGER MAKEFLAGS=-j$THREADS nice -19 mkchrootpkg -u -r "$CHROOTPATH64" -- -R; then
       exit 1
     fi
   else
-    if ! PACKAGER=$PACKAGER MAKEFLAGS=-j$THREADS nice -19 makechrootpkg -u -n -r "$CHROOTPATH64" -- -R; then
+    if ! PACKAGER=$PACKAGER MAKEFLAGS=-j$THREADS nice -19 mkchrootpkg -u -n -r "$CHROOTPATH64" -- -R; then
       exit 1
     fi
   fi
@@ -392,7 +392,7 @@
 }
 
 preview() {
-  [[ -f "$CHROOTPATH64"/root/.arch-chroot ]] && \
+  [[ -f "$CHROOTPATH64"/root/.artools ]] && \
     PRESENT="${BOLD}($(du -sh "$CHROOTPATH64" 2>/dev/null|awk '{ print $1 }'))${ALL_OFF}" || \
     PRESENT="${BOLD}${RED}(Not present)${ALL_OFF}"
   echo -en "${BOLD} chroot path:"
@@ -504,9 +504,9 @@
 
     # verify distcc is running and try to start it if not else fail
     if [[ $DISTCCFAIL -ne 1 ]]; then
-      if ! systemctl is-active distccd &>/dev/null; then
-        [[ -f /usr/lib/systemd/system/distccd.service ]] && systemctl start distccd
-        if ! systemctl is-active distccd &>/dev/null; then
+      if ! sv status distccd &>/dev/null; then
+        [[ -f /run/runit/service/distccd ]] && sv start distccd
+        if ! sv status distccd &>/dev/null; then
           mesg="Cannot start distcc... is it configured properly?"
           echo -e "${RED}==> ERROR:${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}"
           exit 1
@@ -548,7 +548,7 @@
     header && distcc_check && preview
     ;;
   R)
-    if [[ ! -f "$CHROOTPATH64"/root/.arch-chroot ]]; then
+    if [[ ! -f "$CHROOTPATH64"/root/.artools ]]; then
       mesg="No chroot has been created/nothing to repackage. Aborting."
       echo -e "${RED}==> ERROR:${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}"
       exit 1
@@ -557,7 +557,7 @@
     ;;
   s)
     distcc_check
-    if [[ ! -f "$CHROOTPATH64"/root/.arch-chroot ]]; then
+    if [[ ! -f "$CHROOTPATH64"/root/.artools ]]; then
       mesg="No chroot has been created so making one now..."
       echo -e "${YELLOW}---->${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}"
       mesg=
@@ -566,7 +566,7 @@
     build && indexit && syncup
     ;;
   S)
-    if [[ ! -f "$CHROOTPATH64"/root/.arch-chroot ]]; then
+    if [[ ! -f "$CHROOTPATH64"/root/.artools ]]; then
       mesg="No chroot has been created so making one now..."
       echo -e "${YELLOW}---->${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}"
       mesg=