Skip to content

Instantly share code, notes, and snippets.

@mithereal
Last active August 29, 2015 14:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mithereal/de11b8e13c0db2677858 to your computer and use it in GitHub Desktop.
Save mithereal/de11b8e13c0db2677858 to your computer and use it in GitHub Desktop.
command line opencart module installer
#!/bin/bash
DESTINATION_HELP='-p project_destination_path'
PROJECT_HELP='-r Resets the Project dir'
CWD=$(pwd)
function help()
{
echo ""
echo "Opencart Plugin Installer by Jason Clark <mithereal@gmail.com>"
echo ""
echo "Usage: install-opencart-plugin $DESTINATION_HELP "
echo $PROJECT_HELP
}
function install()
{
if [ -f $CWD/.projdir ]
then
pdir="$(<$CWD/.projdir)"
command="cp -r -v -t $pdir $CWD/upload/"*
echo $($command)
elif [ $DESTINATION_PATH ]
then
command="cp -r -v -t $DESTINATION_PATH $CWD/upload/"*
echo $($command)
else
read -p "Which directory shall I install to: " LINE
echo "$LINE" > "$CWD/.projdir"
fi
}
while getopts ":p:?:r" opt; do
case $opt in
p)
DESTINATION_PATH=$OPTARG
;;
r)
rm "$CWD/.projdir"
exit 0
;;
?)
help
exit 0
;;
esac
done
install
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment