178 lines
4.5 KiB
Text
178 lines
4.5 KiB
Text
|
#!/bin/bash
|
|||
|
|
|||
|
CWD=$(pwd)
|
|||
|
|
|||
|
PRGNAM=$(basename "$CWD")
|
|||
|
VERSION=${VERSION:-latest}
|
|||
|
ARCH=${ARCH:-$(uname -m)}
|
|||
|
BUILD=${BUILD:-2}
|
|||
|
TAG=${TAG:-gwh}
|
|||
|
|
|||
|
TMP=${TMP:-/tmp/$TAG}
|
|||
|
PKG=$TMP/pkg-$PRGNAM
|
|||
|
OUTPUT=${OUTPUT:-/tmp}
|
|||
|
PREFIX=/usr
|
|||
|
|
|||
|
REPOSITORY=${REPOSITORY:-/home/installs/SlackBuilds/_repositories/$PRGNAM}
|
|||
|
|
|||
|
APP_WORK_DIR=/var/lib/gitea
|
|||
|
|
|||
|
# Check if the gitea user and group exist. If not, then bail.
|
|||
|
if [ "$(id -g gitea 2> /dev/null)" != "817" ] || [ "$(id -u gitea 2> /dev/null)" != "817" ]; then
|
|||
|
echo " You must have an 'gitea' user and group to run this script."
|
|||
|
echo " # groupadd -g 817 gitea"
|
|||
|
echo " # useradd -d /var/lib/gitea -g gitea -s /bin/bash -u 817 gitea --system "
|
|||
|
exit 1
|
|||
|
fi
|
|||
|
|
|||
|
# nettoyage préalable
|
|||
|
rm -r "$PKG" "{$TMP:?}/$PRGNAM"
|
|||
|
mkdir -p "$PKG"
|
|||
|
|
|||
|
# mise en place
|
|||
|
[ ! -e "$REPOSITORY" ] && git clone https://codeberg.org/forgejo/forgejo.git "$REPOSITORY"
|
|||
|
cd "$REPOSITORY" || exit 1
|
|||
|
git pull --all
|
|||
|
|
|||
|
mkdir -p "$TMP"
|
|||
|
cp -r "$REPOSITORY" "$TMP/"
|
|||
|
|
|||
|
cd "$TMP/$PRGNAM" || exit 1
|
|||
|
case $VERSION in
|
|||
|
trunk)
|
|||
|
VERSION="git_r$(git rev-list --count HEAD)_$(git log -1 --format=%h)"
|
|||
|
;;
|
|||
|
latest)
|
|||
|
VERSION=$(git describe --tags --abbrev=0)
|
|||
|
git checkout "$VERSION"
|
|||
|
;;
|
|||
|
*)
|
|||
|
git checkout "$VERSION"
|
|||
|
;;
|
|||
|
esac
|
|||
|
|
|||
|
make
|
|||
|
|
|||
|
mkdir -p "$PKG$PREFIX"/bin
|
|||
|
cp gitea "$PKG$PREFIX"/bin/gitea # ${PRGNAM}
|
|||
|
chmod +x "$PKG$PREFIX"/bin/gitea # ${PRGNAM}
|
|||
|
|
|||
|
mkdir -p "$PKG"/etc/gitea/
|
|||
|
cp "$CWD"/app.ini "$PKG"/etc/gitea/app.ini.new
|
|||
|
chown -R gitea:gitea "$PKG"/etc/gitea
|
|||
|
chmod 770 "$PKG"/etc/gitea
|
|||
|
|
|||
|
mkdir -p "$PKG${APP_WORK_DIR}"/{custom,data/gitea-repositories,indexers,public,log,.ssh} |