diff --git a/main/managementinterface.go b/main/managementinterface.go index d5447e08..e4bafbc2 100644 --- a/main/managementinterface.go +++ b/main/managementinterface.go @@ -20,6 +20,7 @@ import ( "log" "net/http" "os" + "os/exec" "strings" "syscall" "text/template" @@ -312,6 +313,19 @@ func defaultServer(w http.ResponseWriter, r *http.Request) { http.FileServer(http.Dir("/var/www")).ServeHTTP(w, r) } +func handleroPartitionRebuild() { + out, err := exec.Command("/usr/sbin/rebuild_ro_part.sh").Output() + + var ret_err error + if err != nil { + ret = fmt.Errorf("Rebuild RO Partition error: %s", err.Error()) + } else { + ret = fmt.Errorf("Rebuild RO Partition success: %s", out) + } + + addSystemError(ret_err) +} + // https://gist.github.com/alexisrobert/982674. // Copyright (c) 2010-2014 Alexis ROBERT . const dirlisting_tpl = ` @@ -440,6 +454,7 @@ func managementInterface() { http.HandleFunc("/reboot", handleRebootRequest) http.HandleFunc("/getClients", handleClientsGetRequest) http.HandleFunc("/updateUpload", handleUpdatePostRequest) + http.HandleFunc("/roPartitionRebuild", handleroPartitionRebuild) err := http.ListenAndServe(managementAddr, nil)