-
Notifications
You must be signed in to change notification settings - Fork 2
/
main.go
58 lines (50 loc) · 1.57 KB
/
main.go
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
// SPDX-License-Identifier: GPL-3.0-only
//
// This file is part of the podman-launcher project:
//
// https://github.com/89luca89/podman-launcher
//
// # Copyright (C) 2023 podman-launcher contributors
//
// podman-launcher is free software; you can redistribute it and/or modify it
// under the terms of the GNU General Public License version 3
// as published by the Free Software Foundation.
//
// podman-launcher is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with podman-launcher; if not, see <http://www.gnu.org/licenses/>.
package main
import (
_ "embed"
"os"
"os/exec"
"path/filepath"
"github.com/89luca89/podman-launcher/pkg/launcher"
)
//go:embed assets.tar.gz
var pack []byte
var (
targetDir = filepath.Join(os.Getenv("HOME"), ".local/share/podman-static")
tmpDir = "/var/tmp"
)
func main() {
// if specific PODMAN_STATIC_TARGET_DIR is set, then use that instead
if os.Getenv("PODMAN_STATIC_TARGET_DIR") != "" {
targetDir = os.Getenv("PODMAN_STATIC_TARGET_DIR")
}
// if specific PODMAN_STATIC_TMP_DIR is set, then use that instead
if os.Getenv("PODMAN_STATIC_TMP_DIR") != "" {
tmpDir = os.Getenv("PODMAN_STATIC_TMP_DIR")
}
conf := launcher.NewLauncher(targetDir, tmpDir, pack)
err := conf.Run(os.Args)
if err != nil {
if exiterr, ok := err.(*exec.ExitError); ok {
os.Exit(exiterr.ExitCode())
}
}
}