forked from sarelvdwalt/fun-base
-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathsetup.sh
More file actions
executable file
·41 lines (30 loc) · 794 Bytes
/
setup.sh
File metadata and controls
executable file
·41 lines (30 loc) · 794 Bytes
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
#!/bin/sh
echo "You are about to set up a new copy of this repository at the remote you specified, being: '$1'";
if [ -z "$1" ]
then
echo 'You MUST give us a git remote location before continuing as first parameter!';
exit 0;
fi
read -r -p "Are you sure? [y/N] " response
if [[ $response =~ ^([yY][eE][sS]|[yY])$ ]]
then
echo 'These are the remotes before we started:'
git remote -v
echo;
echo 'Deleting those remotes...'
git remote rm origin
echo '... done.'
echo;
echo 'Adding new origin...'
git remote add origin "$1"
echo '... done.'
echo 'These are the remotes after we done:'
git remote -v
echo;
git push -u origin master
rm setup.sh
git commit --all -m 'Removed setup script, this is a leaf node.'
git push -u origin master
else
echo 'Ok. Bailing out.'
fi