btrfs compression!
This commit is contained in:
parent
1aea862534
commit
fed2cb9ebc
3 changed files with 22 additions and 2 deletions
|
@ -271,6 +271,10 @@ setup_extlinux() {
|
||||||
-e "s|^[# ]*(serial_port)=.*|\1=$serial_port|" \
|
-e "s|^[# ]*(serial_port)=.*|\1=$serial_port|" \
|
||||||
"$mnt"/etc/update-extlinux.conf
|
"$mnt"/etc/update-extlinux.conf
|
||||||
|
|
||||||
|
sed -Ei \
|
||||||
|
-e "s|remount,rw|&,noatime$COMPRESSFLAGS|" \
|
||||||
|
"$mnt"/etc/init.d/root
|
||||||
|
|
||||||
chroot "$mnt" extlinux --install /boot
|
chroot "$mnt" extlinux --install /boot
|
||||||
chroot "$mnt" update-extlinux --warn-only # 2>&1 \
|
chroot "$mnt" update-extlinux --warn-only # 2>&1 \
|
||||||
# | grep -Fv 'extlinux: cannot open device /dev' >&2
|
# | grep -Fv 'extlinux: cannot open device /dev' >&2
|
||||||
|
@ -351,10 +355,12 @@ done
|
||||||
: ${KEYS_DIR:="/etc/apk/keys"}
|
: ${KEYS_DIR:="/etc/apk/keys"}
|
||||||
: ${PACKAGES:=}
|
: ${PACKAGES:=}
|
||||||
: ${REPOS_FILE:="/etc/apk/repositories"}
|
: ${REPOS_FILE:="/etc/apk/repositories"}
|
||||||
: ${ROOTFS:="ext4"}
|
: ${ROOTFS:="btrfs"}
|
||||||
: ${SCRIPT_CHROOT:="no"}
|
: ${SCRIPT_CHROOT:="no"}
|
||||||
: ${SERIAL_CONSOLE:="no"}
|
: ${SERIAL_CONSOLE:="no"}
|
||||||
|
|
||||||
|
export ROOTFS
|
||||||
|
|
||||||
case "$ALPINE_BRANCH" in
|
case "$ALPINE_BRANCH" in
|
||||||
[0-9]*) ALPINE_BRANCH="v$ALPINE_BRANCH";;
|
[0-9]*) ALPINE_BRANCH="v$ALPINE_BRANCH";;
|
||||||
esac
|
esac
|
||||||
|
@ -475,12 +481,18 @@ fi
|
||||||
#-----------------------------------------------------------------------
|
#-----------------------------------------------------------------------
|
||||||
einfo 'Setting up extlinux bootloader'
|
einfo 'Setting up extlinux bootloader'
|
||||||
|
|
||||||
|
COMPRESSFLAGS=
|
||||||
|
if [ "$ROOTFS" = 'btrfs' ]; then
|
||||||
|
COMPRESSFLAGS=',compress=zstd'
|
||||||
|
fi
|
||||||
|
export COMPRESSFLAGS
|
||||||
|
|
||||||
_apk add --root . --no-scripts syslinux
|
_apk add --root . --no-scripts syslinux
|
||||||
setup_extlinux . "UUID=$root_uuid" "$ROOTFS" "$KERNEL_FLAVOR" "$SERIAL_PORT"
|
setup_extlinux . "UUID=$root_uuid" "$ROOTFS" "$KERNEL_FLAVOR" "$SERIAL_PORT"
|
||||||
|
|
||||||
cat > etc/fstab <<-EOF
|
cat > etc/fstab <<-EOF
|
||||||
# <fs> <mountpoint> <type> <opts> <dump/pass>
|
# <fs> <mountpoint> <type> <opts> <dump/pass>
|
||||||
UUID=$root_uuid / $ROOTFS noatime 0 1
|
UUID=$root_uuid / $ROOTFS noatime$COMPRESSFLAGS 0 1
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
#-----------------------------------------------------------------------
|
#-----------------------------------------------------------------------
|
||||||
|
|
|
@ -45,3 +45,10 @@ rc-update add sshd default
|
||||||
step 'Creating authorized_keys for root'
|
step 'Creating authorized_keys for root'
|
||||||
mkdir -p /root/.ssh/
|
mkdir -p /root/.ssh/
|
||||||
echo "$SSHPUBKEY" >> /root/.ssh/authorized_keys
|
echo "$SSHPUBKEY" >> /root/.ssh/authorized_keys
|
||||||
|
|
||||||
|
if [ "$ROOTFS" = 'btrfs' ]; then
|
||||||
|
step 'Compressing btrfs'
|
||||||
|
btrfs filesystem defragment -r -czstd /
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
alpine-base
|
alpine-base
|
||||||
busybox
|
busybox
|
||||||
btrfs-progs
|
btrfs-progs
|
||||||
|
btrfs-compsize
|
||||||
chrony
|
chrony
|
||||||
network-extras
|
network-extras
|
||||||
openssl
|
openssl
|
||||||
|
|
Loading…
Reference in a new issue