rpi(most): enable enable-ssh service, and wpa_supplicant copying as well as copy the correct .bashrc into /root

This commit is contained in:
Steev Klimaszewski
2018-07-12 06:05:39 -05:00
parent c6577ab1cd
commit 22d27f4ddc
5 changed files with 195 additions and 2 deletions

View File

@@ -147,6 +147,38 @@ WantedBy=multi-user.target
EOF
chmod 644 kali-${architecture}/lib/systemd/system/rpiwiggle.service
cat << EOF > "${basedir}"/kali-${architecture}/lib/systemd/system/enable-ssh.service
[Unit]
Description=Turn on SSH if /boot/ssh is present
ConditionPathExistsGlob=/boot/ssh{,.txt}
After=regenerate_ssh_host_keys.service
[Service]
Type=oneshot
ExecStart=/bin/sh -c "update-rc.d ssh enable && invoke-rc.d ssh start && rm -f /boot/ssh ; rm -f /boot/ssh.txt"
[Install]
WantedBy=multi-user.target
EOF
chmod 644 "${basedir}"/kali-${architecture}/lib/systemd/system/enable-ssh.service
cat << EOF > "${basedir}"/kali-${architecture}/lib/systemd/system/copy-user-wpasupplicant.service
[Unit]
Description=Copy user wpa_supplicant.conf
ConditionPathExists=/boot/wpa_supplicant.conf
Before=dhcpcd.service
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/bin/mv /boot/wpa_supplicant.conf /etc/wpa_supplicant/wpa_supplicant.conf
ExecStartPost=/bin/chmod 600 /etc/wpa_supplicant/wpa_supplicant.conf
[Install]
WantedBy=multi-user.target
EOF
chmod 644 "${basedir}"/kali-${architecture}/lib/systemd/system/copy-user-wpasupplicant.service
cat << EOF > kali-${architecture}/third-stage
#!/bin/bash
set -e
@@ -184,6 +216,15 @@ systemctl enable rpiwiggle
systemctl enable regenerate_ssh_host_keys
systemctl enable ssh
# Enable copying of user wpa_supplicant.conf file
systemctl enable copy-user-wpasupplicant
# Enable... enabling ssh by putting ssh or ssh.txt file in /boot
systemctl enable enable-ssh
# Copy over the default bashrc
cp /etc/skel/.bashrc /root/.bashrc
# Fix startup time from 5 minutes to 15 secs on raise interface wlan0
sed -i 's/^TimeoutStartSec=5min/TimeoutStartSec=15/g' "/lib/systemd/system/networking.service"

41
rpi.sh
View File

@@ -141,6 +141,38 @@ WantedBy=multi-user.target
EOF
chmod 644 kali-${architecture}/lib/systemd/system/rpiwiggle.service
cat << EOF > "${basedir}"/kali-${architecture}/lib/systemd/system/enable-ssh.service
[Unit]
Description=Turn on SSH if /boot/ssh is present
ConditionPathExistsGlob=/boot/ssh{,.txt}
After=regenerate_ssh_host_keys.service
[Service]
Type=oneshot
ExecStart=/bin/sh -c "update-rc.d ssh enable && invoke-rc.d ssh start && rm -f /boot/ssh ; rm -f /boot/ssh.txt"
[Install]
WantedBy=multi-user.target
EOF
chmod 644 "${basedir}"/kali-${architecture}/lib/systemd/system/enable-ssh.service
cat << EOF > "${basedir}"/kali-${architecture}/lib/systemd/system/copy-user-wpasupplicant.service
[Unit]
Description=Copy user wpa_supplicant.conf
ConditionPathExists=/boot/wpa_supplicant.conf
Before=dhcpcd.service
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/bin/mv /boot/wpa_supplicant.conf /etc/wpa_supplicant/wpa_supplicant.conf
ExecStartPost=/bin/chmod 600 /etc/wpa_supplicant/wpa_supplicant.conf
[Install]
WantedBy=multi-user.target
EOF
chmod 644 "${basedir}"/kali-${architecture}/lib/systemd/system/copy-user-wpasupplicant.service
cat << EOF > kali-${architecture}/third-stage
#!/bin/bash
set -e
@@ -177,6 +209,15 @@ systemctl enable rpiwiggle
systemctl enable regenerate_ssh_host_keys
systemctl enable ssh
# Enable copying of user wpa_supplicant.conf file
systemctl enable copy-user-wpasupplicant
# Enable... enabling ssh by putting ssh or ssh.txt file in /boot
systemctl enable enable-ssh
# Copy over the default bashrc
cp /etc/skel/.bashrc /root/.bashrc
# Fix startup time from 5 minutes to 15 secs on raise interface wlan0
sed -i 's/^TimeoutStartSec=5min/TimeoutStartSec=15/g' "/lib/systemd/system/networking.service"

