File tree Expand file tree Collapse file tree 3 files changed +60
-1
lines changed
Expand file tree Collapse file tree 3 files changed +60
-1
lines changed Original file line number Diff line number Diff line change 2525
2626# install required packages and config files
2727set -e
28- xbps-install -y opendoas tar gzip curl diffutils
28+ xbps-install -y \
29+ cloud-guest-utils \
30+ curl \
31+ diffutils \
32+ gzip \
33+ opendoas \
34+ tar
35+
36+ # grow ssd partition and filesystem at boot (one-shot)
37+ GROW_SSD_SVDIR=etc/sv/grow-ssd
38+ mkdir -p /$GROW_SSD_SVDIR
39+ mkdir -p /$GROW_SSD_SVDIR /log
40+ if [ ! -f /$GROW_SSD_SVDIR /run ]; then
41+ cp " $SYSUPDATES_ROOTDIR /files/$GROW_SSD_SVDIR /run" /$GROW_SSD_SVDIR /run
42+ chmod +x /$GROW_SSD_SVDIR /run
43+ cp " $SYSUPDATES_ROOTDIR /files/$GROW_SSD_SVDIR /run" /$GROW_SSD_SVDIR /finish
44+ chmod +x /$GROW_SSD_SVDIR /finish
45+ fi
46+ ln -sfT /$GROW_SSD_SVDIR /etc/runit/runsvdir/default/
2947
3048# openbsd's doas util config, a minial replacement of sudo
3149if [ ! -f /etc/doas.conf ]; then
Original file line number Diff line number Diff line change 1+ #! /bin/sh
2+ exit 0
Original file line number Diff line number Diff line change 1+ #! /bin/sh
2+ # grow ssd partition and filesystem at boot (one-shot)
3+
4+ set -e
5+
6+ SSD_DEV=$( findmnt -n -o SOURCE /ssd 2> /dev/null || echo " " )
7+ case " $SSD_DEV " in
8+ /dev/* ) ;;
9+ * )
10+ echo " grow-ssd: unable to detect root device for /ssd; skipping"
11+ exit 0
12+ ;;
13+ esac
14+
15+ PKNAME=$( lsblk -no pkname " $SSD_DEV " 2> /dev/null || echo " " )
16+ if [ -n " $PKNAME " ]; then
17+ DISK=" /dev/$PKNAME "
18+ else
19+ DISK=$( printf ' %s\n' " $SSD_DEV " | sed -E ' s/p?[0-9]+$//' )
20+ fi
21+
22+ PART=$( printf ' %s\n' " $SSD_DEV " | sed -E ' s/.*p?([0-9]+)$/\1/' )
23+ case " $PART " in
24+ ' ' |* [!0-9]* )
25+ echo " grow-ssd: unable to determine partition number from $SSD_DEV ; skipping"
26+ exit 0
27+ ;;
28+ esac
29+
30+ # Only run if partition can be grown
31+ growpart --dry-run " $DISK " " $PART " > /dev/null 2>&1 || exit 0
32+
33+ echo " Growing partition $SSD_DEV "
34+ growpart " $DISK " " $PART "
35+
36+ echo " Resizing filesystem on $SSD_DEV "
37+ resize2fs " $SSD_DEV "
38+
39+ echo " grow-ssd completed"
You can’t perform that action at this time.
0 commit comments