-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
install.sh
executable file
·47 lines (39 loc) · 1.34 KB
/
install.sh
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#! /usr/bin/env bash
# Copyright (c) 2024, Tomasz Pakuła Using Arch BTW
PREFIX=""
if [[ $1 == "add-prefix" ]]; then
PREFIX="$2"
fi
# uninstall boxflat
if [[ $1 == "remove" || $3 == "remove" ]]; then
rm "$PREFIX/usr/share/applications/"*boxflat.desktop
rm "$PREFIX/usr/bin/boxflat"
rm "$PREFIX/usr/share/metainfo/"*boxflat*
rm -rf "$PREFIX/usr/share/boxflat"
cp -r ./icons/* "$PREFIX/usr/share/icons/hicolor/"
rm "$PREFIX/etc/udev/rules.d/"*boxflat*.rules
exit 0
fi
if [[ -n $PREFIX ]]; then
mkdir -p "$PREFIX/etc/udev/rules.d"
mkdir -p "$PREFIX/usr/bin"
mkdir -p "$PREFIX/usr/share/applications"
fi
mkdir -p "$PREFIX/usr/share/boxflat"
mkdir -p "$PREFIX/usr/share/metainfo"
mkdir -p "$PREFIX/usr/share/icons/hicolor/"
cp -r ./boxflat "$PREFIX/usr/share/boxflat/"
cp -r ./data "$PREFIX/usr/share/boxflat/"
cp -r ./icons/* "$PREFIX/usr/share/icons/hicolor/"
cp -r ./udev "$PREFIX/usr/share/boxflat/"
cp entrypoint.py "$PREFIX/usr/share/boxflat/"
cp ./*metainfo.xml "$PREFIX/usr/share/metainfo/"
cp --preserve=mode "boxflat.sh" "$PREFIX/usr/bin/boxflat"
cp ./*.desktop "$PREFIX/usr/share/applications/"
cp udev/* "$PREFIX/etc/udev/rules.d/"
# refresh udev so the rules take effect immadietely
if [[ $1 == "no-udev" || $3 == "no-udev" ]]; then
exit 0
fi
udevadm control --reload
udevadm trigger --attr-match=subsystem=tty