View File

@@ -169,6 +169,38 @@ WantedBy=multi-user.target
EOF
chmod 644 kali-${architecture}/lib/systemd/system/rpiwiggle.service
cat << EOF > "${basedir}"/kali-${architecture}/lib/systemd/system/enable-ssh.service
[Unit]
Description=Turn on SSH if /boot/ssh is present
ConditionPathExistsGlob=/boot/ssh{,.txt}
After=regenerate_ssh_host_keys.service
[Service]
Type=oneshot
ExecStart=/bin/sh -c "update-rc.d ssh enable && invoke-rc.d ssh start && rm -f /boot/ssh ; rm -f /boot/ssh.txt"
[Install]
WantedBy=multi-user.target
EOF
chmod 644 "${basedir}"/kali-${architecture}/lib/systemd/system/enable-ssh.service
cat << EOF > "${basedir}"/kali-${architecture}/lib/systemd/system/copy-user-wpasupplicant.service
[Unit]
Description=Copy user wpa_supplicant.conf
ConditionPathExists=/boot/wpa_supplicant.conf
Before=dhcpcd.service
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/bin/mv /boot/wpa_supplicant.conf /etc/wpa_supplicant/wpa_supplicant.conf
ExecStartPost=/bin/chmod 600 /etc/wpa_supplicant/wpa_supplicant.conf
[Install]
WantedBy=multi-user.target
EOF
chmod 644 "${basedir}"/kali-${architecture}/lib/systemd/system/copy-user-wpasupplicant.service
# Bluetooth enabling
mkdir -p kali-${architecture}/etc/udev/rules.d
cp "${basedir}"/../misc/pi-bluetooth/99-com.rules kali-${architecture}/etc/udev/rules.d/99-com.rules
@@ -255,7 +287,7 @@ echo "dmesg -D" > /etc/rc.local
echo "exit 0" >> /etc/rc.local
# Copy bashrc
cp /etc/bash.bashrc /root/.bashrc
cp /etc/skel/.bashrc /root/.bashrc
# libinput seems to fail hard on RaspberryPi devices, so we make sure it's not
# installed here (and we have xserver-xorg-input-evdev and

View File

