# Maintainer: exponential #_MANUALEASYREPO='Debian_11' #_MANUALEASYREPO='Ubuntu_22.04' #_MANUALEASYREPO='Raspbian_11' pkgname=easyrpg-repo _pkgver=0.2 pkgver=0.2bookworm pkgrel=1 pkgdesc='Repo for easyrpg, the RPG Maker 2000/2003 clone' arch=('all') license=('GPL3') makedepends=('lsb-release' 'gpg' 'sed' 'grep' 'cat' 'printf') checkdepends=('curl') source=("https://download.opensuse.org/repositories/home:easyrpg/Debian_Unstable/Release.key") b2sums=('b74ba355090a544ff5f6e83995960a7160e95f83031a48fe38e248c1a79a6494c6b5ffb06a3b3820bc57db83a4f64aec2e0ea30660ede7d7f55b50942124c0ab') prepare() { printf "\33[2K\r\033[1;33m%s\033[0m" "Warning:" >&2 echo "Your system must be compatible with the available repos" echo "see: https://software.opensuse.org/download.html?project=home%3Aeasyrpg&package=easyrpg-player" echo "even if incompatible, a package will be build anyway." } build() { if [ -z $_MANUALEASYREPO ]; then _DISTRAW="$(lsb_release -i -s)" case "$_DISTRAW" in Ubuntu) _RELNUM="$(lsb_release -r -s)" export _LNKNAME="xUbuntu_${_RELNUM}" ;; Debian|Raspbian) _RELNUM="$(lsb_release -r -s)" export _LNKNAME="${_DISTRAW}_${_RELNUM}" ;; Linuxmint) # not tested _DIST="$(cat /etc/upstream-release/lsb-release | grep 'DISTRIB_ID=' | sed 's!DISTRIB_ID=!!' | sed s!Ubuntu!xUbuntu! )" _RELNUM="$(cat /etc/upstream-release/lsb-release | grep 'DISTRIB_RELEASE=' | sed 's!DISTRIB_RELEASE=!!')" export _LNKNAME="${_DIST}_${_RELNUM}" ;; *) printf "\33[2K\r\033[1;31m%s\033[0m" "Warning:" >&2 echo "Oups, your variant was not recognized" echo "try setting it manually with a compatible entry" echo "like this \"export _MANUALEASYREPO=Debian_11\"" echo " or this \"export _MANUALEASYREPO=Ubuntu_22.04\"" echo "or define _MANUALEASYREPO inside the PKGBUILD" exit 1 ;; esac else export _LNKNAME="$(echo "$_MANUALEASYREPO" | sed 's!Ubuntu!xUbuntu!')" fi } check() { if ! curl --output /dev/null --silent --head --fail "http://download.opensuse.org/repositories/home:/easyrpg/${_LNKNAME}" then printf "\33[2K\r\033[1;31m%s\033[0m" "Warning:" >&2 echo "Repo doesn't exist" echo "http://download.opensuse.org/repositories/home:/easyrpg/${_LNKNAME}" echo "Aborting" exit 1 fi } pkgver() { _RELNAME="$(lsb_release -c -s)" echo "$_pkgver${_RELNAME}" } package() { mkdir -p "${pkgdir}/etc/apt/sources.list.d" echo "deb [signed-by=/usr/share/keyrings/easyrpg.gpg] http://download.opensuse.org/repositories/home:/easyrpg/${_LNKNAME}/ /" > "${pkgdir}/etc/apt/sources.list.d/easyrpg.list" mkdir -p "${pkgdir}/usr/share/keyrings" cat Release.key | gpg --dearmor > "${pkgdir}/usr/share/keyrings/easyrpg.gpg" 2>/dev/null }