-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinstall-gce-copier.sh
executable file
·69 lines (48 loc) · 1.4 KB
/
install-gce-copier.sh
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/usr/bin/env bash
#
# creates new install script.
# fixed missing }, but still not updateding the raw
update-upgrade () {
apt update -y && apt upgrade -y
}
install-packages () {
# test update
apt install $1 -y
}
install-apps () {
#
# install rclone
#
local DOWNLOAD_LINK="https://beta.rclone.org/rclone-beta-latest-linux-amd64.zip"
local RCLONE_ZIP="rclone-beta-latest-linux-amd64.zip"
local UNZIP_DIR="/tmp/rclone-temp"
curl -O $DOWNLOAD_LINK
mkdir -p $UNZIP_DIR
/usr/bin/unzip -a $RCLONE_ZIP -d $UNZIP_DIR
cd $UNZIP_DIR/*
cp rclone /usr/bin/rclone.new
chmod 755 /usr/bin/rclone.new
chown root:root /usr/bin/rclone.new
mv /usr/bin/rclone.new /usr/bin/rclone
#manuals
mkdir -p /usr/local/share/man/man1
cp rclone.1 /usr/local/share/man/man1/
mandb
mkdir -p /root/.config/rclone/
}
create_scripts () {
echo "#!/bin/bash" >> /opt/runcopy.sh
echo "" >> /opt/runcopy.sh
echo "sleep 30" >> /opt/runcopy.sh
echo "/usr/bin/rclone sync --config=/root/.config/rclone/rclone.conf -v --checkers=50 --transfers=40 --drive-chunk-size=64M --stats=60s --ignore-existing source:/ destination:/" >> /opt/runcopy.sh
echo "shutdown -h now" >> /opt/runcopy.sh
chmod a+x /opt/runcopy.sh
sed -i -e '$i \sleep 60 \n' /etc/rc.local
sed -i -e '$i \/opt/runcopy.sh &\n' /etc/rc.local
}
#
# This is where the "stuff" happens
update-upgrade
install-packages "unzip screen htop"
install-apps
create_scripts