5 # The contents of this file are subject to the terms of the
6 # Common Development and Distribution License, Version 1.0 only
7 # (the "License"). You may not use this file except in compliance
10 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
11 # or http://www.opensolaris.org/os/licensing.
12 # See the License for the specific language governing permissions
13 # and limitations under the License.
15 # When distributing Covered Code, include this CDDL HEADER in each
16 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
17 # If applicable, add the following below this CDDL HEADER, with the
18 # fields enclosed by brackets "[]" replaced with your own identifying
19 # information: Portions Copyright [yyyy] [name of copyright owner]
24 # Copyright 1999 Sun Microsystems, Inc. All rights reserved.
25 # Use is subject to license terms.
27 #ident "%Z%%M% %I% %E% SMI"
34 # sys: system; user: login name; cdir: current directory;
35 # tdir: temporary directory; pu: PUBDIR/receive/user;
43 trap "exit 1" 1 2 13 15
45 # mktmpdir - Create a private (mode 0700) temporary directory inside of /tmp
46 # for this process's temporary files. We set up a trap to remove the
47 # directory on exit (trap 0), and also on SIGHUP, SIGINT, SIGQUIT, and
52 trap '/usr/bin/rm -rf $tmpdir' 0 1 2 3 15
53 /usr
/bin
/mkdir
-m 700 $tmpdir ||
exit 1
59 while getopts s
: FLAG
; do
63 ?
) gettext "Usage: uupick [-s sysname]\n" 1>&2;
68 shift `expr $OPTIND - 1`
71 gettext "Usage: uupick [-s sysname]\n" 1>&2;
74 user
=`id | sed -n "/^uid=[0-9]*(\([^)]*\)).*/s//\1/p"`
77 then gettext "User id required!\n" >&2; exit 1
80 pu
=/var
/spool
/uucppublic
/receive
/$user
81 if test -d $pu -a -s $pu
83 for i
in `/usr/bin/ls $pu`
87 if test $sys != $i; then continue; fi
89 if test -d $pu/$i -a -s $pu/$i
92 for j
in `/usr/bin/ls -a`
94 if test $j = "." -o $j = ".."; then continue; fi
96 then printf "`gettext 'from system %s: directory %s '`" $i $j
97 else printf "`gettext 'from system %s: file %s '`" $i $j
111 # If dir path begins with a slash, use full path for destination;
112 # otherwise, use path relative to current dir;
113 # default destination is current dir
115 # As files are transferred, put their names in $tmpdir/$$uupick.
116 # Only remove those named files from...receive/..dir if cmp
117 # verifies transfer took place. then find & remove directories
118 # (separate find is necessary because cpio -v doesn't print dir names)
122 then abs
=`expr "$dir" : '/.*'`
130 if [ ! -d $tdir -o ! -w $tdir ]; then
131 printf "`gettext 'directory %s doesn't exist or isn't writable'`" $tdir >&2
136 find .
-depth -print | \
137 grep -v '^\.$' > $tmpdir/$
$uupick
140 find $j -depth -print > $tmpdir/$
$uupick
143 cpio -pdmu $tdir < $tmpdir/$
$uupick
144 for k
in `cat $tmpdir/$$uupick`
148 if test -f $varfrom; then
149 if cmp $varfrom $varto ; then
152 printf "`gettext 'file %s not removed'`" $varfrom >&2
155 rmdir $varfrom 2>/dev
/null
158 rm -f $tmpdir/$
$uupick
169 ex
=`expr "$cmd $dir" : '!\(.*\)'`
176 gettext "Usage: [d][m dir][a dir][p][q][cntl-d][!cmd][*][new-line]";;