Remove useless files, change locale to UTF-8, adjust debootstrap
This commit is contained in:
parent
28d96c6a73
commit
237a7c86f8
3 changed files with 14 additions and 44 deletions
23
build-rpi.sh
23
build-rpi.sh
|
@ -28,13 +28,18 @@ mkdir -p "${basedir}"
|
|||
cd "${basedir}"
|
||||
|
||||
# Bootstrap an ubuntu minimal system
|
||||
debootstrap --foreign --arch $architecture $codename ubuntusway-$architecture http://ports.ubuntu.com/ubuntu-ports
|
||||
debootstrap \
|
||||
--arch $architecture \
|
||||
--components=main,restricted,universe,multiverse \
|
||||
--foreign \
|
||||
--include=cloud-guest-utils \
|
||||
$codename ubuntusway-$architecture http://ports.ubuntu.com/ubuntu-ports
|
||||
|
||||
# Add the QEMU emulator for running ARM executables
|
||||
cp /usr/bin/qemu-arm-static ubuntusway-$architecture/usr/bin/
|
||||
|
||||
# Run the second stage of the bootstrap in QEMU
|
||||
LANG=C chroot ubuntusway-$architecture /debootstrap/debootstrap --second-stage
|
||||
LANG=C.UTF-8 chroot ubuntusway-$architecture /debootstrap/debootstrap --second-stage
|
||||
|
||||
# Copy Raspberry Pi specific files
|
||||
cp -r "${rootdir}"/rpi/rootfs/writable/* ubuntusway-${architecture}/
|
||||
|
@ -77,7 +82,7 @@ LABEL=writable / ext4 discard,noatime,x-systemd.growfs 0
|
|||
LABEL=system-boot /boot/firmware vfat defaults 0 1
|
||||
EOF
|
||||
|
||||
export LC_ALL=C
|
||||
export LC_ALL=C.UTF-8
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
# Config to stop flash-kernel trying to detect the hardware in chroot
|
||||
export FK_MACHINE=none
|
||||
|
@ -96,7 +101,7 @@ rm -f /desktop
|
|||
EOF
|
||||
|
||||
chmod +x ubuntusway-$architecture/desktop
|
||||
LANG=C chroot ubuntusway-$architecture /desktop
|
||||
LANG=C.UTF-8 chroot ubuntusway-$architecture /desktop
|
||||
|
||||
# Install Raspberry Pi specific packages
|
||||
cat << EOF > ubuntusway-$architecture/hardware
|
||||
|
@ -112,7 +117,7 @@ rm -f hardware
|
|||
EOF
|
||||
|
||||
chmod +x ubuntusway-$architecture/hardware
|
||||
LANG=C chroot ubuntusway-$architecture /hardware
|
||||
LANG=C.UTF-8 chroot ubuntusway-$architecture /hardware
|
||||
|
||||
# Copy in any file overrides
|
||||
cp -rv "${rootdir}"/etc/config/includes.chroot/* ubuntusway-$architecture/
|
||||
|
@ -124,7 +129,7 @@ hook_files="ubuntusway-$architecture/hooks/*"
|
|||
for f in $hook_files
|
||||
do
|
||||
base=$(basename "${f}")
|
||||
LANG=C chroot ubuntusway-$architecture "/hooks/${base}"
|
||||
LANG=C.UTF-8 chroot ubuntusway-$architecture "/hooks/${base}"
|
||||
done
|
||||
|
||||
rm -r "ubuntusway-$architecture/hooks"
|
||||
|
@ -139,7 +144,7 @@ rm -f user
|
|||
EOF
|
||||
|
||||
chmod +x ubuntusway-$architecture/user
|
||||
LANG=C chroot ubuntusway-$architecture /user
|
||||
LANG=C.UTF-8 chroot ubuntusway-$architecture /user
|
||||
|
||||
# Creating swapfile service
|
||||
|
||||
|
@ -186,7 +191,7 @@ rm -f enable_zswap
|
|||
EOF
|
||||
|
||||
chmod +x ubuntusway-$architecture/enable_zswap
|
||||
LANG=C chroot ubuntusway-$architecture /enable_zswap
|
||||
LANG=C.UTF-8 chroot ubuntusway-$architecture /enable_zswap
|
||||
|
||||
# Calculate image size accounting for boot parition + 5%
|
||||
boot_size="256"
|
||||
|
@ -246,7 +251,7 @@ rm -f hardware
|
|||
EOF
|
||||
|
||||
chmod +x ubuntusway-$architecture/hardware
|
||||
LANG=C chroot ubuntusway-$architecture /hardware
|
||||
LANG=C.UTF-8 chroot ubuntusway-$architecture /hardware
|
||||
|
||||
umount ubuntusway-$architecture/dev/pts
|
||||
umount ubuntusway-$architecture/dev/
|
||||
|
|
|
@ -1,22 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
rootpart="$(findmnt -n -o SOURCE /)"
|
||||
rootdev="/dev/$(lsblk -no pkname "$rootpart")"
|
||||
|
||||
flock $rootdev sfdisk -f $rootdev -N 2 <<EOF
|
||||
,+
|
||||
EOF
|
||||
|
||||
sleep 5
|
||||
|
||||
udevadm settle
|
||||
|
||||
sleep 5
|
||||
|
||||
flock $rootdev partprobe $rootdev
|
||||
|
||||
mount -o remount,rw $rootpart
|
||||
|
||||
resize2fs $rootpart
|
||||
|
||||
exit 0
|
|
@ -1,13 +0,0 @@
|
|||
[Unit]
|
||||
Description=resize root file system
|
||||
Before=local-fs-pre.target
|
||||
DefaultDependencies=no
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
TimeoutSec=infinity
|
||||
ExecStart=/usr/sbin/resizerootfs
|
||||
ExecStart=/bin/systemctl --no-reload disable %n
|
||||
|
||||
[Install]
|
||||
RequiredBy=local-fs-pre.target
|
Loading…
Add table
Reference in a new issue