summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xprepare78
1 files changed, 44 insertions, 34 deletions
diff --git a/prepare b/prepare
index cf81022..16d000a 100755
--- a/prepare
+++ b/prepare
@@ -5,7 +5,7 @@
# Purpose : Prepare wallpapers for Adélie desktop environments.
# Authors : Zach van Rijn <me@zv.io>
# License : Apache 2.0
-# Revision : 20231203
+# Revision : 20231205
#===============================================================
#===============================================================
@@ -124,7 +124,7 @@ cd "${HERE}";
##
# Check for required tools.
#
-for k in curl composite convert magick; do
+for k in curl composite convert; do
if ! command -v ${k} 2>&1 >/dev/null; then
printf "E: required utility '%s' not found!\n" "${k}";
exit 1;
@@ -137,25 +137,28 @@ done
# not prevent someone from being stupid, but they can avoid some
# common errors. We want to reduce surprises/ensure consistency.
#
-VTAG=$(git describe --tags --abbrev=0 2>/dev/null || true);
-if test -z "${VTAG}"; then
- printf "E: you need to tag at least one commit!\n";
- exit 1;
-fi
-if test $(git rev-list ${VTAG}..HEAD | wc -l) -gt 0; then
- printf "E: you need to be checked out at a tag!\n";
- exit 1;
-fi
-if test $(git ls-remote --tags origin ${VTAG} | wc -l) -eq 0; then
- printf "E: tag '%s' does not exist on origin!\n" "${VTAG}";
- exit 1;
-fi
-if test $(git status --porcelain | wc -l) -gt 0; then
- printf "E: tree is not clean; aborting!\n" "${VTAG}";
- exit 1;
+if test "${1}" = "--test"; then
+ VTAG="DEV";
+else
+ VTAG=$(git describe --tags --abbrev=0 2>/dev/null || true);
+ if test -z "${VTAG}"; then
+ printf "E: you need to tag at least one commit!\n";
+ exit 1;
+ fi
+ if test $(git rev-list ${VTAG}..HEAD | wc -l) -gt 0; then
+ printf "E: you need to be checked out at a tag!\n";
+ exit 1;
+ fi
+ if test $(git ls-remote --tags origin ${VTAG} | wc -l) -eq 0; then
+ printf "E: tag '%s' does not exist on origin!\n" "${VTAG}";
+ exit 1;
+ fi
+ if test $(git status --porcelain | wc -l) -gt 0; then
+ printf "E: tree is not clean; aborting!\n" "${VTAG}";
+ exit 1;
+ fi
fi
-
##
# Name of build directory. Please ensure it is in '.gitignore'.
#
@@ -278,7 +281,7 @@ mkdir -p "${HERE}/${KEEP}";
#
##
-# make_fake GRADIENT_FROM GRADIENT_TO XxY TEMPLATE OUTPUT
+# make_fake GRADIENT_FROM GRADIENT_TO XxY TEMPLATE OUTPUT [ARGS]
#
make_fake ()
{
@@ -287,9 +290,10 @@ make_fake ()
hexb="${1}"; shift; # gradient to
temp="${1}"; shift; # template
name="${1}"; shift; # output filename
+ args="${@}"; # all remaining arguments
printf "Generating %5s ('%s')...\n" "${size}" "${name}";
- magick \
+ convert \
-define gradient:angle=65 \
-size ${size} \
gradient:"${hexa}"-"${hexb}" \
@@ -318,6 +322,11 @@ make_fake ()
"${name}" \
"${name}" \
;
+ convert \
+ ${args} \
+ "${name}" \
+ "${name}" \
+ ;
}
@@ -330,22 +339,22 @@ printf "%s\n" "${MAKE}" | while read ratio scale _; do
x=$((${scale}*${ratio%:*}));
y=$((${scale}*${ratio#*:}));
- ############################################################
- # FIXME!
- # FOR SOME REASON, CHANGING '#EEEEEF' TO '#EEEEEE' OR FROM
- # '#303031' TO '#303030' WILL DISCARD COLOR INFORMATION OF
- # THE COMPOSITED SVG. WTF. WE LEVERAGE THIS THOUGH...
- ############################################################
-
- # background (we want the buggy black/white version)
+ # background (monochrome)
mkdir -p "${TEMP}"/generated/background;
- make_fake ${x}x${y} "#bbbbbb" "#eeeeee" black_x200 "${TEMP}"/generated/background/${x}x${y}.png;
- #make_fake ${x}x${y} "#bbbbbb" "#eeeeef" black_x200 "${TEMP}"/generated/background/${x}x${y}.png;
+ make_fake ${x}x${y} \
+ "#bbbbbb" "#eeeeee" \
+ black_x200 \
+ "${TEMP}"/generated/background/${x}x${y}.png \
+ -colorspace Gray -separate -average \
+ ;
- # lockscreen (we want the color version)
+ # lockscreen (full color)
mkdir -p "${TEMP}"/generated/lockscreen;
- #make_fake ${x}x${y} "#151515" "#303030" white_x200 "${TEMP}"/generated/lockscreen/${x}x${y}.png;
- make_fake ${x}x${y} "#151515" "#303031" white_x200 "${TEMP}"/generated/lockscreen/${x}x${y}.png;
+ make_fake ${x}x${y} \
+ "#151515" "#303030" \
+ white_x200 \
+ "${TEMP}"/generated/lockscreen/${x}x${y}.png \
+ ;
done
@@ -494,6 +503,7 @@ mkdir -p adelie-wallpapers-${VTAG}/usr/share/gnome-background-properties;
mv "${temp}" adelie-wallpapers-${VTAG}/usr/share/gnome-background-properties/Adelie.xml;
# generate tarball
+rm -f adelie-wallpapers-${VTAG}.tar.xz;
tar -pcJf adelie-wallpapers-${VTAG}.tar.xz adelie-wallpapers-${VTAG};
# clean up