Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Explicitly specify full path to (pre)-postinstall scripts on the box being built #352

wants to merge 2 commits into from

3 participants


I had this case with building Win7 box, which uses cygwin's sshd

  1. scp (in provider/core/box/build.rb) initiated copy of file with the path on the box being ./ ie. relative to the login directory; which in case of cygwin is / if the user hasn't started cygwin shell from Windows yet
  2. I started cygwin shell that automatically created /home/myusername directory associating it with the home for this user
  3. successive exec of "chmod +x ./" on the box failed not being able to find the file as the file is located in / but this login ended up in /home/myusername.

This happened because there was a considerable delay (15-30 sec) between completion of scp (step 1.) and execution of exec (step 3.) commands when I just clicked on Cygwin icon on Windows desktop. Sorry, I didn't dig into this. This could be either timeouts in the calling code or this could be related to some delays in the ssh port forwarded connection due to my Mac's or VirtualBox configurations.

However, I think, it would be good to always explicitly specify the location of the target remote file so that it can always be found in a predefined place. I set it to /tmp ... but it can be anything else.



Sorry. The merge 001c0e6 have to be ignored.


@konstan would it help if veewee checks/creates the homedirectory first before putting the files ? This would allow the files to be in the right spot for that user. Not sure if windows user creation will like this that the homedir is already there.


now 1) this is far to outdated, 2) is this still a problem 3) does the fix still apply? - maybe could you rebase the fix?

@mpapis mpapis added the need info label
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 13 additions and 10 deletions.
  1. +13 −10 lib/veewee/provider/core/box/build.rb
23 lib/veewee/provider/core/box/build.rb
@@ -193,21 +193,25 @@ def handle_kickstart(options)
# It requires a box(to login to) and a definition(listing the postinstall files)
def handle_postinstall(options)
+ remote_base = "/tmp/"
# Transfer all postinstall files
definition.postinstall_files.each do |postinstall_file|
# Filenames of postinstall_files are relative to their definition
- filename=File.join(definition.path,postinstall_file)
- self.scp(filename,File.basename(filename))
- self.exec("chmod +x \"#{File.basename(filename)}\"")
+ local_file=File.join(definition.path,postinstall_file)
+ remote_file = remote_base + File.basename(local_file)
+ self.scp(local_file,remote_file)
+ self.exec("chmod +x \"#{remote_file}\"")
# Prepare a pre_poinstall file if needed (not nil , or not empty)
unless definition.pre_postinstall_file.to_s.empty?
pre_filename=File.join(definition.path, definition.pre_postinstall_file)
- self.scp(pre_filename,File.basename(pre_filename))
- self.exec("chmod +x \"#{File.basename(pre_filename)}\"")
+ remote_file = remote_base + File.basename(pre_filename)
+ self.scp(pre_filename,remote_file)
+ self.exec("chmod +x \"#{remote_file}\"")
# Inject the call to the real script by executing the first argument (it will be the postinstall script file name to be executed)
- self.exec("execute=\"\\n# We must execute the script passed as the first argument\\n\\$1\" && printf \"%b\\n\" \"$execute\" >> #{File.basename(pre_filename)}")
+ self.exec("execute=\"\\n# We must execute the script passed as the first argument\\n\\$1\" && printf \"%b\\n\" \"$execute\" >> #{remote_file}")
# Now iterate over the postinstall files
@@ -220,11 +224,10 @@ def handle_postinstall(options)
unless definition.pre_postinstall_file.to_s.empty?
# Filename of pre_postinstall_file are relative to their definition
pre_filename=File.join(definition.path, definition.pre_postinstall_file)
- # Upload the pre postinstall script if not already transfered
- command = "./" + File.basename(pre_filename)
- command = sudo(command) + " ./"+File.basename(filename)
+ command = remote_base + File.basename(pre_filename)
+ command = sudo(command) + " " + remote_base + File.basename(filename)
- command = "./"+File.basename(filename)
+ command = remote_base + File.basename(filename)
command = sudo(command)
Something went wrong with that request. Please try again.