Skip to content

Commit 57bb0ea

Browse files
committed
fix: default path, build, log
1 parent b484ca4 commit 57bb0ea

File tree

7 files changed

+15
-19
lines changed

7 files changed

+15
-19
lines changed

build_android.sh

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ fi
1111
if [ ! -d "$ANDROID_NDK_PATH" ]; then
1212
echo "Android NDK path not found: $ANDROID_NDK_PATH" # ANDROID_NDK_PATH="/tmp/android-ndk-r27c-linux/toolchains/llvm/prebuilt/linux-x86_64/bin"
1313
# exit 1
14-
curl -L https://dl.google.com/android/repository/android-ndk-r27c-linux.zip -o /tmp/android-ndk-r27c-linux.zip
14+
curl -# -L https://dl.google.com/android/repository/android-ndk-r27c-linux.zip -o /tmp/android-ndk-r27c-linux.zip
1515
unzip -q /tmp/android-ndk-r27c-linux.zip -d /tmp
1616
mv /tmp/android-ndk-r27c /tmp/android-ndk-r27c-linux
1717
rm /tmp/android-ndk-r27c-linux.zip
@@ -119,7 +119,6 @@ REMOVE=(
119119
drive
120120
debugeventbus
121121
debug
122-
portmapper
123122
debugportmapper
124123
tailnetlock
125124
syspolicy
@@ -156,12 +155,15 @@ echo "Build completed: $(file ./dist/tailscaled.$GOARCH)"
156155
if [ -n "$USE_UPX" ]; then
157156
if ! command -v upx &> /dev/null; then
158157
echo "UPX not found, downloading..."
159-
curl -L https://github.com/upx/upx/releases/download/v5.0.2/upx-5.0.2-amd64_linux.tar.xz -o /tmp/upx.tar.xz
158+
curl -# -L https://github.com/upx/upx/releases/download/v5.0.2/upx-5.0.2-amd64_linux.tar.xz -o /tmp/upx.tar.xz
160159
tar -xf /tmp/upx.tar.xz -C /tmp
161160
sudo mv /tmp/upx-5.0.2-amd64_linux/upx /usr/local/bin/
162161
rm -rf /tmp/upx.tar.xz /tmp/upx-5.0.2-amd64_linux
163162
echo "UPX installed"
164163
fi
164+
if ! command -v file &> /dev/null; then
165+
sudo apt install file -y
166+
fi
165167
echo "File size before compression: $(du -h ./dist/tailscaled.$GOARCH | cut -f1)"
166168
echo "Compressing with UPX..."
167169
if upx --lzma --best ./dist/tailscaled.$GOARCH 2>&1 | grep -q "AlreadyPackedException"; then

cmd/tailscaled/tailscaled.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ func main() {
249249
flag.StringVar(&args.birdSocketPath, "bird-socket", "", "path of the bird unix socket")
250250
}
251251
flag.BoolVar(&printVersion, "version", false, "print version information and exit")
252-
flag.BoolVar(&args.disableLogs, "no-logs-no-support", false, "disable log uploads; this also disables any technical support")
252+
flag.BoolVar(&args.disableLogs, "no-logs-no-support", true, "disable log uploads; this also disables any technical support")
253253
flag.StringVar(&args.confFile, "config", "", "path to config file, or 'vm:user-data' to use the VM's user-data (EC2)")
254254
if buildfeatures.HasTPM {
255255
flag.Var(&args.hardwareAttestation, "hardware-attestation", "use hardware-backed keys to bind node identity to this device when supported by the OS and hardware. Uses TPM 2.0 on Linux and Windows; SecureEnclave on macOS and iOS; and Keystore on Android")

logpolicy/logpolicy.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,17 +252,18 @@ func LogsDir(logf logger.Logf) string {
252252
}
253253
}
254254

255-
cacheDir, err := os.UserCacheDir()
256255
if runtime.GOOS == "android" {
257256
prefix := os.Getenv("PREFIX")
258257
if prefix == "" {
259258
if os.Geteuid() == 0 {
260-
return filepath.Join("data", "adb", "tailscale", "log")
259+
return "/data/adb/tailscale/log"
261260
}
262261
return filepath.Join(os.TempDir(), "tailscale", "log")
263262
}
264263
return filepath.Join(prefix, "var", "log", "tailscale")
265264
}
265+
266+
cacheDir, err := os.UserCacheDir()
266267
if err == nil {
267268
d := filepath.Join(cacheDir, "Tailscale")
268269
logf("logpolicy: using UserCacheDir, %q", d)

net/dns/resolvconfpath_android.go

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,12 @@ func init() {
1616
prefix := os.Getenv("PREFIX")
1717
if prefix == "" {
1818
if os.Geteuid() == 0 {
19-
if fi, err := os.Stat("/data/adb/tailscale"); err == nil && fi.IsDir() {
20-
prefix = "/data/adb/tailscale"
21-
} else if wd, err := os.Getwd(); err == nil {
22-
prefix = wd
23-
} else {
24-
prefix = os.TempDir()
25-
}
19+
prefix = "/data/adb/tailscale"
2620
} else {
27-
prefix = os.TempDir()
21+
prefix = filepath.Join(os.TempDir(), "tailscale")
2822
}
2923
}
3024
dnsDir := filepath.Join(prefix, "etc")
31-
os.MkdirAll(dnsDir, 0755)
3225
resolvConf = filepath.Join(dnsDir, "resolv.conf")
3326
backupConf = filepath.Join(dnsDir, "resolv.pre-tailscale-backup.conf")
3427
}

paths/paths.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ func DefaultTailscaledSocket() string {
2626
prefix := os.Getenv("PREFIX")
2727
if prefix == "" {
2828
if os.Geteuid() == 0 {
29-
return filepath.Join("data", "adb", "tailscale", "tmp", "tailscaled.sock")
29+
return "/data/adb/tailscale/tailscaled.sock"
3030
}
3131
return filepath.Join(os.TempDir(), "tailscale", "tailscaled.sock")
3232
}
@@ -102,7 +102,7 @@ func DefaultTailscaledStateDir() string {
102102
// when it's absent.
103103
func MakeAutomaticStateDir() bool {
104104
switch runtime.GOOS {
105-
case "plan9":
105+
case "plan9", "android":
106106
return true
107107
case "linux":
108108
if distro.Get() == distro.JetKVM {

paths/paths_unix.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ func statePath() string {
3737
prefix := os.Getenv("PREFIX")
3838
if prefix == "" {
3939
if os.Geteuid() == 0 {
40-
return filepath.Join("data", "adb", "tailscale", "tmp", "tailscaled.state")
40+
return "/data/adb/tailscale/tailscaled.state"
4141
}
4242
return filepath.Join(os.TempDir(), "tailscale", "tailscaled.state")
4343
}

tsweb/tsweb.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ func DefaultCertDir(leafDir string) string {
4444
prefix := os.Getenv("PREFIX")
4545
if prefix == "" {
4646
if os.Geteuid() == 0 {
47-
return filepath.Join("data", "adb", "tailscale", "certs")
47+
return "/data/adb/tailscale/certs"
4848
}
4949
return filepath.Join(os.TempDir(), "tailscale", "certs")
5050
}

0 commit comments

Comments
 (0)