mcobit / retrosmc

An easier way to get retropie onto osmc
Other
212 stars 32 forks source link

Creating shortcut fails if the mainmenu.DATA.xml file does not exist #3

Closed jcnventura closed 9 years ago

jcnventura commented 9 years ago

Hi,

On a fresh install, the /home/osmc/.kodi/userdata/addon_data/script.skinshortcuts/mainmenu.DATA.xml file may not exist. The 'grep' will fail because of that, and the shortcut will not be created.

The current algorithm is also wrong. It's:

  1. Check if shortcut is in mainmenu XML file. 1a. If not, overwrite the current one and add the shortcut to the file. 1b. If yes, do nothing.

It should be:

  1. Check if mainmenu XML file exists in userdata. 1a. If not, copy it 1b. If yes do nothing
  2. Check if shortcut is in mainmenu XML file. 2a. If not, add the shortcut to the file 2b. If yes, do nothing.
jcnventura commented 9 years ago

I'll do a pull request later, but the following patch fixed this for me:

--- install-retrosmc.sh.orig    2015-07-02 21:50:59.566543338 +0200
+++ install-retrosmc.sh 2015-07-02 21:59:56.924325905 +0200
@@ -60,10 +60,11 @@
                  ./install-retrosmc.sh
                  ;;
         3)
-           if [ ! "$(grep retropie.sh /home/osmc/.kodi/userdata/addon_data/script.skinshortcuts/mainmenu.DATA.xml 2>&1)" ]; then
+           if [ ! -f /home/osmc/.kodi/userdata/addon_data/script.skinshortcuts/mainmenu.DATA.xml ]; then
            cp /usr/share/kodi/addons/skin.osmc/shortcuts/mainmenu.DATA.xml /home/osmc/.kodi/userdata/addon_data/script.skinshortcuts/mainmenu.DATA.xml
            sudo chown osmc:osmc /home/osmc/.kodi/userdata/addon_data/script.skinshortcuts/mainmenu.DATA.xml
-
+           fi
+           if [ ! "$(grep retropie.sh /home/osmc/.kodi/userdata/addon_data/script.skinshortcuts/mainmenu.DATA.xml 2>&1)" ]; then
jcnventura commented 9 years ago

See pull request #7