I'm using github scripts to create a custom color for the icons in the 'places' directory. But I'm not able to automate the creation of symbolic links to the 'places' folder.
Also, I can't automate the creation of the 'index.theme' file, using only the scripts available on the site.
I'm doing it wrong, or there's no automation for it in the github scripts.
I'm trying through this script to add a new icon color and render the files.
Code: Select all
#!/usr/bin/env bash
set -e
SYSTEM_USER=false #$HOME/.icons
#SYSTEM_USER=true #/usr/share/icons/
VARIATION_NAME="Yellow-New"
VARIATION_SVG_COLOR="ffe35f"
MINT_Y_GIT="https://github.com/linuxmint/mint-y-icons/archive/refs/heads/master.zip"
OUTPUT_NAME_GIT="mint-y-icons-master"
INIT_DIR="$PWD/$OUTPUT_NAME_GIT"
SVG_PLACES="$INIT_DIR/src/places"
VARIATION_SVG_NAME=${VARIATION_NAME,,}
#==============
wget -c "$MINT_Y_GIT" -P "$PWD" -O "$OUTPUT_NAME_GIT.zip"
echo "=========> Unzip File"
unzip -qq -o "./$OUTPUT_NAME_GIT.zip"
if [ -d "$INIT_DIR/usr/share/icons/Mint-Y-$VARIATION_NAME" ]; then
rm -fr "$INIT_DIR/usr/share/icons/Mint-Y-$VARIATION_NAME"
fi
if ! grep -q "COLORS\[\"$VARIATION_SVG_NAME\"\] = \"$VARIATION_SVG_COLOR\"" "$SVG_PLACES/generate-color-variations.py" ; then
echo "=========> Modifying file: $SVG_PLACES/generate-color-variations.py"
sed -i "s/GREEN_COLOR = \"8bb158\"/COLORS[\"$VARIATION_SVG_NAME\"] = \"$VARIATION_SVG_COLOR\"\n\nGREEN_COLOR = \"8bb158\"/g" "$SVG_PLACES/generate-color-variations.py"
fi
echo "=========> Generating file: $SVG_PLACES/$VARIATION_SVG_NAME.svg"
cd "$SVG_PLACES"
"./generate-color-variations.py"
if ! grep -q "\"$VARIATION_NAME\"" "$INIT_DIR/src/render_places.py" ; then
echo "=========> Modifying file(Add new color): $INIT_DIR/src/render_places.py"
sed -i "s/colors = \[/colors = \[\"$VARIATION_NAME\", /g" "$INIT_DIR/src/render_places.py"
sed -i "s/ or All./, $VARIATION_NAME or All./g" "$INIT_DIR/src/render_places.py"
fi
echo "=========> Rendering files:"
cd "$INIT_DIR/src"
"./render_places.py" "$VARIATION_NAME"
echo -e "=========> Compressing file: $INIT_DIR/$VARIATION_NAME.tar.gz"
cd "$INIT_DIR/usr/share/icons"
tar -zcf "$INIT_DIR/$VARIATION_NAME.tar.gz" "Mint-Y-$VARIATION_NAME"
if [ -d "$HOME/.icons/Mint-Y-$VARIATION_NAME" ]; then
echo -e "=========> Removing folder: $HOME/.icons/Mint-Y-$VARIATION_NAME\n"
rm -fr "$HOME/.icons/Mint-Y-$VARIATION_NAME"
fi
if [ "$SYSTEM_USER" = true ]; then
if [ -d "/usr/share/icons/Mint-Y-$VARIATION_NAME" ]; then
echo -e "=========> Removing folder: /usr/share/icons/Mint-Y-$VARIATION_NAME\n"
sudo rm -fr "/usr/share/icons/Mint-Y-$VARIATION_NAME"
fi
echo -e "=========> Unpacking file to: /usr/share/icons/"
sudo tar zxf "$INIT_DIR/$VARIATION_NAME".tar.gz -C "/usr/share/icons/"
else
mkdir -p "$HOME/.icons"
echo -e "=========> Unpacking file to: $HOME/.icons"
tar zxf "$INIT_DIR/$VARIATION_NAME".tar.gz -C "$HOME/.icons"
if [ -d "/usr/share/icons/Mint-Y-$VARIATION_NAME" ]; then
echo -e "=========> Removing folder: /usr/share/icons/Mint-Y-$VARIATION_NAME\n"
sudo rm -fr "/usr/share/icons/Mint-Y-$VARIATION_NAME"
fi
fi