-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathtools.sh
69 lines (59 loc) · 2.12 KB
/
tools.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#
# Copyright 2020-2021 by Andreas Schmidt
# All rights reserved.
# This file is part of the trackfs project
# and licensed under the terms of the GNU Lesser General Public License v3.0.
# See https://github.com/andresch/trackfs for details.
#
#
# A few useful commands within the dev-docker container of trackfs
# the dev-launcher will load this file
#
thelp () {
echo "
A few shortcuts for trackfs development:
tfs run trackfs on the std mount points with --root-enabled
pidtfs return the pid of the current running trackfs instance
killtfs kill the running trackfs instance and unmount /dst
tfshelp prints this info
pypackage build the distribution files for the trackfs python package
pypubtest published the distribution files on testpypi
pypubprod publishes the distribution files on pypi
lt reloads the the trackfs dev tools
st prints the trackfs dev tools code
"
}
realias () {
if alias "${1}" >/dev/null 2>/dev/null; then unalias "${1}"; fi
alias "${1}"="${2}"
}
realias tfs "/usr/bin/trackfs --root-allowed /src /dst"
realias st "cat /work/tools.sh"
realias lt "source /work/tools.sh"
# find pid of trackfs
pidtfs () {
ps -o comm,pid | awk '/trackfs/{print $2}'
}
# kill trackfs and unmount /dst
killtfs () {
kill -KILL "$(pidtfs)"
fusermount -u /dst
}
pypackage () {
local curr="${PWD}"
cd ~/dev
rm -f dist/*
python3 setup.py sdist bdist_wheel
# now run any arbitrary command that has been passed in
if [[ ${#} -gt 0 ]]; then
$@
fi
cd "${curr}"
}
realias pypubtest 'pypackage twine upload -r testpypi dist/*'
realias pypubprod 'pypackage twine upload dist/*'
realias vcat 'cat /work/VERSION'
realias vnew 'echo "s/trackfs\\\\>=.*\$/trackfs\\\\>=$(cat /work/VERSION)/" | sed -f - -i /work/Dockerfile ; vcat'
realias vpatch 'echo $(awk -F "." -v OFS="." "{print \$1, \$2, \$3+1}" /work/VERSION) > /work/VERSION ; vnew'
realias vminor 'echo $(awk -F "." -v OFS="." "{print \$1, \$2+1, 0}" /work/VERSION) > /work/VERSION ; vnew'
realias vmajor 'echo $(awk -F "." -v OFS="." "{print \$1+1, 0, 0}" /work/VERSION) > /work/VERSION ; vnew'