Index: stable/10/usr.sbin/Makefile =================================================================== --- stable/10/usr.sbin/Makefile (revision 294786) +++ stable/10/usr.sbin/Makefile (revision 294787) @@ -1,365 +1,366 @@ # From: @(#)Makefile 5.20 (Berkeley) 6/12/93 # $FreeBSD$ .include SUBDIR= adduser \ arp \ binmiscctl \ bsdconfig \ camdd \ cdcontrol \ chkgrp \ chown \ chroot \ ckdist \ clear_locks \ crashinfo \ cron \ ctladm \ ctld \ daemon \ dconschat \ devinfo \ digictl \ diskinfo \ dumpcis \ extattr \ extattrctl \ fifolog \ fstyp \ fwcontrol \ getfmac \ getpmac \ gstat \ i2c \ ifmcstat \ iostat \ kldxref \ mailwrapper \ makefs \ memcontrol \ mergemaster \ mfiutil \ mixer \ mlxcontrol \ mountd \ mount_smbfs \ mptutil \ mtest \ ${_mtree} \ newsyslog \ nfscbd \ nfsd \ nfsdumpstate \ nfsrevoke \ nfsuserd \ nmtree \ nologin \ ${_pc_sysinstall} \ pciconf \ periodic \ powerd \ procctl \ pstat \ pw \ pwd_mkdb \ quot \ rarpd \ rmt \ rpcbind \ rpc.lockd \ rpc.statd \ rpc.umntall \ rtprio \ service \ services_mkdb \ sesutil \ setfib \ setfmac \ setpmac \ smbmsg \ snapinfo \ spray \ syslogd \ sysrc \ tcpdrop \ tcpdump \ traceroute \ trpt \ tzsetup \ uefisign \ ugidfw \ + vigr \ vipw \ wake \ watch \ watchdogd \ zic # NB: keep these sorted by MK_* knobs .if ${MK_ACCT} != "no" SUBDIR+= accton SUBDIR+= sa .endif .if ${MK_AMD} != "no" SUBDIR+= amd .endif .if ${MK_AUDIT} != "no" SUBDIR+= audit SUBDIR+= auditd .if ${MK_OPENSSL} != "no" SUBDIR+= auditdistd .endif SUBDIR+= auditreduce SUBDIR+= praudit .endif .if ${MK_AUTHPF} != "no" SUBDIR+= authpf .endif .if ${MK_AUTOFS} != "no" SUBDIR+= autofs .endif .if ${MK_BLUETOOTH} != "no" SUBDIR+= bluetooth .endif .if ${MK_BOOTPARAMD} != "no" SUBDIR+= bootparamd .endif .if ${MK_BSDINSTALL} != "no" SUBDIR+= bsdinstall .endif .if ${MK_BSNMP} != "no" SUBDIR+= bsnmpd .endif .if ${MK_CTM} != "no" SUBDIR+= ctm .endif .if ${MK_FLOPPY} != "no" SUBDIR+= fdcontrol SUBDIR+= fdformat SUBDIR+= fdread SUBDIR+= fdwrite .endif .if ${MK_FMTREE} != "no" SUBDIR+= mtree .endif .if ${MK_FREEBSD_UPDATE} != "no" SUBDIR+= freebsd-update .endif .if ${MK_GSSAPI} != "no" SUBDIR+= gssd .endif .if ${MK_GPIO} != "no" SUBDIR+= gpioctl .endif .if ${MK_INET6} != "no" SUBDIR+= faithd SUBDIR+= ip6addrctl SUBDIR+= mld6query SUBDIR+= ndp SUBDIR+= rip6query SUBDIR+= route6d SUBDIR+= rrenumd SUBDIR+= rtadvctl SUBDIR+= rtadvd SUBDIR+= rtsold SUBDIR+= traceroute6 .endif .if ${MK_INETD} != "no" SUBDIR+= inetd .endif .if ${MK_IPFW} != "no" SUBDIR+= ipfwpcap .endif .if ${MK_IPX} != "no" SUBDIR+= IPXrouted .endif .if ${MK_ISCSI} != "no" SUBDIR+= iscsid .endif .if ${MK_JAIL} != "no" SUBDIR+= jail SUBDIR+= jexec SUBDIR+= jls .endif # XXX MK_SYSCONS .if ${MK_LEGACY_CONSOLE} != "no" SUBDIR+= kbdcontrol SUBDIR+= kbdmap SUBDIR+= moused SUBDIR+= vidcontrol .endif .if ${MK_LIBTHR} != "no" || ${MK_LIBPTHREAD} != "no" .if ${MK_PPP} != "no" SUBDIR+= pppctl .endif .if ${MK_NS_CACHING} != "no" SUBDIR+= nscd .endif .endif .if ${MK_LPR} != "no" SUBDIR+= lpr .endif .if ${MK_MAN_UTILS} != "no" SUBDIR+= manctl .endif .if ${MK_NAND} != "no" SUBDIR+= nandsim SUBDIR+= nandtool .endif .if ${MK_NETGRAPH} != "no" SUBDIR+= flowctl SUBDIR+= lmcconfig SUBDIR+= ngctl SUBDIR+= nghook .endif .if ${MK_NIS} != "no" SUBDIR+= rpc.yppasswdd SUBDIR+= rpc.ypupdated SUBDIR+= rpc.ypxfrd SUBDIR+= ypbind SUBDIR+= yp_mkdb SUBDIR+= yppoll SUBDIR+= yppush SUBDIR+= ypserv SUBDIR+= ypset .endif .if ${MK_NTP} != "no" SUBDIR+= ntp .endif .if ${MK_OPENSSL} != "no" SUBDIR+= keyserv .endif .if ${MK_PC_SYSINSTALL} != "no" _pc_sysinstall= pc-sysinstall .endif .if ${MK_PF} != "no" SUBDIR+= ftp-proxy .endif .if ${MK_PKGBOOTSTRAP} != "no" SUBDIR+= pkg .endif .if ${MK_PKGTOOLS} != "no" SUBDIR+= pkg_install .endif # XXX MK_TOOLCHAIN? .if ${MK_PMC} != "no" SUBDIR+= pmcannotate SUBDIR+= pmccontrol SUBDIR+= pmcstat SUBDIR+= pmcstudy .endif .if ${MK_PORTSNAP} != "no" SUBDIR+= portsnap .endif .if ${MK_PPP} != "no" SUBDIR+= ppp .endif .if ${MK_QUOTAS} != "no" SUBDIR+= edquota SUBDIR+= quotaon SUBDIR+= repquota .endif .if ${MK_RCMDS} != "no" SUBDIR+= rwhod .endif .if ${MK_RCS} != "no" SUBDIR+= etcupdate .endif .if ${MK_SENDMAIL} != "no" SUBDIR+= editmap SUBDIR+= mailstats SUBDIR+= makemap SUBDIR+= praliases SUBDIR+= sendmail .endif .if ${MK_TCP_WRAPPERS} != "no" SUBDIR+= tcpdchk SUBDIR+= tcpdmatch .endif .if ${MK_TESTS} != "no" SUBDIR+= tests .endif .if ${MK_TIMED} != "no" SUBDIR+= timed .endif .if ${MK_TOOLCHAIN} != "no" SUBDIR+= config SUBDIR+= crunch .endif .if ${MK_UNBOUND} != "no" SUBDIR+= unbound .endif .if ${MK_USB} != "no" SUBDIR+= uathload SUBDIR+= uhsoctl SUBDIR+= usbconfig SUBDIR+= usbdump .endif .if ${MK_UTMPX} != "no" SUBDIR+= ac SUBDIR+= lastlogin SUBDIR+= utx .endif .if ${MK_WIRELESS} != "no" SUBDIR+= ancontrol SUBDIR+= wlandebug SUBDIR+= wpa .endif .include SUBDIR:= ${SUBDIR:O} SUBDIR_PARALLEL= .include Index: stable/10/usr.sbin/vigr/Makefile =================================================================== --- stable/10/usr.sbin/vigr/Makefile (nonexistent) +++ stable/10/usr.sbin/vigr/Makefile (revision 294787) @@ -0,0 +1,6 @@ +# $FreeBSD$ + +SCRIPTS= vigr +MAN= vigr.8 + +.include Property changes on: stable/10/usr.sbin/vigr/Makefile ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +FreeBSD=%H \ No newline at end of property Index: stable/10/usr.sbin/vigr/vigr.8 =================================================================== --- stable/10/usr.sbin/vigr/vigr.8 (nonexistent) +++ stable/10/usr.sbin/vigr/vigr.8 (revision 294787) @@ -0,0 +1,71 @@ +.\"- +.\" Copyright (c) 2014 Dag-Erling Smørgrav +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd December 14, 2014 +.Dt VIGR 8 +.Os +.Sh NAME +.Nm vigr +.Nd edit the group file +.Sh SYNOPSIS +.Nm +.Op Fl d Ar directory +.Sh DESCRIPTION +The +.Nm +utility makes a temporary copy of the group file, allows the user to +edit it, then verifies that the edited file is valid before installing +it. +.Pp +The following options are available: +.Bl -tag -width Fl +.It Fl d Ar directory +Edit the group file in the specified directory instead of the default +.Pa /etc/group . +.El +.Sh ENVIRONMENT +.Bl -tag -width EDITOR +.It Ev EDITOR +The editor to use instead of +.Xr vi 1 . +.It Ev TMPDIR +The directory in which to store the temporary copy of the group file. +.El +.Sh SEE ALSO +.Xr group 5 , +.Xr chkgrp 8 , +.Xr vipw 8 +.Sh HISTORY +The +.Nm +utility appeared in +.Fx 11.0 . +.Sh AUTHORS +The +.Nm +utility and this manual page were written by +.An Dag-Erling Sm\(/orgrav Aq Mt des@FreeBSD.org . Property changes on: stable/10/usr.sbin/vigr/vigr.8 ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +FreeBSD=%H \ No newline at end of property Index: stable/10/usr.sbin/vigr/vigr.sh =================================================================== --- stable/10/usr.sbin/vigr/vigr.sh (nonexistent) +++ stable/10/usr.sbin/vigr/vigr.sh (revision 294787) @@ -0,0 +1,95 @@ +#!/bin/sh +#- +# Copyright (c) 2014 Dag-Erling Smørgrav +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# +# $FreeBSD$ +# + +error() { + echo "$@" >&2 + exit 1 +} + +usage() { + error "usage: vigr [-d dir]" +} + +# Check arguments +while getopts d: opt ; do + case $opt in + d) + etcdir="${OPTARG}" + ;; + *) + usage + ;; + esac +done + +# Look for the current group file +grpfile="${etcdir:-/etc}/group" +if [ ! -f "${grpfile}" ] ; then + error "Missing group file" +fi + +# Create a secure temporary working directory +tmpdir=$(mktemp -d -t vigr) +if [ -z "${tmpdir}" -o ! -d "${tmpdir}" ] ; then + error "Unable to create the temporary directory" +fi +tmpfile="${tmpdir}/group" + +# Clean up on exit +trap "exit 1" INT +trap "rm -rf '${tmpdir}'" EXIT +set -e + +# Make a copy of the group file for the user to edit +cp "${grpfile}" "${tmpfile}" + +while :; do + # Let the user edit the file + ${EDITOR:-/usr/bin/vi} "${tmpfile}" + + # If the result is valid, install it and exit + if chkgrp -q "${tmpfile}" ; then + install -b -m 0644 -C -S "${tmpfile}" "${grpfile}" + exit 0 + fi + + # If it is not, offer to re-edit + while :; do + echo -n "Re-edit the group file? " + read ans + case $ans in + [Yy]|[Yy][Ee][Ss]) + break + ;; + [Nn]|[Nn][Oo]) + exit 1 + ;; + esac + done +done Property changes on: stable/10/usr.sbin/vigr/vigr.sh ___________________________________________________________________ Added: svn:keywords ## -0,0 +1 ## +FreeBSD=%H \ No newline at end of property Index: stable/10 =================================================================== --- stable/10 (revision 294786) +++ stable/10 (revision 294787) Property changes on: stable/10 ___________________________________________________________________ Modified: svn:mergeinfo ## -0,0 +0,1 ## Merged /head:r275768