Fix deployment with readonly root

This commit is contained in:
Moritz Bitsch 2021-10-14 14:13:49 +02:00
parent b5ae1b67a5
commit 8ee3c66d87

View file

@ -55,13 +55,13 @@ func main() {
} }
defer connection.Close() defer connection.Close()
err = deployFile(connection, flag.Arg(1), path.Base(flag.Arg(1)), "0755") err = deployFile(connection, flag.Arg(1), "/tmp/"+path.Base(flag.Arg(1)), "0755")
if err != nil { if err != nil {
fmt.Fprintf(os.Stderr, "Can't deploy file: %s", err.Error()) fmt.Fprintf(os.Stderr, "Can't deploy file: %s", err.Error())
os.Exit(1) os.Exit(1)
} }
session, err := startGDB(connection, "./"+path.Base(flag.Arg(1))) session, err := startGDB(connection, "/tmp/"+path.Base(flag.Arg(1)))
if err != nil { if err != nil {
fmt.Fprintf(os.Stderr, "Can't start gdb: %s", err.Error()) fmt.Fprintf(os.Stderr, "Can't start gdb: %s", err.Error())
os.Exit(1) os.Exit(1)
@ -98,6 +98,8 @@ func startGDB(client *ssh.Client, remoteCommand string) (*ssh.Session, error) {
} }
func deployFile(client *ssh.Client, localPath, remotePath string, permissions string) error { func deployFile(client *ssh.Client, localPath, remotePath string, permissions string) error {
fmt.Printf("Deploy: %s -> %s\n", localPath, remotePath)
reader, err := os.Open(localPath) reader, err := os.Open(localPath)
if err != nil { if err != nil {
return err return err