Skip to content

Commit

Permalink
copy files hack
Browse files Browse the repository at this point in the history
Signed-off-by: Kirtana Ashok <[email protected]>
  • Loading branch information
kiashok committed Sep 10, 2024
1 parent 777f798 commit 8a5fb6c
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions internal/wclayer/baselayerwriter.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@ package wclayer
import (
"context"
"errors"
"fmt"
"os"
"path/filepath"
"syscall"

"github.com/Microsoft/go-winio"
"github.com/Microsoft/hcsshim/internal/copyfile"
"github.com/Microsoft/hcsshim/internal/hcserror"
"github.com/Microsoft/hcsshim/internal/oc"
"github.com/Microsoft/hcsshim/internal/safefile"
Expand Down Expand Up @@ -173,6 +175,20 @@ func (w *baseLayerWriter) Close() (err error) {
if err != nil {
return err
}

// hack to copy some executables over to GCS for sidecar implementation
err = winio.EnableProcessPrivileges([]string{winio.SeBackupPrivilege, winio.SeRestorePrivilege})
if err != nil {
return err
}

sourcePath := filepath.Join("C:\\", "Users", "kiashok", "cc-images")
dstPath := filepath.Join(w.root.Name(), "UtilityVM", "Files", "Windows")
err = copyfile.CopyFile(w.ctx, sourcePath, dstPath, true)
if err != nil {
return fmt.Errorf("err copying file into GCS %v", err)
}

err = ProcessUtilityVMImage(w.ctx, filepath.Join(w.root.Name(), "UtilityVM"))
if err != nil {
return err
Expand Down

0 comments on commit 8a5fb6c

Please sign in to comment.