Last active
March 26, 2018 12:16
-
-
Save tom-it/ea1d64f285494d8fa9c8980fbca2fcf9 to your computer and use it in GitHub Desktop.
Opencart 3.0.2.0 duplicate default theme
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ "$#" -ne 3 ] || ! [ -d "$1" ]; then | |
echo "Usage: $0 THEMEDIR $1 ADMINDIR $2 COPYNAME" >&2 | |
exit 1 | |
fi | |
#The admin controller needs a capitalized theme name | |
function capitalize_first(){ | |
string0=$COPY | |
firstchar=${string0:0:1} | |
string1=${string0:1} | |
FirstChar=`echo "$firstchar" | tr a-z A-Z` | |
CAPITALIZEDCOPY="$FirstChar$string1" | |
} | |
THEMEDIR=$1 | |
ADMINDIR=$2 | |
COPY=$3 | |
capitalize_first | |
echo "Duplicating default theme" | |
cp -R $THEMEDIR"/default" $THEMEDIR"/"$COPY | |
echo "renaming theme image" | |
mv $THEMEDIR"/"$COPY"/image/default.png" $THEMEDIR"/"$COPY"/image/"$COPY".png" | |
echo "fix css include dir" | |
sed -i "s/default/${COPY}/g" $THEMEDIR"/"$COPY"/template/common/header.twig" | |
echo "copy admin controller and rename" | |
cp $ADMINDIR"/controller/extension/theme/default.php" $ADMINDIR"/controller/extension/theme/"$COPY.php | |
sed -i "s/default/${COPY}/g" $ADMINDIR"/controller/extension/theme/"$COPY".php" | |
sed -i "s/Default/${CAPITALIZEDCOPY}/g" $ADMINDIR"/controller/extension/theme/"$COPY".php" | |
echo "copy language file" | |
cp $ADMINDIR"/language/en-gb/extension/theme/default.php" $ADMINDIR"/language/en-gb/extension/theme/"$COPY".php" | |
sed -i "s/default/${COPY}/g" $ADMINDIR"/language/en-gb/extension/theme/"$COPY".php" | |
sed -i "s/Default/${CAPITALIZEDCOPY}/g" $ADMINDIR"/language/en-gb/extension/theme/"$COPY".php" | |
echo "copy admin view file" | |
cp $ADMINDIR"/view/template/extension/theme/default.twig" $ADMINDIR"/view/template/extension/theme/"$COPY".twig" | |
sed -i "s/default/${COPY}/g" $ADMINDIR"/view/template/extension/theme/"$COPY".twig" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment