now sync needs to run as root

This commit is contained in:
2025-10-06 11:55:51 -03:00
parent 0a965c67c2
commit b89abb31df

View File

@@ -105,11 +105,10 @@ var syncCmd = &cobra.Command{
log.Fatal("index.db does not exist, try to use \"packets sync\"") log.Fatal("index.db does not exist, try to use \"packets sync\"")
} }
} }
f, err := os.OpenFile(consts.IndexDB, os.O_WRONLY, 0)
if err != nil { if os.Getuid() != 0 {
log.Fatalf("can't open to write [ %s ]. Are you running packets as root?\n", consts.IndexDB) log.Fatal("are you running packets as root?")
} }
f.Close()
syncUrl := consts.DefaultSyncUrl syncUrl := consts.DefaultSyncUrl
if len(args) > 0 { if len(args) > 0 {