-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathpack.sh
47 lines (47 loc) · 1.12 KB
/
pack.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/usr/bin/bash
# creates importable packs
# usage: pack.sh [dir]
# where [dir] is a subdirectory in webres
#
# check for params
if [ $# = "0" ]; then
echo "ERROR: No directory specified."
else
emojidir=webres/$1
zipfile=releases/$1.zip
tarfile=releases/$1.tar.gz
jsonfile=webres/$1/meta.json
# check if dir exists
if [ ! -d $emojidir ]; then
echo "ERROR: Directory '$1' does not exist."
# check if dir is empty (apparently read NEEDS a variable :/ )
elif find $emojidir -mindepth 1 -maxdepth 1 | read ugh; then
# remove old files
if [ -f $zipfile ]; then
rm $zipfile
fi
if [ -f $tarfile ]; then
rm $tarfile
fi
if [ -f $jsonfile ]; then
rm $jsonfile
fi
# generate .tar.gz for masto/akkoma
tar -czf $tarfile -C webres $1
if [ -f $tarfile ]; then
echo "Created '$tarfile' sucessfully!"
fi
# generate meta.json
python3 pack_json.py $1
if [ -f $jsonfile ]; then
echo "Created '$jsonfile' sucessfully!"
fi
# generate .zip for misskey
zip -jq $zipfile $emojidir/*
if [ -f $zipfile ]; then
echo "Created '$zipfile' sucessfully!"
fi
else
echo "ERROR: Directory '$1' is empty."
fi
fi