-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathsw
More file actions
executable file
·98 lines (81 loc) · 1.74 KB
/
Copy pathsw
File metadata and controls
executable file
·98 lines (81 loc) · 1.74 KB
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#!/usr/bin/env bash
#
# SPDX-FileCopyrightText: 2019 Saalim Quadri <danascape@gmail.com>
# SPDX-License-Identifier: GPL-3.0-or-later
#
# Determine installation paths
# Priority: 1) System install 2) User install 3) Local development
if [[ -f '/usr/bin/sw' && -d '/usr/share/sworkflow' ]]; then
# System-wide installation (Debian package / make install)
SW_SRC_DIR="/usr/share/sworkflow"
SW_CONFIG_DIR="/etc/sworkflow"
elif [[ -d "$HOME/.local/share/sworkflow" ]]; then
# User installation (XDG compliant)
SW_SRC_DIR="$HOME/.local/share/sworkflow"
SW_CONFIG_DIR="$HOME/.config/sworkflow"
elif [[ -d "$HOME/.local/sw" ]]; then
# Legacy user installation (setup.sh)
SW_SRC_DIR="$HOME/.local/sw"
SW_CONFIG_DIR="$HOME/.local/sw/configs"
else
# Local development (running from source)
SW_SRC_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
SW_CONFIG_DIR="$SW_SRC_DIR/configs"
fi
export SW_SRC_DIR
export SW_CONFIG_DIR
sw()
{
argument="$1"
case "$argument" in
build | b)
(
. "$SW_SRC_DIR"/src/build.sh --source-only
kernel_build '' "$@"
)
;;
init | i)
(
. "$SW_SRC_DIR"/src/init.sh --source-only
generate_config
)
;;
help | h)
(
. "$SW_SRC_DIR"/src/help.sh --source-only
sworkflow_help
)
;;
man | m)
(
. "$SW_SRC_DIR"/src/help.sh --source-only
sworkflow_help
)
;;
pack | p)
(
. "$SW_SRC_DIR"/src/sw_package.sh --source-only
kernel_package '' "$@"
)
;;
version | v)
(
. "$SW_SRC_DIR"/src/version.sh --source-only
sworkflow_version
)
;;
doctor | d)
(
. "$SW_SRC_DIR"/src/doctor.sh --source-only
sworkflow_doctor "$2"
)
;;
*)
(
. "$SW_SRC_DIR"/src/help.sh --source-only
sworkflow_help
)
;;
esac
}
sw "$@"