Update launch.sh
Browse files
launch.sh
CHANGED
@@ -1,8 +1,6 @@
|
|
1 |
#!/bin/sh
|
2 |
|
3 |
-
BASE
|
4 |
-
USERNAME=$(printenv username)
|
5 |
-
PASSWORD=$(printenv password)
|
6 |
|
7 |
function env() {
|
8 |
if [[ ! -z "${fetch}" ]]; then
|
@@ -16,8 +14,6 @@ function env() {
|
|
16 |
echo "fetch = ${fetch}"
|
17 |
echo "github_secret = $github_secret"
|
18 |
echo "github_project = $github_project"
|
19 |
-
echo "USERNAME = ${USERNAME}"
|
20 |
-
echo "PASSWORD = ${PASSWORD}"
|
21 |
echo
|
22 |
echo
|
23 |
|
@@ -26,58 +22,22 @@ function env() {
|
|
26 |
}
|
27 |
|
28 |
function init() {
|
29 |
-
mkdir ${BASE}/
|
30 |
-
cd ${BASE}/
|
31 |
|
32 |
git config --global user.email "[email protected]"
|
33 |
-
git config --global user.name "
|
34 |
git config --global init.defaultBranch main
|
35 |
git init
|
36 |
git remote add origin https://[github_secret]@github.com/[github_project].git
|
37 |
git add .
|
38 |
-
echo "'update
|
39 |
-
git commit -m "'update
|
40 |
git pull origin main
|
41 |
|
42 |
cd ${BASE}
|
43 |
-
|
44 |
-
|
45 |
-
if [ "$(ls -A $DIR | grep -v .git)" ]; then
|
46 |
-
echo "Has history..."
|
47 |
-
else
|
48 |
-
echo "Empty history..."
|
49 |
-
cp -r data/* history/
|
50 |
-
cp -r secrets.json history/secrets.json
|
51 |
-
fi
|
52 |
-
|
53 |
-
rm -rf data
|
54 |
-
ln -s history data
|
55 |
-
|
56 |
-
rm -r config.yaml
|
57 |
-
cp config/config.yaml history/config.yaml
|
58 |
-
ln -s history/config.yaml config.yaml
|
59 |
-
sed -i "s/username: .*/username: \"${USERNAME}\"/" ${BASE}/config.yaml
|
60 |
-
sed -i "s/password: .*/password: \"${PASSWORD}\"/" ${BASE}/config.yaml
|
61 |
-
sed -i "s/whitelistMode: true/whitelistMode: false/" ${BASE}/config.yaml
|
62 |
-
sed -i "s/basicAuthMode: false/basicAuthMode: true/" ${BASE}/config.yaml
|
63 |
-
cat config.yaml
|
64 |
-
echo "Init history."
|
65 |
-
chmod -R 777 history
|
66 |
-
|
67 |
-
nohup ./git-batch --commit 10s --name git-batch --email [email protected] --push 1m -p history > access.log 2>1 &
|
68 |
-
}
|
69 |
-
|
70 |
-
function release() {
|
71 |
-
rm -rf history
|
72 |
-
}
|
73 |
-
|
74 |
-
function update() {
|
75 |
-
cd ${BASE}/history
|
76 |
-
git pull origin main
|
77 |
-
git add .
|
78 |
-
echo "'update history$(date "+%Y-%m-%d %H:%M:%S")'"
|
79 |
-
git commit -m "'update history$(date "+%Y-%m-%d %H:%M:%S")'"
|
80 |
-
git push origin main
|
81 |
}
|
82 |
|
83 |
case $1 in
|
@@ -87,10 +47,8 @@ case $1 in
|
|
87 |
init)
|
88 |
init
|
89 |
;;
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
update)
|
94 |
-
update
|
95 |
;;
|
96 |
esac
|
|
|
1 |
#!/bin/sh
|
2 |
|
3 |
+
BASE=
|
|
|
|
|
4 |
|
5 |
function env() {
|
6 |
if [[ ! -z "${fetch}" ]]; then
|
|
|
14 |
echo "fetch = ${fetch}"
|
15 |
echo "github_secret = $github_secret"
|
16 |
echo "github_project = $github_project"
|
|
|
|
|
17 |
echo
|
18 |
echo
|
19 |
|
|
|
22 |
}
|
23 |
|
24 |
function init() {
|
25 |
+
mkdir ${BASE}/data
|
26 |
+
cd ${BASE}/data
|
27 |
|
28 |
git config --global user.email "[email protected]"
|
29 |
+
git config --global user.name "git-batch"
|
30 |
git config --global init.defaultBranch main
|
31 |
git init
|
32 |
git remote add origin https://[github_secret]@github.com/[github_project].git
|
33 |
git add .
|
34 |
+
echo "'update data $(date "+%Y-%m-%d %H:%M:%S")'"
|
35 |
+
git commit -m "'update data $(date "+%Y-%m-%d %H:%M:%S")'"
|
36 |
git pull origin main
|
37 |
|
38 |
cd ${BASE}
|
39 |
+
chmod -R 777 data
|
40 |
+
nohup ./git-batch --commit 10s --name git-batch --email [email protected] --push 1m -p data > access.log 2>1 &
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
}
|
42 |
|
43 |
case $1 in
|
|
|
47 |
init)
|
48 |
init
|
49 |
;;
|
50 |
+
start)
|
51 |
+
init
|
52 |
+
/oneapi
|
|
|
|
|
53 |
;;
|
54 |
esac
|