forked from polychromatic/polychromatic
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcreate-files-for-opt.sh
executable file
·49 lines (40 loc) · 1.13 KB
/
create-files-for-opt.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
48
49
#!/bin/bash
#
# Creates a distro-agnostic set of files that allows Polychromatic to run
# relatively without installation or with additional sources.
#
# This could be installed to /opt.
#
# Dependencies must be installed to use the application. See README for details.
#
# Parameters: <install path> [--overwrite]
#
if [ -z "$1" ]; then
echo "Please specify the directory to place files."
exit 1
fi
SOURCE="`realpath $(dirname "$0")/../`"
DEST="$1"
# Prerequisites
cd "$SOURCE"
./scripts/build-styles.sh
# Prepare destination directory
if [ -d "$DEST" ] && [ "$2" != "--overwrite" ]; then
echo "Output directory already exists! Pass --overwrite as second parameter to delete."
exit 1
fi
if [ "$2" == "--overwrite" ]; then
rm -rf "$DEST"
fi
mkdir "$DEST"
# Copy required files
cd "$DEST"
cp -vr "$SOURCE/data" "$DEST/data"
cp -vr "$SOURCE/polychromatic" "$DEST/polychromatic"
cp -vr "$SOURCE/LICENSE" "$DEST/"
cp -vr "$SOURCE/polychromatic-"* "$DEST/"
rm "$DEST/polychromatic-controller-dev"
# Build locales
"$SOURCE/scripts/build-locales.sh" "$DEST/locale/"
# Clean up
find "$DEST" -name "__pycache__" -type d -exec rm -rf {} +