-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPrepareForUpload.sh
35 lines (33 loc) · 1014 Bytes
/
PrepareForUpload.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
#!/bin/sh
# $1 = the name of the repo
# $2 = the name of the target mod folder
# $3 = the name of the thumbnail file
currentDir=$(pwd)
currentDirName=$(basename "$currentDir")
devDirName="$1"
destinationName="$2"
if [ $currentDirName==$devDirName ] ; then
{
destinationName="../$destinationName"
}
elif [ -d "$currentDir/$devDirName"] ; then
{
currentDir="$currentDir/$devDirName"
}
else
{
echo "$devDirName doesn't exist"
exit 1
}
fi
if [ -d $destinationName ] ; then
echo "$destinationName exists, deleting"
rm -rfd $destinationName
fi
mkdir $destinationName
if [ ! -f "thumbnail.png" ]; then
convert $3 thumbnail.png
fi
sed -i "s/picture=.*//g" "descriptor.mod"
rsync -ahm --include="/thumbnail.png" --include='/descriptor.mod' --include='/README.md' --exclude='*.7z' --exclude='/*.*' --exclude='/.*' --exclude='/tutorial' --exclude='*.sh' --exclude='*.ps1' --exclude='*.psd' --exclude='*.py' . $destinationName
cp -f "$destinationName/descriptor.mod" "$destinationName/../$2.mod"