aboutsummaryrefslogtreecommitdiffstats
path: root/setupdisk.sh
blob: 659a6215ab32a1e53050c4e446bce07b521352e0 (plain)
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
#!/bin/bash

printf "%b" "  ${IGRN}Creating primary partition at \
${IWHT}${LFS_DISK}${RST}...\n"
sudo fdisk "${LFS_DISK}" >/dev/null 2>&1 << EOF
o
n
p
1

+14G
a
1
n
p
2


p
w
q
EOF
retval=$?
if [[ "$retval" -ne 0 ]]; then
	printf "%b" "  ${IGRN}Creating partition ${IWHT}${LFS_DISK}${LFS_PART} "
	fail "FAILED!"
	exit 1
fi
printf "%b" "  ${IGRN}Formatting ${IWHT}${LFS_DISK}${LFS_PART} with \
${IWHT}${LFS_FS}${IGRN} filesystem and label ${IWHT}${LFS_VER}${RST}\n"
if ! sudo /sbin/mkfs -t "${LFS_FS,,}" -L "${LFS_VER}" -F "${LFS_DISK}${LFS_PART}" >/dev/null 2>&1; then
	printf "%b" "  ${IGRN}Creating ${IWHT}${LFS_FS}${IGRN} filesystem at \
${IWHT}${LFS_DISK}${LFS_PART} "
	fail "FAILED!"
	exit 1
fi