auto upgrade proxy

This commit is contained in:
ljm42
2024-03-28 17:01:34 -07:00
parent 02de6b43b4
commit 08918b8892
+31 -1
View File
@@ -14,6 +14,24 @@
# run & log functions
. /etc/rc.d/rc.runlog
# import CA proxy
UnProxy=/boot/config/proxy.cfg
CAProxy=/boot/config/plugins/community.applications/proxy.cfg
if [[ -f "${CAProxy}" && ! -f "${UnProxy}" ]]; then
proxy=
port=
. "${CAProxy}"
# proxy and port were set by the previous command
if [[ -n "${proxy}" && -n "${port}" ]]; then
cat << EOF > "${UnProxy}"
proxy_active="1"
proxy_url_1="${proxy}:${port}"
proxy_name_1="Imported from CA"
EOF
fi
mv "${CAProxy}" "${CAProxy}.bak"
fi
# load proxy environment vars so it is used for plugin updates and the go script
/usr/local/sbin/set_proxy
[[ -x /etc/profile.d/proxy.sh ]] && . /etc/profile.d/proxy.sh
@@ -73,7 +91,7 @@ rm -f /boot/plugins/unRAIDServer.plg
rm -f $CONFIG/plugins/unRAIDServer.plg
# These plugins are now integrated in the OS or obsolete and may interfere
OBSOLETE="vfio.pci dynamix.wireguard dynamix.ssd.trim dynamix.file.manager gui.search unlimited-width"
OBSOLETE="vfio.pci dynamix.wireguard dynamix.ssd.trim dynamix.file.manager gui.search unlimited-width proxy.editor"
for PLUGIN in $OBSOLETE; do
if [[ -e $CONFIG/plugins/$PLUGIN.plg ]]; then
log "moving obsolete plugin $PLUGIN.plg to $CONFIG/plugins-error"
@@ -170,6 +188,18 @@ if [[ $PERSISTENT_BASH_HISTORY == 1 ]]; then
ln -s /boot/config/history/bash_history /root/.bash_history
fi
# cleanup the 'go' script
# comment out line with trailing & (could also have leading env vars), add new line with just /usr/local/sbin/emhttp
GOTEST1='^[^#]*/usr/local/sbin/emhttp.*&$'
if grep -q "$GOTEST1" $CONFIG/go; then
sed -i "s@$GOTEST1@#&\n/usr/local/sbin/emhttp@g" $CONFIG/go
fi
# delete lines added by ProxyEditor
GOTEST2='# Added by ProxyEditor'
if grep -q "$GOTEST2" $CONFIG/go; then
sed -i "/$GOTEST2/d" $CONFIG/go
fi
# Invoke the 'go' script
if [[ -f $CONFIG/go ]]; then
log "Starting go script"