Repository navigation
Expand file tree
/
Copy pathpython.toolkit.plg
More file actions
executable file
·76 lines (72 loc) · 3.54 KB
/
Copy pathpython.toolkit.plg
File metadata and controls
executable file
·76 lines (72 loc) · 3.54 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
<?xml version="1.0" standalone="yes"?>
<!DOCTYPE PLUGIN [
<!ENTITY name "python.toolkit">
<!ENTITY author "Kurotaku">
<!ENTITY version "2026.12.01">
<!ENTITY md5 "09d92ef4b8c546a2ea6e3e8ce6ac17c5">
<!ENTITY plugdir "/usr/local/emhttp/plugins/&name;">
<!ENTITY github "Kurotaku-sama/unraid.python.toolkit">
<!ENTITY pluginURL "https://raw.githubusercontent.com/&github;/main/&name;.plg">
]>
<PLUGIN name="&name;"
author="&author;"
version="&version;"
pluginURL="&pluginURL;"
icon="images/icon.png"
min="6.9.0"
support="https://forums.unraid.net/topic/201496-plugin-python-toolkit/">
<CHANGES>
###2026.12.01 - Initial Release
- Initial release of Python Toolkit.
</CHANGES>
<!-- The 'source' file. -->
<FILE Name="/boot/config/plugins/&name;/&name;-&version;.txz" Run="upgradepkg --install-new">
<URL>https://raw.githubusercontent.com/&github;/main/archive/&name;-&version;.txz</URL>
<MD5>&md5;</MD5>
</FILE>
<!-- Post-Install Script -->
<FILE Run="/bin/bash">
<INLINE>
find /boot/config/plugins/&name; -maxdepth 1 -name '&name;-*.txz' ! -name '&name;-&version;.txz' -delete
echo "----------------------------------------------------"
echo "Python Toolkit has been installed."
echo "Version: &version;"
echo "----------------------------------------------------"
echo ""
php &plugdir;/php/run_on_install_check_config.php
php &plugdir;/php/run_on_boot.php
# Unraid before 7.3.1 has no startup event, event/startup never runs there.
# Unraid registers the plugin only after this script, so its update_cron left the cron file out.
# A background process waits for the registration (at most 10 minutes) and runs update_cron then
unraid_version=$(sed -n 's/^version="\(.*\)"$/\1/p' /etc/unraid-version)
if [ -x /usr/local/sbin/update_cron ] && ! printf '%s\n' 7.3.1 "$unraid_version" | sort -V -C; then
nohup bash -c 'for second in $(seq 600); do [ -e /var/log/plugins/&name;.plg ] && exec /usr/local/sbin/update_cron; sleep 1; done' > /dev/null 2>&1 &
fi
echo "----------------------------------------------------"
</INLINE>
</FILE>
<!-- The 'remove' script. -->
<FILE Run="/bin/bash" Method="remove">
<INLINE>
echo "Removing Python Toolkit..."
# Every Python and its commands leave the running system first, the script that knows them is gone once the
# package is removed
if [ -f "&plugdir;/php/run_on_uninstall.php" ]; then
php &plugdir;/php/run_on_uninstall.php
fi
removepkg /boot/config/plugins/&name;/&name;-&version;
rm -f /boot/config/plugins/&name;/&name;-&version;.txz
rm -rf &plugdir;
echo "----------------------------------------------------"
echo "Python Toolkit &version; successfully removed."
echo "----------------------------------------------------"
echo ""
echo "!!! INFO: YOUR DATA WAS NOT DELETED !!!"
echo "Settings, downloaded Python versions, cached packages and the scripts of every instance"
echo "are still on the boot drive in /boot/config/plugins/&name;"
echo "Installing the plugin again brings everything back."
echo "To delete them for good run: rm -rf /boot/config/plugins/&name;"
echo "----------------------------------------------------"
</INLINE>
</FILE>
</PLUGIN>