Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

explicit path to (pre)-postinstall files on the box during the build …

…process.
  • Loading branch information...
commit e3a011b5e013b862b71f97be9a7ce247cdd6246a 1 parent 1ac899d
@konstan authored
Showing with 13 additions and 10 deletions.
  1. +13 −10 lib/veewee/provider/core/box/build.rb
View
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}\"")
end
# 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}")
end
# 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)
else
- command = "./"+File.basename(filename)
+ command = remote_base + File.basename(filename)
command = sudo(command)
end
Please sign in to comment.
Something went wrong with that request. Please try again.