-
Notifications
You must be signed in to change notification settings - Fork 1
/
myinstall
executable file
·67 lines (62 loc) · 1.57 KB
/
myinstall
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/bin/sh
#
# daemon - https://libslack.org/daemon
#
# Copyright (C) 1999-2004, 2010, 2020-2023 raf <[email protected]>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <https://www.gnu.org/licenses/>.
#
# 20230824 raf <[email protected]>
#
# This is a local version of install for OpenSolaris because it doesn't have
# /usr/ucb/install and the normal Solaris install program is weird and
# doesn't do what its manpage says it does (i.e. it ignores the directory
# at the end of the command line instead of installing the file there).
# Note: All our uses of install are of the form:
# install -m ### file... dir
# or:
# install -m ### file dest
if [ "x$1" != "x-m" -o "$#" -lt 4 ]
then
echo "$0: Unexpected usage" >&2
exit 1
fi
shift
mode="$1"
shift
files=""
while [ "$#" -gt 1 ]
do
if [ ! -f "$1" ]
then
echo "$0: Expected $1 to be a file" >&2
exit 1
fi
files="$files $1"
shift
done
if [ -d "$1" ]
then
dir="$1"
cp $files $dir
else
dst="$1"
cp $files $dst
fi
for file in $files
do
chmod $mode $dir/$file
done
exit 0
# vi:set ts=4 sw=4: