Examples could be things like specific configuration defaults or general decision-making in leadership.

What would you change?

  • @Samueru
    link
    0
    edit-2
    11 months ago

    You can use an alias for that. Or even a wrapper script that intercepts that.

    For example you could place this script in your PATH named idk mmm installpkg (install might be an issue for a name)

    Which would do the following:

    #!/bin/sh
    
    sudo pacman -S $@
    

    So when you type installpkg vim it will run sudo pacman -S vim

    You can repeat that for pacman -Syu, pacman -Rsn, etc. You can even replace pacman for your aur helper instead. (remove the sudo if you will use an aur helper instead).

    • @[email protected]
      link
      fedilink
      511 months ago

      I think the point is that if one needs to read a thousand pages of documentation before they can start using a new operating system they will just give up regardless of how good it is.

      Installing packages is probably one of the first things you’d want to do so there is a lot of value in keeping its design intuitive.

      The ‘you can make an alias or script for it’ argument only works if someone already has a working understanding of the underlying mechanisms. Which you can assume it someone gradually gets introduced to a Programme, but not if they are making a big switch like installing a new OS.

      • @Samueru
        link
        5
        edit-2
        11 months ago

        Oh I totally agree with that. But I don’t think the regular a new user should be using CLI tools to install packages. There are plenty of GUI tools that should be doing that for you instead.

        And if they did, it should be very simplified with a wrapper script like in the example above, iirc the common command update-grub is a wrapper script that simplifies it, it is a shame this isn’t more common with other tasks.

        This could be even standardized, like regardless of the distro if you type installpkg vim, the installpkg script would do something like this that will run it thru the most popular packages managers to do the simple operation:

        # Install with 'pacman' (if available)
        if command -v pacman >/dev/null 2>&1; then
            sudo pacman -S $@ || exit 1
        fi
        
        # Install with 'apt' (if available)
        if command -v apt >/dev/null 2>&1; then
            sudo apt install $@ || exit 1
        fi
        
        # Install with 'dnf' (if available)
        if command -v dnf >/dev/null 2>&1; then
            sudo dnf install $@ || exit 1
        fi
        
        echo "No package manager found"
        
    • L3ft_F13ld!
      link
      fedilink
      411 months ago

      Just curious, why a script instead of just a bash alias or something like it?

      • @Samueru
        link
        3
        edit-2
        11 months ago

        alias totally works, but if you want to simplify it for multiple package managers then it is better to use a script.

        Like this example that when the user types pkginstall vim, pkginstall would be a script in path that would do the operation regarless of the package manager:

        # Install with 'pacman' (if available)
        if command -v pacman >/dev/null 2>&1; then
            sudo pacman -S $@ || exit 1
        fi
        
        # Install with 'apt' (if available)
        if command -v apt >/dev/null 2>&1; then
            sudo apt install $@ || exit 1
        fi
        
        # Install with 'dnf' (if available)
        if command -v dnf >/dev/null 2>&1; then
            sudo dnf install $@ || exit 1
        fi
        

        They could even install it in their ~/.local/bin, and as long as their distro makes that part of PATH (which arch does not kek) by just using that same home with another distro they already could install/remove packages and update using those wrapper scripts regardless of the distro.

        If you are wondering why the script needs to check if the package manager exists, it is because when testing it I discovered that if the first one is not installed it will cancel the operation and not continue, and if I remove the exit 1 it will attempt to use the next package manager when canceling the operation with ctrl+c.

        • L3ft_F13ld!
          link
          fedilink
          311 months ago

          Thanks for the solid explanation.

          As a noob that doesn’t change my distro too often, I never would have thought of something like this.