From 02f0baa56ac1572a13c6a026d023f6a4ecb6c4f0 2018-11-16 12:37:23 From: burnbabyburn <2515038+burnbabyburn@users.noreply.github.com> Date: 2018-11-16 12:37:23 Subject: [PATCH] Merge pull request #3 from drtyhlpr/master ok --- diff --git a/README.md b/README.md index 5588cf8..04723a1 100644 --- a/README.md +++ b/README.md @@ -176,7 +176,7 @@ Install and enable OpenSSH service. The default configuration of the service doe Allow the installation of non-free Debian packages that do not comply with the DFSG. This is required to install closed-source firmware binary blobs. ##### `ENABLE_WIRELESS`=false -Download and install the [closed-source firmware binary blob](https://github.com/RPi-Distro/firmware-nonfree/tree/master/brcm80211/brcm) that is required to run the internal wireless interface of the Raspberry Pi model `3`. This parameter is ignored if the specified `RPI_MODEL` is not `3`. +Download and install the [closed-source firmware binary blob](https://github.com/RPi-Distro/firmware-nonfree/raw/master/brcm) that is required to run the internal wireless interface of the Raspberry Pi model `3`. This parameter is ignored if the specified `RPI_MODEL` is not `3`. ##### `ENABLE_RSYSLOG`=true If set to false, disable and uninstall rsyslog (so logs will be available only @@ -200,6 +200,9 @@ Install Xorg open-source X Window System. ##### `ENABLE_WM`="" Install a user defined window manager for the X Window System. To make sure all X related package dependencies are getting installed `ENABLE_XORG` will automatically get enabled if `ENABLE_WM` is used. The `rpi23-gen-image.sh` script has been tested with the following list of window managers: `blackbox`, `openbox`, `fluxbox`, `jwm`, `dwm`, `xfce4`, `awesome`. +##### `ENABLE_SYSVINIT`=false +Support for halt,init,poweroff,reboot,runlevel,shutdown,telinit commands + --- #### Advanced system features: diff --git a/bootstrap.d/10-bootstrap.sh b/bootstrap.d/10-bootstrap.sh index 93bf254..d8cfb69 100644 --- a/bootstrap.d/10-bootstrap.sh +++ b/bootstrap.d/10-bootstrap.sh @@ -7,7 +7,6 @@ VARIANT="" COMPONENTS="main" -EXCLUDES="" # Use non-free Debian packages if needed if [ "$ENABLE_NONFREE" = true ] ; then @@ -19,13 +18,8 @@ if [ "$ENABLE_MINBASE" = true ] ; then VARIANT="--variant=minbase" fi -# Exclude packages if required by Debian release -if [ "$RELEASE" = "stretch" ] || [ "$RELEASE" = "buster" ] ; then - EXCLUDES="--exclude=init,systemd-sysv" -fi - # Base debootstrap (unpack only) -http_proxy=${APT_PROXY} debootstrap ${EXCLUDES} --arch="${RELEASE_ARCH}" --foreign ${VARIANT} --components="${COMPONENTS}" --include="${APT_INCLUDES}" "${RELEASE}" "${R}" "http://${APT_SERVER}/debian" +http_proxy=${APT_PROXY} debootstrap ${APT_EXCLUDES} --arch="${RELEASE_ARCH}" --foreign ${VARIANT} --components="${COMPONENTS}" --include="${APT_INCLUDES}" "${RELEASE}" "${R}" "http://${APT_SERVER}/debian" # Copy qemu emulator binary to chroot install -m 755 -o root -g root "${QEMU_BINARY}" "${R}${QEMU_BINARY}" diff --git a/bootstrap.d/12-locale.sh b/bootstrap.d/12-locale.sh index e69f44c..ac342ef 100644 --- a/bootstrap.d/12-locale.sh +++ b/bootstrap.d/12-locale.sh @@ -28,10 +28,10 @@ if [ $(echo "$APT_INCLUDES" | grep ",locales") ] ; then chroot_exec update-locale LANG="${DEFLOCAL}" # Install and setup default keyboard configuration - if [ "$XKB_MODEL" != "" ] ; then + if [ "$XKB_MODEL" != "pc105" ] ; then sed -i "s/^XKBMODEL.*/XKBMODEL=\"${XKB_MODEL}\"/" "${ETC_DIR}/default/keyboard" fi - if [ "$XKB_LAYOUT" != "" ] ; then + if [ "$XKB_LAYOUT" != "us" ] ; then sed -i "s/^XKBLAYOUT.*/XKBLAYOUT=\"${XKB_LAYOUT}\"/" "${ETC_DIR}/default/keyboard" fi if [ "$XKB_VARIANT" != "" ] ; then diff --git a/bootstrap.d/15-rpi-config.sh b/bootstrap.d/15-rpi-config.sh index 5018fcf..b84de23 100644 --- a/bootstrap.d/15-rpi-config.sh +++ b/bootstrap.d/15-rpi-config.sh @@ -95,7 +95,7 @@ if [ "$ENABLE_INITRAMFS" = true ] ; then fi # Disable RPi3 Bluetooth and restore ttyAMA0 serial device -if [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 3P ]; then +if [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 3P ] ; then if [ "$ENABLE_CONSOLE" = true ] && [ "$ENABLE_UBOOT" = false ] ; then echo "dtoverlay=pi3-disable-bt" >> "${BOOT_DIR}/config.txt" echo "enable_uart=1" >> "${BOOT_DIR}/config.txt" diff --git a/bootstrap.d/20-networking.sh b/bootstrap.d/20-networking.sh index 57c72de..c386754 100644 --- a/bootstrap.d/20-networking.sh +++ b/bootstrap.d/20-networking.sh @@ -107,7 +107,7 @@ if [ "$ENABLE_WIRELESS" = true ] ; then as_nobody wget -q -O "${temp_dir}/brcmfmac43455-sdio.bin" "${WLAN_FIRMWARE_URL}/brcmfmac43455-sdio.bin" as_nobody wget -q -O "${temp_dir}/brcmfmac43455-sdio.txt" "${WLAN_FIRMWARE_URL}/brcmfmac43455-sdio.txt" as_nobody wget -q -O "${temp_dir}/brcmfmac43455-sdio.clm_blob" "${WLAN_FIRMWARE_URL}/brcmfmac43455-sdio.clm_blob" - else + elif [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 0 ] ; then # Fetch firmware binary blob for RPI3 as_nobody wget -q -O "${temp_dir}/brcmfmac43430-sdio.bin" "${WLAN_FIRMWARE_URL}/brcmfmac43430-sdio.bin" as_nobody wget -q -O "${temp_dir}/brcmfmac43430-sdio.txt" "${WLAN_FIRMWARE_URL}/brcmfmac43430-sdio.txt" @@ -116,7 +116,7 @@ if [ "$ENABLE_WIRELESS" = true ] ; then # Move downloaded firmware binary blob if [ "$RPI_MODEL" = 3P ] ; then mv "${temp_dir}/brcmfmac43455-sdio."* "${WLAN_FIRMWARE_DIR}/" - else + elif [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 0 ] ; then mv "${temp_dir}/brcmfmac43430-sdio."* "${WLAN_FIRMWARE_DIR}/" fi @@ -127,7 +127,7 @@ if [ "$ENABLE_WIRELESS" = true ] ; then if [ "$RPI_MODEL" = 3P ] ; then chown root:root "${WLAN_FIRMWARE_DIR}/brcmfmac43455-sdio."* chmod 600 "${WLAN_FIRMWARE_DIR}/brcmfmac43455-sdio."* - else + elif [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 0 ] ; then chown root:root "${WLAN_FIRMWARE_DIR}/brcmfmac43430-sdio."* chmod 600 "${WLAN_FIRMWARE_DIR}/brcmfmac43430-sdio."* fi diff --git a/bootstrap.d/21-firewall.sh b/bootstrap.d/21-firewall.sh index d5cd258..1cabec2 100644 --- a/bootstrap.d/21-firewall.sh +++ b/bootstrap.d/21-firewall.sh @@ -10,9 +10,9 @@ if [ "$ENABLE_IPTABLES" = true ] ; then mkdir -p "${ETC_DIR}/iptables" # make sure iptables-legacy,iptables-legacy-restore and iptables-legacy-save are the used alternatives - chroot_exec update-alternatives --verbose --set iptables /usr/bin/iptables-legacy - chroot_exec update-alternatives --verbose --set iptables-save /usr/bin/iptables-legacy-save - chroot_exec update-alternatives --verbose --set iptables-restore /usr/bin/iptables-legacy-restore + chroot_exec update-alternatives --verbose --set iptables /usr/sbin/iptables-legacy + chroot_exec update-alternatives --verbose --set iptables-save /usr/sbin/iptables-legacy-save + chroot_exec update-alternatives --verbose --set iptables-restore /usr/sbin/iptables-legacy-restore # Install iptables systemd service install_readonly files/iptables/iptables.service "${ETC_DIR}/systemd/system/iptables.service" diff --git a/rpi23-gen-image.sh b/rpi23-gen-image.sh index d8d008a..103e58f 100755 --- a/rpi23-gen-image.sh +++ b/rpi23-gen-image.sh @@ -176,6 +176,7 @@ ENABLE_USER=${ENABLE_USER:=true} USER_NAME=${USER_NAME:="pi"} ENABLE_ROOT=${ENABLE_ROOT:=false} ENABLE_QEMU=${ENABLE_QEMU:=false} +ENABLE_SYSVINIT=${ENABLE_SYSVINIT:=false} # SSH settings SSH_ENABLE_ROOT=${SSH_ENABLE_ROOT:=false} @@ -244,6 +245,9 @@ CHROOT_SCRIPTS=${CHROOT_SCRIPTS:=""} APT_INCLUDES=${APT_INCLUDES:=""} APT_INCLUDES="${APT_INCLUDES},apt-transport-https,apt-utils,ca-certificates,debian-archive-keyring,dialog,sudo,systemd,sysvinit-utils" +#Packages to exclude from chroot build environment +APT_EXCLUDES=${APT_EXCLUDES:=""} + # Packages required for bootstrapping REQUIRED_PACKAGES="debootstrap debian-archive-keyring qemu-user-static binfmt-support dosfstools rsync bmap-tools whois git bc psmisc dbus sudo" MISSING_PACKAGES="" @@ -253,6 +257,11 @@ COMPILER_PACKAGES="" set +x +#If init and systemd-sysv are wanted e.g. halt/reboot/shutdown scripts +if [ "$ENABLE_SYSVINIT" = false ] ; then +APT_EXCLUDES="--exclude=${APT_EXCLUDES},init,systemd-sysv" +fi + # Set Raspberry Pi model specific configuration if [ "$RPI_MODEL" = 0 ] ; then DTB_FILE=${RPI0_DTB_FILE} @@ -306,9 +315,9 @@ if [ "$BUILD_KERNEL" = true ] ; then if [ "$RELEASE_ARCH" = "armhf" ]; then REQUIRED_PACKAGES="${REQUIRED_PACKAGES} crossbuild-essential-armhf" fi - if [ "$RELEASE_ARCH" = "arm64" ]; then - REQUIRED_PACKAGES="${REQUIRED_PACKAGES} crossbuild-essential-arm64" - fi + fi + if [ "$RELEASE_ARCH" = "arm64" ]; then + REQUIRED_PACKAGES="${REQUIRED_PACKAGES} crossbuild-essential-arm64" fi fi @@ -448,7 +457,7 @@ if [ "$ENABLE_MINBASE" = true ] ; then fi # Add required locales packages -if [ "$DEFLOCAL" != "en_US.UTF-8" ] ; then +if [ "$DEFLOCAL" != "en_US.UTF-8" ] || ([ -n XKB_MODEL ] || [ -n XKB_LAYOUT ] || [ -n XKB_VARIANT ] || [ -n XKB_OPTIONS ]); then APT_INCLUDES="${APT_INCLUDES},locales,keyboard-configuration,console-setup" fi @@ -464,7 +473,7 @@ fi # Add iptables IPv4/IPv6 package if [ "$ENABLE_IPTABLES" = true ] ; then - APT_INCLUDES="${APT_INCLUDES},iptables" + APT_INCLUDES="${APT_INCLUDES},iptables,iptables-persistent" fi # Add openssh server package