Changes
Jump to navigation
Jump to search
← Older edit
Newer edit →
BASH
(view source)
Revision as of 14:36, 22 September 2016
1,048 bytes added
,
14:36, 22 September 2016
→Ubuntu proxy setup
Line 260:
Line 260:
https_proxy="http://$HTTPS_PROXY_HOST:$HTTPS_PROXY_PORT/"
https_proxy="http://$HTTPS_PROXY_HOST:$HTTPS_PROXY_PORT/"
EOF
EOF
+
</source>
+
+
=== Git check for updates and prompt to update ===
+
<source lang="bash">
+
#!/bin/bash
+
PROJECT_DIR="$HOME/cpc"
+
PROJECT_PYTHON_INTERPRETER="$HOME/Virtualenvs/cpc/bin/python"
+
TRACK_BRANCH="MacBookPablo"
+
TRACK_REPO="origin"
+
+
+
cd $PROJECT_DIR
+
remote_commit=$(git branch -av | sed s/*/' '/g | grep $TRACK_BRANCH | grep $TRACK_REPO | awk '{print $2}')
+
echo "Remote commit: $remote_commit"
+
local_commit=$(git branch -av | sed s/*/' '/g | grep $TRACK_BRANCH | grep -v remotes/ | awk '{print $2}')
+
echo "Local commit: $local_commit"
+
+
+
django_migrate() {
+
$PROJECT_PYTHON_INTERPRETER manage.py migrate
+
}
+
+
update() {
+
echo "Updating code"
+
git pull $TRACK_REPO, $TRACK_BRANCH
+
django_migrate
+
}
+
+
+
if [ "$remote_commit" = "$local_commit" ]; then
+
echo "Runing latest version"
+
else
+
while true; do
+
read -p "Update available. Do you wish to update? " yn
+
case $yn in
+
[YySs]*) update; break;;
+
[Nn]* ) echo "Skipping update..." ; break;;
+
* ) echo "Choose y/n";;
+
esac
+
done
+
fi
+
</source>
</source>
Rafahsolis
Bureaucrats
,
Administrators
2,306
edits
Navigation menu
Personal tools
Not logged in
Talk
Contributions
Create account
Log in
Namespaces
Page
Discussion
Variants
Views
Read
View source
View history
More
Search
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Tools
Special pages
Printable version