Add Raspbian stages
This commit is contained in:
3
stage2/00-copies-and-fills/00-run.sh
Executable file
3
stage2/00-copies-and-fills/00-run.sh
Executable file
@@ -0,0 +1,3 @@
|
||||
#!/bin/bash -e
|
||||
|
||||
touch ${ROOTFS_DIR}/spindle_install
|
1
stage2/00-copies-and-fills/01-packages
Normal file
1
stage2/00-copies-and-fills/01-packages
Normal file
@@ -0,0 +1 @@
|
||||
raspi-copies-and-fills
|
3
stage2/00-copies-and-fills/02-run.sh
Executable file
3
stage2/00-copies-and-fills/02-run.sh
Executable file
@@ -0,0 +1,3 @@
|
||||
#!/bin/bash -e
|
||||
|
||||
rm -f ${ROOTFS_DIR}/spindle_install
|
32
stage2/01-sys-tweaks/00-debconf
Normal file
32
stage2/01-sys-tweaks/00-debconf
Normal file
File diff suppressed because one or more lines are too long
15
stage2/01-sys-tweaks/00-packages
Normal file
15
stage2/01-sys-tweaks/00-packages
Normal file
@@ -0,0 +1,15 @@
|
||||
ssh locales less fbset sudo psmisc strace module-init-tools 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
|
||||
avahi-daemon
|
||||
lua5.1
|
||||
luajit
|
||||
hardlink ca-certificates curl
|
||||
fake-hwclock ntp nfs-common usbutils
|
||||
libraspberrypi-dev libraspberrypi-doc libfreetype6-dev
|
||||
dosfstools
|
||||
dphys-swapfile
|
||||
raspberrypi-sys-mods
|
||||
pi-bluetooth
|
||||
apt-listchanges
|
1
stage2/01-sys-tweaks/00-packages-nr
Normal file
1
stage2/01-sys-tweaks/00-packages-nr
Normal file
@@ -0,0 +1 @@
|
||||
cifs-utils
|
10
stage2/01-sys-tweaks/00-patches/00-sudoers.diff
Normal file
10
stage2/01-sys-tweaks/00-patches/00-sudoers.diff
Normal file
@@ -0,0 +1,10 @@
|
||||
Index: jessie-stage2/rootfs/etc/sudoers
|
||||
===================================================================
|
||||
--- jessie-stage2.orig/rootfs/etc/sudoers
|
||||
+++ jessie-stage2/rootfs/etc/sudoers
|
||||
@@ -25,3 +25,5 @@ root ALL=(ALL:ALL) ALL
|
||||
# See sudoers(5) for more information on "#include" directives:
|
||||
|
||||
#includedir /etc/sudoers.d
|
||||
+
|
||||
+pi ALL=(ALL) NOPASSWD: ALL
|
22
stage2/01-sys-tweaks/00-patches/01-useradd.diff
Normal file
22
stage2/01-sys-tweaks/00-patches/01-useradd.diff
Normal file
@@ -0,0 +1,22 @@
|
||||
Index: jessie-stage2/rootfs/etc/default/useradd
|
||||
===================================================================
|
||||
--- jessie-stage2.orig/rootfs/etc/default/useradd
|
||||
+++ jessie-stage2/rootfs/etc/default/useradd
|
||||
@@ -5,7 +5,7 @@
|
||||
# Similar to DHSELL in adduser. However, we use "sh" here because
|
||||
# useradd is a low level utility and should be as general
|
||||
# as possible
|
||||
-SHELL=/bin/sh
|
||||
+SHELL=/bin/bash
|
||||
#
|
||||
# The default group for users
|
||||
# 100=users on Debian systems
|
||||
@@ -29,7 +29,7 @@ SHELL=/bin/sh
|
||||
# The SKEL variable specifies the directory containing "skeletal" user
|
||||
# files; in other words, files such as a sample .profile that will be
|
||||
# copied to the new user's home directory when it is created.
|
||||
-# SKEL=/etc/skel
|
||||
+SKEL=/etc/skel
|
||||
#
|
||||
# Defines whether the mail spool should be created while
|
||||
# creating the account
|
13
stage2/01-sys-tweaks/00-patches/02-swap.diff
Normal file
13
stage2/01-sys-tweaks/00-patches/02-swap.diff
Normal file
@@ -0,0 +1,13 @@
|
||||
Index: jessie-stage2/rootfs/etc/dphys-swapfile
|
||||
===================================================================
|
||||
--- jessie-stage2.orig/rootfs/etc/dphys-swapfile
|
||||
+++ jessie-stage2/rootfs/etc/dphys-swapfile
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
# set size to absolute value, leaving empty (default) then uses computed value
|
||||
# you most likely don't want this, unless you have an special disk situation
|
||||
-#CONF_SWAPSIZE=
|
||||
+CONF_SWAPSIZE=100
|
||||
|
||||
# set size to computed value, this times RAM size, dynamically adapts,
|
||||
# guarantees that there is enough swap without wasting disk space on excess
|
17
stage2/01-sys-tweaks/00-patches/03-console-setup.diff
Normal file
17
stage2/01-sys-tweaks/00-patches/03-console-setup.diff
Normal file
@@ -0,0 +1,17 @@
|
||||
Index: jessie-stage2/rootfs/etc/default/console-setup
|
||||
===================================================================
|
||||
--- jessie-stage2.orig/rootfs/etc/default/console-setup
|
||||
+++ jessie-stage2/rootfs/etc/default/console-setup
|
||||
@@ -6,9 +6,9 @@ ACTIVE_CONSOLES="/dev/tty[1-6]"
|
||||
|
||||
CHARMAP="UTF-8"
|
||||
|
||||
-CODESET="Lat15"
|
||||
-FONTFACE="Fixed"
|
||||
-FONTSIZE="8x16"
|
||||
+CODESET="guess"
|
||||
+FONTFACE=""
|
||||
+FONTSIZE=""
|
||||
|
||||
VIDEOMODE=
|
||||
|
12
stage2/01-sys-tweaks/00-patches/04-inputrc.diff
Normal file
12
stage2/01-sys-tweaks/00-patches/04-inputrc.diff
Normal file
@@ -0,0 +1,12 @@
|
||||
Index: jessie-stage2/rootfs/etc/inputrc
|
||||
===================================================================
|
||||
--- jessie-stage2.orig/rootfs/etc/inputrc
|
||||
+++ jessie-stage2/rootfs/etc/inputrc
|
||||
@@ -65,3 +65,7 @@ $endif
|
||||
# "\e[F": end-of-line
|
||||
|
||||
$endif
|
||||
+
|
||||
+# mappings for up and down arrows search history
|
||||
+# "\e[B": history-search-forward
|
||||
+# "\e[A": history-search-backward
|
26
stage2/01-sys-tweaks/00-patches/05-path.diff
Normal file
26
stage2/01-sys-tweaks/00-patches/05-path.diff
Normal file
@@ -0,0 +1,26 @@
|
||||
Index: jessie-stage2/rootfs/etc/login.defs
|
||||
===================================================================
|
||||
--- jessie-stage2.orig/rootfs/etc/login.defs
|
||||
+++ jessie-stage2/rootfs/etc/login.defs
|
||||
@@ -100,7 +100,7 @@ HUSHLOGIN_FILE .hushlogin
|
||||
#
|
||||
# (they are minimal, add the rest in the shell startup files)
|
||||
ENV_SUPATH PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
|
||||
-ENV_PATH PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
|
||||
+ENV_PATH PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games
|
||||
|
||||
#
|
||||
# Terminal permissions
|
||||
Index: jessie-stage2/rootfs/etc/profile
|
||||
===================================================================
|
||||
--- jessie-stage2.orig/rootfs/etc/profile
|
||||
+++ jessie-stage2/rootfs/etc/profile
|
||||
@@ -4,7 +4,7 @@
|
||||
if [ "`id -u`" -eq 0 ]; then
|
||||
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
|
||||
else
|
||||
- PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games"
|
||||
+ PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games"
|
||||
fi
|
||||
export PATH
|
||||
|
15
stage2/01-sys-tweaks/00-patches/06-rc_local.diff
Normal file
15
stage2/01-sys-tweaks/00-patches/06-rc_local.diff
Normal file
@@ -0,0 +1,15 @@
|
||||
Index: jessie-stage2/rootfs/etc/rc.local
|
||||
===================================================================
|
||||
--- jessie-stage2.orig/rootfs/etc/rc.local
|
||||
+++ jessie-stage2/rootfs/etc/rc.local
|
||||
@@ -11,4 +11,10 @@
|
||||
#
|
||||
# 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
|
5
stage2/01-sys-tweaks/00-patches/07-resize-init.diff
Normal file
5
stage2/01-sys-tweaks/00-patches/07-resize-init.diff
Normal file
@@ -0,0 +1,5 @@
|
||||
--- a/rootfs/boot/cmdline.txt
|
||||
+++ b/rootfs/boot/cmdline.txt
|
||||
@@ -1 +1 @@
|
||||
-dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait
|
||||
+dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait quiet init=/usr/lib/raspi-config/init_resize.sh
|
8
stage2/01-sys-tweaks/00-patches/series
Normal file
8
stage2/01-sys-tweaks/00-patches/series
Normal file
@@ -0,0 +1,8 @@
|
||||
00-sudoers.diff
|
||||
01-useradd.diff
|
||||
02-swap.diff
|
||||
03-console-setup.diff
|
||||
04-inputrc.diff
|
||||
05-path.diff
|
||||
06-rc_local.diff
|
||||
07-resize-init.diff
|
41
stage2/01-sys-tweaks/01-run.sh
Executable file
41
stage2/01-sys-tweaks/01-run.sh
Executable file
@@ -0,0 +1,41 @@
|
||||
#!/bin/bash -e
|
||||
|
||||
install -m 755 files/regenerate_ssh_host_keys ${ROOTFS_DIR}/etc/init.d/
|
||||
install -m 755 files/apply_noobs_os_config ${ROOTFS_DIR}/etc/init.d/
|
||||
install -m 755 files/resize2fs_once ${ROOTFS_DIR}/etc/init.d/
|
||||
|
||||
install -d ${ROOTFS_DIR}/etc/systemd/system/rc-local.service.d
|
||||
install -m 644 files/ttyoutput.conf ${ROOTFS_DIR}/etc/systemd/system/rc-local.service.d/
|
||||
|
||||
install -m 644 files/50raspi ${ROOTFS_DIR}/etc/apt/apt.conf.d/
|
||||
install -m 644 files/98-rpi.conf ${ROOTFS_DIR}/etc/sysctl.d/
|
||||
|
||||
|
||||
on_chroot sh -e - <<EOF
|
||||
systemctl disable hwclock.sh
|
||||
systemctl disable nfs-common
|
||||
systemctl disable rpcbind
|
||||
systemctl disable ssh
|
||||
systemctl enable regenerate_ssh_host_keys
|
||||
systemctl enable apply_noobs_os_config
|
||||
systemctl enable resize2fs_once
|
||||
EOF
|
||||
|
||||
on_chroot sh -e - << \EOF
|
||||
for GRP in input spi i2c gpio; do
|
||||
groupadd -f -r $GRP
|
||||
done
|
||||
for GRP in adm dialout cdrom audio users sudo video games plugdev input gpio spi i2c netdev; do
|
||||
adduser pi $GRP
|
||||
done
|
||||
EOF
|
||||
|
||||
on_chroot sh -e - <<EOF
|
||||
setupcon --force --save-only -v
|
||||
EOF
|
||||
|
||||
on_chroot sh -e - <<EOF
|
||||
usermod --pass='*' root
|
||||
EOF
|
||||
|
||||
rm -f ${ROOTFS_DIR}/etc/ssh/ssh_host_*_key*
|
5
stage2/01-sys-tweaks/files/50raspi
Normal file
5
stage2/01-sys-tweaks/files/50raspi
Normal file
@@ -0,0 +1,5 @@
|
||||
# never use pdiffs. Current implementation is very slow on low-powered devices
|
||||
Acquire::PDiffs "0";
|
||||
|
||||
# download up to 5 pdiffs:
|
||||
#Acquire::PDiffs::FileLimit "5";
|
3
stage2/01-sys-tweaks/files/98-rpi.conf
Normal file
3
stage2/01-sys-tweaks/files/98-rpi.conf
Normal file
@@ -0,0 +1,3 @@
|
||||
kernel.printk = 3 4 1 3
|
||||
vm.swappiness=1
|
||||
vm.min_free_kbytes = 8192
|
31
stage2/01-sys-tweaks/files/apply_noobs_os_config
Normal file
31
stage2/01-sys-tweaks/files/apply_noobs_os_config
Normal file
@@ -0,0 +1,31 @@
|
||||
#!/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
|
36
stage2/01-sys-tweaks/files/regenerate_ssh_host_keys
Normal file
36
stage2/01-sys-tweaks/files/regenerate_ssh_host_keys
Normal file
@@ -0,0 +1,36 @@
|
||||
#!/bin/sh
|
||||
### BEGIN INIT INFO
|
||||
# Provides: regenerate_ssh_host_keys
|
||||
# Required-Start:
|
||||
# Required-Stop:
|
||||
# Default-Start: 2
|
||||
# Default-Stop:
|
||||
# Short-Description: Regenerate ssh host keys
|
||||
# Description:
|
||||
### END INIT INFO
|
||||
|
||||
. /lib/lsb/init-functions
|
||||
|
||||
set -e
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
log_daemon_msg "Regenerating ssh host keys (in background)"
|
||||
nohup sh -c "if [ -e /dev/hwrng ]; then
|
||||
dd if=/dev/hwrng of=/dev/urandom count=1 bs=4096
|
||||
fi; \
|
||||
yes | ssh-keygen -q -N '' -t dsa -f /etc/ssh/ssh_host_dsa_key && \
|
||||
yes | ssh-keygen -q -N '' -t rsa -f /etc/ssh/ssh_host_rsa_key && \
|
||||
yes | ssh-keygen -q -N '' -t ecdsa -f /etc/ssh/ssh_host_ecdsa_key && \
|
||||
yes | ssh-keygen -q -N '' -t ed25519 -f /etc/ssh/ssh_host_ed25519_key && \
|
||||
systemctl enable ssh && sync && \
|
||||
rm /etc/init.d/regenerate_ssh_host_keys && \
|
||||
update-rc.d regenerate_ssh_host_keys remove && \
|
||||
printf '\nfinished\n' && systemctl start ssh" > /var/log/regen_ssh_keys.log 2>&1 &
|
||||
log_end_msg $?
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 start" >&2
|
||||
exit 3
|
||||
;;
|
||||
esac
|
25
stage2/01-sys-tweaks/files/resize2fs_once
Normal file
25
stage2/01-sys-tweaks/files/resize2fs_once
Normal file
@@ -0,0 +1,25 @@
|
||||
#!/bin/sh
|
||||
### BEGIN INIT INFO
|
||||
# Provides: resize2fs_once
|
||||
# Required-Start:
|
||||
# Required-Stop:
|
||||
# Default-Start: 3
|
||||
# Default-Stop:
|
||||
# Short-Description: Resize the root filesystem to fill partition
|
||||
# Description:
|
||||
### END INIT INFO
|
||||
. /lib/lsb/init-functions
|
||||
case "$1" in
|
||||
start)
|
||||
log_daemon_msg "Starting resize2fs_once"
|
||||
ROOT_DEV=`grep -Eo 'root=[[:graph:]]+' /proc/cmdline | cut -d '=' -f 2-` &&
|
||||
resize2fs $ROOT_DEV &&
|
||||
update-rc.d resize2fs_once remove &&
|
||||
rm /etc/init.d/resize2fs_once &&
|
||||
log_end_msg $?
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 start" >&2
|
||||
exit 3
|
||||
;;
|
||||
esac
|
2
stage2/01-sys-tweaks/files/ttyoutput.conf
Normal file
2
stage2/01-sys-tweaks/files/ttyoutput.conf
Normal file
@@ -0,0 +1,2 @@
|
||||
[Service]
|
||||
StandardOutput=tty
|
2
stage2/02-net-tweaks/00-packages
Normal file
2
stage2/02-net-tweaks/00-packages
Normal file
@@ -0,0 +1,2 @@
|
||||
wpasupplicant wireless-tools firmware-atheros firmware-brcm80211 firmware-libertas firmware-ralink firmware-realtek
|
||||
dhcpcd5
|
27
stage2/02-net-tweaks/00-patches/00-interfaces.diff
Normal file
27
stage2/02-net-tweaks/00-patches/00-interfaces.diff
Normal file
@@ -0,0 +1,27 @@
|
||||
Index: jessie-stage2/rootfs/etc/network/interfaces
|
||||
===================================================================
|
||||
--- jessie-stage2.orig/rootfs/etc/network/interfaces
|
||||
+++ jessie-stage2/rootfs/etc/network/interfaces
|
||||
@@ -1,4 +1,20 @@
|
||||
-auto lo
|
||||
+# interfaces(5) file used by ifup(8) and ifdown(8)
|
||||
+
|
||||
+# Please note that this file is written to be used with dhcpcd
|
||||
+# For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'
|
||||
|
||||
+# Include files from /etc/network/interfaces.d:
|
||||
+source-directory /etc/network/interfaces.d
|
||||
+
|
||||
+auto lo
|
||||
iface lo inet loopback
|
||||
-iface eth0 inet dhcp
|
||||
+
|
||||
+iface eth0 inet manual
|
||||
+
|
||||
+allow-hotplug wlan0
|
||||
+iface wlan0 inet manual
|
||||
+ wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
|
||||
+
|
||||
+allow-hotplug wlan1
|
||||
+iface wlan1 inet manual
|
||||
+ wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
|
1
stage2/02-net-tweaks/00-patches/series
Normal file
1
stage2/02-net-tweaks/00-patches/series
Normal file
@@ -0,0 +1 @@
|
||||
00-interfaces.diff
|
8
stage2/02-net-tweaks/01-run.sh
Executable file
8
stage2/02-net-tweaks/01-run.sh
Executable file
@@ -0,0 +1,8 @@
|
||||
#!/bin/bash -e
|
||||
|
||||
install -v -d ${ROOTFS_DIR}/etc/systemd/system/dhcpcd.service.d
|
||||
install -v -m 644 files/wait.conf ${ROOTFS_DIR}/etc/systemd/system/dhcpcd.service.d/
|
||||
|
||||
install -v -d ${ROOTFS_DIR}/etc/wpa_supplicant
|
||||
install -v -m 600 files/wpa_supplicant.conf ${ROOTFS_DIR}/etc/wpa_supplicant/
|
||||
|
3
stage2/02-net-tweaks/files/wait.conf
Normal file
3
stage2/02-net-tweaks/files/wait.conf
Normal file
@@ -0,0 +1,3 @@
|
||||
[Service]
|
||||
ExecStart=
|
||||
ExecStart=/sbin/dhcpcd -q -w
|
3
stage2/02-net-tweaks/files/wpa_supplicant.conf
Normal file
3
stage2/02-net-tweaks/files/wpa_supplicant.conf
Normal file
@@ -0,0 +1,3 @@
|
||||
country=GB
|
||||
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
|
||||
update_config=1
|
5
stage2/03-cleanup/00-run.sh
Executable file
5
stage2/03-cleanup/00-run.sh
Executable file
@@ -0,0 +1,5 @@
|
||||
#!/bin/bash -e
|
||||
|
||||
on_chroot sh -e - <<EOF
|
||||
apt-get clean
|
||||
EOF
|
1
stage2/EXPORT_IMAGE
Normal file
1
stage2/EXPORT_IMAGE
Normal file
@@ -0,0 +1 @@
|
||||
-lite
|
4
stage2/prerun.sh
Executable file
4
stage2/prerun.sh
Executable file
@@ -0,0 +1,4 @@
|
||||
#!/bin/bash -e
|
||||
if [ ! -d ${ROOTFS_DIR} ]; then
|
||||
copy_previous
|
||||
fi
|
Reference in New Issue
Block a user