|
| 1 | +#!/bin/bash |
| 2 | +echo 'installing brackets to your ~/.local directory' |
| 3 | + |
| 4 | +curDir=$(pwd) |
| 5 | + |
| 6 | +mkdir -p ~/.local/share/applications |
| 7 | +mkdir -p ~/.local/bin |
| 8 | + |
| 9 | +# Setup our brackets.desktop file. |
| 10 | +cp brackets.desktop temp.desktop |
| 11 | +execPath="$curDir/brackets" |
| 12 | +iconPath="$curDir/brackets.svg" |
| 13 | + |
| 14 | +sed -i 's|Exec=brackets|Exec='$execPath'|g' temp.desktop |
| 15 | +sed -i 's|Icon=brackets|Icon='$iconPath'|g' temp.desktop |
| 16 | +cp temp.desktop ~/.local/share/applications/brackets.desktop |
| 17 | +rm temp.desktop |
| 18 | + |
| 19 | +# Run xdg-desktop-menu to register the .desktop file. |
| 20 | +# This is for Unity's benefit: Gnome 3 and KDE 4 both watch ~/.local/share/applications and install .desktop files automatically. |
| 21 | +# Copy-pasta this straight from the .deb's postinst script. |
| 22 | +XDG_DESKTOP_MENU="`which xdg-desktop-menu 2> /dev/null`" |
| 23 | +if [ ! -x "$XDG_DESKTOP_MENU" ]; then |
| 24 | + echo "Error: Could not find xdg-desktop-menu" >&2 |
| 25 | + exit 1 |
| 26 | +fi |
| 27 | +"$XDG_DESKTOP_MENU" install ~/.local/share/applications/brackets.desktop --novendor |
| 28 | + |
| 29 | +# Symlink brackets executable to our current location... where-ever that is. |
| 30 | +rm -f ~/.local/bin/brackets |
| 31 | +ln -s $execPath ~/.local/bin/brackets |
| 32 | + |
| 33 | +# Try to symlink libudev.so.0 to the current directory. |
| 34 | +# Gratefully borrowed from https://github.com/rogerwang/node-webkit/wiki/The-solution-of-lacking-libudev.so.0 |
| 35 | +paths=( |
| 36 | + "/lib/x86_64-linux-gnu/libudev.so.1" # Ubuntu, Xubuntu, Mint |
| 37 | + "/usr/lib64/libudev.so.1" # SUSE, Fedora |
| 38 | + "/usr/lib/libudev.so.1" # Arch, Fedora 32bit |
| 39 | + "/lib/i386-linux-gnu/libudev.so.1" # Ubuntu 32bit |
| 40 | +) |
| 41 | +for i in "${paths[@]}" |
| 42 | +do |
| 43 | + if [ -f $i ] |
| 44 | + then |
| 45 | + ln -sf "$i" $curDir/libudev.so.0 |
| 46 | + break |
| 47 | + fi |
| 48 | +done |
| 49 | + |
| 50 | +echo 'installed brackets to ~/.local' |
0 commit comments