fs-resize: move as systemd target

This commit is contained in:
Stefan Saraev 2015-01-19 02:24:51 +02:00
parent 7c2fcdc256
commit 4fffa76c53
4 changed files with 18 additions and 14 deletions

View File

@ -31,6 +31,9 @@ if [ -e /storage/.please_resize_me ] ; then
;;
esac
rm -f /storage/.please_resize_me
sync
# just in case
if [ ! -z "$DISK" -a ! -z "$PART" ] ; then
# get storage partition start
@ -38,8 +41,6 @@ if [ -e /storage/.please_resize_me ] ; then
# failed to get partition start offset ?
if [ ! -z "$PART_START" ] ; then
rm -f /storage/.please_resize_me
sync
umount $PART
# TODO: clean up debug
echo "resizing /storage..."
@ -54,7 +55,7 @@ if [ -e /storage/.please_resize_me ] ; then
resize2fs $PART &>/dev/null
echo "...done. rebooting in 15s"
sleep 15
reboot
fi
fi
fi
reboot

View File

@ -662,6 +662,10 @@
if [ "$STORAGE_NETBOOT" = "yes" ] ; then
echo "" > /sysroot/dev/.storage_netboot
fi
if [ -f /sysroot/storage/.please_resize_me ] ; then
INIT_ARGS="--unit=fs-resize.target"
fi
# switch to new sysroot and start real init
exec /bin/busybox switch_root /sysroot /usr/lib/systemd/systemd $INIT_ARGS

View File

@ -1,16 +1,10 @@
[Unit]
Description=FS Resize
DefaultDependencies=false
After=show-version.service
Before=local-fs-pre.target shutdown.target
Conflicts=shutdown.target
ConditionPathExists=|/storage/.please_resize_me
DefaultDependencies=no
[Service]
Type=oneshot
Type=idle
ExecStart=/usr/lib/openelec/fs-resize
StandardOutput=tty
[Install]
WantedBy=local-fs-pre.target
StandardInput=tty-force
StandardOutput=inherit
StandardError=inherit

View File

@ -0,0 +1,5 @@
[Unit]
Description=FS Resize target
Requires=fs-resize.service
After=fs-resize.service
AllowIsolate=yes