forked from dcflachs/compose_plugin
-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathcompose.manager.plg
More file actions
203 lines (186 loc) · 8.27 KB
/
compose.manager.plg
File metadata and controls
203 lines (186 loc) · 8.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
<?xml version='1.0' standalone='yes'?>
<!DOCTYPE PLUGIN [
<!ENTITY name "compose.manager">
<!ENTITY author "mstrhakr">
<!ENTITY version "2026.04.10">
<!ENTITY launch "Settings/&name;.settings">
<!ENTITY packageVER "&version;">
<!ENTITY packageMD5 "ad0053b8361f39c14abc0bf824eb16e4">
<!ENTITY pkgBUILD "2116">
<!ENTITY packageName "&name;-&packageVER;-noarch-&pkgBUILD;">
<!ENTITY packagefile "&packageName;.txz">
<!ENTITY github "mstrhakr/compose_plugin">
<!ENTITY pluginURL "https://raw.githubusercontent.com/&github;/main/&name;.plg">
<!ENTITY packageURL "https://github.com/&github;/releases/download/v&version;/&packagefile;">
<!ENTITY pluginLOC "/boot/config/plugins/&name;">
<!ENTITY emhttpLOC "/usr/local/emhttp/plugins/&name;">
<!ENTITY aceVER "1.43.5">
<!ENTITY aceURL "https://github.com/ajaxorg/ace-builds/archive/refs/tags/v&aceVER;.zip">
]>
<PLUGIN name="&name;"
author="&author;"
version="&version;"
launch="&launch;"
pluginURL="&pluginURL;"
icon="cubes"
min="6.9.0"
support="https://forums.unraid.net/topic/197334-plugin-compose-manager-plus/"
project="https://github.com/mstrhakr/compose_plugin"
readme="https://github.com/mstrhakr/compose_plugin#readme"
>
<CHANGES>
###2026.04.10
- Bug Fixes (stack): detect existing compose files via getComposeFilePath before creating default; fixes #91
- [View all changes](https://github.com/mstrhakr/compose_plugin/compare/v2026.04.08...v2026.04.10)
</CHANGES>
<!-- The 'pre-install' script. -->
<FILE Run="/bin/bash">
<INLINE>
# Remove old 'source' files
rm -f $(ls &pluginLOC;/&name;*.txz 2>/dev/null|grep -v '&packageVER;')
# Clean up legacy package entries (compose.manager-package-*) left by older builds
# that used non-standard Slackware naming and weren't removed by upgradepkg
for pkg in /var/log/packages/&name;-package-*; do
[ -e "$pkg" ] && removepkg "$(basename "$pkg")" 2>/dev/null || true
done
#Create projects folder if it doesnt exist
mkdir -p &pluginLOC;/projects
</INLINE>
</FILE>
<FILE Name="&pluginLOC;/&packagefile;" Run="upgradepkg --install-new">
<URL>&packageURL;</URL>
<MD5>&packageMD5;</MD5>
</FILE>
<FILE Run="/bin/bash">
<INLINE>
# Download Ace editor if not already provided by Unraid (Unraid 7.0.0+ includes it via Dynamix)
ACE_DYNAMIX_PATH="/usr/local/emhttp/plugins/dynamix/javascript/ace/ace.js"
ACE_PLUGIN_DIR="&emhttpLOC;/javascript/ace"
if [ -f "$ACE_DYNAMIX_PATH" ]; then
echo "Ace editor found at $ACE_DYNAMIX_PATH (Unraid 7.0.0+), skipping download."
else
echo "Ace editor not found in Dynamix (pre-7.0.0 Unraid), downloading v&aceVER;..."
mkdir -p "$ACE_PLUGIN_DIR"
TMPDIR_ACE="/tmp/ace-install-$$"
mkdir -p "$TMPDIR_ACE"
WGET_CERT_OPTS=""
if [ ! -f /etc/ssl/certs/ca-certificates.crt ] && [ ! -d /etc/ssl/certs ]; then
echo "WARNING: No system CA bundle found; downloading Ace with TLS verification disabled."
WGET_CERT_OPTS="--no-check-certificate"
fi
if wget $WGET_CERT_OPTS -q -O "$TMPDIR_ACE/ace.zip" "&aceURL;"; then
if unzip -q "$TMPDIR_ACE/ace.zip" \
"ace-builds-&aceVER;/src-min-noconflict/ace.js" \
"ace-builds-&aceVER;/src-min-noconflict/mode-yaml.js" \
"ace-builds-&aceVER;/src-min-noconflict/mode-sh.js" \
"ace-builds-&aceVER;/src-min-noconflict/theme-tomorrow.js" \
"ace-builds-&aceVER;/src-min-noconflict/theme-tomorrow_night.js" \
-d "$TMPDIR_ACE/extracted"; then
if cp "$TMPDIR_ACE/extracted/ace-builds-&aceVER;/src-min-noconflict/"*.js "$ACE_PLUGIN_DIR/"; then
if [ -f "$ACE_PLUGIN_DIR/ace.js" ]; then
echo "Ace editor v&aceVER; installed to $ACE_PLUGIN_DIR"
else
echo "WARNING: Ace editor files not found in $ACE_PLUGIN_DIR after install. Editor will lack syntax highlighting."
fi
else
echo "WARNING: Failed to copy Ace editor files. Editor will lack syntax highlighting."
fi
else
echo "WARNING: Failed to extract Ace editor archive. Editor will lack syntax highlighting."
fi
else
echo "WARNING: Failed to download Ace editor. The YAML/env editor will not have syntax highlighting."
fi
rm -rf "$TMPDIR_ACE"
fi
</INLINE>
</FILE>
<FILE Run="/bin/bash">
<INLINE>
# Use the new patch utility during install to cleanup and optionally apply patches
patch_script=/usr/local/emhttp/plugins/compose.manager/scripts/patch.sh
config_file=/boot/config/plugins/compose.manager/compose.manager.cfg
if [ -f "$patch_script" ]; then
if [ -f "$config_file" ]; then
#Grab the contents of our config file.
source <(grep = $config_file)
patch_ui=${PATCH_UI:='false'}
# Parse /etc/unraid-version into numeric form: M*10000 + m*100 + p
# Handles formats like: 6.10.2 or "7.2.3" by extracting the first X.Y.Z
ver=$(grep -oE '[0-9]+(\.[0-9]+){0,2}' /etc/unraid-version | head -n1)
IFS=. read -r major minor patch <<< "$ver"
major=${major:-0}; minor=${minor:-0}; patch=${patch:-0}
unraid_version=$((major*10000 + minor*100 + patch))
if [ $unraid_version -ge 61000 ] && [ $unraid_version -le 69999 ] && [ $patch_ui == 'true' ]; then
echo ""
echo "----------------------------------------------------"
echo " Applying WebUI Patches because PATCH_UI=true"
echo "----------------------------------------------------"
echo ""
#Remove patchs if already applied
$patch_script -r
#Apply Patches
$patch_script apply || true
fi
if [ $unraid_version -ge 61000 ] && [ $unraid_version -le 69999 ] && [ $patch_ui != 'true' ]; then
echo ""
echo "----------------------------------------------------"
echo " Removing WebUI Patches because PATCH_UI=false"
echo " To enable the WebUI, set PATCH_UI=true in &name;.cfg"
echo " and apply patches from the plugin settings page."
echo "----------------------------------------------------"
echo ""
$patch_script -r
fi
fi
fi
</INLINE>
</FILE>
<FILE Run="/bin/bash">
<INLINE>
echo ""
echo "----------------------------------------------------"
echo " Compose Manager Plus has been installed."
echo " Version: &version;"
echo "----------------------------------------------------"
echo ""
</INLINE>
</FILE>
<FILE Run="/bin/bash" Method="remove">
<INLINE>
# Use the new patch utility during install to cleanup and optionally apply patches
patch_script=/usr/local/emhttp/plugins/compose.manager/scripts/patch.sh
config_file=/boot/config/plugins/compose.manager/compose.manager.cfg
if [ -f "$patch_script" ]; then
if [ -f "$config_file" ]; then
#Grab the contents of our config file.
source <(grep = $config_file)
patch_ui=${PATCH_UI:='false'}
# Parse /etc/unraid-version into numeric form: M*10000 + m*100 + p
# Handles formats like: 6.10.2 or "7.2.3" by extracting the first X.Y.Z
ver=$(grep -oE '[0-9]+(\.[0-9]+){0,2}' /etc/unraid-version | head -n1)
IFS=. read -r major minor patch <<< "$ver"
major=${major:-0}; minor=${minor:-0}; patch=${patch:-0}
unraid_version=$((major*10000 + minor*100 + patch))
if [ $unraid_version -ge 61000 ] && [ $unraid_version -le 69999 ] && [ $patch_ui == 'true' ]; then
echo ""
echo "----------------------------------------------------"
echo " Removing WebUI Patches because plugin is being removed"
echo "----------------------------------------------------"
echo ""
#Remove patchs if already applied
$patch_script -r
fi
fi
fi
# Remove all Slackware package entries for this plugin.
# Handles both new naming (compose.manager-VERSION-noarch-1) and
# legacy naming (compose.manager-package-VERSION) left by older builds.
for pkg in /var/log/packages/&name;-*; do
[ -e "$pkg" ] && removepkg "$(basename "$pkg")" 2>/dev/null || true
done
# Remove old package files from flash
rm -f $(ls &pluginLOC;/&name;*.txz 2>/dev/null|grep -v '&packageVER;')
</INLINE>
</FILE>
</PLUGIN>