rc

Add command to output current git directory

Author
Maarten 'Vngngdn' Vangeneugden
Date
Oct. 1, 2017, 2:46 p.m.
Hash
277db3dfb554c9c9298cdd3bbc402c3ccdbb3752
Parent
a1dc44ed14c7570375c74a09055b0b2d6185be3f
Modified file
shutdown.sh

shutdown.sh

1 addition and 0 deletions.

View changes Hide changes
1
1
# whether the repositories are handled properly, and aborts if there is still
2
2
# work to be done. Of course, it can be overridden anytime by manually issuing
3
3
# the shutdown command.
4
4
# This script is made to work with i3, because it uses the i3-nagbar to send
5
5
# messages to the user.
6
6
7
7
readyForShutdown=true
8
8
9
9
echo -e "Checking all repositories for outstanding commits...\n"
10
10
cd ~/Repositories
11
11
for directory in */ ; do
12
12
	cd $directory
13
13
    files="$(git status -s)"
+
14
    files="$(git status -s)"
14
15
    if [ "${files:0:2}" == " M" ]; then
15
16
        i3-nagbar -t warning -m "Repository $directory has uncommitted modifications!"
16
17
        readyForShutdown=false
17
18
        break
18
19
    else
19
20
        git push # Pushing the changes to the upstream repo if applicable
20
21
    fi
21
22
	cd ..  # Returning to Repositories
22
23
done
23
24
24
25
cd ~  # Return to home
25
26
26
27
if [ "$readyForShutdown" == true ]; then
27
28
    echo -e "Synchronizing remaining university data...\n"
28
29
    rsync -a -P --delete -e ssh ~/University maarten@maartenv.be:/home/maarten/Documenten &> /dev/null
29
30
fi
30
31
31
32
32
33
33
34
if [ "$readyForShutdown" == true ]; then
34
35
    # All set!
35
36
    echo -e "All tasks completed, system will now terminate. Have a furry day. =3\n"
36
37
    sleep 1  # Necessary to let the nice furry pun display long enough OwO
37
38
    shutdown now
38
39
fi
39
40