Second commit

This commit is contained in:
MatMoul 2023-01-14 00:24:36 +01:00
parent 1050702522
commit 0ad6dbf3a9
5 changed files with 35 additions and 37 deletions

View File

@ -64,6 +64,16 @@ getPluginFile() { # $1=PKGDIR $2=PKGNAME $3=PLUGINDIR
echo "${PLUGINDIR}"/"${PLUGIN}"
fi
}
updatePkgSums() { # $1=FILES
local -r FILES=${1}
local TMPDIR=""
TMPDIR=$(mktemp -d)
cp -r "${FILES}/*" "${TMPDIR}"
chown -R pkgbuilder "${TMPDIR}"
sudo -u pkgbuilder updpkgsums "${TMPDIR}"/PKGBUILD
cp -r "${TMPDIR}"/PKGBUILD "${FILES}/"
rm -rf "${TMPDIR}"
}
notify() {
if [ ${NOTIFY} == 0 ]; then
return 0
@ -127,6 +137,10 @@ pkgBuild() { # $1=PKGNAME
if ! PLUGINFILE=$(getPluginFile "${PKGDIR}" "${PKGNAME}" "${PLUGINDIR}"); then
return 1
fi
# shellcheck disable=SC2034 # Variable for plugin
local -r PKGSETTINGS=${PKGDIR}/${PKGNAME}/settings
# shellcheck disable=SC2034 # Variable for plugin
local -r PKGBUILD="${PKGDIR}/${PKGNAME}/files/PKGBUILD"
. "${PLUGINFILE}"
local PKGFILES=""
if ! PKGFILES=$(plugin_getpkgfiles "${PKGDIR}" "${PKGNAME}"); then
@ -243,6 +257,10 @@ pkgBump() { # $1=PKGNAME
if ! PLUGINFILE=$(getPluginFile "${PKGDIR}" "${PKGNAME}" "${PLUGINDIR}"); then
return 1
fi
# shellcheck disable=SC2034 # Variable for plugin
local -r PKGSETTINGS=${PKGDIR}/${PKGNAME}/settings
# shellcheck disable=SC2034 # Variable for plugin
local -r PKGBUILD="${PKGDIR}/${PKGNAME}/files/PKGBUILD"
. "${PLUGINFILE}"
if ! plugin_isbumpable; then
return 1
@ -262,6 +280,10 @@ pkgCheckUpdate() { # $1=PKGNAME
if ! PLUGINFILE=$(getPluginFile "${PKGDIR}" "${PKGNAME}" "${PLUGINDIR}"); then
return 1
fi
# shellcheck disable=SC2034 # Variable for plugin
local -r PKGSETTINGS=${PKGDIR}/${PKGNAME}/settings
# shellcheck disable=SC2034 # Variable for plugin
local -r PKGBUILD="${PKGDIR}/${PKGNAME}/files/PKGBUILD"
. "${PLUGINFILE}"
local -r PKGVERSION=$(readSetting "${PKGDIR}"/"${PKGNAME}"/settings "version" "0")
local -r PKGPLUGIN=$(readSetting "${PKGDIR}"/"${PKGNAME}"/settings "plugin" "")
@ -310,6 +332,10 @@ pkgUpdate() { # $1=PKGNAME
if ! PLUGINFILE=$(getPluginFile "${PKGDIR}" "${PKGNAME}" "${PLUGINDIR}"); then
return 1
fi
# shellcheck disable=SC2034 # Variable for plugin
local -r PKGSETTINGS=${PKGDIR}/${PKGNAME}/settings
# shellcheck disable=SC2034 # Variable for plugin
local -r PKGBUILD="${PKGDIR}/${PKGNAME}/files/PKGBUILD"
. "${PLUGINFILE}"
if ! plugin_isupdatable; then
return 1

View File

@ -13,12 +13,11 @@ plugin_getpkgfiles() {
}
plugin_bump() {
local -r PKGREL=$(readSetting "${PKGDIR}"/"${PKGNAME}"/files/PKGBUILD "pkgrel" 0)
sed -i "s/pkgrel=.*/pkgrel=$((PKGREL+1))/" "${PKGDIR}"/"${PKGNAME}"/files/PKGBUILD
local -r PKGREL=$(readSetting "${PKGBUILD}" "pkgrel" 0)
sed -i "s/pkgrel=.*/pkgrel=$((PKGREL+1))/" "${PKGBUILD}"
}
plugin_getlatestversion() {
local -r PKGSETTINGS=${PKGDIR}/${PKGNAME}/settings
local -r GITHUBUSER=$(readSetting "${PKGSETTINGS}" "githubuser" "")
local -r GITHUBREPO=$(readSetting "${PKGSETTINGS}" "githubrepo" "")
local -r GITBRANCH=$(readSetting "${PKGSETTINGS}" "gitbranch" "")
@ -40,7 +39,6 @@ plugin_getlatestversion() {
}
plugin_update() {
local -r PKGSETTINGS=${PKGDIR}/${PKGNAME}/settings
local -r GITHUBUSER=$(readSetting "${PKGSETTINGS}" "githubuser" "")
local -r GITHUBREPO=$(readSetting "${PKGSETTINGS}" "githubrepo" "")
local -r GITBRANCH=$(readSetting "${PKGSETTINGS}" "gitbranch" "")
@ -60,7 +58,6 @@ plugin_update() {
writeSetting "${PKGSETTINGS}" "pkgrev" "$((PKGREVISION + 1))"
writeSetting "${PKGSETTINGS}" "pkgrel" "1"
local -r PKGBUILD="${PKGDIR}/${PKGNAME}/files/PKGBUILD"
writeSetting "${PKGBUILD}" "_githubuser" "${GITHUBUSER}"
writeSetting "${PKGBUILD}" "_githubrepo" "${GITHUBREPO}"
writeSetting "${PKGBUILD}" "_gitcommit" "${ONLINECOMMIT}"

View File

@ -13,12 +13,11 @@ plugin_getpkgfiles() {
}
plugin_bump() {
local -r PKGREL=$(readSetting "${PKGDIR}"/"${PKGNAME}"/files/PKGBUILD "pkgrel" 0)
sed -i "s/pkgrel=.*/pkgrel=$((PKGREL+1))/" "${PKGDIR}"/"${PKGNAME}"/files/PKGBUILD
local -r PKGREL=$(readSetting "${PKGBUILD}" "pkgrel" 0)
sed -i "s/pkgrel=.*/pkgrel=$((PKGREL+1))/" "${PKGBUILD}"
}
plugin_getlatestversion() {
local -r PKGSETTINGS=${PKGDIR}/${PKGNAME}/settings
local -r GITHUBUSER=$(readSetting "${PKGSETTINGS}" "githubuser" "")
local -r GITHUBREPO=$(readSetting "${PKGSETTINGS}" "githubrepo" "")
local GITHUBTAGNAME=""
@ -44,7 +43,6 @@ plugin_getlatestversion() {
}
plugin_update() {
local -r PKGSETTINGS=${PKGDIR}/${PKGNAME}/settings
local -r GITHUBUSER=$(readSetting "${PKGSETTINGS}" "githubuser" "")
local -r GITHUBREPO=$(readSetting "${PKGSETTINGS}" "githubrepo" "")
local GITHUBTAGNAME=""
@ -68,7 +66,6 @@ plugin_update() {
writeSetting "${PKGSETTINGS}" "pkgrel" "1"
local -r PKGBUILD="${PKGDIR}/${PKGNAME}/files/PKGBUILD"
writeSetting "${PKGBUILD}" "_githubuser" "${GITHUBUSER}"
writeSetting "${PKGBUILD}" "_githubrepo" "${GITHUBREPO}"
writeSetting "${PKGBUILD}" "_pkgtagname" "${GITHUBTAGNAME}"
@ -76,11 +73,5 @@ plugin_update() {
writeSetting "${PKGBUILD}" "pkgrel" "1"
writeSetting "${PKGBUILD}" "pkgver" "${GITHUBVERSION}"
local TMPDIR=""
TMPDIR=$(mktemp -d)
cp -r "${PKGDIR}"/"${PKGNAME}"/files/* "${TMPDIR}"
chown -R pkgbuilder "${TMPDIR}"
sudo -u pkgbuilder updpkgsums "${TMPDIR}"/PKGBUILD
cp -r "${TMPDIR}"/PKGBUILD "${PKGDIR}/${PKGNAME}/files/"
rm -rf "${TMPDIR}"
updatePkgSums "${PKGDIR}"/"${PKGNAME}"/files
}

View File

@ -13,12 +13,11 @@ plugin_getpkgfiles() {
}
plugin_bump() {
local -r PKGREL=$(readSetting "${PKGDIR}"/"${PKGNAME}"/files/PKGBUILD "pkgrel" 0)
sed -i "s/pkgrel=.*/pkgrel=$((PKGREL+1))/" "${PKGDIR}"/"${PKGNAME}"/files/PKGBUILD
local -r PKGREL=$(readSetting "${PKGBUILD}" "pkgrel" 0)
sed -i "s/pkgrel=.*/pkgrel=$((PKGREL+1))/" "${PKGBUILD}"
}
plugin_getlatestversion() {
local -r PKGSETTINGS=${PKGDIR}/${PKGNAME}/settings
local -r GITHUBUSER=$(readSetting "${PKGSETTINGS}" "githubuser" "")
local -r GITHUBREPO=$(readSetting "${PKGSETTINGS}" "githubrepo" "")
local GITHUBTAGNAME=""
@ -44,7 +43,6 @@ plugin_getlatestversion() {
}
plugin_update() {
local -r PKGSETTINGS=${PKGDIR}/${PKGNAME}/settings
local -r GITHUBUSER=$(readSetting "${PKGSETTINGS}" "githubuser" "")
local -r GITHUBREPO=$(readSetting "${PKGSETTINGS}" "githubrepo" "")
local GITHUBTAGNAME=""
@ -68,7 +66,6 @@ plugin_update() {
writeSetting "${PKGSETTINGS}" "pkgrel" "1"
local -r PKGBUILD="${PKGDIR}/${PKGNAME}/files/PKGBUILD"
writeSetting "${PKGBUILD}" "_githubuser" "${GITHUBUSER}"
writeSetting "${PKGBUILD}" "_githubrepo" "${GITHUBREPO}"
writeSetting "${PKGBUILD}" "_pkgtagname" "${GITHUBTAGNAME}"
@ -76,11 +73,5 @@ plugin_update() {
writeSetting "${PKGBUILD}" "pkgrel" "1"
writeSetting "${PKGBUILD}" "pkgver" "${GITHUBVERSION}"
local TMPDIR=""
TMPDIR=$(mktemp -d)
cp -r "${PKGDIR}"/"${PKGNAME}"/files/* "${TMPDIR}"
chown -R pkgbuilder "${TMPDIR}"
sudo -u pkgbuilder updpkgsums "${TMPDIR}"/PKGBUILD
cp -r "${TMPDIR}"/PKGBUILD "${PKGDIR}/${PKGNAME}/files/"
rm -rf "${TMPDIR}"
updatePkgSums "${PKGDIR}"/"${PKGNAME}"/files
}

View File

@ -9,14 +9,7 @@ plugin_isbumpable() {
}
plugin_getpkgfiles() {
local TMPDIR=""
TMPDIR=$(mktemp -d)
cp -r "${PKGDIR}"/"${PKGNAME}"/files/* "${TMPDIR}"
chown -R pkgbuilder "${TMPDIR}"
sudo -u pkgbuilder updpkgsums "${TMPDIR}"/PKGBUILD
cp -r "${TMPDIR}"/PKGBUILD "${PKGDIR}/${PKGNAME}/files/"
rm -rf "${TMPDIR}"
echo "${PKGDIR}/${PKGNAME}/files"
updatePkgSums "${PKGDIR}"/"${PKGNAME}"/files
}
plugin_bump() {