mirror of
https://github.com/tailscale/tailscale.git
synced 2024-11-29 04:55:31 +00:00
db39a43f06
This PR is all about adding functionality that will enable the installer's upgrade sequence to terminate processes belonging to the previous version, and then subsequently restart instances belonging to the new version within the session(s) corresponding to the processes that were killed. There are multiple parts to this: * We add support for the Restart Manager APIs, which allow us to query the OS for a list of processes locking specific files; * We add the RestartableProcess and RestartableProcesses types that query additional information about the running processes that will allow us to correctly restart them in the future. These types also provide the ability to terminate the processes. * We add the StartProcessInSession family of APIs that permit us to create new processes within specific sessions. This is needed in order to properly attach a new GUI process to the same RDP session and desktop that its previously-terminated counterpart would have been running in. * I tweaked the winutil token APIs again. * A lot of this stuff is pretty hard to test without a very elaborate harness, but I added a unit test for the most complicated part (though it requires LocalSystem to run). Updates https://github.com/tailscale/corp/issues/13998 Signed-off-by: Aaron Klotz <aaron@tailscale.com>
69 lines
1.8 KiB
Bash
Executable File
69 lines
1.8 KiB
Bash
Executable File
#!/bin/sh
|
|
#
|
|
# Copyright (c) Tailscale Inc & AUTHORS
|
|
# SPDX-License-Identifier: BSD-3-Clause
|
|
#
|
|
# check_license_headers.sh checks that all Go files in the given
|
|
# directory tree have a correct-looking Tailscale license header.
|
|
|
|
check_file() {
|
|
got=$1
|
|
|
|
want=$(cat <<EOF
|
|
// Copyright (c) Tailscale Inc & AUTHORS
|
|
// SPDX-License-Identifier: BSD-3-Clause
|
|
EOF
|
|
)
|
|
if [ "$got" = "$want" ]; then
|
|
return 0
|
|
fi
|
|
return 1
|
|
}
|
|
|
|
if [ $# != 1 ]; then
|
|
echo "Usage: $0 rootdir" >&2
|
|
exit 1
|
|
fi
|
|
|
|
fail=0
|
|
for file in $(find $1 \( -name '*.go' -or -name '*.tsx' -or -name '*.ts' -not -name '*.config.ts' \) -not -path '*/.git/*' -not -path '*/node_modules/*'); do
|
|
case $file in
|
|
$1/tempfork/*)
|
|
# Skip, tempfork of third-party code
|
|
;;
|
|
$1/wgengine/router/ifconfig_windows.go)
|
|
# WireGuard copyright.
|
|
;;
|
|
$1/cmd/tailscale/cli/authenticode_windows.go)
|
|
# WireGuard copyright.
|
|
;;
|
|
*_string.go)
|
|
# Generated file from go:generate stringer
|
|
;;
|
|
$1/control/controlbase/noiseexplorer_test.go)
|
|
# Noiseexplorer.com copyright.
|
|
;;
|
|
*/zsyscall_windows.go)
|
|
# Generated syscall wrappers
|
|
;;
|
|
$1/util/winutil/subprocess_windows_test.go)
|
|
# Subprocess test harness code
|
|
;;
|
|
$1/util/winutil/testdata/testrestartableprocesses/main.go)
|
|
# Subprocess test harness code
|
|
;;
|
|
*)
|
|
header="$(head -2 $file)"
|
|
if ! check_file "$header"; then
|
|
fail=1
|
|
echo "${file#$1/} doesn't have the right copyright header:"
|
|
echo "$header" | sed -e 's/^/ /g'
|
|
fi
|
|
;;
|
|
esac
|
|
done
|
|
|
|
if [ $fail -ne 0 ]; then
|
|
exit 1
|
|
fi
|