[#TODO] Support more package manager
NNBnh opened this issue ยท 16 comments
Current state:
Lines 47 to 77 in ef20588
#TODO
- Linux:
- BSD:
- OpenBSD PKG (for OpenBSD)
- PKG NG (for FreeBSD and DragonFly)
- Mports (for MidnightBSD)
- PKG IN (for NetBSD)
- MacOS:
- Other:
- Termux PKG (for Termux)
- Language:
You can help us by summit:
- A mark (3 letter)
- A package manager tool
- A full command with flags to install packages
- A setup function
- NOTE:
- The less user input needed the better, you should add no-confirm flag like
--noconfirm
,--non-interactive
,--assume-yes
, ... to the commands - For more Clarity, use full flag instead of short flag (E.g: use
--sync
over-S
)
- The less user input needed the better, you should add no-confirm flag like
Example:
Pacman_MARK='PAC'
Pacman_PM='pacman'
Pacman_COMMAND="$PERMISSION_COMMAND $Pacman_PM --sync --noconfirm --needed"
superbbootstrap_Pacman() {
sudo pacman --sync --sysupgrade --refresh --noconfirm --needed
}
NOTE:
$PERMISSION_COMMAND
is default tosudo
on Linux anddoas
on BSD
Zypper (openSUSE)
Zypper_MARK='ZPR'; Zypper_COMMAND='sudo zypper refresh && sudo zypper -n install'
superbbootstrap_Zypper() {
sudo zypper -n update # or dist-upgrade instead? maybe overkill
}
Just curious, why do:
Pacman_COMMAND
XBPS_COMMAND
AUR_COMMAND
include a sync/refresh option (respectively --refresh
; --sync
and -Sy
) whereas the others just perform install
without any sync/refresh operation?
Lines 101 to 107 in 5b8a7f2
The superbbootstrap_$package_manager
functions, which are run before, all perform a sync/refresh too. Isn't it redundant to sync/refresh a second time?
Lines 159 to 160 in 5b8a7f2
Lines 164 to 165 in 5b8a7f2
Lines 168 to 169 in 5b8a7f2
Lines 174 to 175 in 5b8a7f2
Lines 182 to 186 in 5b8a7f2
Lines 192 to 194 in 5b8a7f2
If so, maybe this should now be:
Value | Old | New |
---|---|---|
Pacman_COMMAND | sudo pacman --sync --refresh --noconfirm --needed |
sudo pacman --sync --noconfirm --needed |
XBPS_COMMAND | sudo xbps-install --sync --yes |
sudo xbps-install --yes |
AUR_COMMAND | paru -Sy --nodiffmenu --save --noconfirm |
paru --sync --nodiffmenu --save --noconfirm |
Emerge_COMMAND | sudo emerge --sync && sudo emerge -v |
sudo emerge -v |
Zypper_COMMAND | sudo zypper refresh && sudo zypper -n install |
sudo zypper -n install |
Zypper (openSUSE)
Zypper_MARK='ZPR'; Zypper_COMMAND='sudo zypper refresh && sudo zypper -n install' superbbootstrap_Zypper() { sudo zypper -n update # or dist-upgrade instead? maybe overkill }
I'm not a Gentoo expert by any means but here's my attempt for Emerge (Gentoo)
Emerge_MARK='EMG'; Emerge_COMMAND='sudo emerge --sync && sudo emerge -v' superbbootstrap_Emerge() { sudo emerge --sync sudo emerge -vuND --with-bdeps=y @world }
Thanks, this will be add to SBB 1.5.4 but i will change Gentoo package manager's mark EMG
to PTG
because "Portage" is the package manager real name, emerge
is just a command that come with Portage
Just curious, why do:
*Pacman_COMMAND
*XBPS_COMMAND
*AUR_COMMAND
include a sync/refresh option (respectively
--refresh
;--sync
and-Sy
) whereas the others just performinstall
without any sync/refresh operation?The
superbbootstrap_$package_manager
functions, which are run before, all perform a sync/refresh too. Isn't it redundant to sync/refresh a second time?
Yeah... this is kinda redundant, here is the fix taking from your suggestion:
Name | Mark | PM | Command |
---|---|---|---|
APT | APT |
apt |
$PERMISSION_COMMAND $APT_PM install --assume-yes |
Pacman | PAC |
pacman |
$PERMISSION_COMMAND $Pacman_PM --sync --noconfirm --needed |
Portage | PTG |
emerge |
$PERMISSION_COMMAND $Emerge_PM |
XBPS | XBP |
xbps-install |
$PERMISSION_COMMAND $XBPS_PM --yes |
Zypper | ZPR |
zypper |
$PERMISSION_COMMAND $Zypper_PM --non-interactive install |
AUR | AUR |
paru |
$AUR_PM --sync --nodiffmenu --save --noconfirm |
Flatpak | FLA |
flatpak |
$PERMISSION_COMMAND $Flatpak_PM install |
Homebrew | HBR |
brew |
$Homebrew_PM install |
Snap | SNA |
snap |
$PERMISSION_COMMAND $Snap_PM install |
btw, do you mind if i add you name to the credits section?
Zypper (openSUSE)
Zypper_MARK='ZPR'; Zypper_COMMAND='sudo zypper refresh && sudo zypper -n install' superbbootstrap_Zypper() { sudo zypper -n update # or dist-upgrade instead? maybe overkill }I'm not a Gentoo expert by any means but here's my attempt for Emerge (Gentoo)
Emerge_MARK='EMG'; Emerge_COMMAND='sudo emerge --sync && sudo emerge -v' superbbootstrap_Emerge() { sudo emerge --sync sudo emerge -vuND --with-bdeps=y @world }Thanks, this will be add to SBB 1.5.4 but i will change Gentoo package manager's mark
EMG
toPTG
because "Portage" is the package manager real name,emerge
is just a command that come with Portage
Indeed, PTG
makes more sense.
btw, do you mind if i add you name to the credits section?
No problem!
Slackware has an 'official' package manager and many unofficial third-party managers for Slackbuilds.org, which is similar to the AUR. I went with sbopkg here for the latter as it does dependency resolution with minimal user interaction, as per the gist of this script.
slackpkg_MARK='SLK'; slackpkg_PM='slackpkg' ; slackpkg_COMMAND="$PERMISSION_COMMAND $slackpkg_PM install" sbopkg_MARK='SBO'; sbopkg_PM='sbopkg' ; sbopkg_COMMAND="$PERMISSION_COMMAND $sbopkg_PM -ifq"
superbbootstrap_slackpkg() { $PERMISSION_COMMAND slackpkg update gpg $PERMISSION_COMMAND slackpkg update }
superbbootstrap_sbopkg() { if ! command -v 'sbopkg' >/dev/null; then SLACKWARE_VERSION=$(awk '{print $2}' /etc/slackware-version) SBO_VERSION=$(curl -s https://api.github.com/repos/sbopkg/sbopkg/releases/latest | grep tag_name | awk -F':' '{print substr($2,3,length($2)-4)}') cd $TEMPORARY || exit 1 $PERMISSION_COMMAND wget https://github.com/sbopkg/sbopkg/releases/download/$SBO_VERSION/sbopkg-$SBO_VERSION-noarch-1_wsr.tgz upgradepkg --install-new $TEMPORARY/sbopkg-$SBO_VERSION-noarch-1_wsr.tgz cd $WD || exit 1 $PERMISSION_COMMAND mkdir -p /var/lib/sbopkg/SBo/$SLACKWARE_VERSION /var/lib/sbopkg/queues /var/log/sbopkg /var/cache/sbopkg $PERMISSION_COMMAND sbopkg -rq $PERMISSION_COMMAND sqg -a else printf '%s\n' "sbopkg has been installed" fi }
Add this to subperbbootstrap_Flatpak():
'SBO') $sbopkg_COMMAND flatpak ;;
Also, to my knowledge, there isn't a SlackBuild for snapd (likely due to philosophy and the systemd work-arounds). I would suggest that testing for package manager isn't a fool-proof way to determin if Snap should be in the PACKAGEMANAGER_LIST. I would suggest doing a search by the distro instead, perhaps checking in '/etc/os-release' or similar. This is more important when you get to DNF, which could be Fedora or CentOS 8, etc., etc. Happy to work on that if desired.
@arcadellama Awesome, thank you for your contribution, This will be added to SBB 1.6.0.
Do you mind if i add you name to the credits section?
Of course, no problem.
Hello again! I managed to do something for...
I couldn't find a way to install MacPorts entirely through the CLI. It has to be installed through a .pkg installer and I don't know how to get the information to get the name of the .pkg file.
MacPorts_MARK='MCP'
MacPorts_PM='port'
MacPorts_COMMAND="$PERMISSION_COMMAND $MacPorts_PM install"
superbbootstrap_MacPorts() {
# Install Apple's Command Line Developer Tools (will open a pop-up to confirm)
xcode-select --install
# Get MACPORT_VERSION (ex.: 2.6.4), OS_VERSION_NUMBER (ex.: 10.15) and OS_VERSION_NAME (ex.: Catalina) somehow
macports_pkg_filename=MacPorts-$MACPORT_VERSION-$OS_VERSION_NUMBER-$OS_VERSION_NAME.pkg
curl -O https://github.com/macports/macports-base/releases/latest/download/$macports_pkg_filename
sudo installer -pkg $macports_pkg_filename -target /
}
MAS can be installed with Homebrew or MacPorts, one of them should be the PACKAGEMANAGER_MAIN
on MacOS. The script checks which was installed and uses it. MAS also requires to be signed into the AppStore, but on MacOS 10.13+ you have to sign in manually. I'm not sure on how to proceed if this is the case.
MAS_MARK='MAS'
MAS_PM='mas'
MAS_COMMAND="$MAS_PM install"
superbbootstrap_MAS() {
if [ ! -x "$(command -v "$MAS_PM")" ]; then
if [ -x "$(command -v "$Homebrew_PM")" ]; then
$Homebrew_COMMAND mas
elif [ -x "$(command -v "$MCP_PM")" ]; then
$MacPorts_COMMAND mas
else
superbbootstrap_Homebrew
$Homebrew_COMMAND mas
fi
else
printf '%s\n' "MAS has been installed"
fi
# Sign in to the AppStore
if ! (
mas account &> /dev/null && # verify if user is already signed in
mas signin --dialog $APPLE_ID # if not, try to sign in with a pop-up
) ; then
# signin command failed. It is disabled on 10.13+, user has to sign in
# directly from the AppStore
# (stop execution, skip packages with MAS Mark, wait till the user signs in or something)
else
printf '%s\n' "Successfully signed in to the AppStore"
fi
I dug a little more about brew cask and it seems you can install apps with brew install app-name
. The Homebrew website uses the --cask
flag (like on these app), but the Homebrew Cask github uses it without the flag. I tried on my Macbook and indeed, it works without the flag. However, it's a good practice to use the flag in case there's a package and a cask app with the same name (like wireshark).
Soo.. here's the script with the flag. I didn't include a HomebrewCask_PM because it's the same as Homebrew and I don't know if it's necessary.
HomebrewCask_MARK='HBC'
HomebrewCask_COMMAND="$Homebrew_PM --cask install"
superbbootstrap_HomebrewCask() {
if [ ! -x "$(command -v "$Homebrew_PM")" ]; then
superbbootstrap_Homebrew
fi
}
There's also an easier way that doesn't need any code change. This brew install --cask app-name
is just another way to write brew install homebrew/cask/app-name
. So just writing HBR:homebrew/cask/app-name
should work I guess.
Finally, Brew bundle just installs the first time you run brew bundle
and looks for a Brewfile in the directory. No need to implement that.
Feel free to change the code or rewrite all of it, I'm not very good at bash and it may not be the best code. If you don't own a device with MacOS I'm happy to test it if necessary (as long as I don't have to remove important stuff to reinstall them and set them up again).
pipx
is a wonderful tool that installs Python packages just like regular PIP, but does it in isolated Python environment. That way packages and their dependencies don't interfere with system Python and with each other.
Default commands requires no sudo and no user interaction.
It's convenient way to install youtube-dl
for example.
pipx_MARK='PIX'
pipx_PM='pipx'
pipx_COMMAND="$pipx_PM install"
superbbootstrap_pipx() {
python3 -m ensurepip
python3 -m pip install --user pipx
python3 -m pipx ensurepath
}
Their repo: https://github.com/pipxproject/pipx
Are pip and npm still open ? I could work on them if that's the case !
EDIT: I added them locally, I could git that and start a PR with another change I made to handle this kind of "auxiliary" package manager better
@LoricAndre Yes it is still open and i love to see your work on them ^^
Done with #18
Done with #18
Hi, @LoricAndre! There is some problem I mentioned here: #28