-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdo-git.sh
More file actions
52 lines (52 loc) · 2.16 KB
/
do-git.sh
File metadata and controls
52 lines (52 loc) · 2.16 KB
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/bin/bash
clear #clears the air of your terminal
# variables
###############################################################
###############################################################
################ VARIABLES TO EDIT ############################
APPNAME="MIUI-XML-6.0-Greek"
BACKPATH="../MIUI-XML-6.0-Greek_backup" #always a folder outside git
################ DO NOT EDIT AFTER THESE LINES ################
###############################################################
###############################################################
VER="0.8"
echo "Do GIT script v.$VER"
echo "by @SomniusX (Somnius on GitHub)"
echo " "
echo "The program checks for backup directory, if it doesn't exist it creates it."
echo "Then it zip's with -r -q -9 flags (recursive/quiet/max compression) with date."
echo "Then it displays backup folder size and starts commit all, pull and then push."
echo " "
echo "-------------------------------------------------------"
echo " "
if [ -d $BACKPATH ]
then
echo "Backup Directory exists."
echo "Starting process.."
zip -r -q -9 $BACKPATH/backup-$(date +%Y%m%d_%H%M).zip * # the zipping using date
du -sh $BACKPATH/*.zip|tail -1|sed -e "s/..\/\"$APPNAME\"_backup\//is the back'ed up file\: /" # the du to check the file size
echo "Backup folder size is.."
du -sh $BACKPATH|sed -e "s/..\/\"$APPNAME\"_/holds the folder\: /" # the du with sed to display the backup folder size
echo " "
sleep 1 # wait for 1sec
git commit -a # the commit all
git pull # the pull
git push # the push
echo " "
echo "All done.."
else
echo "Backup Directory doesn't exist, creating.."
mkdir $BACKPATH # creating the backup directory for 1st time use
echo "Starting process.."
zip -r -q -9 $BACKPATH/backup-$(date +%Y%m%d_%H%M).zip * # the zipping using date
du -sh $BACKPATH/*.zip|tail -1|sed -e "s/..\/\"$APPNAME\"_backup\//is the back'ed up file\: /" # the du to check the file size
echo "Backup folder size is.."
du -sh $BACKPATH|sed -e "s/..\/\"$APPNAME\"_/holds the folder\: /" # the du with sed to display the backup folder size
echo " "
sleep 1 # wait for 1sec
git commit -a # the commit all
git pull # the pull
git push # the push
echo " "
echo "All done.."
fi