-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes and improvements #27
base: master
Are you sure you want to change the base?
Changes from all commits
fd1207b
d37574b
61c54ea
b522ea3
0212baa
0b60b88
f00a71d
ad2b231
846a1ce
ac15d86
ded9bb0
1f6c0cb
b11648d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,35 @@ | ||
# SPDX-License-Identifier: GPL-2.0 | ||
# | ||
# This is check code sourced by gbmake | ||
|
||
# Directory for kernel build objects, usually a relative path | ||
# GNUBEE_KERNEL_OBJECTS=O | ||
# Directory for initramfs, can be relative | ||
# GNUBEE_INITRAMFS_TREE:=initramfs | ||
# Directory containing kernel config files - 'kern_config' in parent of script by default | ||
# GNUBEE_CONFIG_DIR= | ||
# Directory where user-space tools are built - usually ../build from script dir | ||
# GNUBEE_BUILD_DIR= | ||
# Cross compiler - full path such as /opt/cross/bin/mipsel-unknown-linux-gnu- | ||
# This file is sourced by gbmake | ||
# | ||
# $gbtools can be used as the path to the root of the gnubee-tools repository | ||
# all paths can be relative to the directory the script is executed in | ||
|
||
# Debian suite to use for debootstrap, will be used to build initramfs | ||
# May be a release code name (e.g. stretch, buster, sid) or a symbolic name (eg, unstable, testing, stable, oldstable) | ||
# GNUBEE_DEBIAN_SUITE="stable" | ||
|
||
# Debian mirror to use for debootstrap, will be used to build initramfs | ||
# GNUBEE_DEBIAN_MIRROR="http://deb.debian.org/debian/" | ||
|
||
# Directory for kernel build objects | ||
# GNUBEE_KERNEL_OBJECTS="O" | ||
|
||
# Directory for initramfs | ||
# GNUBEE_INITRAMFS_TREE="initramfs" | ||
|
||
# Directory containing kernel config files | ||
# GNUBEE_CONFIG_DIR="$gbtools/kern_config" | ||
|
||
# Directory where user-space tools are built | ||
# GNUBEE_BUILD_DIR="$gbtools/build" | ||
|
||
# Path to cross compiler - must be in $PATH or full path such as /opt/cross/bin/mipsel-unknown-linux-gnu- | ||
# CROSS_COMPILE= | ||
|
||
# GnuBee running Debian from which various programs can be copied. | ||
# [email protected] | ||
|
||
# To include extenal modules in the image, list them here. Just the name | ||
# of the directory may suffice if the Makefile there follows normal conventions. | ||
# Otherwise provide a script that will build the module and install it. | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,8 +11,12 @@ | |
# hostname | ||
# ssh PermitRootLogin | ||
# label filesystem | ||
# add leds udev rule | ||
|
||
mp=/tmp/newroot | ||
default_debian_suite=buster | ||
default_debian_mirror="http://httpredir.debian.org/debian" | ||
include_packages="vim,openssh-server,ntpdate,cron,locales,udev,fake-hwclock,mtd-utils,ca-certificates,apt-transport-https,vlan,bash-completion,less,man-db,manpages,dbus" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd separate that into 2 commits, one for the fix, maybe adding a reference in the commitmsg to the "timedatectl bug" that is being fixed. And another commit for the "useful" stuff that may be a matter of taste (i.e.: you prefer minimalistic or with batteries included) |
||
|
||
set_host() { | ||
case `hostname` in | ||
|
@@ -31,6 +35,33 @@ set_host() { | |
return 1 | ||
} | ||
|
||
set_debian() { | ||
while [ -z "$debian_suite" ]; do | ||
read -p "Which Debian suite do you want to install? (jessie | stretch | buster | bullseye | sid) [buster] " debian_suite | ||
case "$debian_suite" in | ||
"" ) debian_suite="$default_debian_suite" ;; | ||
jessie | stretch | buster | bullseye | sid ) ;; | ||
* ) echo "Unknown debian suite. Please enter one of the above choices." | ||
esac | ||
done | ||
while [ -z "$debian_mirror" ]; do | ||
read -p "Which Debian mirror do you want to use? [$default_debian_mirror]" debian_mirror | ||
debian_mirror="${debian_mirror%/}" | ||
case "$debian_mirror" in | ||
"" ) debian_mirror="$default_debian_mirror" ;; | ||
* ) | ||
echo -n "Validating mirror URL ... " | ||
if wget -q --spider "$debian_mirror/debian/dists/$debian_suite/Release.gpg"; then | ||
echo "OK." | ||
else | ||
echo "ERROR, please enter a valid Debian mirror URL." | ||
debian_mirror= | ||
fi | ||
esac | ||
done | ||
|
||
} | ||
|
||
check_net() { | ||
net_dev=`ip route show match 0/0 | awk '$4 == "dev" {print $5 }'` | ||
if [ -z "$net_dev" ]; then | ||
|
@@ -145,7 +176,7 @@ bootstrap() { | |
fi | ||
PATH=/bin:/usr/bin:/sbin:/usr/sbin:$PATH | ||
export PATH | ||
debootstrap --arch=mipsel --include=vim,openssh-server,ntpdate,cron,locales,udev,fake-hwclock,mtd-utils,ca-certificates,apt-transport-https,vlan,libnl-3-200,libnl-genl-3-200 stretch $mp http://httpredir.debian.org/debian || exit 1 | ||
debootstrap --arch=mipsel --include="$include_packages" "$debian_version" "$mp" "$debian_mirror" || exit 1 | ||
return 1 | ||
} | ||
|
||
|
@@ -199,6 +230,13 @@ fixup_modules() { | |
cp -a /lib/modules/. $mp/lib/modules | ||
} | ||
|
||
fixup_leds() { | ||
cat > "$mp/lib/udev/rules.d/70-gnubee-leds.rules" <<- "EOF" | ||
ACTION=="add", SUBSYSTEM=="leds", KERNEL=="gb-pc1:green:status", ATTR{trigger}="default-on" | ||
ACTION=="add", SUBSYSTEM=="leds", KERNEL=="gb-pc1:green:system", ATTR{trigger}="activity" | ||
EOF | ||
} | ||
|
||
fixup() { | ||
hostname > $mp/etc/hostname | ||
root=`grep '^root:' /etc/shadow` | ||
|
@@ -211,10 +249,11 @@ fixup() { | |
esac | ||
fixup_net | ||
fixup_modules | ||
fixup_leds | ||
return 0 | ||
} | ||
|
||
until set_host && set_passwd && set_net && set_time && create_filesystem && bootstrap && fixup; do | ||
until set_host && set_debian && set_passwd && set_net && set_time && create_filesystem && bootstrap && fixup; do | ||
: | ||
done | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,9 @@ set_led() { | |
echo $2 > delay_on | ||
echo $3 > delay_off | ||
;; | ||
2 ) | ||
echo $2 > trigger | ||
;; | ||
* ) echo none > trigger | ||
esac | ||
) | ||
|
@@ -105,7 +108,7 @@ gnubee_switch_root(){ | |
done | ||
|
||
set_led system | ||
set_led status | ||
set_led status 100 100 | ||
|
||
umount -l /proc /sys /dev/pts /dev | ||
exec switch_root /mnt/root /sbin/init | ||
|
@@ -178,11 +181,9 @@ gnubee_boot(){ | |
udhcpd_config ethblack 192.168.10 | ||
udhcpd /udhcpd.conf | ||
fi | ||
if [ ! -s /etc/dropbear/dropbear_ecdsa_host_key ]; then | ||
# build host didn't have dropbear, so make a new key on each boot | ||
dropbearkey -t ecdsa -f /etc/dropbear/dropbear_ecdsa_host_key | ||
fi | ||
dropbear | ||
|
||
# -R to generate new host keys on each boot | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this comment accurate ? Reading the man page @ https://manpages.org/dropbear/8 I've not tested, sorry, just asking while looking at your PR... |
||
dropbear -R | ||
|
||
run_shell /dev/ttyS0 | ||
fi | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How is that related to the other change in config.sample:
GNUBEE_DEBIAN_SUITE="stable"