ソースを参照

Added start script backup

Toby Chui 3 年 前
コミット
2387b5e809
9 ファイル変更26 行追加1 行削除
  1. 8 0
      fs.go
  2. BIN
      launcher_darwin_amd64
  3. BIN
      launcher_linux_amd64
  4. BIN
      launcher_linux_arm
  5. BIN
      launcher_linux_arm64
  6. 1 1
      main.go
  7. 1 0
      start.bat
  8. 1 0
      start.sh
  9. 15 0
      update.go

+ 8 - 0
fs.go

@@ -17,6 +17,14 @@ func restoreConfigs() {
 	restoreIfExists("system/cron.json")
 	restoreIfExists("system/storage.json")
 	restoreIfExists("web/SystemAO/vendor/")
+
+	//Restore start script
+	if fileExists("./arozos.old/start.sh") {
+		copy("./arozos.old/start.sh", "./start.sh")
+	}
+	if fileExists("./arozos.old/start.bat") {
+		copy("./arozos.old/start.bat", "./start.bat")
+	}
 }
 
 func restoreOldArozOS() {

BIN
launcher_darwin_amd64


BIN
launcher_linux_amd64


BIN
launcher_linux_arm


BIN
launcher_linux_arm64


+ 1 - 1
main.go

@@ -19,7 +19,7 @@ import (
 */
 
 const (
-	launcherVersion   = "1.0"
+	launcherVersion   = "1.1"
 	restoreRetryCount = 3 //The number of retry before restore old version, if not working after restoreRetryCount + 1 launcher will exit
 )
 

+ 1 - 0
start.bat

@@ -0,0 +1 @@
+asd asd asd 

+ 1 - 0
start.sh

@@ -0,0 +1 @@
+asd asd asd 

+ 15 - 0
update.go

@@ -20,12 +20,27 @@ func updateIfExists(binaryName string) {
 			fmt.Println("[LAUNCHER] Starting system backup process (to ./arozos.old)")
 			os.MkdirAll("./arozos.old", 0775)
 			copy(binaryName, filepath.Join("./arozos.old", filepath.Base(binaryName)))
+
+			//Backup the start.sh script and start.bat script if exists
+			if fileExists("./start.sh") {
+				copy("./start.sh", "./arozos.old/start.sh")
+			}
+
+			if fileExists("./start.bat") {
+				copy("./start.bat", "./arozos.old/start.bat")
+			}
+
+			//Backup the important system files
+			fmt.Println("[LAUNCHER] Backing up system files")
 			cp.Copy("./system", "./arozos.old/system/")
+
+			fmt.Println("[LAUNCHER] Backing up web server")
 			cp.Copy("./web", "./arozos.old/web/")
 
 			//Success. Continue binary replacement
 			fmt.Println("[LAUNCHER] Copying updates to runtime environment")
 			copy(newArozBinary, binaryName)
+
 			cp.Copy("./updates/system", "./system/")
 			cp.Copy("./updates/web", "./web/")