67 lines
2.1 KiB
Bash
Executable File
67 lines
2.1 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
DIE() {
|
|
echo "$progname: error: $1" >&2
|
|
exit 1
|
|
}
|
|
|
|
Main() {
|
|
disk=$(blkid --label data_flash)
|
|
|
|
if [[ "" != "$disk" ]]; then
|
|
mkdir /flash
|
|
|
|
if [[ 0 -eq "$?" ]]; then
|
|
if [ -z "$(mount | grep '/flash')" ]; then
|
|
mount "$disk" /flash
|
|
|
|
if [[ 0 -eq "$?" ]]; then
|
|
mount | grep '/flash' | grep rw
|
|
|
|
if [[ 0 -eq "$?" ]]; then
|
|
if [ -f "/usr/local/bin/start-data-flash.sh" ]; then
|
|
/bin/bash /usr/local/bin/start-data-flash.sh
|
|
|
|
if [[ 0 -eq "$?" ]]; then
|
|
return 0 # true
|
|
fi
|
|
fi
|
|
else
|
|
umount /flash
|
|
|
|
if [[ 0 -eq "$?" ]]; then
|
|
blkid | grep "$disk" | grep "btrfs"
|
|
if [[ 0 -eq "$?" ]]; then
|
|
btrfs check --repair "$disk"
|
|
|
|
if [[ 0 -eq "$?" ]]; then
|
|
mount "$disk" /flash
|
|
|
|
if [[ 0 -eq "$?" ]]; then
|
|
if [ -f "/usr/local/bin/start-data-flash.sh" ]; then
|
|
/bin/bash /usr/local/bin/start-data-flash.sh
|
|
|
|
if [[ 0 -eq "$?" ]]; then
|
|
return 0 # true
|
|
fi
|
|
fi
|
|
fi
|
|
fi
|
|
fi
|
|
fi
|
|
fi
|
|
fi
|
|
fi
|
|
fi
|
|
|
|
# если ничего из вышеперечисленного не сработало, и диск имеет метку data_flash
|
|
if [ -f /usr/local/bin/usermod-home.sh ]; then
|
|
/bin/bash /usr/local/bin/usermod-home.sh
|
|
fi
|
|
fi
|
|
|
|
return 0 # true
|
|
}
|
|
|
|
Main "$@"
|