From f2c6c23c8e5b00bace17affcec2bf0dc4041d88a Mon Sep 17 00:00:00 2001 From: Christopher Young Date: Tue, 28 Mar 2017 15:57:10 -0400 Subject: [PATCH] Remove auto-expand code. Increases microSD card failures. --- __root__stratux-pre-start.sh | 100 ----------------------------------- 1 file changed, 100 deletions(-) diff --git a/__root__stratux-pre-start.sh b/__root__stratux-pre-start.sh index 320cc7242..cda14e54e 100755 --- a/__root__stratux-pre-start.sh +++ b/__root__stratux-pre-start.sh @@ -15,103 +15,3 @@ if [ -e /root/update*stratux*v*.sh ] ; then fi fi - -get_init_sys() { - if command -v systemctl > /dev/null && systemctl | grep -q '\-\.mount'; then - SYSTEMD=1 - elif [ -f /etc/init.d/cron ] && [ ! -h /etc/init.d/cron ]; then - SYSTEMD=0 - else - echo "Unrecognised init system" >>/tmp/err - return 1 - fi -} - -do_expand_rootfs() { - get_init_sys - if [ $SYSTEMD -eq 1 ]; then - ROOT_PART=$(mount | sed -n 's|^/dev/\(.*\) on / .*|\1|p') - else - if ! [ -h /dev/root ]; then - echo "/dev/root does not exist or is not a symlink. Don't know how to expand" >>/tmp/err - return 0 - fi - ROOT_PART=$(readlink /dev/root) - fi - - PART_NUM=${ROOT_PART#mmcblk0p} - if [ "$PART_NUM" = "$ROOT_PART" ]; then - echo "$ROOT_PART is not an SD card. Don't know how to expand" >>/tmp/err - return 0 - fi - - # NOTE: the NOOBS partition layout confuses parted. For now, let's only - # agree to work with a sufficiently simple partition layout - if [ "$PART_NUM" -ne 2 ]; then - echo "Your partition layout is not currently supported by this tool. You are probably using NOOBS, in which case your root filesystem is already expanded anyway." >>/tmp/err - return 0 - fi - - LAST_PART_NUM=$(parted /dev/mmcblk0 -ms unit s p | tail -n 1 | cut -f 1 -d:) - if [ $LAST_PART_NUM -ne $PART_NUM ]; then - echo "$ROOT_PART is not the last partition. Don't know how to expand" >>/tmp/err - return 0 - fi - - # Get the starting offset of the root partition - PART_START=$(parted /dev/mmcblk0 -ms unit s p | grep "^${PART_NUM}" | cut -f 2 -d: | sed 's/[^0-9]//g') - [ "$PART_START" ] || return 1 - # Return value will likely be error for fdisk as it fails to reload the - # partition table because the root fs is mounted - fdisk /dev/mmcblk0 < /etc/init.d/resize2fs_once && -#!/bin/sh -### BEGIN INIT INFO -# Provides: resize2fs_once -# Required-Start: -# Required-Stop: -# Default-Start: 3 -# Default-Stop: -# Short-Description: Resize the root filesystem to fill partition -# Description: -### END INIT INFO - -. /lib/lsb/init-functions - -case "\$1" in - start) - log_daemon_msg "Starting resize2fs_once" && - resize2fs /dev/$ROOT_PART && - update-rc.d resize2fs_once remove && - rm /etc/init.d/resize2fs_once && - log_end_msg \$? - ;; - *) - echo "Usage: \$0 start" >&2 - exit 3 - ;; -esac -EOF - chmod +x /etc/init.d/resize2fs_once && - update-rc.d resize2fs_once defaults -} - -if [ ! -f /etc/stratux.firstboot ]; then - echo "expanding filesystem (first boot)" >>/tmp/err - do_expand_rootfs - touch /etc/stratux.firstboot -fi -