Files
occweb/install.sh
T
dillard 138ee88486 Rename app id from occweb to extended_occweb, prep for App Store
Nextcloud's app id "occweb" is effectively unavailable for a new store
listing: the original Adphi/occweb still owns that App Store slot
(stale, v0.2.3), and el-choco/occweb_v2 has since published a
same-lineage rewrite under its own id. Rather than fight over the
"occweb" name, publish this fork under its own id, matching the
<name> this app has always had: "Extended OCC Web".

Renames every place the literal app id is used: info.xml <id> and the
auto-generated navigation <route>, script()/style() registrations in
templates/index.php, the TemplateResponse app name in
OccController::index(), the /apps/... base URL in js/index.js, and the
'app' log context tag in DbController.php. The GitHub repo name and
its <website>/<bugs>/<repository>/<screenshot> links are unaffected -
those identify the repo, not the Nextcloud app.

Docs (README, INSTALL-AIO.md, install.sh) updated to clone into and
reference an "extended_occweb" directory, since Nextcloud requires the
app folder name to match its id - a plain `git clone` of this repo no
longer produces a correctly-named install directory on its own.

Version bump to 0.4.0 given the scope (breaking change for anyone who
already deployed under the old "occweb" id - requires disable+remove
of the old app and a fresh enable under the new id, not an in-place
upgrade).
2026-09-26 12:51:21 +02:00

61 lines
2.0 KiB
Bash
Executable File

#!/usr/bin/env bash
#
# Post-clone install script for occweb (Nextcloud app id: extended_occweb).
#
# Usage (from nextcloud/apps/) - clone into "extended_occweb", not the repo's
# own name, since Nextcloud requires the app directory to match its id:
# git clone https://github.com/dillardblom/occweb.git extended_occweb
# bash extended_occweb/install.sh [nextcloud-root] [web-user]
#
# Defaults: nextcloud-root=/var/www/nextcloud, web-user=www-data
#
# What it does:
# 1. Removes dev/CI-only files that aren't needed to run the app
# (tests, CI config, PHPUnit config, composer files, Makefile).
# 2. chown -R's the app directory to the web server user.
# 3. Enables the app via occ.
#
# Note: this deletes files that are tracked in git. If you plan to keep
# updating this install with `git pull`, be aware that a future upstream
# change to one of the removed files could make a plain `git pull` refuse
# to merge (it will tell you so, and you can `git checkout -- <file>` to
# recover it, or re-clone instead of pulling).
set -euo pipefail
NEXTCLOUD_ROOT="${1:-/var/www/nextcloud}"
WEB_USER="${2:-www-data}"
APP_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
APP_NAME="$(basename "$APP_DIR")"
echo "==> App directory: $APP_DIR"
echo "==> App name: $APP_NAME"
echo "==> Nextcloud root: $NEXTCLOUD_ROOT"
echo "==> Web server user: $WEB_USER"
echo
if [ ! -f "$NEXTCLOUD_ROOT/occ" ]; then
echo "error: $NEXTCLOUD_ROOT/occ not found — pass the correct Nextcloud root as the first argument." >&2
exit 1
fi
echo "==> Removing dev/CI-only files not needed at runtime"
rm -rf \
"$APP_DIR/tests" \
"$APP_DIR/.travis.yml" \
"$APP_DIR/phpunit.xml" \
"$APP_DIR/phpunit.integration.xml" \
"$APP_DIR/composer.json" \
"$APP_DIR/composer.lock" \
"$APP_DIR/Makefile"
echo "==> Setting ownership to $WEB_USER:$WEB_USER"
sudo chown -R "$WEB_USER:$WEB_USER" "$APP_DIR"
echo "==> Enabling $APP_NAME"
sudo -u "$WEB_USER" php "$NEXTCLOUD_ROOT/occ" app:enable "$APP_NAME"
echo
echo "==> Done. $APP_NAME is installed and enabled."