numix-gtk-theme/scripts/utils.sh

110 lines
2.0 KiB
Bash
Raw Normal View History

#!/bin/bash
do_install() {
local GTKDIR GTK320DIR GTKVER INSTALL_DIR
INSTALL_DIR="$1"
GTKDIR="${INSTALL_DIR}/gtk-3.0"
GTK320DIR="${INSTALL_DIR}/gtk-3.20"
install -dm755 "${INSTALL_DIR}"
cd src
2016-09-18 11:01:08 +00:00
cp index.theme "${INSTALL_DIR}"
cp -rt "${INSTALL_DIR}" \
assets gtk-2.0 metacity-1 openbox-3 xfce-notify-4.0 xfwm4 unity
for _DIR in "${GTKDIR}" "${GTK320DIR}"
do
GTKVER="${_DIR##*/}"
2016-10-27 15:05:00 +00:00
mkdir -p "${_DIR}"
2016-09-18 11:01:08 +00:00
cp -t "${_DIR}" \
"${GTKVER}/gtk.css" \
"${GTKVER}/gtk-dark.css" \
"${GTKVER}/gtk.gresource" \
2016-09-18 11:01:08 +00:00
"${GTKVER}/thumbnail.png"
cd "${_DIR}"
2016-10-27 15:05:00 +00:00
ln -srf ../assets assets
2016-09-18 11:01:08 +00:00
cd -
done
}
output_changes_file_version_marker() {
line() {
dashes="$(printf '%0.s-' $(seq 1 13))"
echo "${dashes}>>>> $1 <<<<${dashes}"
}
tag_line="$(line $1)"
echo "-${tag_line}${tag_line}${tag_line}-"
}
update_changes_file() {
LAST_STABLE_RELEASE=$(git describe --abbrev=0 --tags $(git rev-list --tags --max-count=1))
2016-10-23 00:29:07 +00:00
LAST_MAJOR_MINOR="${LAST_STABLE_RELEASE%.*}"
LAST_MAJOR="${LAST_STABLE_RELEASE%%.*}"
LAST_MINOR="${LAST_MAJOR_MINOR#*.}"
2016-10-23 00:29:07 +00:00
LAST_PATCH="${LAST_STABLE_RELEASE##*.}"
case "${PWD##*/}" in
2016-11-14 22:22:11 +00:00
numix-gtk-theme)
NEXT_PATCH=$(($LAST_PATCH + 1))
NEXT_STABLE_RELEASE="${LAST_MAJOR_MINOR}.${NEXT_PATCH}"
;;
Numix-Frost)
LAST_MAJOR=$(($LAST_MAJOR + 1))
NEXT_STABLE_RELEASE="${LAST_MAJOR}.${LAST_MINOR}.${LAST_PATCH}"
LAST_PATCH=$(($LAST_PATCH - 1))
LAST_STABLE_RELEASE="${LAST_MAJOR}.${LAST_MINOR}.${LAST_PATCH}"
;;
*)
echo 'Unknown directory!' && exit 1
;;
esac
[[ -f CHANGES ]] && mv CHANGES CHANGES.old
2016-10-23 00:29:07 +00:00
output_changes_file_version_marker "${NEXT_STABLE_RELEASE}" > CHANGES
{ git log \
--pretty=format:"[%ai] %<(69,trunc) %s %><(15) %aN {%h}" \
2016-10-23 00:29:07 +00:00
--cherry-pick "${LAST_STABLE_RELEASE}...HEAD"; } >> CHANGES
[[ -f CHANGES.old ]] && echo "" >> CHANGES && cat CHANGES.old >> CHANGES && rm CHANGES.old
2016-10-23 00:29:07 +00:00
git add CHANGES
git commit -m 'RELEASE PREP :: Update CHANGES file.'
git push
}
case $1 in
changes)
update_changes_file
exit $?
;;
install)
do_install "$2"
;;
*)
exit 0
;;
esac