diff --git a/build-image/first-boot.bash b/build-image/first-boot.bash index afdd8298d..2b9980cf7 100755 --- a/build-image/first-boot.bash +++ b/build-image/first-boot.bash @@ -18,7 +18,9 @@ fail_inprogress() { exit 1 } -echo "$(timestamp) [openHABian] Starting the openHABian initial setup." +###### start ###### +sleep 5 +echo -e "\n\n$(timestamp) [openHABian] Starting the openHABian initial setup." rm -f /opt/openHABian-install-failed touch /opt/openHABian-install-inprogress diff --git a/build-image/openhabian.pi-raspbian.conf b/build-image/openhabian.pi-raspios32.conf similarity index 100% rename from build-image/openhabian.pi-raspbian.conf rename to build-image/openhabian.pi-raspios32.conf diff --git a/build-image/openhabian.pi-raspios64beta.conf b/build-image/openhabian.pi-raspios64beta.conf new file mode 100644 index 000000000..272f103b9 --- /dev/null +++ b/build-image/openhabian.pi-raspios64beta.conf @@ -0,0 +1,59 @@ +# Modify your openHABian settings +# Handle with care, only touch if you need to!! + +hostname=openhab +username=openhabian +userpw=openhabian + +# Language and time. Be sure to set these to valid values +timeserver=0.pool.ntp.org +locales="en_US.UTF-8 de_DE.UTF-8" +system_default_locale="en_US.UTF-8" +#timezone=Europe/Berlin + +# Wi-Fi settings. An ethernet connection is recommended +# Requirement: RPi4, RPi3, RPi0W or a supported external Wi-Fi dongle +# Fill in your SSID and password below, leave empty to use ethernet +# ATTENTION: you need to escape these special characters: $, `, ", \, (newline) +# 'Escaping' means to put an additional \ in front of that character +wifi_ssid="" +wifi_psk="" + +# Wi-Fi setting. Select a two-letter country code suitable for your location +# E.g. US (default), DE, AU, NZ... +# You may infringe on local legislature otherwise +# See https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2 or /usr/share/zoneinfo/zone.tab +wifi_country="" + +# Eventually disable all IPv6 e.g. on installation problems +# values: "enable", "disable" +ipv6=enable + +# repo to clone from (if not master for build and test) +repositoryurl=https://github.com/openhab/openhabian.git +clonebranch=stable + +# debug verbosity mode +# off, on (verbose output in log) or maximum (show every command) +# as long as image is still beta, default to on +debugmode=on + +# Hardware +# pi0, pi0w, pi1, cm1, pi2, pi3, cm3, pi3+, cm3+, pi4 +#hw=pi3 + +# Hardware architecture +# x86_64, amd64, armv6l, armv7l, aarch64, arm64 +#hwarch=armv7l + +# OS Release +# ubuntu, raspbian, debian +# stretch, buster +# bionic, focal +#release=buster + +# Java architecture mode +# Valid arguments: "Adopt11", "Zulu8-32", "Zulu8-64", "Zulu11-32", or "Zulu11-64" +java_opt=Zulu11-64 + +# vim: filetype=sh diff --git a/build.bash b/build.bash index 05552cb86..4c9a5bf36 100755 --- a/build.bash +++ b/build.bash @@ -4,7 +4,7 @@ set -e usage() { echo -e "Usage: $(basename "$0") [dev-git|dev-url] " - echo -e "\\nCurrently supported platforms: rpi" + echo -e "\\nCurrently supported platforms: rpi, rpi64 (beta)" } ########################## @@ -141,9 +141,13 @@ echo_process "This script will build the openHABian image file." # Identify hardware platform if [ "$1" == "rpi" ]; then - hw_platform="pi-raspbian" + hw_platform="pi-raspios32" echo_process "Hardware platform: Raspberry Pi (rpi)" +elif [ "$1" == "rpi64" ]; then + hw_platform="pi-raspios64beta" + echo_process "Hardware platform: Raspberry Pi (rpi64) - BETA -" + elif [ "$1" == "pine64" ]; then hw_platform="pine64-xenial" echo_process "Hardware platform: Pine A64 (pine64)" @@ -265,7 +269,17 @@ if [ "$hw_platform" == "pine64-xenial" ]; then if mv $buildfolder/xenial-pine64-*.img $imagefile; then echo "OK"; else echo "FAILED"; exit 1; fi # Build Raspberry Pi image -elif [ "$hw_platform" == "pi-raspbian" ]; then +elif [ "$hw_platform" == "pi-raspios32" ] || [ "$hw_platform" == "pi-raspios64beta" ]; then + if [ "$hw_platform" == "pi-raspios64beta" ]; then + zipfile=raspios_lite_arm64_latest.zip + baseurl="https://downloads.raspberrypi.org/raspios_arm64/images/raspios_arm64-2020-05-28/2020-05-27-raspios-buster-arm64.zip" + bits=64 + else + zipfile=raspios_lite_armhf_latest.zip + baseurl="https://downloads.raspberrypi.org/raspios_lite_armhf_latest" + bits=32 + fi + # Prerequisites echo_process "Checking prerequisites... " REQ_COMMANDS="git wget unzip crc32 dos2unix xz" @@ -286,16 +300,16 @@ elif [ "$hw_platform" == "pi-raspbian" ]; then fi check_command_availability_and_exit "$REQ_COMMANDS" "$REQ_PACKAGES" - if [ -f "raspbian.zip" ]; then - echo_process "Using local copy of Raspbian Lite image, raspbian.zip... " - cp raspbian.zip $buildfolder/raspbian.zip + if [ -f "$zipfile" ]; then + echo_process "Using local copy of Raspberry Pi OS ($bits-bit) Lite image, $zipfile... " + cp $zipfile "$buildfolder/$zipfile" else - echo_process "Downloading latest Raspbian Lite image (no local copy raspbian.zip found)... " - wget -nv -O $buildfolder/raspbian.zip "https://downloads.raspberrypi.org/raspbian_lite_latest" + echo_process "Downloading latest Raspberry Pi OS ($bits-bit) Lite image (no local copy of $zipfile found)... " + wget -nv -O "$buildfolder/$zipfile" "$baseurl" fi echo_process "Unpacking image... " - unzip $buildfolder/raspbian.zip -d $buildfolder - mv $buildfolder/*raspbian*.img $imagefile + unzip $buildfolder/$zipfile -d $buildfolder + mv $buildfolder/*-rasp*.img $imagefile echo_process "Mounting the image for modifications... " mkdir -p $buildfolder/boot $buildfolder/root @@ -309,6 +323,16 @@ elif [ "$hw_platform" == "pi-raspbian" ]; then echo_process "Injecting 'openhabian-installer.service', 'first-boot.bash' and 'openhabian.conf'... " cp $sourcefolder/openhabian-installer.service $buildfolder/root/etc/systemd/system/ ln -s $buildfolder/root/etc/systemd/system/openhabian-installer.service $buildfolder/root/etc/systemd/system/multi-user.target.wants/openhabian-installer.service + + echo_process "Setting default runlevel multiuser.target... " + ( # open a subshell, returns to current dir automatically + cd $buildfolder/root/etc/systemd/system/ || exit 1 + rm -rf default.target + ln -s ../../../lib/systemd/system/multi-user.target default.target + # disable autologin + rm -f $buildfolder/root/etc/systemd/system/getty@tty1.service.d/autologin.conf + ) + touch $buildfolder/root/opt/openHABian-install-inprogress # maybe we should use a trap to get this done in case of error umount_image_file_root "$imagefile" "$buildfolder" diff --git a/functions/helpers.bash b/functions/helpers.bash index d16b5fcf1..02ed293f9 100644 --- a/functions/helpers.bash +++ b/functions/helpers.bash @@ -174,11 +174,17 @@ is_ubuntu() { [[ $(cat /etc/*release*) =~ "Ubuntu" ]] return $? } +# introduction of Raspberry Pi OS: +# 32 bit returns false (1) +# 64 bit returns true (0) is_debian() { if [[ "$release" == "debian" ]]; then return 0; fi [[ $(cat /etc/*release*) =~ "Debian" ]] return $? } +# introduction of Raspberry Pi OS: +# 32 bit returns true (0) +# 64 bit returns false (1) is_raspbian() { if [[ "$release" == "raspbian" ]]; then return 0; fi [[ "$(cat /etc/*release*)" =~ "Raspbian" ]]