Files
occweb/install.sh
T
dillard 20bdb7dcd6 Fix install/clone instructions to point at our fork, revert max-version to 35
README.md and install.sh's install instructions still told new users to
git clone the abandoned upstream (fanategorius/occweb), which lacks all
of this fork's fixes. Point those at dillardblom/occweb; leave the
Credits section's links to Adphi/fanategorius as-is since those are
deliberate attribution, not install instructions. Also repoint the
README screenshot badge, which was hotlinking Adphi's repo.

composer.json still listed only the original author; add ourselves
alongside, matching the info.xml author field.

Revert max-version 40->35: 35 was fanategorius's own tested release
value (commit 7c09dd2), not a guess. Bumping to 40 was our own
speculative headroom into an untested future major - exactly the
pattern this project's own history already reverted twice, for the
same stated reason ("hasn't been tested against newer Nextcloud
releases"). Getting auto-disabled by the compat check on an untested
major is the correct, safe failure mode; claiming compatibility we
haven't verified is not. 35 still satisfies the Codex finding (no
narrowing below a previously-validated ceiling) without guessing ahead.
2026-09-26 03:50:37 +02:00

60 lines
1.8 KiB
Bash
Executable File

#!/usr/bin/env bash
#
# Post-clone install script for occweb.
#
# Usage (from nextcloud/apps/):
# git clone https://github.com/dillardblom/occweb.git
# bash 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."