-
Notifications
You must be signed in to change notification settings - Fork 1
/
pkg-install.sh
executable file
·46 lines (38 loc) · 1.16 KB
/
pkg-install.sh
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
#!/bin/sh
APP="pal"
INSTALL_DIR="/$APP"
UPLOAD_DIR="/$APP/upload"
CONF_DIR="/etc/$APP"
ACTIONS_DIR="/etc/$APP/actions"
DB_DIR="/etc/$APP/$APP.db"
ID="101010"
if [ "$(id $ID 2>/dev/null)" = "" ]; then
addgroup --gid "$ID" --system "$APP" || groupadd --gid "$ID" --system "$APP"
adduser --uid "$ID" --system --ingroup "$APP" --home "$INSTALL_DIR" --shell /sbin/nologin "$APP" || adduser --uid "$ID" --system --gid "$ID" --home-dir "$INSTALL_DIR" --shell /sbin/nologin "$APP"
chmod -f 0700 "$INSTALL_DIR"
fi
if [ ! -d "$INSTALL_DIR" ]; then
mkdir -p "$INSTALL_DIR"
chmod -f 0700 "$INSTALL_DIR"
chown -f "$APP":"$APP" "$INSTALL_DIR"
fi
if [ ! -d "$UPLOAD_DIR" ]; then
mkdir -p "$UPLOAD_DIR"
chmod -f 0700 "$UPLOAD_DIR"
chown -f "$APP":"$APP" "$UPLOAD_DIR"
fi
if [ ! -d "$CONF_DIR" ]; then
mkdir -p "$CONF_DIR"
chmod -f 0700 "$CONF_DIR"
chown -f "$APP":"$APP" "$CONF_DIR"
fi
if [ ! -d "$ACTIONS_DIR" ]; then
mkdir -p "$ACTIONS_DIR"
chmod -f 0700 "$ACTIONS_DIR"
chown -f "$APP":"$APP" "$ACTIONS_DIR"
fi
if [ ! -d "$DB_DIR" ]; then
mkdir -p "$DB_DIR"
chmod -f 0700 "$DB_DIR"
chown -f "$APP":"$APP" "$DB_DIR"
fi