##// END OF EJS Templates
formating and dropbear fix for static ip
Unknown -
r569:c84998d2e8c2
parent child
Show More
@@ -46,6 +46,20 if [ "$ENABLE_INITRAMFS" = true ] ; then
46 46 install_exec files/initramfs/expand-tools "${ETC_DIR}/initramfs-tools/hooks/expand-tools"
47 47 fi
48 48
49 if [ "$ENABLE_DHCP" = false ] ; then
50 # Get cdir from NET_ADDRESS e.g. 24
51 cdir=$(${NET_ADDRESS} | cut -d '/' -f2)
52
53 # Convert cdir ro netmask e.g. 24 to 255.255.255.0
54 NET_MASK=$(cdr2mask "$cdir")
55
56 # Write static ip settings to "${ETC_DIR}"/initramfs-tools/initramfs.conf
57 sed -i "\$aIP=${NET_ADDRESS}::${NET_GATEWAY}:${NET_MASK}:${HOSTNAME}:" "${ETC_DIR}"/initramfs-tools/initramfs.conf
58
59 # Regenerate initramfs
60 chroot_exec mkinitramfs -o "/boot/firmware/initramfs-${KERNEL_VERSION}" "${KERNEL_VERSION}"
61 fi
62
49 63 if [ "$CRYPTFS_DROPBEAR" = true ]; then
50 64 if [ -n "$CRYPTFS_DROPBEAR_PUBKEY" ] && [ -f "$CRYPTFS_DROPBEAR_PUBKEY" ] ; then
51 65 install_readonly "${CRYPTFS_DROPBEAR_PUBKEY}" "${ETC_DIR}"/dropbear-initramfs/id_rsa.pub
@@ -156,14 +156,13 if [ "$RPI_MODEL" = 0 ] || [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 3P ] ; then
156 156
157 157 # Switch Pi3 Bluetooth function to use the mini-UART (ttyS0) and restore UART0/ttyAMA0 over GPIOs 14 & 15. Slow Bluetooth and slow cpu. Use /dev/ttyS0 instead of /dev/ttyAMA0
158 158 if [ "$ENABLE_MINIUART_OVERLAY" = true ] ; then
159
160 159 # set overlay to swap ttyAMA0 and ttyS0
161 160 echo "dtoverlay=pi3-miniuart-bt" >> "${BOOT_DIR}/config.txt"
162 161
163 # if force_turbo didn't lock cpu at high speed, lock it at low speed (XOR logic) or miniuart will be broken
164 162 if [ "$ENABLE_TURBO" = false ] ; then
165 163 echo "core_freq=250" >> "${BOOT_DIR}/config.txt"
166 164 fi
165
167 166 fi
168 167
169 168 # Activate services
@@ -181,13 +180,17 if [ "$ENABLE_CONSOLE" = true ] ; then
181 180 # add string to cmdline
182 181 CMDLINE="${CMDLINE} console=serial0,115200"
183 182
183 if [ "$RPI_MODEL" = 3 ] || [ "$RPI_MODEL" = 3P ]|| [ "$RPI_MODEL" = 0 ]; then
184 # if force_turbo didn't lock cpu at high speed, lock it at low speed (XOR logic) or miniuart will be broken
185 if [ "$ENABLE_TURBO" = false ] ; then
186 echo "core_freq=250" >> "${BOOT_DIR}/config.txt"
187 fi
188 fi
189
184 190 # Enable serial console systemd style
185 chroot_exec systemctl enable serial-getty\@serial0.service
191 chroot_exec systemctl enable serial-getty@serial0.service
186 192 else
187 193 echo "enable_uart=0" >> "${BOOT_DIR}/config.txt"
188
189 # disable serial console systemd style
190 chroot_exec systemctl disable serial-getty\@"$SET_SERIAL".service
191 194 fi
192 195
193 196 if [ "$ENABLE_SYSTEMDSWAP" = true ] ; then
@@ -200,33 +203,32 if [ "$ENABLE_SYSTEMDSWAP" = true ] ; then
200 203 # Copy downloaded systemd-swap sources
201 204 mv "${temp_dir}/systemd-swap" "${R}/tmp/"
202 205
203 # Set permissions of the systemd-swap sources
204 chown -R root:root "${R}/tmp/systemd-swap"
205
206 # Remove temporary directory for systemd-swap sources
207 rm -fr "${temp_dir}"
208
209 206 # Change into downloaded src dir
210 207 cd "${R}/tmp/systemd-swap" || exit
211 208
212 209 # Build package
213 . ./package.sh debian
210 bash ./package.sh debian
214 211
215 # Install package
216 chroot_exec dpkg -i /tmp/systemd-swap/systemd-swap-*any.deb
212 # Change back into script root dir
213 cd "${WORKDIR}" || exit
214
215 # Set permissions of the systemd-swap sources
216 chown -R root:root "${R}/tmp/systemd-swap"
217
218 # Install package - IMPROVE AND MAKE IT POSSIBLE WITHOUT VERSION NR.
219 chroot_exec dpkg -i /tmp/systemd-swap/systemd-swap_4.0.1_any.deb
217 220
218 221 # Enable service
219 222 chroot_exec systemctl enable systemd-swap
220 223
221 # Change back into script root dir
222 cd "${WORKDIR}" || exit
224 # Remove temporary directory for systemd-swap sources
225 rm -fr "${temp_dir}"
223 226 else
224 227 # Enable ZSWAP in cmdline if systemd-swap is not used
225 228 if [ "$KERNEL_ZSWAP" = true ] ; then
226 229 CMDLINE="${CMDLINE} zswap.enabled=1 zswap.max_pool_percent=25 zswap.compressor=lz4"
227 230 fi
228 231 fi
229
230 232 if [ "$KERNEL_SECURITY" = true ] ; then
231 233 CMDLINE="${CMDLINE} apparmor=1 security=apparmor"
232 234 fi
@@ -57,20 +57,6 else # ENABLE_DHCP=false
57 57 -e "0,/NTP=\$/ s|NTP=\$|NTP=${NET_NTP_1}|"\
58 58 -e "0,/NTP=\$/ s|NTP=\$|NTP=${NET_NTP_2}|"\
59 59 "${ETC_DIR}/systemd/network/eth.network"
60
61 if [ "$CRYPTFS_DROPBEAR" = true ] ; then
62 # Get cdir from NET_ADDRESS e.g. 24
63 cdir=$(${NET_ADDRESS} | cut -d '/' -f2)
64
65 # Convert cdir ro netmask e.g. 24 to 255.255.255.0
66 NET_MASK=$(cdr2mask "$cdir")
67
68 # Write static ip settings to "${ETC_DIR}"/initramfs-tools/initramfs.conf
69 sed -i "\$aIP=${NET_ADDRESS}::${NET_GATEWAY}:${NET_MASK}:${HOSTNAME}:" "${ETC_DIR}"/initramfs-tools/initramfs.conf
70
71 # Regenerate initramfs
72 chroot_exec mkinitramfs -o "/boot/firmware/initramfs-${KERNEL_VERSION}" "${KERNEL_VERSION}"
73 fi
74 60 fi
75 61
76 62 # Remove empty settings from network configuration
1 NO CONTENT: modified file
General Comments 0
Vous devez vous connecter pour laisser un commentaire. Se connecter maintenant