1
0
mirror of https://github.com/home-assistant/operating-system.git synced 2026-05-02 06:32:42 +01:00

Allow easy move data partition (#651)

* Allow easy move data partition

* Cleanup handling systemd

* Improve handling

* fix pipeline

* pipeline

* fix shell handling

* fix scripts

* Add bin folder

* fix lint

* Fix service handling

* Fix loading

* hide output

* Fix handling
This commit is contained in:
Pascal Vizeli
2020-05-06 00:00:28 +02:00
committed by GitHub
parent ba9d1bac1e
commit b3530d1ce1
49 changed files with 185 additions and 44 deletions

View File

@@ -0,0 +1,31 @@
#!/bin/sh
# ==============================================================================
# HassOS data partition handling
# ==============================================================================
set -e
OPTION_FILE=/mnt/overlay/data.opt
DATA_DEVICE_CHILD="$(findfs LABEL="hassos-data")"
DATA_DEVICE_ROOT="/dev/$(lsblk -no pkname "${DATA_DEVICE_CHILD}")"
# Move command
if [ "${1}" = "move" ] && [ -e "${2}" ]; then
DEVICE="${2}"
# Check device
if ! lsblk "${DEVICE}" | grep disk > /dev/null 2>&1; then
echo "[ERROR] Is not disk!"
exit 1
elif [ "${DEVICE}" = "${DATA_DEVICE_ROOT}" ]; then
echo "[ERROR] Can't be the same disk!"
exit 1
fi
# Flag device
echo "WARNING: ${DEVICE} will be reset on next restart!"
echo "Press a key to move forward"
read -r
echo "${DEVICE}" > ${OPTION_FILE}
fi