@@ -166,6 +166,38 @@ WantedBy=multi-user.target
EOF
chmod 644 kali-${architecture}/lib/systemd/system/rpiwiggle.service
cat << EOF > "${basedir}"/kali-${architecture}/lib/systemd/system/enable-ssh.service
[Unit]
Description=Turn on SSH if /boot/ssh is present
ConditionPathExistsGlob=/boot/ssh{,.txt}
After=regenerate_ssh_host_keys.service
[Service]
Type=oneshot
ExecStart=/bin/sh -c "update-rc.d ssh enable && invoke-rc.d ssh start && rm -f /boot/ssh ; rm -f /boot/ssh.txt"
[Install]
WantedBy=multi-user.target
EOF
chmod 644 "${basedir}"/kali-${architecture}/lib/systemd/system/enable-ssh.service
cat << EOF > "${basedir}"/kali-${architecture}/lib/systemd/system/copy-user-wpasupplicant.service
[Unit]
Description=Copy user wpa_supplicant.conf
ConditionPathExists=/boot/wpa_supplicant.conf
Before=dhcpcd.service
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/bin/mv /boot/wpa_supplicant.conf /etc/wpa_supplicant/wpa_supplicant.conf
ExecStartPost=/bin/chmod 600 /etc/wpa_supplicant/wpa_supplicant.conf
[Install]
WantedBy=multi-user.target
EOF
chmod 644 "${basedir}"/kali-${architecture}/lib/systemd/system/copy-user-wpasupplicant.service
# Bluetooth enabling
mkdir -p kali-${architecture}/etc/udev/rules.d
cp "${basedir}"/../misc/pi-bluetooth/99-com.rules kali-${architecture}/etc/udev/rules.d/99-com.rules
@@ -234,6 +266,12 @@ systemctl enable rpiwiggle
systemctl enable regenerate_ssh_host_keys
systemctl enable ssh
# Enable copying of user wpa_supplicant.conf file
systemctl enable copy-user-wpasupplicant
# Enable... enabling ssh by putting ssh or ssh.txt file in /boot
systemctl enable enable-ssh
# Install and hold pi-bluetooth deb package from re4son
dpkg --force-all -i /root/pi-bluetooth_0.1.4+re4son_all.deb
apt-mark hold pi-bluetooth
@@ -243,7 +281,7 @@ echo "dmesg -D" > /etc/rc.local
echo "exit 0" >> /etc/rc.local
# Copy bashrc
cp /etc/bash.bashrc /root/.bashrc
cp /etc/skel/.bashrc /root/.bashrc
# libinput seems to fail hard on RaspberryPi devices, so we make sure it's not
# installed here (and we have xserver-xorg-input-evdev and

41
rpi2.sh
View File

@@ -144,6 +144,38 @@ WantedBy=multi-user.target
EOF
chmod 644 kali-${architecture}/lib/systemd/system/rpiwiggle.service
cat << EOF > "${basedir}"/kali-${architecture}/lib/systemd/system/enable-ssh.service
[Unit]
Description=Turn on SSH if /boot/ssh is present
ConditionPathExistsGlob=/boot/ssh{,.txt}
After=regenerate_ssh_host_keys.service
[Service]
Type=oneshot
ExecStart=/bin/sh -c "update-rc.d ssh enable && invoke-rc.d ssh start && rm -f /boot/ssh ; rm -f /boot/ssh.txt"
[Install]
WantedBy=multi-user.target
EOF
chmod 644 "${basedir}"/kali-${architecture}/lib/systemd/system/enable-ssh.service
cat << EOF > "${basedir}"/kali-${architecture}/lib/systemd/system/copy-user-wpasupplicant.service
[Unit]
Description=Copy user wpa_supplicant.conf
ConditionPathExists=/boot/wpa_supplicant.conf
Before=dhcpcd.service
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/bin/mv /boot/wpa_supplicant.conf /etc/wpa_supplicant/wpa_supplicant.conf
ExecStartPost=/bin/chmod 600 /etc/wpa_supplicant/wpa_supplicant.conf
[Install]
WantedBy=multi-user.target
EOF
chmod 644 "${basedir}"/kali-${architecture}/lib/systemd/system/copy-user-wpasupplicant.service
# Let's try out binky's package for the rpi kernel and headers.
wget https://github.com/nethunteros/rpi-kernel/releases/download/v4.14.30-re4son/raspberrypi-kernel_20180704-223830_armhf.deb -O "${basedir}"/kali-${architecture}/root/raspberrypi-kernel_20180704-223830_armhf.deb
wget https://github.com/nethunteros/rpi-kernel/releases/download/v4.14.30-re4son/raspberrypi-kernel-headers_20180704-223830_armhf.deb -O "${basedir}"/kali-${architecture}/root/raspberrypi-kernel-headers_20180704-223830_armhf.deb
@@ -187,6 +219,15 @@ systemctl enable rpiwiggle
systemctl enable regenerate_ssh_host_keys
systemctl enable ssh
# Enable copying of user wpa_supplicant.conf file
systemctl enable copy-user-wpasupplicant
# Enable... enabling ssh by putting ssh or ssh.txt file in /boot
systemctl enable enable-ssh
# Copy over the default bashrc
cp /etc/skel/.bashrc /root/.bashrc
# libinput seems to fail hard on RaspberryPi devices, so we make sure it's not
# installed here (and we have xserver-xorg-input-evdev and
# xserver-xorg-input-synaptics packages installed above!)