source: hybrid/branches/releng-11/nanobsd/files/usr/local/etc/rc.d/nanobsd-save-sshkeys

Last change on this file was 12925, checked in by huub, 10 years ago

removed rcvar=set_rcvar statement from starup scritps in /usr/local/etc/rc.d

  • Property svn:executable set to *
File size: 880 bytes
Line 
1#!/bin/sh
2#
3# $FreeBSD: ports/net/pen/files/pen.sh.in,v 1.1 2006/09/24 14:34:36 clement Exp $
4#
5
6# PROVIDE: pen
7# REQUIRE: NETWORKING SERVERS sshd
8# KEYWORD: shutdown
9
10#
11# Add the following line to /etc/rc.conf to enable nanobsd-save-sshkeys:
12#
13# nanobsd_save_sshkeys_enable="YES"
14#
15
16. /etc/rc.subr
17
18name=nanobsd_save_sshkeys
19
20nanobsd_save_sshkeys_enable=${nanobsd_save_sshkeys_enable:-"NO"}
21
22start_cmd="save_sshkeys"
23stop_cmd="save_sshkeys"
24
25save_sshkeys() {
26 MOUNTED_RW=0
27 trap "umount /cfg" 1 2 15 EXIT
28 mount -ro noatime /cfg
29 for FILE in /etc/ssh/ssh_host_*; do
30 cmp -s $FILE /cfg/ssh/`basename ${FILE}`
31 if [ $? -ne 0 ]; then
32 if [ ${MOUNTED_RW} -eq 0 ]; then
33 mount -uwo noatime /cfg
34 mkdir -p /cfg/ssh
35 MOUNTED_RW=1
36 fi
37 cp $FILE /cfg/ssh/`basename ${FILE}`
38 fi
39 done
40
41 umount /cfg
42 trap 1 2 15 EXIT
43}
44
45
46load_rc_config $name
47run_rc_command "$1"
48
Note: See TracBrowser for help on using the repository browser.