aboutsummaryrefslogtreecommitdiff
path: root/02/install.sh
blob: 89feda2bfcc7cba771ae920c4fb333a5add7e18d (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/practice2

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/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      $PREFIX/bin/shell
install                         bruteforce $PREFIX/bin/bruteforce
install                         measure    $PREFIX/bin/measure

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