-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.sh
executable file
·88 lines (63 loc) · 1.2 KB
/
setup.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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#!/bin/bash
source config
DRIVE=$1
SWAP=$2
echo $1
echo $SWAP
if [ -d "$LFS" ]; then
echo "$LFS exists"
else
mkdir -v $LFS
echo "$LFS created"
fi
if [ "ext4" = $(df -Th | grep $DRIVE | awk '{print $2}') ]; then
echo "DRIVE is ext4"
else
mkfs -v -t ext4 $DRIVE
fi
if grep -qs $LFS /proc/mounts; then
echo "$LFS is mounted."
else
sudo mount -v -t ext4 $DRIVE $LFS
fi
echo "$LFS is mount completed."
echo "swap off"
swapoff /dev/sda2
if grep -qs $SWAP /proc/swaps; then
echo "$SWAP is swap."
else
echo "making swap"
mkswap $SWAP
fi
echo "Turning Swapon"
/sbin/swapon -v $SWAP
if [ -d "$LFSSOURCE" ]; then
echo "$LFSSOURCE exists"
else
mkdir -v $LFSSOURCE
chmod -v a+wt $LFSSOURCE
echo "$LFSSOURCE created"
fi
linkedtool=/tools
if [ -d "$LFSTOOLS" ]; then
echo "$LFSTOOLS exists"
else
sudo mkdir -v $LFSTOOLS
echo "$LFSTOOLS created"
fi
if [ -L $linkedtool ] ; then
if [ -e $linkedtool ] ; then
echo "Good link"
else
echo "Broken link"
sudo rm linkedtool
sudo ln -sv $LFSTOOLS /
fi
elif [ -e $linkedtool ] ; then
sudo rm $linkedtool
sudo ln -sv $LFSTOOLS /
else
echo "Missing"
sudo rm $linkedtool
sudo ln -sv $LFSTOOLS /
fi