-
-
Notifications
You must be signed in to change notification settings - Fork 49
/
t2
executable file
·84 lines (76 loc) · 2.78 KB
/
t2
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
#!/usr/bin/env bash
# --- T2-COPYRIGHT-NOTE-BEGIN ---
# T2 SDE: t2
# Copyright (C) 2023 - 2024 The T2 SDE Project
#
# This Copyright note is generated by scripts/Create-CopyPatch,
# more information can be found in the files COPYING and README.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2.
# --- T2-COPYRIGHT-NOTE-END ---
top=$(readlink -f $0)
[ "$top" ] && cd ${top%/*}
declare -A commands
commands["bootstrap"]="bootstrap vital deps on homebrew systems"
commands["config"]="creates a target configuration profile"
commands["install"]="installs a package and its dependencies"
commands["uninstall"]="uninstalls a package from the system"
commands["download"]="downloads assets of a package"
commands["build"]="builds a package from source"
commands["build-target"]="builds a whole target sandbox"
commands["clean"]="clean-up build artifacts"
commands["create"]="create a package from external URLs"
commands["create-iso"]="create an ISO after a target build"
commands["list-errors"]="list build target errors"
commands["commit"]="commit changes to the T2 source tree"
commands["find"]="find package based on meta data"
commands["update"]="update a package meta-data version"
commands["upgrade"]="upgrade the system install packages"
commands["up|pull"]="update / pull t2 source tree changes"
usage() {
cat << EOT
Usage: t2 command <options>
Commands:
EOT
for i in "${!commands[@]}"; do
local desc=${commands[$i]}
local n=$((${#i} + 2))
local t="\t\t"
[ $n -gt 7 ] && t="\t"
echo -e " $i$t$desc"
done | sort
cat << EOT
Options:
-v, --verbose verbose operation
-c, --cfg config name
EOT
exit 1
}
# convert modern --* args to backward-compat single-dash -*
# and save the first non option as cmd
cmd=
declare -a args
for a; do
[[ -z "$cmd" && "$a" = [^-]* ]] && cmd="$a" && continue
args+=(${a/--/-})
done
case "$cmd" in
config) exec scripts/Config "${args[@]}" ;;
bootstrap) exec scripts/Bootstrap "${args[@]}" ;;
build) exec scripts/Build-Pkg "${args[@]}" ;;
build-target) exec scripts/Build-Target "${args[@]}" ;;
clean) exec scripts/Cleanup "${args[@]}" ;;
create) exec scripts/Create-Pkg "${args[@]}" ;;
create-iso) exec scripts/Create-ISO "${args[@]}" ;;
list-errors) exec scripts/Create-ErrList "${args[@]}" ;;
commit|ci) exec scripts/Commit "${args[@]}" ;;
download) exec scripts/Download "${args[@]}" ;;
find) exec scripts/Find-Pkg "${args[@]}" ;;
install) exec scripts/Emerge-Pkg "${args[@]}" ;;
update) exec scripts/Update-Pkg "${args[@]}" ;;
upgrade) exec scripts/Emerge-Pkg -system "${args[@]}" ;;
uninstall) exec mine -r "${args[@]}" ;;
up|pull) if [ -e .git ]; then exec git pull; else exec svn up; fi ;;
*) usage ;;
esac