1
0
Fork 0

initial commit

This commit is contained in:
Sangbum Kim 2017-04-27 23:34:46 +09:00
commit d1ab41a818
5 changed files with 135 additions and 0 deletions

82
PKGBUILD Normal file
View File

@ -0,0 +1,82 @@
# Maintainer: surefire@cryptomile.net
pkgname=changer
pkgver=0+c19cc68+
pkgrel=1
pkgdesc="Inhouse internal user mgnt server"
arch=('i686' 'x86_64')
url="https://amuz.es/gogs/infra/changer"
license=('GPL')
conflicts=('changer')
provides=('changer')
replaces=('changer')
options=('!buildflags')
makedepends=('go' 'git')
source=('git+https://amuz.es/gogs/infra/changer.git'
'changer.service'
'changer.sysusers'
'changer.tmpfiles'
)
backup=('etc/changer/settings.yml')
md5sums=('SKIP'
'8727c6834036210128154d999f5858d1'
'6d2e5b6829b056581771fc05506e8600'
'cea427e3f6dc36d8ffd6cab873ea990b')
install=changer.install
prepare() {
export GOPATH="${srcdir}/gopath"
export GOBIN="$GOPATH/bin"
export PATH=$GOBIN:$PATH
mkdir -p "$GOPATH/src/amuz.es/gogs/infra"
ln -sfT "$srcdir/$pkgname" "$GOPATH/src/amuz.es/gogs/infra/$pkgname"
go get -u github.com/jteeuwen/go-bindata/...
go get -u github.com/kardianos/govendor
go get -u github.com/mailru/easyjson/...
}
pkgver() {
cd "${srcdir}/${pkgname}"
printf '%s+%s+%s' \
$(sed -e 's,/,+,g; s, ,,g' templates/.VERSION) \
$(git rev-list --count HEAD...$(git log --pretty=format:%H -n 1 -- templates/.VERSION)) \
$(git rev-parse --short HEAD) \
;
}
build() {
cd "${GOPATH}/src/amuz.es/gogs/infra/$pkgname"
rm -rf vendor
mkdir vendor
govendor init
govendor fetch -v +missing
easyjson http/iface/rest.go
go-bindata -nomemcopy -ignore .DS_Store -prefix asset/static -o bind/static/data.go -pkg static asset/static/...
go-bindata -nomemcopy -ignore .DS_Store -prefix asset/template -o bind/template/data.go -pkg template asset/template/...
BINARY=changer
VERSION=`git describe --always`
BUILD=`date +%FT%T%z`
export LDFLAGS=
export CGO_ENABLED=0
go build -ldflags "-w -s -X amuz.es/gogs/infra/changer/util.version=${VERSION} -X amuz.es/gogs/infra/changer/util.buildDate=${BUILD}" -o ${BINARY}
strip -x ${BINARY}
}
package() {
cd "${GOPATH}/src/amuz.es/gogs/infra/$pkgname"
install -Dm0755 -t "$pkgdir/usr/bin" ./changer
install -Dm0644 -t "$pkgdir/etc/changer" ./settings.yml
install -Dm0644 -t "$pkgdir/usr/lib/systemd/system" "$srcdir/changer.service"
install -Dm0644 "$srcdir/changer.sysusers" "$pkgdir/usr/lib/sysusers.d/changer.conf"
install -Dm0644 "$srcdir/changer.tmpfiles" "$pkgdir/usr/lib/tmpfiles.d/changer.conf"
}

21
changer.install Normal file
View File

@ -0,0 +1,21 @@
post_install() {
cat <<EOF
:: If you do not have a custom configuration files finish the setup:
1) systemctl start gogs.service
2) open the installation page http://localhost:3000
otherwise:
place your custom configuration files in /var/lib/gogs/custom
EOF
}
post_upgrade() {
if [ ! -d /etc/changer ]; then
mkdir -p /etc/changer
fi
if [ ! -f /etc/gogs/app.ini ] && [ -f /srv/gogs/conf/app.ini ]; then
echo ":: Gogs app.ini copied to new place"
install -d -o gogs -g gogs /etc/gogs/
install -d -o gogs -g gogs /etc/gogs/
install -m644 -o gogs -g gogs -t /etc/gogs/ /srv/gogs/conf/app.ini
fi
}

29
changer.service Normal file
View File

@ -0,0 +1,29 @@
[Unit]
Description=Inhouse internal user mgnt server
Documentation=https://amuz.es
After=syslog.target network-online.target
Wants=network-online.target
[Service]
Type=notify
Restart=always
RestartSec=15
ExecStart=/usr/bin/changer -C /etc/changer/settings.yml -L /var/log/changer -v
WorkingDirectory=/var/lib/changer
#ExecReload=/bin/kill -s HUP $MAINPID
TimeoutStartSec=5
User=changer
Group=changer
# Disable timeout logic and wait until process is stopped
TimeoutStopSec=0
# SIGTERM signal is used to stop Minio
KillSignal=SIGTERM
SendSIGKILL=no
SuccessExitStatus=0
# kill only the docker process, not all processes in the cgroup
KillMode=process
[Install]
WantedBy=default.target

1
changer.sysusers Normal file
View File

@ -0,0 +1 @@
u changer - "Inhouse internal user mgnt server" /var/lib/changer

2
changer.tmpfiles Normal file
View File

@ -0,0 +1,2 @@
d /var/lib/changer 0700 changer changer -
d /var/log/changer 0750 changer log -