-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdo_branding.sh
executable file
·83 lines (54 loc) · 1.61 KB
/
do_branding.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#!/bin/bash
if [ -z "$SUBMODULES_HOME" ]; then
echo "ERROR: SUBMODULES_HOME not available"
exit 1
fi
if [ -z "$1" ]; then
echo "ERROR: Path to the launcher icon resource is mandatory"
exit 1
fi
LAUNCHER_ASSET="$1"
if ! test "$LAUNCHER_ASSET"; then
echo "ERROR: Not found '$LAUNCHER_ASSET'"
exit 1
fi
echo "Branding icon asset path: '$LAUNCHER_ASSET'"
SCRIPT_GET_PROGRAM="$SUBMODULES_HOME/Software-Toolkit/Utils/Sys/Programs/get_program.sh"
SCRIPT_GET_CODE_PATHS="$SUBMODULES_HOME/Software-Toolkit/Utils/VSCode/get_paths.sh"
if ! test -e "$SCRIPT_GET_PROGRAM"; then
echo "ERROR: Script not found '$SCRIPT_GET_PROGRAM'"
exit 1
fi
if ! test -e "$SCRIPT_GET_CODE_PATHS"; then
echo "ERROR: Script not found '$SCRIPT_GET_CODE_PATHS'"
exit 1
fi
# shellcheck disable=SC1090
. "$SCRIPT_GET_CODE_PATHS"
# VSCode branding support:
#
if bash "$SCRIPT_GET_PROGRAM" code >/dev/null 2>&1; then
GET_VSCODE_PATHS
if [ -z "$CODE_DIR" ]; then
echo "ERROR: the 'CODE_DIR' variable is not set"
exit 1
fi
PATH_LAUNCHER_ICON="resources/app/resources/linux"
CODE_LAUNCHER_ICON_PATH="$CODE_DIR/$PATH_LAUNCHER_ICON"
if ! test -e "$CODE_LAUNCHER_ICON_PATH"; then
echo "ERROR: Path does not exist"
exit 1
fi
ICON="$CODE_LAUNCHER_ICON_PATH/code.png"
if test -e "$ICON"; then
echo "VSCode icon path: '$ICON'"
fi
echo "Branding '$LAUNCHER_ASSET' -> '$ICON'"
if ! rm -f "$ICON"; then
echo "ERROR: Could not remove '$ICON'"
exit 1
fi
if cp "$LAUNCHER_ASSET" "$ICON"; then
echo "Branding completed"
fi
fi