diff --git a/.dockerignore b/.dockerignore index 4b019f9..e7f7a4a 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,3 +1,5 @@ output/ work/ deploy/ +apt-cacher-ng/ +.git/objects/* diff --git a/.gitignore b/.gitignore index 9f385f6..a6883c2 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ work/* config postrun.sh SKIP +SKIP_IMAGES .pc *-pc apt-cacher-ng/ diff --git a/Dockerfile b/Dockerfile index 1b2979c..4e4264f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1,12 @@ FROM debian:stretch +ENV DEBIAN_FRONTEND noninteractive + RUN apt-get -y update && \ apt-get -y install \ git vim parted \ quilt realpath qemu-user-static debootstrap zerofree pxz zip dosfstools \ - bsdtar libcap2-bin rsync grep udev \ + bsdtar libcap2-bin rsync grep udev xz-utils curl xxd \ && rm -rf /var/lib/apt/lists/* COPY . /pi-gen/ diff --git a/License.md b/LICENSE similarity index 100% rename from License.md rename to LICENSE diff --git a/build-docker.sh b/build-docker.sh index 5e3c5ff..e0a9b90 100755 --- a/build-docker.sh +++ b/build-docker.sh @@ -1,4 +1,5 @@ #!/bin/bash -e + DOCKER="docker" set +e $DOCKER ps >/dev/null 2>&1 @@ -12,10 +13,9 @@ if ! $DOCKER ps >/dev/null; then fi set -e - -config_mount=() +config_file=() if [ -f config ]; then - config_mount=("-v" "$(pwd)/config:/pi-gen/config:ro") + config_file=("--env-file" "$(pwd)/config") source config fi @@ -24,7 +24,7 @@ CONTINUE=${CONTINUE:-0} if [ "$*" != "" ] || [ -z "${IMG_NAME}" ]; then if [ -z "${IMG_NAME}" ]; then - echo "IMG_NAME not set in 'build'" 1>&2 + echo "IMG_NAME not set in 'config'" 1>&2 echo 1>&2 fi cat >&2 < ) CONTAINER_NAME=pigen_work set a name for the build container - CONTINUE=0 continue from a previously started container + CONTINUE=1 continue from a previously started container EOF exit 1 fi @@ -46,13 +46,13 @@ fi if [ "$CONTAINER_EXISTS" != "" ] && [ "$CONTINUE" != "1" ]; then echo "Container $CONTAINER_NAME already exists and you did not specify CONTINUE=1. Aborting." echo "You can delete the existing container like this:" - echo " docker rm -v $CONTAINER_NAME" + echo " $DOCKER rm -v $CONTAINER_NAME" exit 1 fi $DOCKER build -t pi-gen . if [ "$CONTAINER_EXISTS" != "" ]; then - trap "echo 'got CTRL+C... please wait 5s';docker stop -t 5 ${CONTAINER_NAME}_cont" SIGINT SIGTERM + trap "echo 'got CTRL+C... please wait 5s'; $DOCKER stop -t 5 ${CONTAINER_NAME}_cont" SIGINT SIGTERM time $DOCKER run --rm --privileged \ --volumes-from="${CONTAINER_NAME}" --name "${CONTAINER_NAME}_cont" \ -e IMG_NAME=${IMG_NAME}\ @@ -60,17 +60,21 @@ if [ "$CONTAINER_EXISTS" != "" ]; then bash -e -o pipefail -c "dpkg-reconfigure qemu-user-static && cd /pi-gen; ./build.sh; rsync -av work/*/build.log deploy/" & - wait + wait "$!" else - trap "echo 'got CTRL+C... please wait 5s'; docker stop -t 5 ${CONTAINER_NAME}" SIGINT SIGTERM - $DOCKER run --name "${CONTAINER_NAME}" --privileged \ + trap "echo 'got CTRL+C... please wait 5s'; $DOCKER stop -t 5 ${CONTAINER_NAME}" SIGINT SIGTERM + time $DOCKER run --name "${CONTAINER_NAME}" --privileged \ -e IMG_NAME=${IMG_NAME}\ - -v "$(pwd)/deploy:/pi-gen/deploy" \ - "${config_mount[@]}" \ + "${config_file[@]}" \ pi-gen \ bash -e -o pipefail -c "dpkg-reconfigure qemu-user-static && cd /pi-gen; ./build.sh && rsync -av work/*/build.log deploy/" & - wait + wait "$!" fi +echo "copying results from deploy/" +$DOCKER cp "${CONTAINER_NAME}":/pi-gen/deploy . +ls -lah deploy +$DOCKER rm -v $CONTAINER_NAME + echo "Done! Your image(s) should be in deploy/" diff --git a/build.sh b/build.sh index 70f7dc5..77507b2 100755 --- a/build.sh +++ b/build.sh @@ -85,8 +85,10 @@ run_stage(){ unmount ${WORK_DIR}/${STAGE} STAGE_WORK_DIR=${WORK_DIR}/${STAGE} ROOTFS_DIR=${STAGE_WORK_DIR}/rootfs - if [ -f ${STAGE_DIR}/EXPORT_IMAGE ]; then - EXPORT_DIRS="${EXPORT_DIRS} ${STAGE_DIR}" + if [ ! -f SKIP_IMAGES ]; then + if [ -f ${STAGE_DIR}/EXPORT_IMAGE ]; then + EXPORT_DIRS="${EXPORT_DIRS} ${STAGE_DIR}" + fi fi if [ ! -f SKIP ]; then if [ "${CLEAN}" = "1" ]; then @@ -119,6 +121,7 @@ if [ "$(id -u)" != "0" ]; then exit 1 fi + if [ -f config ]; then source config fi @@ -128,6 +131,7 @@ if [ -z "${IMG_NAME}" ]; then exit 1 fi +export USE_QEMU=${USE_QEMU:-0} export IMG_DATE=${IMG_DATE:-"$(date +%Y-%m-%d)"} export OS_TYPE=$1 @@ -179,10 +183,12 @@ for EXPORT_DIR in ${EXPORT_DIRS}; do source "${EXPORT_DIR}/EXPORT_IMAGE" EXPORT_ROOTFS_DIR=${WORK_DIR}/$(basename ${EXPORT_DIR})/rootfs run_stage - if [ -e ${EXPORT_DIR}/EXPORT_NOOBS ]; then - source ${EXPORT_DIR}/EXPORT_NOOBS - STAGE_DIR=${BASE_DIR}/export-noobs - run_stage + if [ "${USE_QEMU}" != "1" ]; then + if [ -e ${EXPORT_DIR}/EXPORT_NOOBS ]; then + source ${EXPORT_DIR}/EXPORT_NOOBS + STAGE_DIR=${BASE_DIR}/export-noobs + run_stage + fi fi done diff --git a/depends b/depends index c453281..d516533 100644 --- a/depends +++ b/depends @@ -9,4 +9,7 @@ mkdosfs:dosfstools capsh:libcap2-bin bsdtar grep -rsync \ No newline at end of file +rsync +xz:xz-utils +curl +xxd diff --git a/export-image/00-allow-rerun/files/policy-rc.d b/export-image/00-allow-rerun/files/policy-rc.d index 0b1556d..1924710 100644 --- a/export-image/00-allow-rerun/files/policy-rc.d +++ b/export-image/00-allow-rerun/files/policy-rc.d @@ -1,2 +1,3 @@ #!/bin/sh + exit 101 diff --git a/export-image/01-set-sources/00-patches/0-sources.diff b/export-image/01-set-sources/00-patches/0-sources.diff index d46afe6..17badff 100644 --- a/export-image/01-set-sources/00-patches/0-sources.diff +++ b/export-image/01-set-sources/00-patches/0-sources.diff @@ -3,7 +3,7 @@ Index: export-jessie/rootfs/etc/apt/sources.list.d/raspi.list --- export-jessie.orig/rootfs/etc/apt/sources.list.d/raspi.list +++ export-jessie/rootfs/etc/apt/sources.list.d/raspi.list @@ -1,3 +1,3 @@ --deb http://archive.raspberrypi.org/debian/ jessie main ui staging -+deb http://archive.raspberrypi.org/debian/ jessie main ui +-deb http://archive.raspberrypi.org/debian/ stretch main ui staging ++deb http://archive.raspberrypi.org/debian/ stretch main ui # Uncomment line below then 'apt-get update' to enable 'apt-get source' - #deb-src http://archive.raspberrypi.org/debian/ jessie main ui + #deb-src http://archive.raspberrypi.org/debian/ stretch main ui diff --git a/export-image/02-network/01-run.sh b/export-image/02-network/01-run.sh index 9026a1f..e21b791 100755 --- a/export-image/02-network/01-run.sh +++ b/export-image/02-network/01-run.sh @@ -1,3 +1,3 @@ -#/bin/bash -e +#!/bin/bash -e install -m 644 files/resolv.conf ${ROOTFS_DIR}/etc/ diff --git a/export-image/03-set-partuuid/00-run.sh b/export-image/03-set-partuuid/00-run.sh index f19884e..4b18405 100755 --- a/export-image/03-set-partuuid/00-run.sh +++ b/export-image/03-set-partuuid/00-run.sh @@ -1,7 +1,8 @@ #!/bin/bash -e + IMG_FILE="${STAGE_WORK_DIR}/${IMG_DATE}-${IMG_NAME}${IMG_SUFFIX}.img" -IMGID="$(fdisk -l ${IMG_FILE} | sed -n 's/Disk identifier: 0x\([^ ]*\)/\1/p')" +IMGID="$(dd if=${IMG_FILE} skip=440 bs=1 count=4 2>/dev/null | xxd -e | cut -f 2 -d' ')" BOOT_PARTUUID="${IMGID}-01" ROOT_PARTUUID="${IMGID}-02" diff --git a/export-image/04-finalise/01-run.sh b/export-image/04-finalise/01-run.sh index cc69dec..f04c7ee 100755 --- a/export-image/04-finalise/01-run.sh +++ b/export-image/04-finalise/01-run.sh @@ -1,6 +1,7 @@ #!/bin/bash -e IMG_FILE="${STAGE_WORK_DIR}/${IMG_DATE}-${IMG_NAME}${IMG_SUFFIX}.img" +INFO_FILE="${STAGE_WORK_DIR}/${IMG_DATE}-${IMG_NAME}${IMG_SUFFIX}.info" on_chroot << EOF /etc/init.d/fake-hwclock stop @@ -14,8 +15,10 @@ fi rm -f ${ROOTFS_DIR}/etc/apt/apt.conf.d/51cache rm -f ${ROOTFS_DIR}/usr/sbin/policy-rc.d rm -f ${ROOTFS_DIR}/usr/bin/qemu-arm-static -if [ -e ${ROOTFS_DIR}/etc/ld.so.preload.disabled ]; then - mv ${ROOTFS_DIR}/etc/ld.so.preload.disabled ${ROOTFS_DIR}/etc/ld.so.preload +if [ "${USE_QEMU}" != "1" ]; then + if [ -e ${ROOTFS_DIR}/etc/ld.so.preload.disabled ]; then + mv ${ROOTFS_DIR}/etc/ld.so.preload.disabled ${ROOTFS_DIR}/etc/ld.so.preload + fi fi rm -f ${ROOTFS_DIR}/etc/apt/sources.list~ @@ -42,11 +45,30 @@ for _FILE in $(find ${ROOTFS_DIR}/var/log/ -type f); do done rm -f "${ROOTFS_DIR}/root/.vnc/private.key" +rm -f "${ROOTFS_DIR}/etc/vnc/updateid" update_issue $(basename ${EXPORT_DIR}) install -m 644 ${ROOTFS_DIR}/etc/rpi-issue ${ROOTFS_DIR}/boot/issue.txt install files/LICENSE.oracle ${ROOTFS_DIR}/boot/ + +cp "$ROOTFS_DIR/etc/rpi-issue" "$INFO_FILE" + +firmware=$(zgrep "firmware as of" "$ROOTFS_DIR/usr/share/doc/raspberrypi-kernel/changelog.Debian.gz" | \ + head -n1 | \ + sed -n 's|.* \([^ ]*\)$|\1|p') + +printf "\nFirmware: https://github.com/raspberrypi/firmware/tree/%s\n" "$firmware" >> "$INFO_FILE" + +kernel=$(curl -s -L "https://github.com/raspberrypi/firmware/raw/$firmware/extra/git_hash") +printf "Kernel: https://github.com/raspberrypi/linux/tree/%s\n" "$kernel" >> "$INFO_FILE" + +uname=$(curl -s -L "https://github.com/raspberrypi/firmware/raw/$firmware/extra/uname_string7") +printf "Uname string: %s\n" "$uname" >> "$INFO_FILE" + +printf "\nPackages:\n">> "$INFO_FILE" +dpkg -l --root "$ROOTFS_DIR" >> "$INFO_FILE" + ROOT_DEV=$(mount | grep "${ROOTFS_DIR} " | cut -f1 -d' ') unmount ${ROOTFS_DIR} @@ -58,7 +80,8 @@ mkdir -p ${DEPLOY_DIR} rm -f ${DEPLOY_DIR}/image_${IMG_DATE}-${IMG_NAME}${IMG_SUFFIX}.zip -echo zip ${DEPLOY_DIR}/image_${IMG_DATE}-${IMG_NAME}${IMG_SUFFIX}.zip ${IMG_FILE} pushd ${STAGE_WORK_DIR} > /dev/null zip ${DEPLOY_DIR}/image_${IMG_DATE}-${IMG_NAME}${IMG_SUFFIX}.zip $(basename ${IMG_FILE}) popd > /dev/null + +cp "$INFO_FILE" "$DEPLOY_DIR" diff --git a/export-image/prerun.sh b/export-image/prerun.sh index 67da3da..cec133c 100755 --- a/export-image/prerun.sh +++ b/export-image/prerun.sh @@ -1,4 +1,5 @@ #!/bin/bash -e + IMG_FILE="${STAGE_WORK_DIR}/${IMG_DATE}-${IMG_NAME}${IMG_SUFFIX}.img" unmount_image ${IMG_FILE} @@ -11,7 +12,8 @@ mkdir -p ${ROOTFS_DIR} BOOT_SIZE=$(du --apparent-size -s ${EXPORT_ROOTFS_DIR}/boot --block-size=1 | cut -f 1) TOTAL_SIZE=$(du --apparent-size -s ${EXPORT_ROOTFS_DIR} --exclude var/cache/apt/archives --block-size=1 | cut -f 1) -IMG_SIZE=$((BOOT_SIZE + TOTAL_SIZE + (800 * 1024 * 1024))) +ROUND_SIZE="$((4 * 1024 * 1024))" +IMG_SIZE=$(((BOOT_SIZE + TOTAL_SIZE + (800 * 1024 * 1024) + ROUND_SIZE) / ROUND_SIZE * ROUND_SIZE)) truncate -s ${IMG_SIZE} ${IMG_FILE} fdisk -H 255 -S 63 ${IMG_FILE} < /dev/null -mkfs.ext4 -O $ROOT_FEATURES $ROOT_DEV > /dev/null +mkfs.ext4 -L rootfs -O $ROOT_FEATURES $ROOT_DEV > /dev/null mount -v $ROOT_DEV ${ROOTFS_DIR} -t ext4 mkdir -p ${ROOTFS_DIR}/boot diff --git a/export-noobs/00-release/files/os.json b/export-noobs/00-release/files/os.json index 46e1634..e48dcb8 100644 --- a/export-noobs/00-release/files/os.json +++ b/export-noobs/00-release/files/os.json @@ -10,9 +10,10 @@ "Pi Model", "Pi 2", "Pi Zero", - "Pi 3" + "Pi 3", + "Pi Compute Module 3" ], "url": "http://www.raspbian.org/", "username": "pi", - "version": "jessie" + "version": "stretch" } diff --git a/export-noobs/00-release/files/release_notes.txt b/export-noobs/00-release/files/release_notes.txt index 1d82bbc..2177cfe 100644 --- a/export-noobs/00-release/files/release_notes.txt +++ b/export-noobs/00-release/files/release_notes.txt @@ -1,5 +1,34 @@ UNRELEASED: - * + * Added battery monitor plugin for taskbar - works on x86 images or first-generation Pi-Top + * Added cutdown mode to PCManFM file manager to reduce complexity + * Added ability to rename files in PCManFM by clicking name when selected + * Bug fix in Bluetooth ALSA module to reduce truncation of audio at end of playback + * Various small tweaks, bug fixes and theme modifications + * New kernel and firmware +2017-09-07: + * Disable predictable network interface names for Ethernet devices + * Bug fix for keyboard settings dialog in Raspberry Pi Configuration + * Bug fix for crash on some videos and animations in Chromium + * Bug fix for taskbar crash when running RealVNC server + * Bug fix for reloading projects with extensions in Scratch 2 + * Bug fix for MAC address problem in Bluetooth + * Simple mode and new icons in Thonny + * New Japanese translations in Raspberry Pi Configuration + * Install fonts-droid-fallback for international fonts +2017-08-16: + * Based on Raspbian Stretch (Debian version 9) + * Version 60 of Chromium browser included + * Version 3.0.1 of Sonic Pi included + * Version 6.1.1 of RealVNC included + * Version 0.17.4 of NodeRED included + * Bluetooth audio routed via ALSA rather than Pulseaudio + * SenseHAT extension added to Scratch 2 + * Various desktop applications modified to prompt for sudo password if needed + * lxinput control options for mouse speed simplified + * lxpanel plugins moved into separate packages + * Wireless firmware for Pi 3 and Pi 0W modified to address Broadpwn exploit + * Latest kernel and firmware + * Various small tweaks, bug fixes and theme modifications 2017-07-05: * New kernel and firmware * Filesystem created without the metadata_csum feature diff --git a/export-noobs/prerun.sh b/export-noobs/prerun.sh index a3bb29f..dafe654 100755 --- a/export-noobs/prerun.sh +++ b/export-noobs/prerun.sh @@ -31,8 +31,10 @@ mkdir -p ${NOOBS_DIR} mount $ROOT_DEV ${STAGE_WORK_DIR}/rootfs mount $BOOT_DEV ${STAGE_WORK_DIR}/rootfs/boot -bsdtar --format gnutar --use-compress-program pxz -C ${STAGE_WORK_DIR}/rootfs/boot -cpf ${NOOBS_DIR}/boot.tar.xz . +ln -sv "/lib/systemd/system/apply_noobs_os_config.service" "$ROOTFS_DIR/etc/systemd/system/multi-user.target.wants/apply_noobs_os_config.service" + +bsdtar --numeric-owner --format gnutar --use-compress-program pxz -C ${STAGE_WORK_DIR}/rootfs/boot -cpf ${NOOBS_DIR}/boot.tar.xz . umount ${STAGE_WORK_DIR}/rootfs/boot -bsdtar --format gnutar --use-compress-program pxz -C ${STAGE_WORK_DIR}/rootfs --one-file-system -cpf ${NOOBS_DIR}/root.tar.xz . +bsdtar --numeric-owner --format gnutar --use-compress-program pxz -C ${STAGE_WORK_DIR}/rootfs --one-file-system -cpf ${NOOBS_DIR}/root.tar.xz . unmount_image ${IMG_FILE} diff --git a/scripts/dependencies_check b/scripts/dependencies_check index 4817561..d649f0c 100644 --- a/scripts/dependencies_check +++ b/scripts/dependencies_check @@ -1,5 +1,5 @@ # dependencies_check -# $@ Dependnecy files to check +# $@ Dependency files to check # # Each dependency is in the form of a tool to test for, optionally followed by # a : and the name of a package if the package on a Debian-ish system is not @@ -21,7 +21,7 @@ dependencies_check() done if [[ "$missing" ]]; then - echo "Reqired dependencies not installed" + echo "Required dependencies not installed" echo echo "This can be resolved on Debian/Raspbian systems by installing:" echo "$missing" diff --git a/stage0/00-configure-apt/files/raspi.list b/stage0/00-configure-apt/files/raspi.list index e1f3b41..656ab48 100644 --- a/stage0/00-configure-apt/files/raspi.list +++ b/stage0/00-configure-apt/files/raspi.list @@ -1,3 +1,3 @@ -deb http://archive.raspberrypi.org/debian/ jessie main ui staging +deb http://archive.raspberrypi.org/debian/ stretch main ui staging # Uncomment line below then 'apt-get update' to enable 'apt-get source' -#deb-src http://archive.raspberrypi.org/debian/ jessie main ui +#deb-src http://archive.raspberrypi.org/debian/ stretch main ui diff --git a/stage0/00-configure-apt/files/sources.list b/stage0/00-configure-apt/files/sources.list index 014f732..f13c50c 100644 --- a/stage0/00-configure-apt/files/sources.list +++ b/stage0/00-configure-apt/files/sources.list @@ -1,3 +1,3 @@ -deb http://mirrordirector.raspbian.org/raspbian/ jessie main contrib non-free rpi +deb http://mirrordirector.raspbian.org/raspbian/ stretch main contrib non-free rpi # Uncomment line below then 'apt-get update' to enable 'apt-get source' -#deb-src http://archive.raspbian.org/raspbian/ jessie main contrib non-free rpi +#deb-src http://archive.raspbian.org/raspbian/ stretch main contrib non-free rpi diff --git a/stage0/prerun.sh b/stage0/prerun.sh index d2bce14..14c09c3 100755 --- a/stage0/prerun.sh +++ b/stage0/prerun.sh @@ -1,4 +1,5 @@ #!/bin/bash -e + if [ ! -d ${ROOTFS_DIR} ]; then - bootstrap jessie ${ROOTFS_DIR} http://mirrordirector.raspbian.org/raspbian/ + bootstrap stretch ${ROOTFS_DIR} http://mirrordirector.raspbian.org/raspbian/ fi diff --git a/stage1/01-sys-tweaks/files/policy-rc.d b/stage1/01-sys-tweaks/files/policy-rc.d index 0b1556d..1924710 100755 --- a/stage1/01-sys-tweaks/files/policy-rc.d +++ b/stage1/01-sys-tweaks/files/policy-rc.d @@ -1,2 +1,3 @@ #!/bin/sh + exit 101 diff --git a/stage1/02-net-tweaks/00-patches/02-persistant-net.diff b/stage1/02-net-tweaks/00-patches/02-persistant-net.diff deleted file mode 100644 index 1e6a975..0000000 --- a/stage1/02-net-tweaks/00-patches/02-persistant-net.diff +++ /dev/null @@ -1,13 +0,0 @@ -Index: jessie-stage1/rootfs/lib/udev/rules.d/75-persistent-net-generator.rules -=================================================================== ---- jessie-stage1.orig/rootfs/lib/udev/rules.d/75-persistent-net-generator.rules -+++ jessie-stage1/rootfs/lib/udev/rules.d/75-persistent-net-generator.rules -@@ -22,7 +22,7 @@ IMPORT{cmdline}="net.ifnames" - ENV{net.ifnames}=="1", GOTO="persistent_net_generator_end" - - # device name whitelist --KERNEL!="eth*|ath*|wlan*[0-9]|msh*|ra*|sta*|ctc*|lcs*|hsi*", \ -+KERNEL!="ath*|msh*|ra*|sta*|ctc*|lcs*|hsi*", \ - GOTO="persistent_net_generator_end" - - # ignore Xen virtual interfaces diff --git a/stage1/02-net-tweaks/00-patches/series b/stage1/02-net-tweaks/00-patches/series index 5299ca1..3dc19a2 100644 --- a/stage1/02-net-tweaks/00-patches/series +++ b/stage1/02-net-tweaks/00-patches/series @@ -1,2 +1 @@ 01-hosts.diff -02-persistant-net.diff diff --git a/stage1/02-net-tweaks/00-run.sh b/stage1/02-net-tweaks/00-run.sh index 85b528f..174b9f8 100755 --- a/stage1/02-net-tweaks/00-run.sh +++ b/stage1/02-net-tweaks/00-run.sh @@ -1,9 +1,6 @@ #!/bin/bash -e install -m 644 files/ipv6.conf ${ROOTFS_DIR}/etc/modprobe.d/ipv6.conf -install -m 644 files/interfaces ${ROOTFS_DIR}/etc/network/interfaces install -m 644 files/hostname ${ROOTFS_DIR}/etc/hostname -on_chroot << EOF -dpkg-divert --add --local /lib/udev/rules.d/75-persistent-net-generator.rules -EOF +ln -sf /dev/null ${ROOTFS_DIR}/etc/systemd/network/99-default.link diff --git a/stage1/prerun.sh b/stage1/prerun.sh index a5ea5f4..ebb5d35 100755 --- a/stage1/prerun.sh +++ b/stage1/prerun.sh @@ -1,4 +1,5 @@ #!/bin/bash -e + if [ ! -d ${ROOTFS_DIR} ]; then copy_previous fi diff --git a/stage2/01-sys-tweaks/00-packages b/stage2/01-sys-tweaks/00-packages index 1f26b57..f792f37 100644 --- a/stage2/01-sys-tweaks/00-packages +++ b/stage2/01-sys-tweaks/00-packages @@ -1,4 +1,4 @@ -ssh less fbset sudo psmisc strace module-init-tools ed ncdu crda +ssh less fbset sudo psmisc strace ed ncdu crda console-setup keyboard-configuration debconf-utils parted unzip build-essential manpages-dev python bash-completion gdb pkg-config python-rpi.gpio v4l-utils @@ -6,7 +6,7 @@ avahi-daemon lua5.1 luajit hardlink ca-certificates curl -fake-hwclock ntp nfs-common usbutils +fake-hwclock nfs-common usbutils libraspberrypi-dev libraspberrypi-doc libfreetype6-dev dosfstools dphys-swapfile @@ -17,3 +17,8 @@ usb-modeswitch apt-transport-https libpam-chksshpwd rpi-update +libmtp-runtime +rsync +htop +man-db +policykit-1 diff --git a/stage2/01-sys-tweaks/00-patches/series b/stage2/01-sys-tweaks/00-patches/series index 8273f0c..aee0402 100644 --- a/stage2/01-sys-tweaks/00-patches/series +++ b/stage2/01-sys-tweaks/00-patches/series @@ -2,5 +2,4 @@ 02-swap.diff 04-inputrc.diff 05-path.diff -06-rc_local.diff 07-resize-init.diff diff --git a/stage2/01-sys-tweaks/01-run.sh b/stage2/01-sys-tweaks/01-run.sh index 15731e1..2b790f3 100755 --- a/stage2/01-sys-tweaks/01-run.sh +++ b/stage2/01-sys-tweaks/01-run.sh @@ -1,7 +1,5 @@ #!/bin/bash -e -install -m 644 files/regenerate_ssh_host_keys.service ${ROOTFS_DIR}/lib/systemd/system/ -install -m 755 files/apply_noobs_os_config ${ROOTFS_DIR}/etc/init.d/ install -m 755 files/resize2fs_once ${ROOTFS_DIR}/etc/init.d/ @@ -16,7 +14,7 @@ install -m 644 files/50raspi ${ROOTFS_DIR}/etc/apt/apt.conf.d/ install -m 644 files/console-setup ${ROOTFS_DIR}/etc/default/ - +install -m 755 files/rc.local ${ROOTFS_DIR}/etc/ on_chroot << EOF systemctl disable hwclock.sh @@ -24,9 +22,28 @@ systemctl disable nfs-common systemctl disable rpcbind systemctl enable ssh systemctl enable regenerate_ssh_host_keys -systemctl enable apply_noobs_os_config +EOF + +if [ "${USE_QEMU}" = "1" ]; then + echo "enter QEMU mode" + install -m 644 files/90-qemu.rules ${ROOTFS_DIR}/etc/udev/rules.d/ + if [ -e ${ROOTFS_DIR}/etc/ld.so.preload.disabled ]; then + rm ${ROOTFS_DIR}/etc/ld.so.preload.disabled + touch ${ROOTFS_DIR}/etc/ld.so.preload.disabled + fi + if [ -e ${ROOTFS_DIR}/etc/ld.so.preload ]; then + rm ${ROOTFS_DIR}/etc/ld.so.preload + touch ${ROOTFS_DIR}/etc/ld.so.preload + fi + on_chroot << EOF +systemctl disable resize2fs_once +EOF + echo "leaving QEMU mode" +else + on_chroot << EOF systemctl enable resize2fs_once EOF +fi on_chroot << \EOF for GRP in input spi i2c gpio; do diff --git a/stage2/01-sys-tweaks/files/90-qemu.rules b/stage2/01-sys-tweaks/files/90-qemu.rules new file mode 100644 index 0000000..cfe8998 --- /dev/null +++ b/stage2/01-sys-tweaks/files/90-qemu.rules @@ -0,0 +1,3 @@ +KERNEL=="sda", SYMLINK+="mmcblk0" +KERNEL=="sda?", SYMLINK+="mmcblk0p%n" +KERNEL=="sda2", SYMLINK+="root" diff --git a/stage2/01-sys-tweaks/files/apply_noobs_os_config b/stage2/01-sys-tweaks/files/apply_noobs_os_config deleted file mode 100644 index c9afe7d..0000000 --- a/stage2/01-sys-tweaks/files/apply_noobs_os_config +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/sh -### BEGIN INIT INFO -# Provides: apply_noobs_os_config -# Required-Start: -# Required-Stop: -# Default-Start: 2 -# Default-Stop: -# Short-Description: Apply config from /boot/os_config.json -# Description: -### END INIT INFO - -. /lib/lsb/init-functions - -set -e - -case "$1" in - start) - log_daemon_msg "Applying config from /boot/os_config.json (if it exists)" - if raspi-config --apply-os-config; then - update-rc.d apply_noobs_os_config remove - rm /etc/init.d/apply_noobs_os_config - log_end_msg 0 - else - log_end_msg 1 - fi - ;; - *) - echo "Usage: $0 start" >&2 - exit 3 - ;; -esac diff --git a/stage2/01-sys-tweaks/files/rc.local b/stage2/01-sys-tweaks/files/rc.local new file mode 100755 index 0000000..7d39ed7 --- /dev/null +++ b/stage2/01-sys-tweaks/files/rc.local @@ -0,0 +1,20 @@ +#!/bin/sh -e +# +# rc.local +# +# This script is executed at the end of each multiuser runlevel. +# Make sure that the script will "exit 0" on success or any other +# value on error. +# +# In order to enable or disable this script just change the execution +# bits. +# +# By default this script does nothing. + +# Print the IP address +_IP=$(hostname -I) || true +if [ "$_IP" ]; then + printf "My IP address is %s\n" "$_IP" +fi + +exit 0 diff --git a/stage2/01-sys-tweaks/files/regenerate_ssh_host_keys.service b/stage2/01-sys-tweaks/files/regenerate_ssh_host_keys.service deleted file mode 100644 index a2d1571..0000000 --- a/stage2/01-sys-tweaks/files/regenerate_ssh_host_keys.service +++ /dev/null @@ -1,11 +0,0 @@ -[Unit] -Description=Regenerate SSH host keys - -[Service] -Type=oneshot -ExecStartPre=/bin/sh -c "if [ -e /dev/hwrng ]; then dd if=/dev/hwrng of=/dev/urandom count=1 bs=4096; fi" -ExecStart=/usr/bin/ssh-keygen -A -ExecStartPost=/bin/rm /lib/systemd/system/regenerate_ssh_host_keys.service ; /usr/sbin/update-rc.d regenerate_ssh_host_keys remove - -[Install] -WantedBy=multi-user.target diff --git a/stage2/02-net-tweaks/00-packages b/stage2/02-net-tweaks/00-packages index 0c1ff68..cc4a68e 100644 --- a/stage2/02-net-tweaks/00-packages +++ b/stage2/02-net-tweaks/00-packages @@ -1,3 +1,4 @@ -wpasupplicant wireless-tools firmware-atheros firmware-brcm80211 firmware-libertas firmware-ralink firmware-realtek +wpasupplicant wireless-tools firmware-atheros firmware-brcm80211 firmware-libertas firmware-misc-nonfree firmware-realtek raspberrypi-net-mods dhcpcd5 +net-tools diff --git a/stage2/02-net-tweaks/files/wait.conf b/stage2/02-net-tweaks/files/wait.conf index 30aa48c..595cc2d 100644 --- a/stage2/02-net-tweaks/files/wait.conf +++ b/stage2/02-net-tweaks/files/wait.conf @@ -1,3 +1,3 @@ [Service] ExecStart= -ExecStart=/sbin/dhcpcd -q -w +ExecStart=/usr/lib/dhcpcd5/dhcpcd -q -w diff --git a/stage2/EXPORT_IMAGE b/stage2/EXPORT_IMAGE index 8ef6ebe..aa8f936 100644 --- a/stage2/EXPORT_IMAGE +++ b/stage2/EXPORT_IMAGE @@ -1 +1,4 @@ IMG_SUFFIX="-lite" +if [ "${USE_QEMU}" = "1" ]; then + export IMG_SUFFIX="${IMG_SUFFIX}-qemu" +fi diff --git a/stage2/EXPORT_NOOBS b/stage2/EXPORT_NOOBS index cc925cd..b741334 100644 --- a/stage2/EXPORT_NOOBS +++ b/stage2/EXPORT_NOOBS @@ -1,2 +1,2 @@ NOOBS_NAME="Raspbian Lite" -NOOBS_DESCRIPTION="A port of Debian jessie for the Raspberry Pi (minimal version)" +NOOBS_DESCRIPTION="A port of Debian Stretch for the Raspberry Pi (minimal version)" diff --git a/stage2/prerun.sh b/stage2/prerun.sh index a5ea5f4..ebb5d35 100755 --- a/stage2/prerun.sh +++ b/stage2/prerun.sh @@ -1,4 +1,5 @@ #!/bin/bash -e + if [ ! -d ${ROOTFS_DIR} ]; then copy_previous fi diff --git a/stage3/00-install-packages/00-packages b/stage3/00-install-packages/00-packages new file mode 100644 index 0000000..9e4d84c --- /dev/null +++ b/stage3/00-install-packages/00-packages @@ -0,0 +1,13 @@ +gstreamer1.0-x gstreamer1.0-omx gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-alsa gstreamer1.0-libav +xpdf gtk2-engines alsa-utils +desktop-base +git +omxplayer +raspberrypi-artwork +policykit-1 +gvfs +rfkill +chromium-browser rpi-chromium-mods +gldriver-test +fonts-droid-fallback +fonts-liberation2 diff --git a/stage3/00-install-packages/01-run.sh b/stage3/00-install-packages/01-run.sh new file mode 100755 index 0000000..d768747 --- /dev/null +++ b/stage3/00-install-packages/01-run.sh @@ -0,0 +1,8 @@ +#!/bin/bash -e + +on_chroot << EOF +update-alternatives --install /usr/bin/x-www-browser \ + x-www-browser /usr/bin/chromium-browser 86 +update-alternatives --install /usr/bin/gnome-www-browser \ + gnome-www-browser /usr/bin/chromium-browser 86 +EOF diff --git a/stage3/prerun.sh b/stage3/prerun.sh new file mode 100755 index 0000000..ebb5d35 --- /dev/null +++ b/stage3/prerun.sh @@ -0,0 +1,5 @@ +#!/bin/bash -e + +if [ ! -d ${ROOTFS_DIR} ]; then + copy_previous +fi diff --git a/stage4/00-install-packages/00-packages b/stage4/00-install-packages/00-packages new file mode 100644 index 0000000..d3f40ef --- /dev/null +++ b/stage4/00-install-packages/00-packages @@ -0,0 +1,34 @@ +java-common oracle-java8-jdk +libreoffice-sdbc-hsqldb +sonic-pi +python idle python3-pygame python-pygame python-tk +python3 idle3 python3-tk +python3-pgzero +python-serial python3-serial +python-picamera python3-picamera +debian-reference-en dillo x2x +raspberrypi-net-mods raspberrypi-ui-mods +smartsim +python-pip python3-pip +python3-numpy +pypy +minecraft-pi python-minecraftpi +alacarte rc-gui sense-hat +claws-mail +tree +scratch nuscratch +greenfoot bluej +nodered +libgl1-mesa-dri libgles1-mesa libgles2-mesa xcompmgr +geany +piclone +wiringpi pigpio python-pigpio python3-pigpio raspi-gpio python-gpiozero python3-gpiozero python3-rpi.gpio +python-spidev python3-spidev +python-twython python3-twython +python-smbus python3-smbus +python-flask python3-flask +python-picraft python3-picraft +python-sense-emu python3-sense-emu sense-emu-tools python-sense-emu-doc +pprompt +scratch2 +python3-thonny diff --git a/stage4/EXPORT_IMAGE b/stage4/EXPORT_IMAGE new file mode 100644 index 0000000..1f1bd4f --- /dev/null +++ b/stage4/EXPORT_IMAGE @@ -0,0 +1,4 @@ +IMG_SUFFIX="-4GB" +if [ "${USE_QEMU}" = "1" ]; then + export IMG_SUFFIX="${IMG_SUFFIX}-qemu" +fi diff --git a/stage4/prerun.sh b/stage4/prerun.sh new file mode 100755 index 0000000..ebb5d35 --- /dev/null +++ b/stage4/prerun.sh @@ -0,0 +1,5 @@ +#!/bin/bash -e + +if [ ! -d ${ROOTFS_DIR} ]; then + copy_previous +fi diff --git a/stage5/EXPORT_IMAGE b/stage5/EXPORT_IMAGE new file mode 100644 index 0000000..79ec11a --- /dev/null +++ b/stage5/EXPORT_IMAGE @@ -0,0 +1,4 @@ +IMG_SUFFIX="" +if [ "${USE_QEMU}" = "1" ]; then + export IMG_SUFFIX="${IMG_SUFFIX}-qemu" +fi diff --git a/stage5/EXPORT_NOOBS b/stage5/EXPORT_NOOBS new file mode 100644 index 0000000..4823501 --- /dev/null +++ b/stage5/EXPORT_NOOBS @@ -0,0 +1,2 @@ +NOOBS_NAME="Raspbian" +NOOBS_DESCRIPTION="A port of Debian Stretch for the Raspberry Pi (full desktop version)" diff --git a/stage5/prerun.sh b/stage5/prerun.sh new file mode 100755 index 0000000..ebb5d35 --- /dev/null +++ b/stage5/prerun.sh @@ -0,0 +1,5 @@ +#!/bin/bash -e + +if [ ! -d ${ROOTFS_DIR} ]; then + copy_previous +fi