Created
November 16, 2024 04:27
-
-
Save thomasjslone/b002cd459ccce945681fed2d6a8a37dc to your computer and use it in GitHub Desktop.
rubin core install location changed handler code, older code witha snippet that allows linux to have disks named rubin or multiple dirs named rubin in the path
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
##about this code | |
## in windows a mounted disks path is a drive letter C:/ E:/ F:/ ect. | |
## however in linux the path is the name of the disk, if a disk is named "rubin" the launch | |
## will fail because it expects the name rubin to only be in a path once | |
##this error will also occur if the install is nested in multiple directories named 'rubin' | |
## this code is outdated and may not be needed anymore | |
##check host WORKDIR and make sure its install directory, adjust installation_header if rubin has been moved unexpectedly | |
if Dir.getwd.to_s.downcase!=INSTALLATION_HEADER[1].to_s.downcase | |
boot_log << "Workdir is not install dir: "+INSTALLATION_HEADER[1].to_s | |
## the entire install directory has been unexpectedly moved | |
if File.file?(Dir.getwd+"/system/rubin.rb") | |
## code to deal with two rubins in the string, on linux the path is the system path to storage then the drive name | |
new_homedir = Dir.getwd | |
path=new_homedir+"/system/rubin.rb" | |
data=File.read(path) | |
header=data.split("\n")[0] | |
header=header.split("=")[-1] | |
header = self.instance_eval(header) | |
header[1]=new_homedir | |
header="INSTALLATION_HEADER="+header.to_s | |
ndata=header.to_s+"\n"+data.split("\n")[1..-1].join("\n") | |
f=File.open(path,"w"); f.write(ndata); f.close | |
Dir.chdir(new_homedir) | |
$homedir=new_homedir | |
##now we gotta restart | |
if $debug | |
puts "System Install dir was recently moved and info had to be updated before startup." | |
puts "Restarting in 3 seconds." | |
sleep 3.0 | |
end | |
system("start launch.rb") | |
sleep 0.2 | |
exit | |
else | |
## | |
##do further checks here and elaborate on workdir | |
if $debug; puts "BOOT CANNOT CONTINUE, INSTALLATION NOT FOUND"; sleep 3.0; end; raise "BOOT FAILED"#exit | |
end | |
else;$homedir=Dir.getwd | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment