18 lines
1.3 KiB
Bash
Executable File
18 lines
1.3 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
if [[ $# -ne 1 ]]; then echo "Usage: ./Licensing\\ Server/install-overlay.sh /path/to/laravel-app" >&2; exit 2; fi
|
|
SRC="$(cd "$(dirname "$0")" && pwd)"; DST="$(cd "$1" && pwd)"
|
|
for dir in app config database routes tests resources; do [[ -d "$SRC/$dir" ]] && cp -R "$SRC/$dir/." "$DST/$dir/"; done
|
|
[[ -f "$DST/routes/web.php" ]] || printf '%s\n' '<?php' 'use Illuminate\Support\Facades\Route;' > "$DST/routes/web.php"
|
|
grep -q "web.stage5.php" "$DST/routes/web.php" || printf "\nrequire __DIR__.'/web.stage5.php';\n" >> "$DST/routes/web.php"
|
|
[[ -f "$DST/routes/api.php" ]] || printf '%s\n' '<?php' > "$DST/routes/api.php"
|
|
grep -q "api.stage4.php" "$DST/routes/api.php" || printf "\nrequire __DIR__.'/api.stage4.php';\n" >> "$DST/routes/api.php"
|
|
if ! grep -q 'RsyncStudioLicensingServiceProvider' "$DST/bootstrap/providers.php"; then python3 - "$DST/bootstrap/providers.php" <<'PY'
|
|
import sys
|
|
p=sys.argv[1]; s=open(p).read(); marker='return ['; s=s.replace(marker, marker+"\n App\\Providers\\RsyncStudioLicensingServiceProvider::class,",1); open(p,'w').write(s)
|
|
PY
|
|
fi
|
|
printf '\nStage 5 files copied into %s\n' "$DST"
|
|
printf 'Run: php artisan migrate && php artisan optimize:clear\n'
|
|
printf 'Then create an administrator with rsync-studio:admin.\n'
|