Skip to content

Commit

Permalink
add User Tools Menue, thanks@nomjasV
Browse files Browse the repository at this point in the history
  • Loading branch information
koivo committed Jun 15, 2016
1 parent d920571 commit 1de279a
Show file tree
Hide file tree
Showing 4 changed files with 98 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ C:menu/tools:Create German Teamimage - most but not all:scripts/create_teamimage
C:menu/tools:Create Austria Teamimage - most but not all:scripts/create_teamimage_austria.sh
C:menu/tools:Create pixbox Teamimage - most but not all:scripts/create_teamimage_pixbox.sh
C:menu/tools:Create Zero Image - Remove not needed stuff:scripts/create_zeroimage.sh
C:menu/tools:Generate User Tools Menue:scripts/genstbtoolmenu.sh
C:menu/tools:Delete Picons from Flash:scripts/picons_flash_del.sh
C:menu/tools:Delete Picons from USB/HDD:scripts/picons_usb_del.sh
C:menu/tools:Remove/Install OpenOpera HbbTV Browser:scripts/openopera.sh
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from downloader import Hdf_Downloader
from boxbranding import getBoxType, getMachineBrand, getMachineName, getDriverDate, getImageVersion, getImageBuild, getBrandOEM

toolboxversion = "Toolbox Version - 06.06.2016"
toolboxversion = "Toolbox Version - 16.06.2016"

try:
os.system("echo ~~~ Box Info ~~~~~~~~~~~~~~~~~~~~"" > /tmp/.ImageVersion")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/sh

hdftoolpath=/usr/lib/enigma2/python/Plugins/Extensions/HDF-Toolbox/scripts
toolscfg=/usr/lib/enigma2/python/Plugins/Extensions/HDF-Toolbox/menu/tools.cfg

# after plugin hdftoolbox update is 'User menu' off
# you have to reboot your box
# yes/no
autogenrc=no

cp genstbtoolmenu.sh ${hdftoolpath}
chmod 755 ${hdftoolpath}/genstbtoolmenu.sh

if ! grep Generate $toolscfg >/dev/null;then
echo "Generate User tools..."
sed -i '/M:main:Return to Main Menu/i\C:menu\/tools:Generate User Tools Menu:scripts\/genstbtoolmenu.sh' ${toolscfg}
fi

if [ "$autogenrc" = "yes" ];then
ln -sf ${hdftoolpath}/genstbtoolmenu.sh /etc/rc3.d/S20genusertoolmenu
fi
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
#!/bin/sh

# Copyright 2015, 2016 nomjasV aka octagoN D2;>@?]ADo8>2:=]4@>, Austria
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
# permitted provided that the following conditions are met:
#
# 1. Redistributions of this script must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AS IS'' AND ANY EXPRESS OR IMPLIED
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

MEDIAPATH=/usr/scripts

#BOXNAME=$(cat /proc/stb/info/boxtype)
ez=$(uname -n | cut -c 1-1 | tr [a-z] [A-Z])
l=$(uname -n | wc -L)
r=$(uname -n | cut -c 2-$l)

BOXNAME=$(echo ${ez}${r})

hdftoolpath=/usr/lib/enigma2/python/Plugins/Extensions/HDF-Toolbox
CREATEDIRECTORY=${MEDIAPATH}/${BOXNAME}-UserTools

# User Tools directory on USB/HDD:/home/root
if [ ! -d ${CREATEDIRECTORY} ];then
echo -e "\n### Create ${BOXNAME} Tools directory ###\n${CREATEDIRECTORY}\n"
mkdir -p ${CREATEDIRECTORY}/${BOXNAME}_menu
mkdir ${CREATEDIRECTORY}/${BOXNAME}_scripts

echo -e "### Create ${BOXNAME} main menu ###\n${CREATEDIRECTORY}/${BOXNAME}.cfg\n"
cat << BOXNAMECFG >${CREATEDIRECTORY}/${BOXNAME}.cfg
S:${BOXNAME}_menu/${BOXNAME}:Image ${BOXNAME} Tools:touch /tmp/hdf.txt
M:${BOXNAME}_menu/first:my first menu
M:main:Return to Main Menu
BOXNAMECFG

echo -e "### Create first.cfg, my_first.sh for testing ###\n${CREATEDIRECTORY}/${BOXNAME}_menu/first.cfg\n${CREATEDIRECTORY}/${BOXNAME}_scripts/my_first.sh"
cat << MYFIRSTCFG >${CREATEDIRECTORY}/${BOXNAME}_menu/first.cfg
S:${BOXNAME}_menu/first:My First Menu:touch /tmp/hdf.txt
C:${BOXNAME}_menu/first:Run my first script:${BOXNAME}_scripts/my_first.sh
M:menu/${BOXNAME}:Return to ${BOXNAME} Tools menu
M:main:Return to Main Menu
MYFIRSTCFG

echo '#!/bin/sh' >${CREATEDIRECTORY}/${BOXNAME}_scripts/my_first.sh
echo 'echo -e "My first script.\n"' >>${CREATEDIRECTORY}/${BOXNAME}_scripts/my_first.sh
chmod 755 ${CREATEDIRECTORY}/${BOXNAME}_scripts/my_first.sh
fi

# generate HDF-Toolbox menu
( cd ${hdftoolpath}
if ! grep "${BOXNAME} Tools" ${hdftoolpath}/main.cfg >/dev/null ;then
echo -e "\n### Prepare HDF-Toolbox with \"${BOXNAME} Tools menu\" ###\n"
sed -i "8i M:menu\/${BOXNAME}:${BOXNAME} Tools" ${hdftoolpath}/main.cfg
fi

echo -e "\nGenerate ${BOXNAME} menu, scripts, cfg... symbolik link\nPlease reload the HDF-Toolbox.\n"

ln -sf ${CREATEDIRECTORY}/${BOXNAME}.cfg ${hdftoolpath}/menu/.
ln -sf ${CREATEDIRECTORY}/${BOXNAME}_menu ${hdftoolpath}/.
ln -sf ${CREATEDIRECTORY}/${BOXNAME}_scripts ${hdftoolpath}/.
)

exit 0

0 comments on commit 1de279a

Please sign in to comment.