Skip to content

Commit 2c52823

Browse files
committed
armbian-tf: add platform and disk judgment
1 parent fbbdec4 commit 2c52823

File tree

1 file changed

+21
-3
lines changed
  • build-armbian/armbian-files/common-files/usr/sbin

1 file changed

+21
-3
lines changed

build-armbian/armbian-files/common-files/usr/sbin/armbian-tf

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616
#
1717
#========================= Set default parameters ==========================
1818
#
19+
# Set the release check file
20+
ophub_release_file="/etc/ophub-release"
21+
1922
# Set font color
2023
STEPS="[\033[95m STEPS \033[0m]"
2124
INFO="[\033[94m INFO \033[0m]"
@@ -33,12 +36,27 @@ error_msg() {
3336

3437
# Check disk
3538
do_checkdisk() {
39+
# Check release file
40+
[[ -f "${ophub_release_file}" ]] || error_msg "missing [ ${ophub_release_file} ] file."
41+
# Get values
42+
source "${ophub_release_file}"
43+
PLATFORM="${PLATFORM}"
44+
[[ -z "${PLATFORM}" ]] && error_msg "Invalid PLATFORM: [ ${PLATFORM} ]"
45+
46+
# Only the [ amlogic ] box needs manual expansion
47+
[[ "${PLATFORM}" != "amlogic" ]] && error_msg "The [ ${PLATFORM} ] box has been expanded without operation."
48+
3649
# Find the partition where root is located
3750
ROOT_PTNAME="$(df / | tail -n1 | awk '{print $1}' | awk -F '/' '{print $3}')"
3851
if [[ -z "${ROOT_PTNAME}" ]]; then
3952
error_msg "Cannot find the partition corresponding to the root file system!"
4053
fi
4154

55+
# Check the current system running disk
56+
if lsblk -l | grep -E "^${ROOT_PTNAME:0:-2}boot0" >/dev/null; then
57+
error_msg "You are running in eMMC mode, please boot system with usb or tf card!"
58+
fi
59+
4260
# Find the disk where the partition is located, only supports mmcblk?p? sd?? hd?? vd?? and other formats
4361
case "${ROOT_PTNAME}" in
4462
mmcblk?p[1-4])
@@ -69,10 +87,10 @@ create_new_part() {
6987
# Set the type of file system
7088
cat <<EOF
7189
-----------------------------------------------
72-
ID TYPE
90+
ID TYPE
7391
-----------------------------------------------
74-
1 ext4
75-
2 btrfs
92+
1 ext4
93+
2 btrfs
7694
-----------------------------------------------
7795
EOF
7896
echo -ne "${OPTIONS} Please Input ID: "

0 commit comments

Comments
 (0)