move image builder to only generate tarballs

Signed-off-by: Xe <me@christine.website>
This commit is contained in:
Cadey Ratio 2022-05-09 16:49:29 +00:00
parent 57a690f34f
commit 1ea3321f55
1 changed files with 5 additions and 4 deletions

View File

@ -19,6 +19,7 @@ var (
out = flag.String("out", ".", "where to save squashfs images to") out = flag.String("out", ".", "where to save squashfs images to")
tsTarballPath = flag.String("tarball", "./var/tailscale_1.24.2_amd64.tgz", "path to tailscale tarball on disk") tsTarballPath = flag.String("tarball", "./var/tailscale_1.24.2_amd64.tgz", "path to tailscale tarball on disk")
distro = flag.String("distro", "steamos", "distro to stamp into system extension") distro = flag.String("distro", "steamos", "distro to stamp into system extension")
versionID = flag.String("version-id", "3.2", "The current version of SteamOS")
//go:embed tailscaled.service //go:embed tailscaled.service
systemdService []byte systemdService []byte
@ -96,6 +97,7 @@ func main() {
} }
fmt.Fprintln(fout, "SYSEXT_LEVEL=1.0") fmt.Fprintln(fout, "SYSEXT_LEVEL=1.0")
fmt.Fprintf(fout, "VERSION_ID=%s")
fmt.Fprintf(fout, "ID=%s", *distro) fmt.Fprintf(fout, "ID=%s", *distro)
err = fout.Close() err = fout.Close()
@ -118,13 +120,12 @@ func main() {
log.Fatal(err) log.Fatal(err)
} }
binPath, err := exec.LookPath("mksquashfs") binPath, err := exec.LookPath("tar")
if err != nil { if err != nil {
log.Fatal(err) log.Fatal(err)
} }
cmd := exec.Command(binPath, "czf", fmt.Sprintf("%s/tailscale_sysext_%s.tar.gz", *out, sp[1]), "usr")
sp := strings.Split(filepath.Base(*tsTarballPath), "_") cmd.Dir = tmpDir
cmd := exec.Command(binPath, tmpDir, fmt.Sprintf("%s/tailscale_sysext_%s.raw", *out, sp[1]), "-quiet", "-noappend", "-all-root", "-root-mode", "755", "-b", "1M", "-comp", "xz", "-Xdict-size", "100%")
cmd.Stderr = os.Stderr cmd.Stderr = os.Stderr
cmd.Stdout = os.Stdout cmd.Stdout = os.Stdout
if err := cmd.Run(); err != nil { if err := cmd.Run(); err != nil {