-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig-phase
More file actions
executable file
·30 lines (24 loc) · 1.02 KB
/
config-phase
File metadata and controls
executable file
·30 lines (24 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/bash
if [ "$SDMNSPAWN" = "Phase0" ]; then
echo "Added ssh keys to authorized_keys"
SSH_DIR=$(grep '^custom2:' $SDMPT/etc/sdm/cparams | cut -d: -f2- | sed 's/"//g')
mkdir -p $SDMPT/home/robotino/.ssh
cat $SSH_DIR/*.pub >> $SDMPT/home/robotino/.ssh/authorized_keys
chmod 700 $SDMPT/home/robotino/.ssh
exit 0
fi
IP=$(grep '^custom1:' /etc/sdm/cparams | cut -d: -f2- | sed 's/"//g')
cat <<EOF > "/boot/firmware/cmdline.txt"
selinux=0 dwc_otg.lpm_enable=0 console=tty1 rootwait rw nfsroot=$IP:/rpi/root ip=dhcp dns=8.8.8.8 root=/dev/nfs systemd.log_level=info systemd.log_target=console systemd.debug-shell=1
EOF
echo "Writing custom fstab..."
cat <<EOF > "${SDM_ROOTFS}/etc/fstab"
proc /proc proc defaults 0 0
$IP:/rpi/root / nfs defaults,noatime 0 1
$IP:/home/robotino/rasputino/object-detection /home/robotino/object-detection nfs defaults,noatime 0 1
EOF
cat << EOF >> "/home/robotino/.bashrc"
if [ -f ~/venv/bin/activate ]; then
source ~/venv/bin/activate
fi
EOF