| @@ -1,16 +1,16 @@ | | | @@ -1,16 +1,16 @@ |
1 | #!/bin/sh | | 1 | #!/bin/sh |
2 | # | | 2 | # |
3 | # $NetBSD: postinstall,v 1.76.2.1 2008/11/27 03:42:00 snj Exp $ | | 3 | # $NetBSD: postinstall,v 1.76.2.2 2008/12/06 22:06:26 snj Exp $ |
4 | # | | 4 | # |
5 | # Copyright (c) 2002-2008 The NetBSD Foundation, Inc. | | 5 | # Copyright (c) 2002-2008 The NetBSD Foundation, Inc. |
6 | # All rights reserved. | | 6 | # All rights reserved. |
7 | # | | 7 | # |
8 | # This code is derived from software contributed to The NetBSD Foundation | | 8 | # This code is derived from software contributed to The NetBSD Foundation |
9 | # by Luke Mewburn. | | 9 | # by Luke Mewburn. |
10 | # | | 10 | # |
11 | # Redistribution and use in source and binary forms, with or without | | 11 | # Redistribution and use in source and binary forms, with or without |
12 | # modification, are permitted provided that the following conditions | | 12 | # modification, are permitted provided that the following conditions |
13 | # are met: | | 13 | # are met: |
14 | # 1. Redistributions of source code must retain the above copyright | | 14 | # 1. Redistributions of source code must retain the above copyright |
15 | # notice, this list of conditions and the following disclaimer. | | 15 | # notice, this list of conditions and the following disclaimer. |
16 | # 2. Redistributions in binary form must reproduce the above copyright | | 16 | # 2. Redistributions in binary form must reproduce the above copyright |
| @@ -582,26 +582,58 @@ contents_owner() | | | @@ -582,26 +582,58 @@ contents_owner() |
582 | msg \ | | 582 | msg \ |
583 | "${_dir} and contents not all owned by ${_user}:${_grp}" | | 583 | "${_dir} and contents not all owned by ${_user}:${_grp}" |
584 | return 1 | | 584 | return 1 |
585 | else | | 585 | else |
586 | return 0 | | 586 | return 0 |
587 | fi | | 587 | fi |
588 | elif [ "${_op}" = "fix" ]; then | | 588 | elif [ "${_op}" = "fix" ]; then |
589 | find "${_dir}" \( \( ! -user "${_user}" \) -o \ | | 589 | find "${_dir}" \( \( ! -user "${_user}" \) -o \ |
590 | \( ! -group "${_grp}" \) \) -a -print0 \ | | 590 | \( ! -group "${_grp}" \) \) -a -print0 \ |
591 | | xargs -0 chown "${_user}:${_grp}" | | 591 | | xargs -0 chown "${_user}:${_grp}" |
592 | fi | | 592 | fi |
593 | } | | 593 | } |
594 | | | 594 | |
| | | 595 | # get_makevar var [var ...] |
| | | 596 | # Retrieve the value of a user-settable system make variable |
| | | 597 | get_makevar() |
| | | 598 | { |
| | | 599 | $SOURCEMODE || err 3 "get_makevar must be used in source mode" |
| | | 600 | [ $# -eq 0 ] && err 3 "USAGE: get_makevar var [var ...]" |
| | | 601 | |
| | | 602 | for _var in "$@"; do |
| | | 603 | _value="$(echo '.include <bsd.own.mk>' | \ |
| | | 604 | ${MAKE:-make} -f - -V "${_var}")" |
| | | 605 | |
| | | 606 | eval ${_var}=\"${_value}\" |
| | | 607 | done |
| | | 608 | } |
| | | 609 | |
| | | 610 | # detect_x11 |
| | | 611 | # Detect if X11 components should be analysed and set values of |
| | | 612 | # relevant variables. |
| | | 613 | detect_x11() |
| | | 614 | { |
| | | 615 | if $SOURCEMODE; then |
| | | 616 | get_makevar MKX11 X11ROOTDIR |
| | | 617 | else |
| | | 618 | if [ -f "${SRC_DIR}/etc/mtree/set.xetc" ]; then |
| | | 619 | MKX11=yes |
| | | 620 | X11ROOTDIR=/this/value/isnt/used/yet |
| | | 621 | else |
| | | 622 | MKX11=no |
| | | 623 | X11ROOTDIR= |
| | | 624 | fi |
| | | 625 | fi |
| | | 626 | } |
595 | | | 627 | |
596 | # | | 628 | # |
597 | # items | | 629 | # items |
598 | # ----- | | 630 | # ----- |
599 | # | | 631 | # |
600 | | | 632 | |
601 | # | | 633 | # |
602 | # bluetooth | | 634 | # bluetooth |
603 | # | | 635 | # |
604 | additem bluetooth "bluetooth configuration is up to date" | | 636 | additem bluetooth "bluetooth configuration is up to date" |
605 | do_bluetooth() | | 637 | do_bluetooth() |
606 | { | | 638 | { |
607 | [ -n "$1" ] || err 3 "USAGE: do_bluetooth fix|check" | | 639 | [ -n "$1" ] || err 3 "USAGE: do_bluetooth fix|check" |
| @@ -889,58 +921,82 @@ do_postfix() | | | @@ -889,58 +921,82 @@ do_postfix() |
889 | | | 921 | |
890 | return ${failed} | | 922 | return ${failed} |
891 | } | | 923 | } |
892 | | | 924 | |
893 | # | | 925 | # |
894 | # rc | | 926 | # rc |
895 | # | | 927 | # |
896 | additem rc "/etc/rc* and /etc/rc.d/ being up to date" | | 928 | additem rc "/etc/rc* and /etc/rc.d/ being up to date" |
897 | do_rc() | | 929 | do_rc() |
898 | { | | 930 | { |
899 | [ -n "$1" ] || err 3 "USAGE: do_rc fix|check" | | 931 | [ -n "$1" ] || err 3 "USAGE: do_rc fix|check" |
900 | op="$1" | | 932 | op="$1" |
901 | failed=0 | | 933 | failed=0 |
| | | 934 | generated_scripts="" |
| | | 935 | if [ "${MKX11}" != "no" ]; then |
| | | 936 | generated_scripts="${generated_scripts} xdm xfs" |
| | | 937 | fi |
902 | | | 938 | |
903 | compare_dir "${op}" "${SRC_DIR}/etc" "${DEST_DIR}/etc" 644 \ | | 939 | compare_dir "${op}" "${SRC_DIR}/etc" "${DEST_DIR}/etc" 644 \ |
904 | rc rc.subr rc.shutdown | | 940 | rc rc.subr rc.shutdown |
905 | failed=$(( ${failed} + $? )) | | 941 | failed=$(( ${failed} + $? )) |
906 | | | 942 | |
| | | 943 | if ! $SOURCEMODE; then |
| | | 944 | extra_scripts="${generated_scripts}" |
| | | 945 | else |
| | | 946 | extra_scripts="" |
| | | 947 | fi |
| | | 948 | |
907 | compare_dir "${op}" "${SRC_DIR}/etc/rc.d" "${DEST_DIR}/etc/rc.d" 555 \ | | 949 | compare_dir "${op}" "${SRC_DIR}/etc/rc.d" "${DEST_DIR}/etc/rc.d" 555 \ |
908 | DAEMON LOGIN NETWORKING SERVERS \ | | 950 | DAEMON LOGIN NETWORKING SERVERS \ |
909 | accounting altqd amd apmd \ | | 951 | accounting altqd amd apmd \ |
910 | bootconf.sh bootparams btattach btconfig btdevctl bthcid \ | | 952 | bootconf.sh bootparams btattach btconfig btdevctl bthcid \ |
911 | ccd cgd cleartmp cron \ | | 953 | ccd cgd cleartmp cron \ |
912 | dhclient dhcpd dhcrelay dmesg downinterfaces envsys \ | | 954 | dhclient dhcpd dhcrelay dmesg downinterfaces envsys \ |
913 | fsck ftp_proxy ftpd \ | | 955 | fsck ftp_proxy ftpd \ |
914 | hostapd \ | | 956 | hostapd \ |
915 | identd ifwatchd inetd ipfilter ipfs ipmon ipnat ipsec \ | | 957 | identd ifwatchd inetd ipfilter ipfs ipmon ipnat ipsec \ |
916 | irdaattach iscsi_target isdnd \ | | 958 | irdaattach iscsi_target isdnd \ |
917 | kdc \ | | 959 | kdc \ |
918 | ldconfig lkm1 lkm2 lkm3 local lpd \ | | 960 | ldconfig lkm1 lkm2 lkm3 local lpd \ |
919 | mixerctl mopd motd mountall mountcritlocal mountcritremote \ | | 961 | mixerctl mopd motd mountall mountcritlocal mountcritremote \ |
920 | mountd moused mrouted \ | | 962 | mountd moused mrouted \ |
921 | named ndbootd network newsyslog nfsd nfslocking ntpd ntpdate \ | | 963 | named ndbootd network newsyslog nfsd nfslocking ntpd ntpdate \ |
922 | perusertmp pf pf_boot pflogd poffd postfix powerd ppp pwcheck \ | | 964 | perusertmp pf pf_boot pflogd poffd postfix powerd ppp pwcheck \ |
923 | quota \ | | 965 | quota \ |
924 | racoon rpcbind raidframe raidframeparity rarpd rbootd root \ | | 966 | racoon rpcbind raidframe raidframeparity rarpd rbootd root \ |
925 | route6d routed rtadvd rtclocaltime rtsold rwho \ | | 967 | route6d routed rtadvd rtclocaltime rtsold rwho \ |
926 | savecore screenblank sdpd securelevel sshd \ | | 968 | savecore screenblank sdpd securelevel sshd \ |
927 | staticroute swap1 swap2 sysctl sysdb syslogd \ | | 969 | staticroute swap1 swap2 sysctl sysdb syslogd \ |
928 | timed tpctl ttys \ | | 970 | timed tpctl ttys \ |
929 | veriexec virecover wdogctl wpa_supplicant wscons wsmoused \ | | 971 | veriexec virecover wdogctl wpa_supplicant wscons wsmoused \ |
930 | xdm xfs \ | | 972 | ypbind yppasswdd ypserv \ |
931 | ypbind yppasswdd ypserv | | 973 | ${extra_scripts} |
932 | failed=$(( ${failed} + $? )) | | 974 | failed=$(( ${failed} + $? )) |
933 | | | 975 | |
| | | 976 | if $SOURCEMODE && [ -n "${generated_scripts}" ]; then |
| | | 977 | # generate scripts |
| | | 978 | mkdir "${SCRATCHDIR}/rc" |
| | | 979 | for f in ${generated_scripts}; do |
| | | 980 | sed -e "s,@X11ROOTDIR@,${X11ROOTDIR},g" \ |
| | | 981 | < "${SRC_DIR}/etc/rc.d/${f}.in" \ |
| | | 982 | > "${SCRATCHDIR}/rc/${f}" |
| | | 983 | done |
| | | 984 | compare_dir "${op}" "${SCRATCHDIR}/rc" \ |
| | | 985 | "${DEST_DIR}/etc/rc.d" 555 \ |
| | | 986 | ${generated_scripts} |
| | | 987 | failed=$(( ${failed} + $? )) |
| | | 988 | fi |
| | | 989 | |
934 | # check for obsolete rc.d files | | 990 | # check for obsolete rc.d files |
935 | for f in NETWORK btcontrol btuartd fsck.sh kerberos nfsiod servers \ | | 991 | for f in NETWORK btcontrol btuartd fsck.sh kerberos nfsiod servers \ |
936 | systemfs daemon gated login portmap sunndd xntpd; do | | 992 | systemfs daemon gated login portmap sunndd xntpd; do |
937 | fd="/etc/rc.d/${f}" | | 993 | fd="/etc/rc.d/${f}" |
938 | [ -e "${DEST_DIR}${fd}" ] && echo "${fd}" | | 994 | [ -e "${DEST_DIR}${fd}" ] && echo "${fd}" |
939 | done | obsolete_paths "${op}" | | 995 | done | obsolete_paths "${op}" |
940 | failed=$(( ${failed} + $? )) | | 996 | failed=$(( ${failed} + $? )) |
941 | | | 997 | |
942 | # check for obsolete rc.conf(5) variables | | 998 | # check for obsolete rc.conf(5) variables |
943 | set -- amd amd_master \ | | 999 | set -- amd amd_master \ |
944 | btcontrol btcontrol_devices \ | | 1000 | btcontrol btcontrol_devices \ |
945 | critical_filesystems critical_filesystems_beforenet \ | | 1001 | critical_filesystems critical_filesystems_beforenet \ |
946 | defcorename \ | | 1002 | defcorename \ |
| @@ -1418,26 +1474,28 @@ EOF | | | @@ -1418,26 +1474,28 @@ EOF |
1418 | [ -n "${MACHINE}" ] || err 2 "\${MACHINE} is not defined" | | 1474 | [ -n "${MACHINE}" ] || err 2 "\${MACHINE} is not defined" |
1419 | [ -n "${MACHINE_ARCH}" ] || err 2 "\${MACHINE_ARCH} is not defined" | | 1475 | [ -n "${MACHINE_ARCH}" ] || err 2 "\${MACHINE_ARCH} is not defined" |
1420 | if ! $SOURCEMODE && ! [ -f "${SRC_DIR}/etc/mtree/set.etc" ]; then | | 1476 | if ! $SOURCEMODE && ! [ -f "${SRC_DIR}/etc/mtree/set.etc" ]; then |
1421 | err 2 "Files from the etc.tgz set are missing" | | 1477 | err 2 "Files from the etc.tgz set are missing" |
1422 | fi | | 1478 | fi |
1423 | | | 1479 | |
1424 | # If directories are /, clear them, so various messages | | 1480 | # If directories are /, clear them, so various messages |
1425 | # don't have leading "//". However, this requires | | 1481 | # don't have leading "//". However, this requires |
1426 | # the use of ${foo:-/} to display the variables. | | 1482 | # the use of ${foo:-/} to display the variables. |
1427 | # | | 1483 | # |
1428 | [ "${SRC_DIR}" = "/" ] && SRC_DIR="" | | 1484 | [ "${SRC_DIR}" = "/" ] && SRC_DIR="" |
1429 | [ "${DEST_DIR}" = "/" ] && DEST_DIR="" | | 1485 | [ "${DEST_DIR}" = "/" ] && DEST_DIR="" |
1430 | | | 1486 | |
| | | 1487 | detect_x11 |
| | | 1488 | |
1431 | op="$1" | | 1489 | op="$1" |
1432 | shift | | 1490 | shift |
1433 | | | 1491 | |
1434 | case "${op}" in | | 1492 | case "${op}" in |
1435 | diff) | | 1493 | diff) |
1436 | op=check | | 1494 | op=check |
1437 | DIFF_STYLE=n # default style is RCS | | 1495 | DIFF_STYLE=n # default style is RCS |
1438 | OPTIND=1 | | 1496 | OPTIND=1 |
1439 | while getopts bcenpuw ch; do | | 1497 | while getopts bcenpuw ch; do |
1440 | case "${ch}" in | | 1498 | case "${ch}" in |
1441 | c|e|n|u) | | 1499 | c|e|n|u) |
1442 | if [ "${DIFF_STYLE}" != "n" -a \ | | 1500 | if [ "${DIFF_STYLE}" != "n" -a \ |
1443 | "${DIFF_STYLE}" != "${ch}" ]; then | | 1501 | "${DIFF_STYLE}" != "${ch}" ]; then |