mirror of
https://github.com/henrygd/beszel.git
synced 2025-12-17 02:36:17 +01:00
Fix hub executable (#1193)
This commit is contained in:
@@ -22,6 +22,12 @@ func Update(cmd *cobra.Command, _ []string) {
|
|||||||
// Check if china-mirrors flag is set
|
// Check if china-mirrors flag is set
|
||||||
useMirror, _ := cmd.Flags().GetBool("china-mirrors")
|
useMirror, _ := cmd.Flags().GetBool("china-mirrors")
|
||||||
|
|
||||||
|
// Get the executable path before update
|
||||||
|
exePath, err := os.Executable()
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
updated, err := ghupdate.Update(ghupdate.Config{
|
updated, err := ghupdate.Update(ghupdate.Config{
|
||||||
ArchiveExecutable: "beszel",
|
ArchiveExecutable: "beszel",
|
||||||
DataDir: dataDir,
|
DataDir: dataDir,
|
||||||
@@ -35,12 +41,9 @@ func Update(cmd *cobra.Command, _ []string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// make sure the file is executable
|
// make sure the file is executable
|
||||||
exePath, err := os.Executable()
|
|
||||||
if err == nil {
|
|
||||||
if err := os.Chmod(exePath, 0755); err != nil {
|
if err := os.Chmod(exePath, 0755); err != nil {
|
||||||
fmt.Printf("Warning: failed to set executable permissions: %v\n", err)
|
fmt.Printf("Warning: failed to set executable permissions: %v\n", err)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Try to restart the service if it's running
|
// Try to restart the service if it's running
|
||||||
restartService()
|
restartService()
|
||||||
|
|||||||
Reference in New Issue
Block a user