aboutsummaryrefslogtreecommitdiff
path: root/03/install.sh
blob: 8cd2aa11daa216eb77c9f397a941ed92a41bfcad (plain)
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
#!/bin/sh
## install.sh
#
# Copyright (C) 2026 by Martin Michalec <martin@michalec.dev>
#
# SPDX-License-Identifier: MIT
#
## Commentary:
#
## Code:

if [ "$(id -u)" != 0 ]; then
    echo "$0: permission denied"
    exit 1
fi

cd "$(dirname "$0")"

PREFIX=/usr/local/practice3

set -xeu

install -o root -g root -m 755 -d $PREFIX
install -o root -g root -m 755 -d $PREFIX/bin
install -o root -g root -m 700 -d $PREFIX/etc
install -o root -g root -m 700 -d $PREFIX/etc/acl
install -o root -g root -m 700 -d $PREFIX/confdata
install -o root -g root -m 700 -d $PREFIX/log

install -o root -g root -m 6711 passwdctl $PREFIX/bin/passwdctl
install -o root -g root -m 6711 shell-dac $PREFIX/bin/shell-dac
install -o root -g root -m 6711 shell-mac $PREFIX/bin/shell-mac

umask 177
[ ! -f $PREFIX/etc/passwd       ] && touch $PREFIX/etc/passwd
[ ! -f $PREFIX/log/passwd.log   ] && touch $PREFIX/log/passwd.log
[ ! -f $PREFIX/log/confdata.log ] && touch $PREFIX/log/confdata.log

exit 0

## install.sh ends here