-
Notifications
You must be signed in to change notification settings - Fork 0
/
init.sh
executable file
·35 lines (24 loc) · 960 Bytes
/
init.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
#!/bin/bash
FOLDER_NAME=/media/disk/
echo "First task at hand, let's mount our drive."
lsblk
echo -n "what is the name of the drive (sdb?): "
read driveName
if [[ -n "$driveName" ]]; then
echo "Okey then, let's format this thing!"
mkfs.ext4 -m 0 -F -E lazy_itable_init=0,lazy_journal_init=0,discard "/dev/$driveName"
echo "Creating the folder to mount!"
mkdir -p $FOLDER_NAME
echo "Mounting .."
sudo mount -o discard,defaults /dev/$driveName $FOLDER_NAME
sudo chmod a+w $FOLDER_NAME
sudo mkdir $FOLDER_NAME/files
echo "WARNING: This drive will not auto mount on reboot. Normally, we don't want to, since the servers should be short-lived."
export PATH="$PATH:$PWD"
echo "PATH=\"\$PATH:$PWD\"" >> ~/.bashrc
echo "Installing rclone!";
curl https://rclone.org/install.sh | sudo bash
echo "We are ready – now run this: rclone config"
else
echo "Okey then, I will not do anything then"
fi