Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change to system-wide install rather than per user
This is to prepare for creation of an AUR package.
- Loading branch information
1 parent
111042c
commit f36e4dd
Showing
7 changed files
with
120 additions
and
119 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
#!/bin/bash | ||
# User setup script. | ||
# (C) Mark Blakeney, markb@berlios.de, Aug 2016. | ||
|
||
PROG="$(basename $0)" | ||
NAME=${PROG%-*} | ||
|
||
BINDIR="/usr/bin" | ||
APPDIR="/usr/share/applications" | ||
ICOBAS="/usr/share/icons/hicolor" | ||
ICODIR="$ICOBAS/128x128/apps" | ||
DOCDIR="/usr/share/doc/$NAME" | ||
|
||
usage() { | ||
echo "Usage:" | ||
echo "As root: sudo $PROG install|uninstall" | ||
echo "As user: $PROG clean" | ||
echo | ||
echo "(-d option sets DESTDIR for install/uninstall)" | ||
exit 1 | ||
} | ||
|
||
# Process command line options | ||
DESTDIR="" | ||
while getopts d: c; do | ||
case $c in | ||
d) DESTDIR="$OPTARG";; | ||
\?) usage;; | ||
esac | ||
done | ||
|
||
shift $((OPTIND - 1)) | ||
|
||
if [ $# -ne 1 ]; then | ||
usage | ||
fi | ||
|
||
cmd="$1" | ||
|
||
if [ $cmd = "install" -o $cmd = "uninstall" ]; then | ||
DESTDIR=$(echo "$DESTDIR" | sed 's:/*$::') | ||
if [ -z "$DESTDIR" -a "$(id -un)" != "root" ]; then | ||
echo "Install or uninstall must be run as sudo/root." | ||
exit 1 | ||
fi | ||
|
||
if [ $cmd = "install" ]; then | ||
install -CDv -m 755 -t $DESTDIR$BINDIR $NAME-setup | ||
install -CDv -m 755 -t $DESTDIR$BINDIR $NAME | ||
install -CDv -m 644 -t $DESTDIR$APPDIR $NAME.desktop | ||
install -CDv -m 644 -t $DESTDIR$ICODIR $NAME.png | ||
install -CDv -m 644 -t $DESTDIR$DOCDIR README.md | ||
else | ||
rm -rfv $DESTDIR$BINDIR/$NAME | ||
rm -rfv $DESTDIR$APPDIR/$NAME.desktop | ||
rm -rfv $DESTDIR$ICODIR/$NAME.png | ||
rm -rfv $DESTDIR$DOCDIR | ||
rm -rfv $DESTDIR$BINDIR/$NAME-setup | ||
fi | ||
|
||
if [ -z "$DESTDIR" ]; then | ||
if [ -x /usr/bin/gtk-update-icon-cache ]; then | ||
/usr/bin/gtk-update-icon-cache $ICOBAS | ||
fi | ||
if [ -x /usr/bin/update-desktop-database ]; then | ||
/usr/bin/update-desktop-database -q | ||
fi | ||
fi | ||
elif [ $cmd = "clean" ]; then | ||
if [ "$(id -un)" = "root" ]; then | ||
echo "This command must be run as your own user." | ||
exit 1 | ||
fi | ||
|
||
# Remove any old configuration from earlier versions of program | ||
rm -fv ~/bin/$NAME | ||
rm -fv ~/.local/bin/$NAME | ||
rm -fv ~/.local/share/applications/$NAME.desktop | ||
rm -fv ~/.local/share/icons/$NAME.png | ||
else | ||
usage | ||
fi | ||
|
||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file was deleted.
Oops, something went wrong.