Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- TAR_LOC="./"
- TAR_LOC+=$( find *xTIMEcomposer* )
- MENU_LOC="/usr/share/applications/xTimeComposer.desktop"
- MENU_CONFIG=$HOME"/.config/menus/applications-kmenuedit.menu"
- if [[ ! -a $TAR_LOC ]]; then
- if [[ -L $TAR_LOC ]]; then
- echo "Error, '$TAR_LOC' is a broken symlink."
- else
- echo "Error, '$TAR_LOC' does not exist."
- fi
- else
- ARRAY=( $( echo $TAR_LOC | tr "()" "\n" ) )
- VERSION=${ARRAY[2]}
- if [[ "$VERSION" == "" ]]; then
- echo "Error, file version not found."
- else
- tar -xf $TAR_LOC -C /opt
- CHECK=$( ls /opt/XMOS )
- if [[ $CHECK == "xTIMEcomposer" ]]; then
- echo "[Desktop Entry]
- comment=
- Exec=/opt/XMOS/xTIMEcomposer/$VERSION/xtimecomposer
- GenericName=XMOS Programming Suite
- Icon=/opt/XMOS/xTIMEcomposer/$VERSION/xtimecomposer_bin/configuration/org.eclipse.osgi/bundles/11/1/.cp/icons/xde_c_128.png
- Name=xTimeComposer
- NoDisplay=false
- StartupNotify=true
- Terminal=0
- TerminalOptions=
- Type=Application
- X-KDE-SubstituteUID=false
- X-KDE-Username=" > $MENU_LOC
- DEV_LINE=$( grep -n '<Name>Development</Name>' $MENU_CONFIG | cut -f1 -d: )
- INC_ARRAY=( $( grep -n '</Include>' $MENU_CONFIG | cut -f1 -d: ) )
- for LINE in "${INC_ARRAY[@]}"
- do
- if [[ "$LINE" -gt "$DEV_LINE" ]]; then
- sed -i $LINE'i <Filename>xTimeComposer.desktop</Filename>' $MENU_CONFIG
- break
- else
- echo $LINE
- fi
- done
- echo "Added to the menu, all done!"
- else
- echo "Error, the extraction failed. Try again with sudo."
- fi
- fi
- fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement