rofi-themes/install.sh

36 lines
939 B
Bash
Raw Normal View History

2018-02-15 16:19:25 +01:00
#!/usr/bin/env bash
xdg="${XDG_DATA_HOME:-${HOME}/.local/share}"
DIRECTORY="${xdg}/rofi/themes"
2018-02-15 16:19:25 +01:00
if [ ! -d "${DIRECTORY}" ]
then
echo "Creating theme directory: ${DIRECTORY}"
mkdir -p "${DIRECTORY}"
fi
declare -i ia=0
for themefile in **/*.rasi
2018-02-15 16:19:25 +01:00
do
if [ -f "${DIRECTORY}/${themefile##*/}" ] && [ ${ia} -eq 0 ]
2018-02-15 16:19:25 +01:00
then
echo -n "Theme '${DIRECTORY}/${themefile##*/}' exists, overwrite? y/N/a(ll) "
2018-02-15 16:19:25 +01:00
read answer
if [ "x$answer" = x"y" ]
2018-02-15 16:19:25 +01:00
then
echo "+Installing '${themefile}'"
install -m 644 "${themefile}" "${DIRECTORY}"
elif [ "x${answer}" = x"a" ]
2018-02-15 16:19:25 +01:00
then
ia=1
echo "+Installing '${themefile}'"
install -m 644 "${themefile}" "${DIRECTORY}"
2018-02-15 16:19:25 +01:00
else
echo "+Skipping ${themefile}"
fi
2018-02-15 16:19:25 +01:00
else
echo "+Installing '${themefile}'"
install -m 644 "${themefile}" "${DIRECTORY}"
2018-02-15 16:19:25 +01:00
fi
done