freebsd-dev/share/examples/diskless/HT.DISKLESS/rc.local

78 lines
1.5 KiB
Plaintext
Raw Normal View History

#!/bin/sh
if [ -f /etc/rc.conf ]; then
. /etc/rc.conf
fi
# Firewall helper - if we configure the firewall to let through
# ports > 4000, we need to configure the machines as such.
#
sysctl -w net.inet.ip.portrange.first=4000
# Setup spool
#
cat >> /var/spool/lpd/ljet4.ps << EOF
#!/bin/sh
#
gs -q -dSAFER -dNOPAUSE -sDEVICE=ljet4 -r600x600 -dBitsPerPixel=1 \
-sOutputFile=- -
EOF
chmod 755 /var/spool/lpd/ljet4.ps
mkdir /var/spool/ljet4
chown daemon /var/spool/ljet4
# Setup remote source
#
mount_mfs -s 600000 -T qp120at dummy /src
mount apollo:/FreeBSD /FreeBSD
mkdir /src/u3
mkdir /src/u3/usr.obj
# Copy of ssh_host_key* files to where sshd
# expects them, assuming you add to /usr/local/etc/sshd_config:
#
# HostKey /var/db/ssh_host_key
#
# Then restart sshd ( the /usr/local/etc/rc.d script installed by
# the port probably failed due to the lack of host keys )
if [ -f /conf/ME/ssh_host_key ]; then
cp /conf/ME/ssh_host_key* /var/db
else
(cd /var/db; ssh-keygen -f ssh_host_key -P "")
fi
chmod 400 /var/db/ssh_host_key
chmod 644 /var/db/ssh_host_key.pub
/usr/local/sbin/sshd
# Copy home directory so you can login
#
#
mount_mfs -s 65536 -T qp120at dummy /home
if [ -d /home.diskless ]; then
cd /home.diskless
for i in *; do
if [ -f $i/home.tgz ]; then
mkdir /home/$i
chown $i /home/$i
chmod 700 /home/$i
(cd /home/$i; tar xzpf /home.diskless/$i/home.tgz)
homeok=1
fi
done
fi
if [ "${homeok:=0}" = "0" ]; then
echo "ERROR, NO /home.diskless DIRECTORY TO COPY TO /HOME"
sleep 10
fi