Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
executable file 87 lines (74 sloc) 1.98 KB
#!/bin/bash
# SETUP RESTful API TEMPLATE
red=`tput setaf 1`
green=`tput setaf 2`
reset=`tput sgr0`
echo
echo "======= CHECKING WE ARE ON A CODIO BOX ======="
if [ -v CODIO_HOSTNAME ]
then
echo "Codio box detected"
echo "continuing setup"
else
echo "no Codio box detected"
echo "exiting setup"
exit 1
fi
sudo chown -R codio:codio .
# destructive section start
echo
echo "============== ${green}DELETING${reset} OLD FILES ==================="
rm -rf *
rm -rf .*
rm -rf .guides
rm -rf .git
echo
echo "============== CLONING ${green}REPOSITORY${reset} ==================="
git clone https://github.coventry.ac.uk/web/Codio-PWA-Template.git .
git remote rm origin
rm -rf install.sh # delete this script so it can't be run from inside the project!
rm .codio
mv codio.json .codio
echo
echo "============= DELETING ${green}TEMPORARY FILES${reset} =============="
rm -rf *.db # delete any old database files
rm -rf package-lock.json
rm -rf .settings
rm -rf .sqlite_history
rm -rf .bash_history
rm -rf .git # delete the repository we have cloned (if any)
# end of distructive section
echo
echo "============ INSTALLING PACKAGES ============"
sudo add-apt-repository -y ppa:git-core/ppa
sudo apt update -y
sudo apt upgrade -y
sudo apt install -y psmisc lsof tree build-essential gcc g++ make jq curl git
sudo apt autoremove -y
echo
echo "========= INSTALLING NODE USING ${green}NODESOURCE${reset} ========="
curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash -
sudo apt install -y nodejs
echo
echo "=========== INSTALLING THE ${green}NODE PACKAGES${reset} ==========="
echo
rm -rf node_modules
rm -rf package-lock.json
sudo npm install -g http-server
echo
echo "========= CUSTOMISING SHELL PROMPT =========="
if grep PS1 ~/.profile
then
echo "correct prompt found"
else
echo "prompt needs updating"
echo "PS1='$ '" >> ~/.profile
fi
if grep http-server ~/.profile
then
echo "server startup script found"
else
echo "adding server startup script"
echo "http-server" >> ~/.profile
fi
source ~/.profile