Skip to content

Commit

Permalink
Add PKGBUILD generation script
Browse files Browse the repository at this point in the history
  • Loading branch information
tespent committed Nov 12, 2020
1 parent 6c63548 commit 731be42
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 1 deletion.
42 changes: 42 additions & 0 deletions build/build-pkgbuild.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/bin/bash

PKGNAME=zjunet
PKGVER=$(cat $(dirname $0)/../VERSION)
PKGVER_NOREL=${PKGVER%%-*}
PKGREL=${PKGVER:$((${#PKGVER_NOREL}+1))}
if [[ -z $PKGREL ]]; then
PKGREL=1
fi

set -xe

wget https://github.com/QSCTech/$PKGNAME/archive/v$PKGVER.tar.gz -O $PKGNAME-$PKGVER.tar.gz

FILE_MD5=$(md5sum $PKGNAME-$PKGVER.tar.gz | cut -f1 -d' ')
FILE_SHA1=$(sha1sum $PKGNAME-$PKGVER.tar.gz | cut -f1 -d' ')
FILE_SHA256=$(sha256sum $PKGNAME-$PKGVER.tar.gz | cut -f1 -d' ')

cat > PKGBUILD <<EOF
# Maintainer: tespent <me@tespent.cn>
pkgname=$PKGNAME
pkgver=$PKGVER_NOREL
pkgrel=$PKGREL
pkgdesc="Command Line Scripts for ZJU"
url="https://github.com/QSCTech/$PKGNAME"
arch=('any')
license=('GPL')
depends=('xl2tpd>=1.3.7' 'curl' 'dnsutils')
source=("$PKGNAME-$PKGVER.tar.gz::https://github.com/QSCTech/$PKGNAME/archive/v$PKGVER.tar.gz")
md5sums=('$FILE_MD5')
sha1sums=('$FILE_SHA1')
sha256sums=('$FILE_SHA256')
package() {
cd "\$srcdir/$PKGNAME-$PKGVER"
DESTDIR=\$pkgdir PREFIX=/usr ./install.sh
}
EOF

makepkg $*
makepkg --printsrcinfo > .SRCINFO
4 changes: 3 additions & 1 deletion install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,6 @@ EOF
chmod +x $DESTDIR$PREFIX/bin/zjunet
echo "[INFO] Done."
echo
zjunet usage
if [[ -z $DESTDIR ]]; then
zjunet usage
fi

0 comments on commit 731be42

Please sign in to comment.