From f02435f2fa8c04423f1a0d7eb967490fe27a26cc Mon Sep 17 00:00:00 2001 From: s3lph Date: Sat, 11 Nov 2023 07:05:59 +0100 Subject: [PATCH] feat: initial commit, split off nextcloud packages from s3lph/package-pipeline --- .gitignore | 2 + .skel/helpers.sh | 9 + .skel/nextcloud-app/build-nextcloud-app | 158 ++++++++++++++++++ .skel/remove-nextcloud-release.sh | 24 +++ .woodpecker.yml | 55 ++++++ LICENSE | 20 +++ README.md | 34 ++++ nextcloud-27-app-calendar/package.sh | 10 ++ nextcloud-27-app-contacts/package.sh | 10 ++ nextcloud-27-app-deck/package.sh | 10 ++ nextcloud-27-app-forms/package.sh | 9 + nextcloud-27-app-gpoddersync/package.sh | 10 ++ nextcloud-27-app-gpxpod/package.sh | 10 ++ nextcloud-27-app-groupfolders/package.sh | 10 ++ nextcloud-27-app-mail/package.sh | 9 + nextcloud-27-app-news/package.sh | 9 + nextcloud-27-app-nextpod/package.sh | 8 + nextcloud-27-app-notes/package.sh | 9 + .../nextcloud-notify-push.default | 25 +++ .../nextcloud-notify-push.service | 12 ++ nextcloud-27-app-notify-push/package.sh | 49 ++++++ nextcloud-27-app-polls/package.sh | 10 ++ .../nextcloud-preview-generator.service | 8 + .../nextcloud-preview-generator.timer | 9 + nextcloud-27-app-previewgenerator/package.sh | 17 ++ nextcloud-27-app-richdocuments/package.sh | 10 ++ nextcloud-27-app-richdocumentscode/package.sh | 15 ++ nextcloud-27-app-talk/package.sh | 10 ++ nextcloud-27-app-tasks/package.sh | 10 ++ .../package.sh | 10 ++ nextcloud-27-app-user-oidc/package.sh | 10 ++ nextcloud-27/config.php | 26 +++ nextcloud-27/debian.conffiles | 2 + nextcloud-27/debian.control | 16 ++ nextcloud-27/debian.postinst | 15 ++ nextcloud-27/nextcloud-cron.service | 8 + nextcloud-27/nextcloud-cron.timer | 9 + nextcloud-27/nextcloud.site.conf | 33 ++++ nextcloud-27/occ.sh | 4 + nextcloud-27/package.sh | 79 +++++++++ .../patches/01_isfairuse_userfacing_ui.patch | 33 ++++ 41 files changed, 826 insertions(+) create mode 100644 .gitignore create mode 100644 .skel/helpers.sh create mode 100644 .skel/nextcloud-app/build-nextcloud-app create mode 100755 .skel/remove-nextcloud-release.sh create mode 100644 .woodpecker.yml create mode 100644 LICENSE create mode 100644 README.md create mode 100755 nextcloud-27-app-calendar/package.sh create mode 100755 nextcloud-27-app-contacts/package.sh create mode 100755 nextcloud-27-app-deck/package.sh create mode 100755 nextcloud-27-app-forms/package.sh create mode 100755 nextcloud-27-app-gpoddersync/package.sh create mode 100755 nextcloud-27-app-gpxpod/package.sh create mode 100755 nextcloud-27-app-groupfolders/package.sh create mode 100755 nextcloud-27-app-mail/package.sh create mode 100755 nextcloud-27-app-news/package.sh create mode 100755 nextcloud-27-app-nextpod/package.sh create mode 100755 nextcloud-27-app-notes/package.sh create mode 100644 nextcloud-27-app-notify-push/nextcloud-notify-push.default create mode 100644 nextcloud-27-app-notify-push/nextcloud-notify-push.service create mode 100755 nextcloud-27-app-notify-push/package.sh create mode 100755 nextcloud-27-app-polls/package.sh create mode 100644 nextcloud-27-app-previewgenerator/nextcloud-preview-generator.service create mode 100644 nextcloud-27-app-previewgenerator/nextcloud-preview-generator.timer create mode 100755 nextcloud-27-app-previewgenerator/package.sh create mode 100755 nextcloud-27-app-richdocuments/package.sh create mode 100755 nextcloud-27-app-richdocumentscode/package.sh create mode 100755 nextcloud-27-app-talk/package.sh create mode 100755 nextcloud-27-app-tasks/package.sh create mode 100755 nextcloud-27-app-twofactor-webauthn/package.sh create mode 100755 nextcloud-27-app-user-oidc/package.sh create mode 100644 nextcloud-27/config.php create mode 100644 nextcloud-27/debian.conffiles create mode 100644 nextcloud-27/debian.control create mode 100755 nextcloud-27/debian.postinst create mode 100644 nextcloud-27/nextcloud-cron.service create mode 100644 nextcloud-27/nextcloud-cron.timer create mode 100644 nextcloud-27/nextcloud.site.conf create mode 100755 nextcloud-27/occ.sh create mode 100755 nextcloud-27/package.sh create mode 100644 nextcloud-27/patches/01_isfairuse_userfacing_ui.patch diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..7cbefb7 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +**/build/ +*.deb \ No newline at end of file diff --git a/.skel/helpers.sh b/.skel/helpers.sh new file mode 100644 index 0000000..e638e37 --- /dev/null +++ b/.skel/helpers.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +function github_changelog() { + curl https://api.github.com/repos/$1/releases | jq -r 'reverse | .[] | select(.draft==false and .prerelease==false) | "'"${PKGNAME}"' (\(.name)); urgency=medium\n \(.body // empty | gsub("\n";"\n "))\n -- '"${MAINTAINER}"' \(.created_at | fromdate | strftime("%a, %d %b %Y %T %z"))\n"' | gzip -9n > "${PKGDIR}/usr/share/doc/${PKGNAME}/changelog.gz" +} + +function gitlab_changelog() { + curl https://gitlab.com/api/v4/$1/releases | jq -r 'reverse | .[] | select(.upcoming_release==false) | "'"${PKGNAME}"' (\(.name)); urgency=medium\n \(.description // empty | gsub("\n";"\n "))\n -- '"${MAINTAINER}"' \(.created_at | fromdate | strftime("%a, %d %b %Y %T %z"))\n"' | gzip -9n > "${PKGDIR}/usr/share/doc/${PKGNAME}/changelog.gz" +} diff --git a/.skel/nextcloud-app/build-nextcloud-app b/.skel/nextcloud-app/build-nextcloud-app new file mode 100644 index 0000000..a0aff8c --- /dev/null +++ b/.skel/nextcloud-app/build-nextcloud-app @@ -0,0 +1,158 @@ +#!/bin/bash + +set -exo pipefail + +. $(dirname ${BASH_SOURCE[0]})/../helpers.sh + +export ARCHS=(all) + + +function postinst_configure_pre() { :; } +function postinst_configure_post() { :; } + + +function _vcompare() { + for V in $@; do + if [[ "$V" =~ ^\<[0-9.]*$ ]]; then [[ $(echo -e "$NCMAJOR_OVERRIDE\n${V:1}" | sort -V | head -1) -eq "$NCMAJOR_OVERRIDE" ]] || return 1; + elif [[ "$V" =~ ^\<=[0-9.]*$ ]]; then [[ $(echo -e "$NCMAJOR_OVERRIDE\n${V:2}" | sort -V | head -1) -eq "$NCMAJOR_OVERRIDE" ]] || return 1; + elif [[ "$V" =~ ^\>[0-9.]*$ ]]; then [[ $(echo -e "$NCMAJOR_OVERRIDE\n${V:1}" | sort -rV | head -1) -eq "$NCMAJOR_OVERRIDE" ]] || return 1; + elif [[ "$V" =~ ^\>=[0-9.]*$ ]]; then [[ $(echo -e "$NCMAJOR_OVERRIDE\n${V:2}" | sort -rV | head -1) -eq "$NCMAJOR_OVERRIDE" ]] || return 1; + elif [[ "$V" =~ ^=[0-9.]*$ ]]; then [[ "$NCMAJOR_OVERRIDE" -eq "${V:1}" ]] || return 1; + elif [[ "$V" =~ ^==[0-9.]*$ ]]; then [[ "$NCMAJOR_OVERRIDE" -eq "${V:1}" ]] || return 1; + else + echo "Unknown version string '${V}'" + return 1 + fi + done + return 0 +} + + +function pre_fetch() { :; } +function _fetch() { + cd "${SRCDIR}" + VERSIONS=$(curl -H 'Accept: application/json' "${_NCAPPS_URL}" | jq --arg app "${APP}" -r "${_NCAPPS_JQ}") + while read -r VERSION URL COMPAT; do + if _vcompare $COMPAT; then + echo "Fetching version ${VERSION}" + wget "${URL}" --output-document "app.tar.gz" + tar -xf "app.tar.gz" + return + fi + done <<<$VERSIONS + echo "No compatible app version is available" + exit 1 +} +function post_fetch() { :; } + +function pre_prepare() { :; } +function _prepare() { + mkdir -p \ + "${PKGDIR}/DEBIAN" \ + "${PKGDIR}/usr/share/doc/${PKGNAME}" \ + "${PKGDIR}/usr/lib/nextcloud/nextcloud-apps" + VERSION=$(cat "${SRCDIR}/${APP}/appinfo/info.xml" | xq-python -r .info.version) + SUMMARY=$(cat "${SRCDIR}/${APP}/appinfo/info.xml" | xq-python -r '.info.summary | if type == "array" then (.[] | select(.["@lang"]=="en") | .["#text"]) else (.) end') + DESCRIPTION=$(cat "${SRCDIR}/${APP}/appinfo/info.xml" | xq-python -r '.info.description | if type == "array" then (.[] | select(.["@lang"]=="en") | .["#text"]) else (.) end') + PHP_MIN=$(cat "${SRCDIR}/${APP}/appinfo/info.xml" | xq-python -r '.info.dependencies.php."@min-version"') + PHP_MAX=$(cat "${SRCDIR}/${APP}/appinfo/info.xml" | xq-python -r '.info.dependencies.php."@max-version"') + PHP_DEP="" +# #f [[ "${PHP_MIN}" != "null" ]]; then +# PHP_DEP="${PHP_DEP}, php (>= ${PHP_MIN})" +# fi +# if [[ "${PHP_MAX}" != "null" ]]; then +# # awk increments the last version component, from https://stackoverflow.com/a/69489163 +# PHP_MAX=$(echo "${PHP_MAX}" | awk -F. -v OFS=. '{$NF=$NF+1;print}') +# PHP_DEP="${PHP_DEP}, php (<< ${PHP_MAX})" +# fi + cp -r "${SRCDIR}/${APP}" "${PKGDIR}/usr/lib/nextcloud/nextcloud-apps/${APP}" + cat > "${PKGDIR}/DEBIAN/control" < "${PKGDIR}/DEBIAN/postinst" <" + exit 1 +fi + +if [[ -z "${GITEA_TOKEN}" ]]; then + echo "Missing env: GITEA_TOKEN" + exit 1 +fi + +packages=$(curl -s -H "Authorization: Bearer ${GITEA_TOKEN}" "https://git.kabelsalat.ch/api/v1/packages/s3lph?type=debian&q=nextcloud-$1" | jq -r '.[] | "\(.name)/\(.version)"') + +nextgen=$(curl -s -H "Authorization: Bearer ${GITEA_TOKEN}" "https://git.kabelsalat.ch/api/v1/packages/s3lph?type=debian&q=nextcloud-$(($1+1))" | jq -r length) +if [[ "${nextgen}" -le 0 ]]; then + echo "No packages matching nextcloud-$(($1+1)); refusing deletion of nextcloud-$1" + exit 2 +fi + +for package in $packages; do + echo "$package" + curl -s -H "Authorization: Bearer ${GITEA_TOKEN}" -X DELETE "https://git.kabelsalat.ch/api/v1/packages/s3lph/debian/$package" +done diff --git a/.woodpecker.yml b/.woodpecker.yml new file mode 100644 index 0000000..2af57bd --- /dev/null +++ b/.woodpecker.yml @@ -0,0 +1,55 @@ +--- + +steps: + + # One step per package + + nextcloud-27: &job + image: git.kabelsalat.ch/s3lph/package-pipeline-builder/builder:latest + group: build + failure: ignore + secrets: + - GITEA_API_REPOSITORY_DEB + - GITEA_API_USERNAME + - GITEA_API_PASSWORD + - MAINTAINER + commands: + # woodpecker for some reason sets CI_STEP_NAME to something autogenerated like wp_01h7nk44xbs0kgqabpatbq2qkv_0_step_0 + - | + if echo "$${CI_STEP_NAME}" | grep -Eq '^wp_'; then + export N=$(echo $${CI_STEP_NAME} | cut -d_ -f5) + cd "$(cat .woodpecker.yml | yq -r '.steps | keys[env.N]')" + else + cd "$${CI_STEP_NAME}" + fi + - '[ -x build.sh ] && ./build.sh' + - '[ -x package.sh ] && fakeroot ./package.sh' + - cd build + - lintian *.deb || true + # Upload to the repo + - | + for file in *deb; do + curl --user "$${GITEA_API_USERNAME}:$${GITEA_API_PASSWORD}" \ + --upload-file "$${file}" \ + "$${GITEA_API_REPOSITORY_DEB}" + done + #nextcloud-27-app-calendar: *job + #nextcloud-27-app-contacts: *job + #nextcloud-27-app-deck: *job + #nextcloud-27-app-forms: *job + #nextcloud-27-app-gpoddersync: *job + #nextcloud-27-app-gpxpod: *job + #nextcloud-27-app-groupfolders: *job + #nextcloud-27-app-polls: *job + #nextcloud-27-app-previewgenerator: *job + #nextcloud-27-app-mail: *job + #nextcloud-27-app-news: *job + #nextcloud-27-app-nextpod: *job + #nextcloud-27-app-notes: *job + #nextcloud-27-app-notify-push: *job + #nextcloud-27-app-richdocuments: *job + #nextcloud-27-app-richdocumentscode: *job + #nextcloud-27-app-talk: *job + #nextcloud-27-app-tasks: *job + #nextcloud-27-app-twofactor-webauthn: *job + #nextcloud-27-app-user-oidc: *job diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..6c25ecc --- /dev/null +++ b/LICENSE @@ -0,0 +1,20 @@ +Copyright 2023 s3lph + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..64db65e --- /dev/null +++ b/README.md @@ -0,0 +1,34 @@ +# Nextcloud Debian Packages + +[![status-badge](https://woodpecker.kabelsalat.ch/api/badges/87/status.svg)](https://woodpecker.kabelsalat.ch/repos/87) + +This project automatically builds Debian packages for Nextcloud and +some of its apps for my personal use (and sometimes adapted to my +needs) . + +There is a daily Gitlab-CI run which builds the latest stable version +of each package and pushes them to my private repository. For more +information, please see [https://repo.s3lph.me/]. + +## Packages + +- [nextcloud-27](https://github.com/nextcloud/server) (Code integrity check fails due to patches applied during build process!) +- [nextcloud-27-app-calendar](https://apps.nextcloud.com/apps/calendar) +- [nextcloud-27-app-contacts](https://apps.nextcloud.com/apps/contacts) +- [nextcloud-27-app-deck](https://apps.nextcloud.com/apps/deck) +- [nextcloud-27-app-forms](https://apps.nextcloud.com/apps/forms) +- [nextcloud-27-app-gpoddersync](https://apps.nextcloud.com/apps/gpoddersync) +- [nextcloud-27-app-gpxpod](https://apps.nextcloud.com/apps/gpxpod) +- [nextcloud-27-app-groupfolders](https://apps.nextcloud.com/apps/groupfolders) +- [nextcloud-27-app-polls](https://apps.nextcloud.com/apps/polls) +- [nextcloud-27-app-previewgenerator](https://apps.nextcloud.com/apps/previewgenerator) +- [nextcloud-27-app-mail](https://apps.nextcloud.com/apps/mail) +- [nextcloud-27-app-news](https://apps.nextcloud.com/apps/news) +- [nextcloud-27-app-nextpod](https://apps.nextcloud.com/apps/nextpod) +- [nextcloud-27-app-notes](https://apps.nextcloud.com/apps/notes) +- [nextcloud-27-app-notify-push](https://apps.nextcloud.com/apps/notify_push) +- [nextcloud-27-app-richdocuments](https://apps.nextcloud.com/apps/richdocuments) +- [nextcloud-27-app-richdocumentscode](https://apps.nextcloud.com/apps/richdocumentscode) +- [nextcloud-27-app-tasks](https://apps.nextcloud.com/apps/tasks) +- [nextcloud-27-app-twofactor-webauthn](https://apps.nextcloud.com/apps/twofactor_webauthn) +- [nextcloud-27-app-user-oidc](https://apps.nextcloud.com/apps/user_oidc) diff --git a/nextcloud-27-app-calendar/package.sh b/nextcloud-27-app-calendar/package.sh new file mode 100755 index 0000000..4267df9 --- /dev/null +++ b/nextcloud-27-app-calendar/package.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +. ../.skel/nextcloud-app/build-nextcloud-app + +post_prepare() { + github_changelog nextcloud/calendar +} + +build_nextcloud_app calendar 27 + diff --git a/nextcloud-27-app-contacts/package.sh b/nextcloud-27-app-contacts/package.sh new file mode 100755 index 0000000..103f936 --- /dev/null +++ b/nextcloud-27-app-contacts/package.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +. ../.skel/nextcloud-app/build-nextcloud-app + +post_prepare() { + github_changelog nextcloud/contacts +} + +build_nextcloud_app contacts 27 + diff --git a/nextcloud-27-app-deck/package.sh b/nextcloud-27-app-deck/package.sh new file mode 100755 index 0000000..ff4786c --- /dev/null +++ b/nextcloud-27-app-deck/package.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +. ../.skel/nextcloud-app/build-nextcloud-app + +post_prepare() { + github_changelog nextcloud/deck +} + +build_nextcloud_app deck 27 + diff --git a/nextcloud-27-app-forms/package.sh b/nextcloud-27-app-forms/package.sh new file mode 100755 index 0000000..48f5d79 --- /dev/null +++ b/nextcloud-27-app-forms/package.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +. ../.skel/nextcloud-app/build-nextcloud-app + +post_prepare() { + github_changelog nextcloud/forms +} + +build_nextcloud_app forms 27 diff --git a/nextcloud-27-app-gpoddersync/package.sh b/nextcloud-27-app-gpoddersync/package.sh new file mode 100755 index 0000000..4a665a9 --- /dev/null +++ b/nextcloud-27-app-gpoddersync/package.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +. ../.skel/nextcloud-app/build-nextcloud-app + +post_prepare() { + cat "${PKGDIR}/usr/lib/nextcloud/nextcloud-apps/${APP}/CHANGELOG.md" | gzip -9n > "${PKGDIR}/usr/share/doc/${PKGNAME}/changelog.gz" +} + +build_nextcloud_app gpoddersync 27 + diff --git a/nextcloud-27-app-gpxpod/package.sh b/nextcloud-27-app-gpxpod/package.sh new file mode 100755 index 0000000..32d8302 --- /dev/null +++ b/nextcloud-27-app-gpxpod/package.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +. ../.skel/nextcloud-app/build-nextcloud-app + +post_prepare() { + github_changelog julien-nc/gpxpod +} + +build_nextcloud_app gpxpod 27 + diff --git a/nextcloud-27-app-groupfolders/package.sh b/nextcloud-27-app-groupfolders/package.sh new file mode 100755 index 0000000..5f4cc70 --- /dev/null +++ b/nextcloud-27-app-groupfolders/package.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +. ../.skel/nextcloud-app/build-nextcloud-app + +post_prepare() { + github_changelog nextcloud/groupfolders +} + +build_nextcloud_app groupfolders 27 + diff --git a/nextcloud-27-app-mail/package.sh b/nextcloud-27-app-mail/package.sh new file mode 100755 index 0000000..a78e74c --- /dev/null +++ b/nextcloud-27-app-mail/package.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +. ../.skel/nextcloud-app/build-nextcloud-app + +post_prepare() { + github_changelog nextcloud/mail +} + +build_nextcloud_app mail 27 diff --git a/nextcloud-27-app-news/package.sh b/nextcloud-27-app-news/package.sh new file mode 100755 index 0000000..30e57dd --- /dev/null +++ b/nextcloud-27-app-news/package.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +. ../.skel/nextcloud-app/build-nextcloud-app + +post_prepare() { + github_changelog nextcloud/news +} + +build_nextcloud_app news 27 diff --git a/nextcloud-27-app-nextpod/package.sh b/nextcloud-27-app-nextpod/package.sh new file mode 100755 index 0000000..503c3bf --- /dev/null +++ b/nextcloud-27-app-nextpod/package.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +. ../.skel/nextcloud-app/build-nextcloud-app + +export ADDITIONAL_DEPS=", nextcloud-27-app-gpoddersync" + +build_nextcloud_app nextpod 27 + diff --git a/nextcloud-27-app-notes/package.sh b/nextcloud-27-app-notes/package.sh new file mode 100755 index 0000000..def4941 --- /dev/null +++ b/nextcloud-27-app-notes/package.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +. ../.skel/nextcloud-app/build-nextcloud-app + +post_prepare() { + github_changelog nextcloud/notes +} + +build_nextcloud_app notes 27 diff --git a/nextcloud-27-app-notify-push/nextcloud-notify-push.default b/nextcloud-27-app-notify-push/nextcloud-notify-push.default new file mode 100644 index 0000000..f22165e --- /dev/null +++ b/nextcloud-27-app-notify-push/nextcloud-notify-push.default @@ -0,0 +1,25 @@ +# Mandatory: TCP port to listen on +PORT=7867 + +# The push server can be configured either by loading the config from +# the nextcloud config.php or by setting all options through +# environment variables. +# +# Re-using the configuration from nextcloud is the recommended way, as +# it ensures that the configuration remains in sync. +CONFIG=/var/lib/nextcloud/webroot/config/config.php + +# If using the config.php isn't possible, you can configure the push +# server by setting the following environment variables: + +# connection url for the Nextcloud database +#DATABASE_URL=postgres://user:password@db_host/db_name + +# database prefix configured in Nextcloud +#DATABASE_PREFIX=oc_ + +# connection url for redis +#REDIS_URL=redis://localhost + +# url for the nextcloud instance +#NEXTCLOUD_URL=https://cloud.example.com \ No newline at end of file diff --git a/nextcloud-27-app-notify-push/nextcloud-notify-push.service b/nextcloud-27-app-notify-push/nextcloud-notify-push.service new file mode 100644 index 0000000..df4c955 --- /dev/null +++ b/nextcloud-27-app-notify-push/nextcloud-notify-push.service @@ -0,0 +1,12 @@ +[Unit] +Description=Push daemon for Nextcloud clients + +[Service] +EnvironmentFile=-/etc/default/nextcloud-notify-push +ExecStart=/usr/lib/nextcloud/nextcloud-apps/notify_push/bin/notify_push $CONFIG +User=www-data +Group=www-data +Restart=on-failure + +[Install] +WantedBy=multi-user.target diff --git a/nextcloud-27-app-notify-push/package.sh b/nextcloud-27-app-notify-push/package.sh new file mode 100755 index 0000000..9c18cc6 --- /dev/null +++ b/nextcloud-27-app-notify-push/package.sh @@ -0,0 +1,49 @@ +#!/bin/bash + +. ../.skel/nextcloud-app/build-nextcloud-app + +export ARCHS=(amd64 arm64 armhf) + +function _ncarch() { + case "$1" in + amd64) + echo x86_64 + ;; + arm64) + echo aarch64 + ;; + armhf) + echo armv7 + ;; + *) + echo no such architecture + exit 1 + esac +} + +function post_prepare() { + NCARCH=$(_ncarch $ARCH) + mkdir -p \ + "${PKGDIR}/lib/systemd/system" \ + "${PKGDIR}/etc/default" + mv "${PKGDIR}/usr/lib/nextcloud/nextcloud-apps/notify_push/bin/${NCARCH}/notify_push" \ + "${PKGDIR}/usr/lib/nextcloud/nextcloud-apps/notify_push/bin/notify_push" + find "${PKGDIR}/usr/lib/nextcloud/nextcloud-apps/notify_push/bin/" -type d -mindepth 1 -maxdepth 1 -exec rm -rf {} \; + cp "${ROOT}/nextcloud-notify-push.service" "${PKGDIR}/lib/systemd/system/nextcloud-notify-push.service" + cp "${ROOT}/nextcloud-notify-push.default" "${PKGDIR}/etc/default/nextcloud-notify-push" + cp "${SRCDIR}/notify_push/LICENSE" "${PKGDIR}/usr/share/doc/nextcloud-${NCMAJOR}-app-${APP//_/-}/copyright" + echo '/etc/default/nextcloud-notify-push' > "${PKGDIR}/DEBIAN/conffiles" + github_changelog nextcloud/notify_push +} + +function post_chown() { + chmod 0600 "${PKGDIR}/etc/default/nextcloud-notify-push" + chmod 0755 "${PKGDIR}/usr/lib/nextcloud/nextcloud-apps/notify_push/bin/notify_push" +} + +function postinst_configure_post() { + deb-systemd-helper enable nextcloud-notify-push.service + deb-systemd-invoke restart nextcloud-notify-push.service +} + +build_nextcloud_app notify_push 27 diff --git a/nextcloud-27-app-polls/package.sh b/nextcloud-27-app-polls/package.sh new file mode 100755 index 0000000..c828a53 --- /dev/null +++ b/nextcloud-27-app-polls/package.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +. ../.skel/nextcloud-app/build-nextcloud-app + +post_prepare() { + github_changelog nextcloud/polls +} + +build_nextcloud_app polls 27 + diff --git a/nextcloud-27-app-previewgenerator/nextcloud-preview-generator.service b/nextcloud-27-app-previewgenerator/nextcloud-preview-generator.service new file mode 100644 index 0000000..e9f36bc --- /dev/null +++ b/nextcloud-27-app-previewgenerator/nextcloud-preview-generator.service @@ -0,0 +1,8 @@ +[Unit] +Description=Pre-Generate Nextcloud preview thumbnails + +[Service] +Type=oneshot +ExecStart=/usr/bin/php /var/lib/nextcloud/webroot/occ preview:pre-generate +User=www-data +Group=www-data diff --git a/nextcloud-27-app-previewgenerator/nextcloud-preview-generator.timer b/nextcloud-27-app-previewgenerator/nextcloud-preview-generator.timer new file mode 100644 index 0000000..b718e19 --- /dev/null +++ b/nextcloud-27-app-previewgenerator/nextcloud-preview-generator.timer @@ -0,0 +1,9 @@ +[Unit] +Description=Pre-Generate Nextcloud preview thumbnails + +[Timer] +OnCalendar=*:0/15 +Persistent=true + +[Install] +WantedBy=timers.target diff --git a/nextcloud-27-app-previewgenerator/package.sh b/nextcloud-27-app-previewgenerator/package.sh new file mode 100755 index 0000000..73530a4 --- /dev/null +++ b/nextcloud-27-app-previewgenerator/package.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +. ../.skel/nextcloud-app/build-nextcloud-app + +post_prepare() { + mkdir -p "${PKGDIR}/lib/systemd/system/" + cp "${ROOT}/nextcloud-preview-generator.service" "${PKGDIR}/lib/systemd/system/nextcloud-preview-generator.service" + cp "${ROOT}/nextcloud-preview-generator.timer" "${PKGDIR}/lib/systemd/system/nextcloud-preview-generator.timer" + github_changelog nextcloud/previewgenerator +} + +postinst_configure_post() { + deb-systemd-helper enable nextcloud-preview-generator.timer +} + +build_nextcloud_app previewgenerator 27 + diff --git a/nextcloud-27-app-richdocuments/package.sh b/nextcloud-27-app-richdocuments/package.sh new file mode 100755 index 0000000..6672aa7 --- /dev/null +++ b/nextcloud-27-app-richdocuments/package.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +. ../.skel/nextcloud-app/build-nextcloud-app + +post_prepare() { + github_changelog nextcloud/richdocuments +} + +build_nextcloud_app richdocuments 27 + diff --git a/nextcloud-27-app-richdocumentscode/package.sh b/nextcloud-27-app-richdocumentscode/package.sh new file mode 100755 index 0000000..05be244 --- /dev/null +++ b/nextcloud-27-app-richdocumentscode/package.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +. ../.skel/nextcloud-app/build-nextcloud-app + +export ARCHS=(amd64) + +post_prepare() { + github_changelog CollaboraOnline/richdocumentscode +} + +post_chown() { + chmod 0755 "${PKGDIR}/usr/lib/nextcloud/nextcloud-apps/${APP}/collabora/Collabora_Online.AppImage" +} + +build_nextcloud_app richdocumentscode 27 25 diff --git a/nextcloud-27-app-talk/package.sh b/nextcloud-27-app-talk/package.sh new file mode 100755 index 0000000..4cef111 --- /dev/null +++ b/nextcloud-27-app-talk/package.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +. ../.skel/nextcloud-app/build-nextcloud-app + +post_prepare() { + github_changelog nextcloud/spreed +} + +build_nextcloud_app spreed 27 + diff --git a/nextcloud-27-app-tasks/package.sh b/nextcloud-27-app-tasks/package.sh new file mode 100755 index 0000000..a2b13da --- /dev/null +++ b/nextcloud-27-app-tasks/package.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +. ../.skel/nextcloud-app/build-nextcloud-app + +post_prepare() { + github_changelog nextcloud/tasks +} + +build_nextcloud_app tasks 27 + diff --git a/nextcloud-27-app-twofactor-webauthn/package.sh b/nextcloud-27-app-twofactor-webauthn/package.sh new file mode 100755 index 0000000..5f95981 --- /dev/null +++ b/nextcloud-27-app-twofactor-webauthn/package.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +. ../.skel/nextcloud-app/build-nextcloud-app + +post_prepare() { + cat "${PKGDIR}/usr/lib/nextcloud/nextcloud-apps/${APP}/CHANGELOG.md" | gzip -9n > "${PKGDIR}/usr/share/doc/${PKGNAME}/changelog.gz" +} + +build_nextcloud_app twofactor_webauthn 27 + diff --git a/nextcloud-27-app-user-oidc/package.sh b/nextcloud-27-app-user-oidc/package.sh new file mode 100755 index 0000000..08d971e --- /dev/null +++ b/nextcloud-27-app-user-oidc/package.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +. ../.skel/nextcloud-app/build-nextcloud-app + +post_prepare() { + cat "${PKGDIR}/usr/lib/nextcloud/nextcloud-apps/${APP}/CHANGELOG.md" | gzip -9n > "${PKGDIR}/usr/share/doc/${PKGNAME}/changelog.gz" +} + +build_nextcloud_app user_oidc 27 + diff --git a/nextcloud-27/config.php b/nextcloud-27/config.php new file mode 100644 index 0000000..863fdba --- /dev/null +++ b/nextcloud-27/config.php @@ -0,0 +1,26 @@ + false, + + 'trusted_domains' => [ + 'nextcloud.example.com' + ], + 'overwrite.cli.url' => 'http://nextcloud.example.com', + 'datadirectory' => '/var/lib/nextcloud/data', + 'logfile' => '/var/log/nextcloud/nextcloud.log', + + 'mysql.utf8mb4' => true, + + 'connectivity_check_domains' => ['localhost'], + + 'appstoreenabled' => false, + 'apps_paths' => [ + [ + 'path'=> '/usr/lib/nextcloud/nextcloud-apps', + 'url' => '/dist-apps', + 'writable' => false, + ] + ], + +); diff --git a/nextcloud-27/debian.conffiles b/nextcloud-27/debian.conffiles new file mode 100644 index 0000000..167e38d --- /dev/null +++ b/nextcloud-27/debian.conffiles @@ -0,0 +1,2 @@ +/var/lib/nextcloud/webroot/config/config.php +/etc/apache2/sites-available/nextcloud.site.conf diff --git a/nextcloud-27/debian.control b/nextcloud-27/debian.control new file mode 100644 index 0000000..14cd32a --- /dev/null +++ b/nextcloud-27/debian.control @@ -0,0 +1,16 @@ +Package: nextcloud-27 +Version: __VERSION__ +Maintainer: __MAINTAINER__ +Section: web +Priority: optional +Architecture: all +Depends: php-cli (>=8.0), php-curl, php-gd, php-mbstring, php-xml, php-zip, php-bz2, php-intl +Suggests: apache2, mariadb-server, php-mysql, php-redis +Provides: nextcloud, nextcloud-app-twofactor-totp +Conflicts: nextcloud, nextcloud-app-twofactor-totp +Replaces: nextcloud-app-twofactor-totp +Description: A safe home for all your data. + Nextcloud Hub is the first completely integrated on-premises content + collaboration platform on the market, ready for a new generation of + users who expect seamless online collaboration capabilities out of + the box. diff --git a/nextcloud-27/debian.postinst b/nextcloud-27/debian.postinst new file mode 100755 index 0000000..b4c6f07 --- /dev/null +++ b/nextcloud-27/debian.postinst @@ -0,0 +1,15 @@ +#!/bin/bash + +set -e + +if [[ "$1" == "configure" ]]; then + + deb-systemd-helper enable nextcloud-cron.timer + + # Only run occ upgrade if nextcloud has been configured + if [[ -z "$(grep installed /var/lib/nextcloud/webroot/config/config.php | grep false)" ]]; then + sudo -u www-data php /var/lib/nextcloud/webroot/occ upgrade + sudo -u www-data php /var/lib/nextcloud/webroot/occ maintenance:mode --off + fi + +fi diff --git a/nextcloud-27/nextcloud-cron.service b/nextcloud-27/nextcloud-cron.service new file mode 100644 index 0000000..0b689ca --- /dev/null +++ b/nextcloud-27/nextcloud-cron.service @@ -0,0 +1,8 @@ +[Unit] +Description=Nextcloud Cronjob + +[Service] +Type=oneshot +ExecStart=/usr/bin/php /var/lib/nextcloud/webroot/cron.php +User=www-data +Group=www-data diff --git a/nextcloud-27/nextcloud-cron.timer b/nextcloud-27/nextcloud-cron.timer new file mode 100644 index 0000000..9295c86 --- /dev/null +++ b/nextcloud-27/nextcloud-cron.timer @@ -0,0 +1,9 @@ +[Unit] +Description=Nextcloud Cronjob + +[Timer] +OnCalendar=*:0/5 +Persistent=true + +[Install] +WantedBy=timers.target diff --git a/nextcloud-27/nextcloud.site.conf b/nextcloud-27/nextcloud.site.conf new file mode 100644 index 0000000..0aa033d --- /dev/null +++ b/nextcloud-27/nextcloud.site.conf @@ -0,0 +1,33 @@ + + + ServerName nextcloud.example.com + + DocumentRoot /var/lib/nextcloud/webroot + Alias /dist-apps /usr/lib/nextcloud/nextcloud-apps + + + Require all granted + AllowOverride All + Options FollowSymLinks MultiViews + + + + Require all granted + AllowOverride All + Options FollowSymLinks MultiViews + + + + Dav off + + + + RewriteEngine on + RewriteRule ^\.well-known/host-meta /public.php?service=host-meta [QSA,L] + RewriteRule ^\.well-known/host-meta\.json /public.php?service=host-meta-json [QSA,L] + RewriteRule ^\.well-known/webfinger /public.php?service=webfinger [QSA,L] + RewriteRule ^\.well-known/carddav /remote.php/dav/ [R=301,L] + RewriteRule ^\.well-known/caldav /remote.php/dav/ [R=301,L] + + + \ No newline at end of file diff --git a/nextcloud-27/occ.sh b/nextcloud-27/occ.sh new file mode 100755 index 0000000..541b5ed --- /dev/null +++ b/nextcloud-27/occ.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +/usr/bin/sudo -u www-data -- /usr/bin/php /var/lib/nextcloud/webroot/occ $@ + diff --git a/nextcloud-27/package.sh b/nextcloud-27/package.sh new file mode 100755 index 0000000..31ae049 --- /dev/null +++ b/nextcloud-27/package.sh @@ -0,0 +1,79 @@ +#!/bin/bash + +set -exo pipefail + +. ../.skel/helpers.sh + +VERSION=27 + +URL="https://download.nextcloud.com/server/releases/latest-${VERSION}.tar.bz2" + +ROOT=$(pwd) +function fetch() { + cd "${SRCDIR}" + wget "${URL}" --output-document "nextcloud-${VERSION}.tar.bz2" + tar -xf "nextcloud-${VERSION}.tar.bz2" + patch --strip=1 --directory="${SRCDIR}" --ignore-whitespace < "${ROOT}/patches/01_isfairuse_userfacing_ui.patch" +} + +function prepare() { + mkdir -p \ + "${PKGDIR}/DEBIAN" \ + "${PKGDIR}/var/lib/nextcloud" \ + "${PKGDIR}/usr/lib/nextcloud" \ + "${PKGDIR}/var/lib/nextcloud/data" \ + "${PKGDIR}/lib/systemd/system" \ + "${PKGDIR}/var/log/nextcloud" \ + "${PKGDIR}/usr/local/bin" \ + "${PKGDIR}/etc/apache2/sites-available" \ + "${PKGDIR}/usr/share/doc/${PKGNAME}" + VERSION=$(cat "${SRCDIR}/nextcloud/version.php" | grep "OC_VersionString" | cut -d"'" -f2) + cp -r "${SRCDIR}/nextcloud" "${PKGDIR}/var/lib/nextcloud/webroot" + mv "${PKGDIR}/var/lib/nextcloud/webroot/apps" "${PKGDIR}/usr/lib/nextcloud/nextcloud-apps" + cp "${ROOT}/config.php" "${PKGDIR}/var/lib/nextcloud/webroot/config/config.php" + cp "${ROOT}/debian.control" "${PKGDIR}/DEBIAN/control" + cp "${ROOT}/debian.conffiles" "${PKGDIR}/DEBIAN/conffiles" + cp "${ROOT}/debian.postinst" "${PKGDIR}/DEBIAN/postinst" + cp "${ROOT}/nextcloud-cron.service" "${ROOT}/nextcloud-cron.timer" "${PKGDIR}/lib/systemd/system/" + cp "${ROOT}/nextcloud.site.conf" "${PKGDIR}/etc/apache2/sites-available/" + cp "${ROOT}/occ.sh" "${PKGDIR}/usr/local/bin/occ" + sed -re "s/__VERSION__/${VERSION}/g" -i "${PKGDIR}/DEBIAN/control" + sed -re "s/__MAINTAINER__/${MAINTAINER}/g" -i "${PKGDIR}/DEBIAN/control" + cp "${SRCDIR}/nextcloud/COPYING" "${PKGDIR}/usr/share/doc/${PKGNAME}/copyright" + github_changelog nextcloud/server + find "${PKGDIR}" -exec touch -m --reference "${SRCDIR}/nextcloud/version.php" {} \; +} + +function _chown() { + chown 0:0 -R "${PKGDIR}/" + # www-data:www-data + chown 33:33 -R \ + "${PKGDIR}/var/lib/nextcloud" \ + "${PKGDIR}/var/log/nextcloud" \ + "${PKGDIR}/usr/lib/nextcloud" + find "${PKGDIR}/var/lib/nextcloud/webroot" "${PKGDIR}/var/log/nextcloud" -type f -exec chmod 0640 {} \; + find "${PKGDIR}/var/lib/nextcloud/webroot" "${PKGDIR}/var/log/nextcloud" -type d -exec chmod 0750 {} \; + find "${PKGDIR}/usr/lib/nextcloud" -type f -exec chmod 0644 {} \; + find "${PKGDIR}/usr/lib/nextcloud" -type d -exec chmod 0755 {} \; + ln -sf "/var/lib/nextcloud/webroot/core" "${PKGDIR}/usr/lib/nextcloud/core" +} + +function package() { + cd "${BUILDDIR}" + dpkg-deb --build "${PKGDIR}" "${BUILDDIR}" +} + +function build() { + export PKGNAME="nextcloud-${VERSION}" + export BUILDDIR=${ROOT}/build + export SRCDIR=${ROOT}/build/srcdir + export PKGDIR=${ROOT}/build/pkgdir + mkdir -p ${SRCDIR} ${PKGDIR} + fetch + prepare + _chown + package +} + + +build diff --git a/nextcloud-27/patches/01_isfairuse_userfacing_ui.patch b/nextcloud-27/patches/01_isfairuse_userfacing_ui.patch new file mode 100644 index 0000000..a983b8f --- /dev/null +++ b/nextcloud-27/patches/01_isfairuse_userfacing_ui.patch @@ -0,0 +1,33 @@ +diff -3ur a/nextcloud/apps/settings/templates/settings/personal/personal.info.php b/nextcloud/apps/settings/templates/settings/personal/personal.info.php +--- a/nextcloud/apps/settings/templates/settings/personal/personal.info.php 2022-10-21 16:18:20.730871392 +0200 ++++ b/nextcloud/apps/settings/templates/settings/personal/personal.info.php 2022-10-21 16:23:38.133437330 +0200 +@@ -35,13 +35,6 @@ + 'vue-settings-personal-info', + ]); + ?> +- +-
+-
+- t('This community release of Nextcloud is unsupported and instant notifications are unavailable.')); ?> +-
+-
+- + +
+diff -3ur a/nextcloud/core/Controller/LoginController.php b/nextcloud/core/Controller/LoginController.php +--- a/nextcloud/core/Controller/LoginController.php 2022-10-21 16:18:20.610870426 +0200 ++++ b/nextcloud/core/Controller/LoginController.php 2022-10-21 16:19:52.921615072 +0200 +@@ -147,12 +147,6 @@ + } + + $loginMessages = $this->session->get('loginMessages'); +- if (!$this->manager->isFairUseOfFreePushService()) { +- if (!is_array($loginMessages)) { +- $loginMessages = [[], []]; +- } +- $loginMessages[1][] = $this->l10n->t('This community release of Nextcloud is unsupported and push notifications are limited.'); +- } + if (is_array($loginMessages)) { + [$errors, $messages] = $loginMessages; + $this->initialStateService->provideInitialState('core', 'loginMessages', $messages);