daily pastebin goal
70%
SHARE
TWEET

xTimeComposer Auto-Setup

a guest Mar 30th, 2013 16 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/bash
  2.  
  3. TAR_LOC="./"
  4. TAR_LOC+=$( find *xTIMEcomposer* )
  5. MENU_LOC="/usr/share/applications/xTimeComposer.desktop"
  6. MENU_CONFIG=$HOME"/.config/menus/applications-kmenuedit.menu"
  7.  
  8. if [[ ! -a $TAR_LOC ]]; then
  9.         if [[ -L $TAR_LOC ]]; then
  10.                 echo "Error, '$TAR_LOC' is a broken symlink."
  11.         else
  12.                 echo "Error, '$TAR_LOC' does not exist."
  13.         fi
  14. else
  15.         ARRAY=( $( echo $TAR_LOC | tr "()" "\n" ) )
  16.        
  17.         VERSION=${ARRAY[2]}
  18.        
  19.         if [[ "$VERSION" == "" ]]; then
  20.                 echo "Error, file version not found."
  21.         else
  22.                 tar -xf $TAR_LOC -C /opt
  23.                 CHECK=$( ls /opt/XMOS )
  24.                
  25.                 if [[ $CHECK == "xTIMEcomposer" ]]; then
  26. echo "[Desktop Entry]
  27. comment=
  28. Exec=/opt/XMOS/xTIMEcomposer/$VERSION/xtimecomposer
  29. GenericName=XMOS Programming Suite
  30. Icon=/opt/XMOS/xTIMEcomposer/$VERSION/xtimecomposer_bin/configuration/org.eclipse.osgi/bundles/11/1/.cp/icons/xde_c_128.png
  31. Name=xTimeComposer
  32. NoDisplay=false
  33. StartupNotify=true
  34. Terminal=0
  35. TerminalOptions=
  36. Type=Application
  37. X-KDE-SubstituteUID=false
  38. X-KDE-Username=" > $MENU_LOC
  39.                        
  40.                         DEV_LINE=$( grep -n '<Name>Development</Name>' $MENU_CONFIG | cut -f1 -d: )
  41.                         INC_ARRAY=( $( grep -n '</Include>' $MENU_CONFIG | cut -f1 -d: ) )
  42.                        
  43.                         for LINE in "${INC_ARRAY[@]}"
  44.                         do
  45.                                 if [[ "$LINE" -gt "$DEV_LINE" ]]; then
  46.                                         sed -i $LINE'i <Filename>xTimeComposer.desktop</Filename>' $MENU_CONFIG
  47.                                         break
  48.                                 else
  49.                                         echo $LINE
  50.                                 fi
  51.                         done
  52.                        
  53.                         echo "Added to the menu, all done!"
  54.                 else
  55.                         echo "Error, the extraction failed. Try again with sudo."
  56.                 fi
  57.         fi
  58. fi
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top