SchildiChat-android/alternative_package.sh

51 lines
1.2 KiB
Bash
Raw Normal View History

2020-06-06 10:07:56 +02:00
#!/bin/bash
# Convert app to a different package with different icon and name,
# to allow multiple installations on the same device.
package_add="$1"
name_add="$2"
mydir="$(dirname "$(realpath "$0")")"
if [ -z "$package_add" ] || [ -z "$name_add" ]; then
echo "Usage: $0 <package_add> <name_add>"
exit 1
fi
logo_replace_color() {
2020-07-18 15:03:15 +02:00
local file="$1"
local color_shell="$2"
local color_shell_dark="$3"
# shell color
2020-07-19 09:42:48 +02:00
sed -i "s|#19931f|$color_shell|gi" "$file"
2020-07-18 15:03:15 +02:00
sed -i "s|#044204|$color_shell_dark|gi" "$file"
2020-06-06 10:07:56 +02:00
}
logo_alternative() {
2020-07-18 15:03:15 +02:00
logo_replace_color "$mydir/graphics/ic_launcher_foreground_sc.svg" "$@"
logo_replace_color "$mydir/graphics/ic_launcher_sc.svg" "$@"
2020-06-06 10:07:56 +02:00
"$mydir/graphics/icon_gen.sh"
}
case "$package_add" in
"a")
# cyan
2020-07-18 15:03:15 +02:00
logo_alternative "#00ACC1" "#006064"
2020-06-06 10:07:56 +02:00
;;
"b")
2020-07-19 09:42:48 +02:00
# orange: 900 color recuded in value
logo_alternative "#FB8C00" "#7f2c00"
2020-06-06 10:07:56 +02:00
;;
"c")
# purple
2020-07-18 15:03:15 +02:00
logo_alternative "#5E35B1" "#311B92"
2020-06-06 10:07:56 +02:00
;;
"d")
# red
2020-07-18 15:03:15 +02:00
logo_alternative "#E53935" "#B71C1C"
2020-06-06 10:07:56 +02:00
;;
esac
build_gradle="$mydir/vector/build.gradle"
2020-07-17 11:35:40 +02:00
sed -i "s|SchildiChat|SchildiChat.$name_add|g" "$build_gradle"
2020-06-06 10:07:56 +02:00
sed -i "s|de.spiritcroc.riotx|de.spiritcroc.riotx.$package_add|g" "$build_gradle"