1#!/bin/bash
2# Assemble database icons from the icons8 collection
3# by Wolfram Rösler 2020-04-30
4
5NC='\033[0m'
6RED='\033[0;31m'
7YELLOW='\033[0;33m'
8
9# Check parameters
10if [[ $# != 1 ]];then
11    echo "Usage: $0 ICONS8"
12    echo "ICONS8 is the directory containing the Icons8 flat-color-icons repository"
13    echo "(git clone https://github.com/icons8/flat-color-icons)".
14    exit
15fi
16
17# Check source directory
18SRCDIR="$1"
19if [ ! -d "$SRCDIR" ];then
20    echo -e "${RED}icons8 directory doesn't exist: ${SRCDIR}${NC}"
21    exit 1
22fi
23
24# Check destination directory
25DSTDIR=share/icons/database
26if [ ! -d "$DSTDIR" ];then
27    echo -e "${RED}Please invoke this script from the KeePassXC source root directory.${NC}"
28    exit 1
29fi
30
31# Copy one icon from the icons8 collection.
32#
33# Usage: copy I8NAME Cnn
34# I8NAME is the file name (without extender and without
35# the "icon8-" prefix) in the icons8 directory.
36# Cnn is C plus the number of the database icon.
37#
38# Example: copy key C00
39copy() {
40    # The source file is:
41    SRC="${SRCDIR}/svg/${1}.svg"
42    if [ ! -f "$SRC" ];then
43        echo -e "${RED}Cannot find source icon for ${2} (${SRC})${NC}"
44        return
45    fi
46
47    # Copy the source file to the destination, keeping
48    # the source file's extension
49    DST="$DSTDIR/${2}.svg"
50    cp $SRC $DST
51    echo "Copied icon for ${1} to ${DST}"
52}
53
54# Now do the actual work
55#copy key                       C00_Password           # Derivative work from key
56copy globe                      C01_Package_Network
57copy high_priority              C02_MessageBox_Warning
58copy data_protection            C03_Server             # No exact match
59copy survey                     C04_Klipper
60copy businessman                C05_Edu_Languages
61copy services                   C06_KCMDF
62#copy notepad                   C07_Kate               # Provided by paomedia/small-n-flat
63copy external                   C08_Socket
64copy business_contact           C09_Identity
65copy address_book               C10_Kontact
66copy old_time_camera            C11_Camera
67copy entering_heaven_alive      C12_IRKickFlash        # No exact match
68#copy keys-holder               C13_KGPG_Key3          # Derivative work from key
69copy crystal_oscillator         C14_Laptop_Power
70copy video_projector            C15_Scanner
71copy bookmark                   C16_Mozilla_Firebird
72#copy cd                        C17_CDROM_Unmount      # Provided by paomedia/small-n-flat
73#copy monitor                   C18_Display            # Provided by paomedia/small-n-flat
74#copy feedback                  C19_Mail_Generic       # Derivative work from feedback
75copy settings                   C20_Misc
76copy inspection                 C21_KOrganizer
77copy file                       C22_ASCII
78copy template                   C23_Icons
79copy flash_on                   C24_Connect_Established
80copy safe                       C25_Folder_Mail        # No exact match
81#copy save                      C26_FileSave           # Provided by paomedia/small-n-flat
82#copy cloud-storage             C27_NFS_Unmount        # Provided by paomedia/small-n-flat
83copy film_reel                  C28_QuickTime
84#copy                           C29_KGPG_Term          # Derivative work from command_line and key
85#copy command_line              C30_Konsole            # Derivative work from command_line
86copy print                      C31_FilePrint
87copy org_unit                   C32_FSView
88copy cloth                      C33_Run
89copy support                    C34_Configure
90#copy vpn                       C35_KRFB               # Derivative work from paomedia/small-n-flat
91#copy archive-folder            C36_Ark                # Derivative work from folder
92#copy percentage                C37_KPercentage        # Original work
93#copy windows-client            C38_Samba_Unmount      # Derivative work from paomedia/small-n-flat
94copy clock                      C39_History
95copy search                     C40_Mail_Find
96copy landscape                  C41_VectorGfx
97copy electronics                C42_KCMMemory
98copy empty_trash                C43_EditTrash
99#copy                           C44_KNotes             # Provided by paomedia/small-n-flat
100#copy                           C45_Cancel             # Original work
101#copy                           C46_Help               # Original work
102copy package                    C47_KPackage
103copy folder                     C48_Folder
104copy opened_folder              C49_Folder_Blue_Open
105copy data_encryption            C50_Folder_Tar
106#copy unlock                    C51_Decrypted          # Provided by paomedia/small-n-flat
107#copy lock                      C52_Encrypted          # Provided by paomedia/small-n-flat
108#copy                           C53_Apply              # Original work
109#copy pencil                    C54_Signature          # Provided by paomedia/small-n-flat
110copy image_file                 C55_Thumbnail
111copy contacts                   C56_KAddressBook
112copy data_sheet                 C57_View_Text
113copy podium_with_speaker        C58_KPGP               # No exact match
114#copy hammer                    C59_Package_Development # Provided by paomedia/small-n-flat
115copy home                       C60_KFM_Home
116#copy                           C61_Services           # Original work
117copy linux                      C62_Tux
118copy android_os                 C63_Feather
119#copy                           C64_Apple              # Derivative work created from simple-icons apple.svg
120copy wikipedia                  C65_W
121#copy currency_exchange         C66_Money              # Provided by paomedia/small-n-flat
122copy diploma_1                  C67_Certificate
123copy smartphone_tablet          C68_Blackberry
124