-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetupgit.sh
More file actions
27 lines (21 loc) · 803 Bytes
/
setupgit.sh
File metadata and controls
27 lines (21 loc) · 803 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
#!/bin/bash
cd /tmp
rm -r CA-server-api
git clone https://github.com/NCKU-NASA/CA-server-api
cd CA-server-api
for a in $(ls -a)
do
if [ "$a" != "." ] && [ "$a" != ".." ] && [ "$a" != ".git" ] && [ "$a" != "Readme.md" ] && [ "$a" != "install.sh" ] && [ "$a" != "remove.sh" ] && [ "$a" != "setupgit.sh" ] && [ "$a" != "config.yaml" ]
then
rm -rf $a
fi
done
for a in $(ls -a /etc/caserverapi)
do
if [ "$a" != "." ] && [ "$a" != ".." ] && [ "$a" != "config.yaml" ] && [ "$(cat /etc/caserverapi/.gitignore | sed 's/\/.*//g' | sed '/^!.*/d' | grep -P "^$(echo "$a" | sed 's/\./\\\./g')$")" == "" ]
then
sudo cp -r /etc/caserverapi/$a $a
fi
done
sudo cp /usr/local/bin/caserverapi caserverapi.sh
sudo cp /etc/systemd/system/caserverapi.service caserverapi.service