#!/bin/bash # # SlackBuild script for gitea # License: GNU General Public License Version 3 # Template automatically generated by pacoteco # Copyright 2026 by Ruben Carlo Benante # All rights reserved. # # Redistribution and use of this script, with or without modification, # is permitted provided that the conditions from the license are met. # # THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE # GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER # IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN # IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #----------------------------------------------------------------------# # More information in the COPYING, README and gitea.info files. # #----------------------------------------------------------------------# # Save current working directory (slackbuilds/) ######################## cd $(dirname $0) ; CWD=$(pwd) # Program metadata ##################################################### PRGNAM=gitea VERSION=${VERSION:-1.25.5} BUILD=${BUILD:-1} TAG=${TAG:-_SBo} PKGTYPE=${PKGTYPE:-tgz} # Architecture detection ############################################### ARCH="" # Set to ARCH="noarch" if it is a script if [ -z "${ARCH}" ]; then case "$(uname -m)" in i?86) ARCH=i586 ;; arm*) ARCH=arm ;; x86_64) ARCH=x86_64 ;; *) ARCH=$(uname -m) ; echo "Warning: unknown architecture" ;; esac fi # PRINT_PACKAGE_NAME section ########################################### if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then echo "${PRGNAM}-${VERSION}-${ARCH}-${BUILD}${TAG}.${PKGTYPE}" exit 0 fi # Set up build environment ############################################# TMP=${TMP:-/tmp/SBo} PKG=${TMP}/package-${PRGNAM} OUTPUT=${OUTPUT:-/tmp} PRGVERSRC="${PRGNAM}-${VERSION}-src" # Exit on errors ####################################################### set -e # Prepare staging area ################################################# rm -rf ${PKG} mkdir -p ${TMP} ${PKG} ${OUTPUT} cd ${TMP} || { echo "Can't change into ${TMP} directory" ; exit 1 ; } rm -rf ${PRGVERSRC} # Extract source tarball ############################################### if [ -f ${CWD}/${PRGVERSRC}.tar.gz ]; then tar -xvf ${CWD}/${PRGVERSRC}.tar.gz else echo "Error: ${CWD}/${PRGVERSRC}.tar.gz not found" exit 1 fi # Change to source directory ########################################### cd "${PRGVERSRC}" || { echo "Can't change into ${PRGVERSRC} directory" ; exit 1 ; } # Set ownership and permissions ######################################## chown -R root:root . find -L . \ \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 -o -perm 511 \) \ -exec chmod 755 {} \; -o \ \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 -o -perm 440 -o -perm 400 \) \ -exec chmod 644 {} \; # Build source ######################################################### make ARCH=${ARCH} # Install files from appletree (MakeInstall created by pacoteco -m) #### # Alternative installation method: # make install DESTDIR=${PKG} # Install files from appletree (MakeInstall created by pacoteco -m) # PACOTECO MARKER - DO NOT REMOVE - INSTALL COMMANDS - BEGIN ########### # Slackbuild files to install/ directory install -Dm 0644 ${CWD}/slack-desc ${PKG}/install/slack-desc install -Dm 0644 ${CWD}/doinst.sh ${PKG}/install/doinst.sh # SlackBuild files to usr/doc/ directory install -Dm 0644 ${CWD}/slack-desc ${PKG}/usr/doc/gitea-1.25.5/slack-desc install -Dm 0644 ${CWD}/doinst.sh ${PKG}/usr/doc/gitea-1.25.5/doinst.sh install -Dm 0644 ${CWD}/gitea.info ${PKG}/usr/doc/gitea-1.25.5/gitea.info install -Dm 0644 ${CWD}/README ${PKG}/usr/doc/gitea-1.25.5/README install -Dm 0644 ${CWD}/COPYING ${PKG}/usr/doc/gitea-1.25.5/COPYING install -Dm 0644 ${CWD}/gitea.SlackBuild ${PKG}/usr/doc/gitea-1.25.5/gitea.SlackBuild # Documentation, man pages and package files install -Dm 644 ${TMP}/${PRGVERSRC}/build/.gitkeep ${PKG}/var/lib/gitea/custom/public/assets/img/.gitkeep install -Dm 644 ${TMP}/${PRGVERSRC}/build/.gitkeep ${PKG}/var/lib/gitea/log/.gitkeep install -Dm 644 ${TMP}/${PRGVERSRC}/build/.gitkeep ${PKG}/var/lib/gitea/data/.gitkeep install -Dm 640 ${TMP}/${PRGVERSRC}/build/app.ini.new ${PKG}/etc/gitea/app.ini.new install -Dm 644 ${TMP}/${PRGVERSRC}/build/rc.gitea.new ${PKG}/etc/rc.d/rc.gitea.new install -Dm 755 ${TMP}/${PRGVERSRC}/build/gitea ${PKG}/usr/bin/gitea install -Dm 644 ${TMP}/${PRGVERSRC}/build/COPYING ${PKG}/usr/doc/gitea-1.25.5/COPYING install -Dm 644 ${TMP}/${PRGVERSRC}/build/VERSION ${PKG}/usr/doc/gitea-1.25.5/VERSION # PACOTECO MARKER - DO NOT REMOVE - INSTALL COMMANDS - END ############# # Install douninst.sh (not managed by pacoteco) ######################## install -Dm 0644 ${CWD}/douninst.sh ${PKG}/install/douninst.sh # Strip binaries (optional, uncomment if needed) ####################### find ${PKG} -print0 | xargs -0 file | grep -e "executable" -e "shared object" \ | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true # Compress man pages (done by make) #################################### # find ${PKG}/usr/man -type f -exec gzip -9 {} \; # for i in $( find ${PKG}/usr/man -type l ) ; do ln -s $( readlink ${i} ).gz ${i}.gz ; rm ${i} ; done # Make the package ##################################################### cd ${PKG} /sbin/makepkg -l y -c n ${OUTPUT}/${PRGNAM}-${VERSION}-${ARCH}-${BUILD}${TAG}.${PKGTYPE} #----------------------------------------------------------------------- # vi: set ai et ts=4 sw=4 tw=0 wm=0 fo=croql syn=sh : Shell Vim modeline # Template by Dr. Beco Version 20250704.084004