Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
christophkreutzer committed Jul 4, 2024
1 parent 271a8b1 commit 9371f60
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 34 deletions.
7 changes: 0 additions & 7 deletions bootstrap/00-kernel
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,3 @@ cat <<EOF > /etc/fstab
/dev/mmcblk0p1 /boot vfat defaults 0 2
/dev/mmcblk0p2 / ext4 defaults,noatime 0 1
EOF

cat <<EOF >> /etc/sysctl.conf
vm.vfs_cache_pressure=500
vm.swappiness=100
vm.dirty_background_ratio=1
vm.dirty_ratio=50
EOF
13 changes: 4 additions & 9 deletions bootstrap/01-system
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,16 @@
set -xe

TARGET_HOSTNAME="raspberrypi"
TARGET_TIMEZONE="Europe/Madrid"
#TARGET_TIMEZONE="Europe/Zurich"
ROOT_PASS=raspberry

# base stuff
apk add ca-certificates
apk add curl ca-certificates
update-ca-certificates
echo "root:$ROOT_PASS" | chpasswd
setup-hostname $TARGET_HOSTNAME
echo "127.0.0.1 $TARGET_HOSTNAME $TARGET_HOSTNAME.localdomain" > /etc/hosts
setup-keymap es es

# time
apk add chrony tzdata
setup-timezone -z $TARGET_TIMEZONE

# other stuff
apk add nano htop curl wget bash bash-completion findutils
sed -i 's/\/bin\/ash/\/bin\/bash/g' /etc/passwd
#apk add chrony tzdata
#setup-timezone -z $TARGET_TIMEZONE
11 changes: 2 additions & 9 deletions bootstrap/02-users
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,10 @@ set -xe
FIRST_USER_NAME=pi
FIRST_USER_PASS=raspberry

apk add sudo

for GRP in spi i2c gpio; do
addgroup --system $GRP
done

adduser -s /bin/ash -D $FIRST_USER_NAME

for GRP in adm dialout cdrom audio users video games input tty gpio spi i2c netdev; do
for GRP in adm dialout cdrom audio users video games input tty netdev; do
adduser $FIRST_USER_NAME $GRP
done

echo "$FIRST_USER_NAME:$FIRST_USER_PASS" | /usr/sbin/chpasswd
echo "$FIRST_USER_NAME ALL=NOPASSWD: ALL" >> /etc/sudoers
echo "$FIRST_USER_NAME:$FIRST_USER_PASS" | chpasswd
8 changes: 1 addition & 7 deletions bootstrap/03-networking
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

set -xe

apk add wpa_supplicant wireless-tools wireless-regdb iw
apk add wpa_supplicant wireless-tools wireless-regdb iw dbus
sed -i 's/wpa_supplicant_args=\"/wpa_supplicant_args=\" -u -Dwext,nl80211/' /etc/conf.d/wpa_supplicant

echo -e 'brcmfmac' >> /etc/modules
Expand Down Expand Up @@ -30,9 +30,3 @@ iface wlan0 inet dhcp
hostname raspberrypi
EOF

# avahi
apk add dbus avahi

# bluetooth
apk add bluez bluez-deprecated
sed -i '/bcm43xx/s/^#//' /etc/mdev.conf
2 changes: 1 addition & 1 deletion bootstrap/04-services
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ for service in modules sysctl hostname bootmisc swclock syslog swap; do
rc-update add $service boot
done

for service in dbus haveged sshd chronyd local networking avahi-daemon bluetooth wpa_supplicant wpa_cli; do
for service in dbus haveged sshd local networking wpa_supplicant wpa_cli; do
rc-update add $service default
done

Expand Down
29 changes: 28 additions & 1 deletion bootstrap/99-first-boot
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ cat <<EOF > /usr/bin/first-boot
#!/bin/sh
set -xe
cat <<PARTED | sudo parted ---pretend-input-tty /dev/mmcblk0
cat <<PARTED | parted ---pretend-input-tty /dev/mmcblk0
unit %
resizepart 2
Yes
Expand All @@ -35,3 +35,30 @@ EOF

chmod +x /etc/init.d/first-boot /usr/bin/first-boot
rc-update add first-boot

cat <<EOF > /usr/bin/second-boot
#!/bin/sh
set -xe
if [ -f /boot/second-boot.sh ]; then
/bin/sh /boot/second-boot.sh
fi
rc-update del second-boot
rm /etc/init.d/second-boot /usr/bin/second-boot
reboot
EOF

cat <<EOF > /etc/init.d/second-boot
#!/sbin/openrc-run
command="/usr/bin/second-boot"
command_background=false
depend() {
after local
need localmount net
}
EOF

chmod +x /etc/init.d/second-boot /usr/bin/second-boot
rc-update add second-boot default

0 comments on commit 9371f60

Please sign in to comment.