-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.sh
More file actions
executable file
·32 lines (27 loc) · 896 Bytes
/
setup.sh
File metadata and controls
executable file
·32 lines (27 loc) · 896 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/bash
APP_NAME="xclock_tiny.desktop"
TARGET_DIR="$HOME/.local/share/applications"
CURRENT_DIR=$(cd "$(dirname "$0")" && pwd)
case "$1" in
install)
echo "Install..."
cp "$APP_NAME" "$APP_NAME.tmp"
sed -i "s|Exec=.*|Exec=$CURRENT_DIR/xclock_tiny|" "$APP_NAME.tmp"
sed -i "s|Icon=.*|Icon=$CURRENT_DIR/xclock_tiny.png|" "$APP_NAME.tmp"
mkdir -p "$TARGET_DIR"
mv "$APP_NAME.tmp" "$TARGET_DIR/$APP_NAME"
chmod +x "$TARGET_DIR/$APP_NAME"
update-desktop-database "$TARGET_DIR" 2>/dev/null
echo "Installed to $TARGET_DIR"
;;
uninstall)
echo "Uninstall..."
rm -f "$TARGET_DIR/$APP_NAME"
update-desktop-database "$TARGET_DIR" 2>/dev/null
echo "Uninstalled."
;;
*)
echo "Usage: $0 {install|uninstall}"
exit 1
;;
esac