2 # I, Ian Kelling, follow the GNU license recommendations at
3 # https://www.gnu.org/licenses/license-recommendations.en.html. They
4 # recommend that small programs, < 300 lines, be licensed under the
5 # Apache License 2.0. This file contains or is part of one or more small
6 # programs. If a small program grows beyond 300 lines, I plan to switch
9 # Copyright 2024 Ian Kelling
11 # Licensed under the Apache License, Version 2.0 (the "License");
12 # you may not use this file except in compliance with the License.
13 # You may obtain a copy of the License at
15 # http://www.apache.org/licenses/LICENSE-2.0
17 # Unless required by applicable law or agreed to in writing, software
18 # distributed under the License is distributed on an "AS IS" BASIS,
19 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20 # See the License for the specific language governing permissions and
21 # limitations under the License.
24 source /a
/bin
/bash-bear-trap
/bash-bear
26 if [[ -s ~
/.bashrc
]]; then . ~
/.bashrc
; fi
33 # https://sw.kovidgoyal.net/kitty/build/
51 last_build
=/a
/opt
/kitty-build-info
/last-build
53 rev=$
(cat $last_build 2>/dev
/null
) ||
:
54 head=$
(sudo
-u zu git rev-parse HEAD
)
55 if ! $recompile && ! $bootstrap && [[ $rev == "$head" ]]; then
60 # built it on one machine, the others it dies with the error illegal
61 # instruction. building is pretty quick, so just detect if our version
62 # works, and if not, rebuild and install.
63 # I had an idea to test the failure like so:
64 # timeout 5 kitty /bin/true, but that doesn't work over ssh
65 if ! $rebuild && ! /bin
/true
; then
70 if mountpoint
-q /usr
/local
/src
/kitty
; then
71 s umount
/usr
/local
/src
/kitty
76 s mkdir
-p /usr
/local
/src
/kitty
77 s mount
-o bind /a
/opt
/kitty
/usr
/local
/src
/kitty
79 s
install -o zu
-g zu
-d /usr
/local
/src
/kitty
80 s chown
-hR zu.zu
/usr
/local
/src
/kitty
81 cd /usr
/local
/src
/kitty
83 p
=PATH
=/usr
/local
/sbin
:/usr
/local
/bin
:/usr
/sbin
:/usr
/bin
:/sbin
:/bin
:/snap
/bin
:/usr
/local
/go
/bin
84 gp
=/usr
/local
/src
/kitty
/go
85 m sudo
-u zu bash
-c 'PATH=$PATH:/usr/local/go/bin; export GOPATH=/usr/local/src/kitty/go; go mod download -x'
86 m sudo
-u zu firejail
--read-write=/usr
/local
/src
/kitty
--profile=makekitty env PATH
=$p make clean
87 m sudo
-u zu firejail
--read-write=/usr
/local
/src
/kitty
--profile=makekitty env PATH
=$p GOPATH
=$gp make
89 s umount
/usr
/local
/src
/kitty
90 s chown
-hR iank.iank
/a
/opt
/kitty
94 s rsync
-ar --chown root
:root
--delete __main__.py kitty logo kittens
/usr
/local
/src
/kitty
95 s rsync
-ar --chown root
:root .
/terminfo
/x
/xterm-kitty
/usr
/share
/terminfo
/x
/xterm-kitty
96 s
ln -sf -T /usr
/local
/src
/kitty
/kitty
/launcher
/kitty
/usr
/local
/bin
/kitty
98 echo $head >$last_build