[forgejo-bin] fix rc script; adapt to upstream changes

Signed-off-by: Gwenhael Le Moine <gwenhael.le.moine@gmail.com>
This commit is contained in:
Gwenhael Le Moine 2023-12-11 09:11:38 +01:00
parent a4279530ef
commit 50a4c2b4ec
No known key found for this signature in database
GPG key ID: FDFE3669426707A7

View file

@ -5,7 +5,7 @@ CWD=$(pwd)
PRGNAM=$(basename $CWD) PRGNAM=$(basename $CWD)
VERSION=${VERSION:-$(curl -q https://codeberg.org/forgejo/forgejo/releases.rss | grep title | head -n2 | tail -n1 | sed 's|<title>||g' | sed 's|</title>||g' | xargs)} VERSION=${VERSION:-$(curl -q https://codeberg.org/forgejo/forgejo/releases.rss | grep title | head -n2 | tail -n1 | sed 's|<title>||g' | sed 's|</title>||g' | xargs)}
ARCH=${ARCH:-$(uname -m)} ARCH=${ARCH:-$(uname -m)}
BUILD=${BUILD:-1} BUILD=${BUILD:-5}
TAG=${TAG:-gwh} TAG=${TAG:-gwh}
TMP=${TMP:-/tmp/$TAG} TMP=${TMP:-/tmp/$TAG}
@ -62,7 +62,7 @@ chown -R gitea:gitea $PKG/var/log/gitea
) )
mkdir -p $PKG/etc/rc.d/ mkdir -p $PKG/etc/rc.d/
cat <<EOF > $PKG/etc/rc.d/rc.gitea cat <<EOF > $PKG/etc/rc.d/rc.$PRGNAM
#!/bin/bash #!/bin/bash
#Slackware startup deamon script #Slackware startup deamon script
@ -83,35 +83,39 @@ OPTIONS=" --config /etc/gitea/app.ini"
PIDFILE=/var/lib/gitea/gitea.pid PIDFILE=/var/lib/gitea/gitea.pid
GITEA_WORK_DIR=$GITEA_WORK_DIR
func_stop() { func_stop() {
[ -e \$PIDFILE ] && kill \$(cat \$PIDFILE) [ -e \$PIDFILE ] && kill \$(cat \$PIDFILE)
# if [ "\$(ps aux | grep \$PROCESSNAME | grep -v grep)" ]; then rm \$PIDFILE
# echo -n "Stopping \$NAME ... "
# killall \$PROCESSNAME
# sleep 2
# fi
if [ ! "\$(ps aux | grep \$PROCESSNAME | grep -v grep)" ]; then if [ ! "\$(pgrep gitea)" ]; then
echo "Done!"
else
echo "Error!" echo "Error!"
else
echo "Stopped!"
fi fi
} }
func_start() { func_start() {
echo -n "Starting \$NAME ... " echo -n "Starting \$NAME ... "
su - \$USERNAME -c "GITEA_WORK_DIR=$GITEA_WORK_DIR \$CMD --pid \$PIDFILE \$OPTIONS" & su - \$USERNAME -c "\$CMD \$OPTIONS" &
echo \$\$ > \$PIDFILE
sleep 2 sleep 2
if [ "\$(ps aux | grep \$PROCESSNAME | grep -v grep)" ]; then if [ "\$(pgrep gitea)" ]; then
echo "Done!" echo "Started!"
else else
echo "Error!" echo "Error!"
fi fi
} }
func_status() {
if [ "\$(pgrep gitea)" ]; then
echo "Running!"
else
echo "NOT running!"
fi
}
case \$1 in case \$1 in
"start") "start")
@ -127,12 +131,17 @@ case \$1 in
sleep 2 sleep 2
func_start func_start
;; ;;
"status")
func_status
;;
*) *)
echo "Usage; start|stop|restart" echo "Usage; start|stop|restart"
;; ;;
esac esac
EOF EOF
chmod +x $PKG/etc/rc.d/rc.gitea chmod +x $PKG/etc/rc.d/rc.$PRGNAM
mkdir -p $PKG/install mkdir -p $PKG/install
cat <<EOF > $PKG/install/slack-desc cat <<EOF > $PKG/install/slack-desc
@ -146,14 +155,14 @@ cat <<EOF > $PKG/install/slack-desc
|-----handy-ruler--------------------------------------------------------| |-----handy-ruler--------------------------------------------------------|
$PRGNAM: $PRGNAM (A painless self-hosted Git service.) $PRGNAM: $PRGNAM (A painless self-hosted Git service.)
$PRGNAM: $PRGNAM:
$PRGNAM: Gitea is a community managed fork of Gogs, lightweight code hosting $PRGNAM: Forgejo is a self-hosted lightweight software forge.
$PRGNAM: solution written in Go and published under the MIT license. $PRGNAM: Easy to install and low maintenance, it just does the job.
$PRGNAM: $PRGNAM:
$PRGNAM: edit /etc/gitea/app.ini $PRGNAM: edit /etc/gitea/app.ini
$PRGNAM: see https://docs.gitea.io/en-us/config-cheat-sheet/ $PRGNAM: see https://forgejo.org/docs/latest/admin/config-cheat-sheet/
$PRGNAM: $PRGNAM:
$PRGNAM: $PRGNAM:
$PRGNAM: https://gitea.io/ $PRGNAM: https://forgejo.org/
$PRGNAM: $PRGNAM:
EOF EOF