Skip to content

Commit

Permalink
apps: tn_bsp_services: resize_rfs: add log and reboot when done
Browse files Browse the repository at this point in the history
  • Loading branch information
JoeZhang-tn committed Jan 16, 2025
1 parent 7c8e64b commit 340a203
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/apps/utils/tn_bsp_services/resize_rfs.service
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ Before=shutdown.target
[Service]
Type=oneshot
StandardOutput=journal+console
ExecStart=-/usr/sbin/resize_rfs.sh
ExecStartPost=/bin/systemctl disable resize_rfs.service
ExecStartPre=-/usr/sbin/resize_rfs.sh
ExecStart=/bin/systemctl disable resize_rfs.service
ExecStart=/bin/sleep 5
ExecStart=/usr/sbin/reboot

[Install]
WantedBy=multi-user.target
14 changes: 14 additions & 0 deletions src/apps/utils/tn_bsp_services/resize_rfs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,19 @@ ROOT_PART_NAME=$(echo "$ROOT_DEVICE" | cut -d "/" -f 3)
DEVICE_NAME=$(echo /sys/block/*/"${ROOT_PART_NAME}" | cut -d "/" -f 4)
PART_ENTRY_NUMBER=$(cat "/sys/block/${DEVICE_NAME}/${ROOT_PART_NAME}/partition")

sleep 5

echo -e '\033[36m\n***********************************'
echo 'Resizing storage at first boot.....'
echo -e '***********************************\033[0m'

sudo parted -s /dev/$DEVICE_NAME "resizepart ${PART_ENTRY_NUMBER} -1" quit
sudo partprobe /dev/$DEVICE_NAME

sudo resize2fs ${ROOT_DEVICE}

sudo mount -o remount,rw /

echo -e '\033[36m\n***********************************'
echo 'Resizing task completes. Rebooting.....'
echo -e '***********************************\033[0m'

0 comments on commit 340a203

Please sign in to comment.