now upgradeCmd is being used, message when downloading, and upgrade need to run as root
This commit is contained in:
		@@ -480,6 +480,10 @@ var upgradeCmd = &cobra.Command{
 | 
			
		||||
	Short: "upgrade all installed packages",
 | 
			
		||||
	Run: func(cmd *cobra.Command, args []string) {
 | 
			
		||||
 | 
			
		||||
		if os.Getuid() != 0 {
 | 
			
		||||
			log.Fatal("you must run this command as root")
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		cfg, err := configs.GetConfigTOML()
 | 
			
		||||
		if err != nil {
 | 
			
		||||
			log.Fatal(err)
 | 
			
		||||
@@ -523,6 +527,7 @@ func main() {
 | 
			
		||||
	rootCmd.AddCommand(syncCmd)
 | 
			
		||||
	rootCmd.AddCommand(listCmd)
 | 
			
		||||
	rootCmd.AddCommand(searchCmd)
 | 
			
		||||
	rootCmd.AddCommand(upgradeCmd)
 | 
			
		||||
	rootCmd.Execute()
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -446,6 +446,7 @@ func GetPackage(id string) (Package, error) {
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if len(peers) == 0 {
 | 
			
		||||
		fmt.Printf(":: Pulling from %s\n", packageUrl)
 | 
			
		||||
		this.PackageF, err = GetFileHTTP(packageUrl)
 | 
			
		||||
		if err != nil {
 | 
			
		||||
			return Package{}, err
 | 
			
		||||
@@ -453,6 +454,7 @@ func GetPackage(id string) (Package, error) {
 | 
			
		||||
	} else {
 | 
			
		||||
		var totalerrors int = 0
 | 
			
		||||
		for _, peer := range peers {
 | 
			
		||||
			fmt.Printf(":: Pulling from local network (%s)\n", peer.IP)
 | 
			
		||||
			this.PackageF, err = GetFileHTTP(fmt.Sprintf("http://%s:%d/%s", peer.IP, peer.Port, filename))
 | 
			
		||||
			if err == nil {
 | 
			
		||||
				break
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user