@@ -168,13 +168,14 @@ func ensureHosts(e types.Exec, identityFile string) {
168168func handleCopySourceDir (isNew bool , e types.Exec , privKey string ) error {
169169 // TODO: Wait until port is open before cleaning up the source code
170170
171+ const dstPath = "/home/unweave"
171172 if ! config .NoCopySource && isNew {
172173 dir , err := config .GetActiveProjectPath ()
173174 if err != nil {
174175 ui .Errorf ("Failed to get active project path. Skipping copying source directory" )
175176 return fmt .Errorf ("failed to get active project path: %v" , err )
176177 }
177- if err := copySource (e .ID , dir , "/home/ubuntu" , * e .Connection , privKey ); err != nil {
178+ if err := copySource (e .ID , dir , dstPath , * e .Connection , privKey ); err != nil {
178179 fmt .Println (err )
179180 }
180181 } else {
@@ -264,6 +265,8 @@ func copySourceUnTar(srcPath, dstPath string, connectionInfo types.ConnectionInf
264265 "-o" , "UserKnownHostsFile=/dev/null" ,
265266 "-i" , prvKeyPath ,
266267 fmt .Sprintf ("%s@%s" , connectionInfo .User , connectionInfo .Host ),
268+ // ensure dstPath exist and root logs into that path
269+ fmt .Sprintf ("mkdir -p %s && echo 'cd %s' > /root/.bashrc &&" , dstPath , dstPath ),
267270 fmt .Sprintf ("tar -xzf %s -C %s && rm -rf %s" , srcPath , dstPath , srcPath ),
268271 )
269272
0 commit comments