-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #97 from 76rhodan/main
next try of s6 migrate
- Loading branch information
Showing
34 changed files
with
1,325 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
#!/usr/bin/with-contenv bash | ||
#shellcheck shell=bash disable=SC2034,SC2164,SC2015 | ||
|
||
APPNAME="$(hostname)/vrs-init" | ||
VRS_DIR="/opt/vrs" | ||
VRS_EXEC="mono VirtualRadar.exe" | ||
VRS_CMDLINE=() | ||
VRS_CMDLINE+=("-nogui") | ||
VRS_CMDLINE+=("-createAdmin:${VRS_ADMIN_USERNAME}") | ||
VRS_CMDLINE+=("-password:${VRS_ADMIN_PASSWORD}") | ||
VRS_CONFIG_DIR="/root/.local/share/VirtualRadar" | ||
VRS_EXTENSION_DIR="/root/.local/share/VirtualRadar/CustomContent/CustomInjectedFiles" | ||
#Silhouettes, OpFlags and DB | ||
FLAGSDB_LINK="https://github.com/rikgale/VRSData/raw/main/BaseStation.zip" | ||
|
||
#max runtime in seconds for VRS init | ||
MAXTIME=15 | ||
|
||
#helper files for updatechecks | ||
ACTUALFILE="$VRS_CONFIG_DIR/commitid" | ||
ACTUALFILE_CM="$VRS_CONFIG_DIR/commitid_cm" | ||
ACTUALFILE_SQB="$VRS_CONFIG_DIR/commitid_sqb" | ||
|
||
#We need that for the update-after-fresh-install prevention | ||
WHICHREPO_SQB="https://api.github.com/repos/rikgale/VRSData/branches" | ||
WHICHBRANCH_SQB="main" | ||
|
||
#if the helper file to store the commit ID isn't there, create it empty | ||
touch $ACTUALFILE | ||
#and the same for the custom markers | ||
touch $ACTUALFILE_CM | ||
#for the database | ||
touch $ACTUALFILE_SQB | ||
|
||
#debugging stuff | ||
#echo $ACTUAL | ||
#echo $PROBE | ||
BUILD_DATE=$(cat "${VRS_DIR}"/builddate) | ||
|
||
echo "[$APPNAME][$(date)] Initializing Virtual Radar Server, build ${BUILD_DATE}..." | ||
|
||
mkdir -p "${VRS_CONFIG_DIR}/flags" | ||
mkdir -p "${VRS_CONFIG_DIR}/silhouettes" | ||
mkdir -p "${VRS_CONFIG_DIR}/photos" | ||
mkdir -p "${VRS_CONFIG_DIR}/db" | ||
mkdir -p "${VRS_CONFIG_DIR}/CustomContent/CustomInjectedFiles" | ||
|
||
#download and install pre-filled DB for operator flags. As this should only happen once, no commit id check needed | ||
if [ ! -e "${VRS_CONFIG_DIR}/db/BaseStation.sqb" ] | ||
then | ||
echo "[$APPNAME][$(date)] Downloading database for Operator Flags" | ||
if curl --fail --compressed -s -L -o "${VRS_CONFIG_DIR}/BaseStation.zip" ${FLAGSDB_LINK} && unzip -qq -o -d "${VRS_CONFIG_DIR}/db" "${VRS_CONFIG_DIR}/BaseStation.zip" | ||
then | ||
echo "[$APPNAME][$(date)] Database for Operator Flags installed successfully" | ||
#that should prevent a DB update right after a fresh download | ||
PROBE_SQB=$(curl -sH "Accept: application/vnd.github.v3+json" $WHICHREPO_SQB | awk "c&&!--c;/$WHICHBRANCH_SQB/{c=2}" | awk '/"sha"/ { print $2}' | sed 's/"//g;s/.$//g') | ||
echo "$PROBE_SQB" > $ACTUALFILE_SQB | ||
echo "[$APPNAME][$(date)] Updated $ACTUALFILE_SQB to commit ID $PROBE_SQB" | ||
else | ||
echo "[$APPNAME][$(date)] Database for Operator Flags not installed - failure" | ||
fi | ||
else | ||
echo "[$APPNAME][$(date)] Found an existing DB in $VRS_CONFIG_DIR, not touching anything!" | ||
fi | ||
|
||
#copy PluginsConfig into place if it's not there | ||
if [ ! -e "${VRS_CONFIG_DIR}/PluginsConfiguration.txt" ] | ||
then | ||
echo "[$APPNAME][$(date)] PluginsConfiguration.txt not found, adding template" | ||
if cp -f /opt/vrs/PluginsConfiguration.txt "${VRS_CONFIG_DIR}/PluginsConfiguration.txt" | ||
then | ||
echo "[$APPNAME][$(date)] PluginsConfiguration.txt not found, adding template - OK" | ||
else | ||
echo "[$APPNAME][$(date)] PluginsConfiguration.txt not found, adding template - Failure" | ||
fi | ||
else | ||
echo "[$APPNAME][$(date)] PluginsConfiguration.txt found, not touching anything" | ||
fi | ||
|
||
# Starting VRS temporarily to create a username and password if none exist | ||
# If VRS has been initialized previously this step will be skipped. | ||
# If it hasn't, a username / password and a bunch of other files will be created... | ||
# ...and VRS will actually stay up and run. We will shut it down after a max runtime of $MAXTIME secs. | ||
if [ ! -e "${VRS_CONFIG_DIR}/Configuration.xml" ] | ||
then | ||
echo "[$APPNAME][$(date)] No Configuration.xml found, doing first run initialization." | ||
cd "${VRS_DIR}" | ||
# shellcheck disable=SC2068,SC2086 | ||
timeout "$MAXTIME" exec ${VRS_EXEC} ${VRS_CMDLINE[@]} #>/dev/null 2>&1 | ||
echo "[$APPNAME][$(date)] Virtual Radar Server has been initialized." | ||
else | ||
echo "[$APPNAME][$(date)] Configuration.xml found, skipping initialization." | ||
fi | ||
|
||
# Replace 127.0.0.1 With ReadSB | ||
sed -i "s#<Address>127.0.0.1</Address>#<Address>${VRS_SBSHOST:-readsb}</Address>#g" "${VRS_CONFIG_DIR}/Configuration.xml" | ||
sed -i "s#<Port>30003</Port>#<Port>${VRS_SBSPORT:-30003}</Port>#g" "${VRS_CONFIG_DIR}/Configuration.xml" | ||
|
||
#Injecting settings for silhouettes, OpFlags and DB into Configuration.xml | ||
if ! grep -q "<DatabaseFileName>" "${VRS_CONFIG_DIR}/Configuration.xml" | ||
then | ||
sed -i "/^ <BaseStationSettings>.*/a \ \<DatabaseFileName>/root/.local/share/VirtualRadar/db/BaseStation.sqb</DatabaseFileName>" "${VRS_CONFIG_DIR}/Configuration.xml" | ||
echo "[$APPNAME][$(date)] Added database filename to Configuration.xml" | ||
else | ||
echo "[$APPNAME][$(date)] DatabaseFileName found, not touching config." | ||
fi | ||
|
||
if ! grep -q "<OperatorFlagsFolder>" "${VRS_CONFIG_DIR}/Configuration.xml" | ||
then | ||
sed -i "/^ <BaseStationSettings>.*/a \ \<OperatorFlagsFolder>/root/.local/share/VirtualRadar/flags</OperatorFlagsFolder>" "${VRS_CONFIG_DIR}/Configuration.xml" | ||
echo "[$APPNAME][$(date)] Added Operator Flags folder to Configuration.xml" | ||
else | ||
echo "[$APPNAME][$(date)] OperatorFlagsFolder found, not touching config." | ||
fi | ||
|
||
if ! grep -q "<SilhouettesFolder>" "${VRS_CONFIG_DIR}/Configuration.xml" | ||
then | ||
sed -i "/^ <BaseStationSettings>.*/a \ \<SilhouettesFolder>/root/.local/share/VirtualRadar/silhouettes</SilhouettesFolder>" "${VRS_CONFIG_DIR}/Configuration.xml" | ||
echo "[$APPNAME][$(date)] Added Silhouettes folder to Configuration.xml" | ||
else | ||
echo "[$APPNAME][$(date)] SilhouettesFolder found, not touching config." | ||
fi | ||
|
||
#cleanup and exit | ||
[[ -f "${VRS_CONFIG_DIR}/BaseStation.zip" ]] && rm -f "${VRS_CONFIG_DIR}/BaseStation.zip" || true | ||
echo "[$APPNAME][$(date)] Cleaned up downloaded files." | ||
echo "[$APPNAME][$(date)] Finished basic configuration." | ||
|
||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
#!/usr/bin/with-contenv bash | ||
# shellcheck shell=bash | ||
|
||
APPNAME="$(hostname)/vrs-ccmarker" | ||
#VRS_DIR="/opt/vrs" | ||
VRS_CONFIG_DIR="/root/.local/share/VirtualRadar" | ||
VRS_EXTENSION_DIR="/root/.local/share/VirtualRadar/CustomContent/CustomInjectedFiles" | ||
|
||
#PluginConfig Settings (escaped) | ||
CCMARKER_DISABLED="%3cInjectSettings%3e%0a++++%3cInjectSettings%3e%0a++++++%3cEnabled%3efalse%3c%2fEnabled%3e%0a++++++%3cPathAndFile%3e\*%3c%2fPathAndFile%3e%0a++++++%3cInjectionLocation%3eBody%3c%2fInjectionLocation%3e%0a++++++%3cStart%3etrue%3c%2fStart%3e%0a++++++%3cFile%3e%2froot%2f\.local%2fshare%2fVirtualRadar%2fCustomContent%2fCustomInjectedFiles%2fMyMarkers1\.html%3c%2fFile%3e%0a++++%3c%2fInjectSettings%3e%0a" | ||
CCMARKER_ENABLED="%3cInjectSettings%3e%0a++++%3cInjectSettings%3e%0a++++++%3cEnabled%3etrue%3c%2fEnabled%3e%0a++++++%3cPathAndFile%3e\*%3c%2fPathAndFile%3e%0a++++++%3cInjectionLocation%3eBody%3c%2fInjectionLocation%3e%0a++++++%3cStart%3etrue%3c%2fStart%3e%0a++++++%3cFile%3e%2froot%2f\.local%2fshare%2fVirtualRadar%2fCustomContent%2fCustomInjectedFiles%2fMyMarkers1\.html%3c%2fFile%3e%0a++++%3c%2fInjectSettings%3e%0a" | ||
|
||
#Downloadlinks | ||
EXT_MARKERS_LINK="https://raw.githubusercontent.com/rikgale/VRSCustomMarkers/main/MyMarkers1.html" | ||
EXT_HFDLMARKERS_LINK="https://raw.githubusercontent.com/rikgale/VRSCustomMarkers/main/MyMarkers1HFDL.html" | ||
|
||
echo "[$APPNAME][$(date)] Starting CustomContent Markers script..." | ||
|
||
#Create the directory in case it's not there | ||
mkdir -p "${VRS_CONFIG_DIR}/CustomContent/CustomInjectedFiles" | ||
|
||
if [[ -n "${VRS_ENHANCED_MARKERS}" ]] | ||
then | ||
echo "[$APPNAME][$(date)] Downloading and installing Custom Markers" | ||
#normal markers | ||
if [[ "${VRS_ENHANCED_MARKERS}" == "normal" ]] | ||
then | ||
echo "[$APPNAME][$(date)] Normal Custom markers" | ||
if curl --fail -s -L -o "${VRS_EXTENSION_DIR}/MyMarkers1.html" ${EXT_MARKERS_LINK} | ||
then | ||
echo "[$APPNAME][$(date)] Normal Custom marker file download - OK" | ||
echo "[$APPNAME][$(date)] Injecting custom marker config into PluginsConfiguration.txt" | ||
if sed -i -e "s/$CCMARKER_DISABLED/$CCMARKER_ENABLED/g" ${VRS_CONFIG_DIR}/PluginsConfiguration.txt | ||
then | ||
echo "[$APPNAME][$(date)] Custom marker config enabled - OK" | ||
else | ||
echo "[$APPNAME][$(date)] Custom marker config enabled - Failure" | ||
fi | ||
else | ||
echo "[$APPNAME][$(date)] Normal Custom marker file download - Failure" | ||
fi | ||
#HFDL markers | ||
elif [[ "${VRS_ENHANCED_MARKERS}" == "HFDL" ]] || [[ "${VRS_ENHANCED_MARKERS}" == "hfdl" ]] | ||
then | ||
echo "[$APPNAME][$(date)] HFDL Custom markers" | ||
if curl --fail -s -L -o "${VRS_EXTENSION_DIR}/MyMarkers1.html" ${EXT_HFDLMARKERS_LINK} | ||
then | ||
echo "[$APPNAME][$(date)] HFDL Custom marker file download - OK" | ||
echo "[$APPNAME][$(date)] Injecting custom marker config into PluginsConfiguration.txt" | ||
if sed -i -e "s/$CCMARKER_DISABLED/$CCMARKER_ENABLED/g" ${VRS_CONFIG_DIR}/PluginsConfiguration.txt | ||
then | ||
echo "[$APPNAME][$(date)] Custom marker config enabled - OK" | ||
else | ||
echo "[$APPNAME][$(date)] Custom marker config enabled - Failure" | ||
fi | ||
else | ||
echo "[$APPNAME][$(date)] HFDL Custom marker file download - Failure" | ||
fi | ||
#disabled | ||
elif [[ "${VRS_ENHANCED_MARKERS}" == "disabled" ]] || [[ "${VRS_ENHANCED_MARKERS}" == "false" ]] | ||
then | ||
echo "[$APPNAME][$(date)] HFDL Custom markers disabled" | ||
if sed -i -e "s/$CCMARKER_ENABLED/$CCMARKER_DISABLED/g" ${VRS_CONFIG_DIR}/PluginsConfiguration.txt | ||
then | ||
echo "[$APPNAME][$(date)] Custom marker config disabled - OK" | ||
else | ||
echo "[$APPNAME][$(date)] Custom marker config disabled - Failure" | ||
fi | ||
|
||
else echo "[$APPNAME][$(date)] yaml setting unkown. Check readme." | ||
fi | ||
else | ||
echo "[$APPNAME][$(date)] Custom Markers not enabled" | ||
fi | ||
|
||
#cleanup and exit | ||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
#!/usr/bin/with-contenv bash | ||
# shellcheck shell=bash | ||
|
||
APPNAME="$(hostname)/vrs-cclayer" | ||
#VRS_DIR="/opt/vrs" | ||
VRS_CONFIG_DIR="/root/.local/share/VirtualRadar" | ||
VRS_EXTENSION_DIR="/root/.local/share/VirtualRadar/CustomContent/CustomInjectedFiles" | ||
|
||
#PluginConfig Settings (escaped) | ||
LAYER_EOB_DISABLED="%3cInjectSettings%3e%0a++++++%3cEnabled%3efalse%3c%2fEnabled%3e%0a++++++%3cPathAndFile%3e\*%3c%2fPathAndFile%3e%0a++++++%3cInjectionLocation%3eBody%3c%2fInjectionLocation%3e%0a++++++%3cStart%3efalse%3c%2fStart%3e%0a++++++%3cFile%3e%2froot%2f\.local%2fshare%2fVirtualRadar%2fCustomContent%2fCustomInjectedFiles%2fEndOfBody\.html%3c%2fFile%3e%0a++++%3c%2fInjectSettings%3e%0a" | ||
LAYER_EOB_ENABLED="%3cInjectSettings%3e%0a++++++%3cEnabled%3etrue%3c%2fEnabled%3e%0a++++++%3cPathAndFile%3e\*%3c%2fPathAndFile%3e%0a++++++%3cInjectionLocation%3eBody%3c%2fInjectionLocation%3e%0a++++++%3cStart%3efalse%3c%2fStart%3e%0a++++++%3cFile%3e%2froot%2f\.local%2fshare%2fVirtualRadar%2fCustomContent%2fCustomInjectedFiles%2fEndOfBody\.html%3c%2fFile%3e%0a++++%3c%2fInjectSettings%3e%0a" | ||
LAYER_EOH_DISABLED="%3cInjectSettings%3e%0a++++++%3cEnabled%3efalse%3c%2fEnabled%3e%0a++++++%3cPathAndFile%3e\*%3c%2fPathAndFile%3e%0a++++++%3cInjectionLocation%3eHead%3c%2fInjectionLocation%3e%0a++++++%3cStart%3efalse%3c%2fStart%3e%0a++++++%3cFile%3e%2froot%2f\.local%2fshare%2fVirtualRadar%2fCustomContent%2fCustomInjectedFiles%2fEndOfHead\.html%3c%2fFile%3e%0a++++%3c%2fInjectSettings%3e%0a" | ||
LAYER_EOH_ENABLED="%3cInjectSettings%3e%0a++++++%3cEnabled%3etrue%3c%2fEnabled%3e%0a++++++%3cPathAndFile%3e\*%3c%2fPathAndFile%3e%0a++++++%3cInjectionLocation%3eHead%3c%2fInjectionLocation%3e%0a++++++%3cStart%3efalse%3c%2fStart%3e%0a++++++%3cFile%3e%2froot%2f\.local%2fshare%2fVirtualRadar%2fCustomContent%2fCustomInjectedFiles%2fEndOfHead\.html%3c%2fFile%3e%0a++++%3c%2fInjectSettings%3e%0a" | ||
LAYER_SCALE_DISABLED="%3cInjectSettings%3e%0a++++++%3cEnabled%3efalse%3c%2fEnabled%3e%0a++++++%3cPathAndFile%3e%2fdesktop\.html%3c%2fPathAndFile%3e%0a++++++%3cInjectionLocation%3eBody%3c%2fInjectionLocation%3e%0a++++++%3cStart%3efalse%3c%2fStart%3e%0a++++++%3cFile%3e%2froot%2f\.local%2fshare%2fVirtualRadar%2fCustomContent%2fCustomInjectedFiles%2fScale\.html%3c%2fFile%3e%0a++++%3c%2fInjectSettings%3e%0a" | ||
LAYER_SCALE_ENABLED="%3cInjectSettings%3e%0a++++++%3cEnabled%3etrue%3c%2fEnabled%3e%0a++++++%3cPathAndFile%3e%2fdesktop\.html%3c%2fPathAndFile%3e%0a++++++%3cInjectionLocation%3eBody%3c%2fInjectionLocation%3e%0a++++++%3cStart%3efalse%3c%2fStart%3e%0a++++++%3cFile%3e%2froot%2f\.local%2fshare%2fVirtualRadar%2fCustomContent%2fCustomInjectedFiles%2fScale\.html%3c%2fFile%3e%0a++++%3c%2fInjectSettings%3e%0a" | ||
LAYER_FULLSCREEN_DISABLED="%3cInjectSettings%3e%0a++++++%3cEnabled%3efalse%3c%2fEnabled%3e%0a++++++%3cPathAndFile%3e%2fdesktop\.html%3c%2fPathAndFile%3e%0a++++++%3cInjectionLocation%3eBody%3c%2fInjectionLocation%3e%0a++++++%3cStart%3efalse%3c%2fStart%3e%0a++++++%3cFile%3e%2froot%2f\.local%2fshare%2fVirtualRadar%2fCustomContent%2fCustomInjectedFiles%2fFullScreen\.html%3c%2fFile%3e%0a++++%3c%2fInjectSettings%3e%0a" | ||
LAYER_FULLSCREEN_ENABLED="%3cInjectSettings%3e%0a++++++%3cEnabled%3etrue%3c%2fEnabled%3e%0a++++++%3cPathAndFile%3e%2fdesktop\.html%3c%2fPathAndFile%3e%0a++++++%3cInjectionLocation%3eBody%3c%2fInjectionLocation%3e%0a++++++%3cStart%3efalse%3c%2fStart%3e%0a++++++%3cFile%3e%2froot%2f\.local%2fshare%2fVirtualRadar%2fCustomContent%2fCustomInjectedFiles%2fFullScreen\.html%3c%2fFile%3e%0a++++%3c%2fInjectSettings%3e%0a" | ||
|
||
#Downloadlinks | ||
EXT_LAYERS_LINK="https://github.com/rikgale/VRSCustomLayers/raw/main/VRSCustomLayers.zip" | ||
|
||
echo "[$APPNAME][$(date)] Starting CustomContent Layers script..." | ||
|
||
#Create the directory in case it's not there | ||
[ -d "${VRS_EXTENSION_DIR}" ] && mkdir -p "${VRS_CONFIG_DIR}/CustomContent/CustomInjectedFiles" | ||
|
||
if [[ -n "${VRS_ENHANCED_LAYERS_COUNTRY}" ]] | ||
then | ||
#cleaning up first | ||
cd "${VRS_EXTENSION_DIR}" || exit | ||
rm "${VRS_CONFIG_DIR}/CustomContent/CustomInjectedFiles"/*.geojson | ||
echo "[$APPNAME][$(date)] Downloading and installing Enhanced Layers" | ||
if curl --fail --compressed -s -L -o "${VRS_EXTENSION_DIR}/enhancedlayers.zip" ${EXT_LAYERS_LINK} &&\ | ||
unzip -q -o "${VRS_EXTENSION_DIR}/enhancedlayers.zip" &&\ | ||
rm "${VRS_EXTENSION_DIR}/enhancedlayers.zip" &&\ | ||
cp -r "${VRS_EXTENSION_DIR}"/VRSCustomLayers/* "${VRS_EXTENSION_DIR}" &&\ | ||
cp -r "${VRS_EXTENSION_DIR}"/'Put these files in VRS root folder'/* "${VRS_EXTENSION_DIR}" &&\ | ||
rm -r 'Put these files in VRS root folder' | ||
then | ||
echo "[$APPNAME][$(date)] Enhanced Layers archive download and uncompress - OK" | ||
case "${VRS_ENHANCED_LAYERS_COUNTRY,,}" in | ||
(uk) echo "[$APPNAME][$(date)] Enhanced Layers renaming country files for: ${VRS_ENHANCED_LAYERS_COUNTRY}" | ||
rename -f 's/UK//' -- *.geojson | ||
;; | ||
(de) echo "[$APPNAME][$(date)] Enhanced Layers renaming country files for: ${VRS_ENHANCED_LAYERS_COUNTRY}" | ||
rename -f 's/DE//' -- *.geojson | ||
;; | ||
(usa1) echo "[$APPNAME][$(date)] Enhanced Layers renaming country files for: ${VRS_ENHANCED_LAYERS_COUNTRY}" | ||
rename -f 's/USA1//' -- *.geojson | ||
;; | ||
(usaaz) echo "[$APPNAME][$(date)] Enhanced Layers renaming country files for: ${VRS_ENHANCED_LAYERS_COUNTRY}" | ||
rename -f 's/USAAZ//' -- *.geojson | ||
;; | ||
(se) echo "[$APPNAME][$(date)] Enhanced Layers renaming country files for: ${VRS_ENHANCED_LAYERS_COUNTRY}" | ||
rename -f 's/SE//' -- *.geojson | ||
;; | ||
(au) echo "[$APPNAME][$(date)] Enhanced Layers renaming country files for: ${VRS_ENHANCED_LAYERS_COUNTRY}" | ||
rename -f 's/AU//' -- *.geojson | ||
;; | ||
(*) echo "[$APPNAME][$(date)] Unknown or wrong country, default set to UK" | ||
;; | ||
esac | ||
if sed -i -e "s/$LAYER_EOB_DISABLED/$LAYER_EOB_ENABLED/g" ${VRS_CONFIG_DIR}/PluginsConfiguration.txt &&\ | ||
sed -i -e "s/$LAYER_EOH_DISABLED/$LAYER_EOH_ENABLED/g" ${VRS_CONFIG_DIR}/PluginsConfiguration.txt &&\ | ||
sed -i -e "s/$LAYER_SCALE_DISABLED/$LAYER_SCALE_ENABLED/g" ${VRS_CONFIG_DIR}/PluginsConfiguration.txt &&\ | ||
sed -i -e "s/$LAYER_FULLSCREEN_DISABLED/$LAYER_FULLSCREEN_ENABLED/g" ${VRS_CONFIG_DIR}/PluginsConfiguration.txt | ||
then | ||
echo "[$APPNAME][$(date)] Enhanced Layers config enabled - OK" | ||
else | ||
echo "[$APPNAME][$(date)] Enhanced Layers config enabled - Failure" | ||
fi | ||
if ! [[ -n "${VRS_ENHANCED_LAYERS_OPENAIP_APIKEY}" || "${VRS_ENHANCED_LAYERS_OPENWX_APIKEY}" ]] | ||
then | ||
echo "[$APPNAME][$(date)] VRS_ENHANCED_LAYERS_OPENAIP_APIKEY and VRS_ENHANCED_LAYERS_OPENWX_APIKEY not set. Expect those layers not to work." | ||
else | ||
if sed -i -e "s/##OPENWXAPIKEY##/${VRS_ENHANCED_LAYERS_OPENWX_APIKEY}/g" ${VRS_EXTENSION_DIR}/EndOfBody.html &&\ | ||
sed -i -e "s/##OPENAIPKEY##/${VRS_ENHANCED_LAYERS_OPENAIP_APIKEY}/g" ${VRS_EXTENSION_DIR}/EndOfBody.html | ||
then | ||
echo "[$APPNAME][$(date)] Enhanced Layers API Keys config injection - OK" | ||
else | ||
echo "[$APPNAME][$(date)] Enhanced Layers API Keys config injection - Failure" | ||
fi | ||
fi | ||
if [[ -n "${VRS_ENHANCED_LAYERS_CONFIG}" ]] | ||
then | ||
#shellcheck disable=SC2001 | ||
sed -i "s|##EXTERNALCONFIG##|$(sed -e 's|/\*[^*]*\*/||g' <<< "${VRS_ENHANCED_LAYERS_CONFIG//[[:space:]]/}")|g" "${VRS_EXTENSION_DIR}"/EndOfBody.html | ||
fi | ||
else | ||
echo "[$APPNAME][$(date)] Enhanced Layers archive download and uncompress - Failure" | ||
fi | ||
else | ||
echo "[$APPNAME][$(date)] Enhanced Layers not set in the yaml. Exiting." | ||
if sed -i -e "s/$LAYER_EOB_ENABLED/$LAYER_EOB_DISABLED/g" ${VRS_CONFIG_DIR}/PluginsConfiguration.txt &&\ | ||
sed -i -e "s/$LAYER_EOH_ENABLED/$LAYER_EOH_DISABLED/g" ${VRS_CONFIG_DIR}/PluginsConfiguration.txt &&\ | ||
sed -i -e "s/$LAYER_SCALE_ENABLED/$LAYER_SCALE_DISABLED/g" ${VRS_CONFIG_DIR}/PluginsConfiguration.txt &&\ | ||
sed -i -e "s/$LAYER_FULLSCREEN_ENABLED/$LAYER_FULLSCREEN_DISABLED/g" ${VRS_CONFIG_DIR}/PluginsConfiguration.txt | ||
then | ||
echo "[$APPNAME][$(date)] Enhanced Layers config enabled - OK" | ||
else | ||
echo "[$APPNAME][$(date)] Enhanced Layers config enabled - Failure" | ||
fi | ||
exit 0 | ||
fi | ||
#cleanup and exit | ||
exit 0 |
Oops, something went wrong.