mirror of
https://github.com/Boof2015/prism.git
synced 2026-08-17 19:24:03 +02:00
prism-tui PoC
This commit is contained in:
@@ -1,11 +1,51 @@
|
||||
#!/bin/sh
|
||||
# Package post-install hook for Linux .deb/.rpm builds. The app package installs
|
||||
# Prism under /opt, then this copies the bundled native Linux VST3 bundles into
|
||||
# the global VST3 scan path used by Linux DAWs.
|
||||
# Prism under /opt, then this exposes prism-tui on PATH and copies the bundled
|
||||
# native Linux VST3 bundles into the global VST3 scan path used by Linux DAWs.
|
||||
|
||||
set -eu
|
||||
|
||||
DEST_DIR="${PRISM_VST3_DEST_DIR:-/usr/lib/vst3}"
|
||||
TUI_LINK="${PRISM_TUI_LINK_PATH:-/usr/bin/prism-tui}"
|
||||
|
||||
find_tui() {
|
||||
if [ -n "${PRISM_TUI_SOURCE_PATH:-}" ] && [ -f "$PRISM_TUI_SOURCE_PATH" ]; then
|
||||
printf '%s\n' "$PRISM_TUI_SOURCE_PATH"
|
||||
return 0
|
||||
fi
|
||||
|
||||
for executable in \
|
||||
/opt/Prism/resources/tui/prism-tui \
|
||||
/opt/prism/resources/tui/prism-tui
|
||||
do
|
||||
if [ -f "$executable" ]; then
|
||||
printf '%s\n' "$executable"
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
|
||||
return 1
|
||||
}
|
||||
|
||||
install_tui() {
|
||||
tui_source="$(find_tui || true)"
|
||||
if [ -z "$tui_source" ]; then
|
||||
echo "Prism TUI install: bundled executable not found; skipping PATH link." >&2
|
||||
return 0
|
||||
fi
|
||||
|
||||
chmod 755 "$tui_source"
|
||||
if [ -e "$TUI_LINK" ] || [ -L "$TUI_LINK" ]; then
|
||||
if [ -L "$TUI_LINK" ] && [ "$(readlink "$TUI_LINK")" = "$tui_source" ]; then
|
||||
return 0
|
||||
fi
|
||||
echo "Prism TUI install: $TUI_LINK already exists and was left unchanged." >&2
|
||||
return 0
|
||||
fi
|
||||
|
||||
ln -s "$tui_source" "$TUI_LINK"
|
||||
echo "Prism TUI installed at $TUI_LINK"
|
||||
}
|
||||
|
||||
find_source_dir() {
|
||||
if [ -n "${PRISM_VST3_SOURCE_DIR:-}" ] && [ -d "$PRISM_VST3_SOURCE_DIR" ]; then
|
||||
@@ -40,6 +80,8 @@ install_plugin() {
|
||||
cp -a "$source_plugin" "$DEST_DIR/"
|
||||
}
|
||||
|
||||
install_tui
|
||||
|
||||
SOURCE_DIR="$(find_source_dir || true)"
|
||||
if [ -z "$SOURCE_DIR" ]; then
|
||||
echo "Prism VST3 install: bundled VST3 directory not found; skipping plugin install." >&2
|
||||
|
||||
@@ -4,7 +4,42 @@
|
||||
|
||||
set -eu
|
||||
|
||||
# Debian postrm reports upgrades by name; RPM postun reports the number of
|
||||
# installed package versions remaining. Keep shared resources during either
|
||||
# upgrade path and remove them only on a real uninstall.
|
||||
remove_action="${1:-}"
|
||||
case "$remove_action" in
|
||||
upgrade|failed-upgrade|abort-*)
|
||||
exit 0
|
||||
;;
|
||||
''|*[!0-9]*)
|
||||
;;
|
||||
*)
|
||||
if [ "$remove_action" -gt 0 ]; then
|
||||
exit 0
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
DEST_DIR="${PRISM_VST3_DEST_DIR:-/usr/lib/vst3}"
|
||||
TUI_LINK="${PRISM_TUI_LINK_PATH:-/usr/bin/prism-tui}"
|
||||
|
||||
remove_tui_link() {
|
||||
[ -L "$TUI_LINK" ] || return 0
|
||||
tui_target="$(readlink "$TUI_LINK")"
|
||||
case "$tui_target" in
|
||||
/opt/Prism/resources/tui/prism-tui|/opt/prism/resources/tui/prism-tui)
|
||||
rm "$TUI_LINK"
|
||||
;;
|
||||
*)
|
||||
if [ -n "${PRISM_TUI_SOURCE_PATH:-}" ] && [ "$tui_target" = "$PRISM_TUI_SOURCE_PATH" ]; then
|
||||
rm "$TUI_LINK"
|
||||
else
|
||||
echo "Prism TUI removal: $TUI_LINK points elsewhere and was left unchanged." >&2
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
remove_plugin() {
|
||||
rm -rf "$DEST_DIR/$1"
|
||||
@@ -17,5 +52,6 @@ remove_plugin "Prism Loudness Meter.vst3"
|
||||
remove_plugin "Prism Vectorscope.vst3"
|
||||
remove_plugin "Prism Spectrogram.vst3"
|
||||
remove_plugin "Prism Waveform.vst3"
|
||||
remove_tui_link
|
||||
|
||||
echo "Prism VST3 plugins removed from $DEST_DIR"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/bin/bash
|
||||
# Postinstall: after the macOS Installer drops Prism.app into /Applications, copy
|
||||
# the bundled VST3 / AU plugins out of the app's Resources into the system
|
||||
# Audio Plug-Ins folders so DAWs find them.
|
||||
# Audio Plug-Ins folders so DAWs find them, and expose prism-tui on PATH.
|
||||
#
|
||||
# Standard pkg postinstall args:
|
||||
# $1 = full path to the installer package
|
||||
@@ -17,8 +17,10 @@ APP_PATH="${2:-/Applications}/Prism.app"
|
||||
[ -d "$APP_PATH" ] || APP_PATH="/Applications/Prism.app"
|
||||
|
||||
PLUGINS_SRC="$APP_PATH/Contents/Resources/plugins"
|
||||
VST3_DEST="/Library/Audio/Plug-Ins/VST3"
|
||||
AU_DEST="/Library/Audio/Plug-Ins/Components"
|
||||
VST3_DEST="${PRISM_VST3_DEST_DIR:-/Library/Audio/Plug-Ins/VST3}"
|
||||
AU_DEST="${PRISM_AU_DEST_DIR:-/Library/Audio/Plug-Ins/Components}"
|
||||
TUI_SOURCE="$APP_PATH/Contents/Resources/tui/prism-tui"
|
||||
TUI_LINK="${PRISM_TUI_LINK_PATH:-/usr/local/bin/prism-tui}"
|
||||
|
||||
mkdir -p "$VST3_DEST" "$AU_DEST"
|
||||
|
||||
@@ -29,4 +31,18 @@ if [ -d "$PLUGINS_SRC/AU" ]; then
|
||||
cp -R "$PLUGINS_SRC/AU/"*.component "$AU_DEST/" 2>/dev/null || true
|
||||
fi
|
||||
|
||||
if [ -f "$TUI_SOURCE" ]; then
|
||||
chmod 755 "$TUI_SOURCE"
|
||||
mkdir -p "$(dirname "$TUI_LINK")"
|
||||
if [ -e "$TUI_LINK" ] || [ -L "$TUI_LINK" ]; then
|
||||
if [ ! -L "$TUI_LINK" ] || [ "$(readlink "$TUI_LINK")" != "$TUI_SOURCE" ]; then
|
||||
echo "Prism postinstall: $TUI_LINK already exists and was left unchanged." >&2
|
||||
fi
|
||||
else
|
||||
ln -s "$TUI_SOURCE" "$TUI_LINK"
|
||||
fi
|
||||
else
|
||||
echo "Prism postinstall: bundled prism-tui not found at $TUI_SOURCE" >&2
|
||||
fi
|
||||
|
||||
exit 0
|
||||
|
||||
@@ -11,9 +11,11 @@
|
||||
; to Common Files succeed without a second elevation. On uninstall, the bundles
|
||||
; are removed unconditionally (harmless if the user opted out at install time).
|
||||
|
||||
!include "LogicLib.nsh"
|
||||
!include "WinMessages.nsh"
|
||||
|
||||
!ifndef BUILD_UNINSTALLER
|
||||
!include "nsDialogs.nsh"
|
||||
!include "LogicLib.nsh"
|
||||
|
||||
Var PRISM_VST_CHECKBOX
|
||||
Var PRISM_VST_STATE
|
||||
@@ -53,6 +55,25 @@
|
||||
!macroend
|
||||
|
||||
!macro customInstall
|
||||
${IfNot} ${FileExists} "$INSTDIR\resources\tui\prism-tui.exe"
|
||||
DetailPrint "ERROR: bundled prism-tui.exe was not found"
|
||||
MessageBox MB_OK|MB_ICONSTOP "The bundled prism-tui executable was not found.$\r$\n$\r$\nMissing path:$\r$\n$INSTDIR\resources\tui\prism-tui.exe" /SD IDOK
|
||||
Abort
|
||||
${EndIf}
|
||||
|
||||
; PowerShell avoids NSIS string-length truncation on machines with a large
|
||||
; PATH. It removes exact duplicates, appends Prism once, and leaves every
|
||||
; other entry intact. PowerShell comparisons are case-insensitive here.
|
||||
nsExec::ExecToLog `powershell.exe -NoProfile -NonInteractive -ExecutionPolicy Bypass -Command "& { param([string]$$entry) $$path = [Environment]::GetEnvironmentVariable('Path', 'Machine'); $$entries = @($$path -split ';' | Where-Object { $$_ -and $$_ -ine $$entry }); $$entries += $$entry; [Environment]::SetEnvironmentVariable('Path', ($$entries -join ';'), 'Machine') }" "$INSTDIR\resources\tui"`
|
||||
Pop $0
|
||||
${If} $0 != 0
|
||||
DetailPrint "ERROR: could not add Prism TUI to the machine PATH (exit code $0)"
|
||||
MessageBox MB_OK|MB_ICONSTOP "Prism could not add prism-tui to the machine PATH.$\r$\n$\r$\nPowerShell exit code: $0" /SD IDOK
|
||||
Abort
|
||||
${EndIf}
|
||||
SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
|
||||
DetailPrint "Added $INSTDIR\resources\tui to the machine PATH"
|
||||
|
||||
${If} $PRISM_VST_STATE == ${BST_CHECKED}
|
||||
DetailPrint "Installing Prism VST3 plugins to $COMMONFILES64\VST3"
|
||||
|
||||
@@ -79,6 +100,16 @@
|
||||
!endif
|
||||
|
||||
!macro customUnInstall
|
||||
; Remove only Prism's exact machine-PATH entry. A failure is non-fatal so an
|
||||
; otherwise valid uninstall is never blocked.
|
||||
nsExec::ExecToLog `powershell.exe -NoProfile -NonInteractive -ExecutionPolicy Bypass -Command "& { param([string]$$entry) $$path = [Environment]::GetEnvironmentVariable('Path', 'Machine'); $$entries = @($$path -split ';' | Where-Object { $$_ -and $$_ -ine $$entry }); [Environment]::SetEnvironmentVariable('Path', ($$entries -join ';'), 'Machine') }" "$INSTDIR\resources\tui"`
|
||||
Pop $0
|
||||
${If} $0 == 0
|
||||
SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
|
||||
${Else}
|
||||
DetailPrint "WARNING: could not remove Prism TUI from the machine PATH (exit code $0)"
|
||||
${EndIf}
|
||||
|
||||
; Always attempt removal — harmless RMDir if the bundle isn't there (user opted
|
||||
; out at install or removed manually).
|
||||
RMDir /r "$COMMONFILES64\VST3\Prism Spectrum.vst3"
|
||||
|
||||
Reference in New Issue
Block a user