Skip to content

Instantly share code, notes, and snippets.

@tnga
Last active May 4, 2019 17:14
Show Gist options
  • Save tnga/213c96fe43596538d9270ca0debd842a to your computer and use it in GitHub Desktop.
Save tnga/213c96fe43596538d9270ca0debd842a to your computer and use it in GitHub Desktop.
A script for quick get icons that are not referenced from Moka icon's source folder to UMI icon's source folder.
#!/bin/bash
#
# Description:
# A script for quick get icons that are not referenced from Moka icon's source folder to UMI icon's source folder.
# NOTE:
# Moka icon's source folder and UMI icon's source folder have to be in the same directory.
#
# Legal Stuff: <https://www.gnu.org/licenses/gpl-3.0.txt>
# @tnga
DIR=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )
MOKABITMAPS_DIR="moka-icon-theme/src/bitmaps"
UMICONTEXTS_DIR="umi-mvx-icons/src"
NEWICON_DIR="newicons"
if [ ! -d "$DIR/$NEWICON_DIR" ]; then
mkdir newicons
fi
for BITMAP_DIR in $( ls $DIR/$MOKABITMAPS_DIR )
do
# echo $BITMAP_DIR
# Check directory
if [ -d "$DIR/$MOKABITMAPS_DIR/$BITMAP_DIR" ]; then
for iconname in $( ls $DIR/$MOKABITMAPS_DIR/$BITMAP_DIR )
do
# echo $iconname
icon_exist=false
for CONTEXT in $( ls $DIR/$UMICONTEXTS_DIR)
do
# echo $CONTEXT
if [ -d "$DIR/$UMICONTEXTS_DIR/$CONTEXT" ]; then
if [ -f "$DIR/$UMICONTEXTS_DIR/$CONTEXT/$BITMAP_DIR/$iconname" ]; then
icon_exist=true
fi
fi
done
# echo $icon_exist
if [ "$icon_exist" = false ]; then
echo "new icon find: $iconname"
cp $DIR/$MOKABITMAPS_DIR/$BITMAP_DIR/$iconname $DIR/$NEWICON_DIR
fi
done
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment