Linux unified package alias generator

in #utopian-io7 years ago (edited)

When I was distrohopping as part of my hobby and in some sort professional growth, I was always wondering: it's so great, that Linux world has package managers. It's been more then twenty years from the moment first PMS (Package Management System) was created - it was simple Bogus Linux package manager back in 1994. *BSD world did it even earlier, with FreeBSD 1.0 (released in late 1993) that already came with, what is called, the ports tree - a very convenient package building framework. Read the great article about history of *nix package management here.

LinuxPackageManagerScript

But as the linux distributions growed in quantity, size and quality, the number of package managers growed too. Some distributions developed own ('the best of class, of course!') package managers, while others sticked to some popular ones.

That large number of distributions and package managers might not be a problem for person who works with one or few distros, but what if you're choosing your distro (let's say, you want to choose distro where VLC performs best)? What if you're tester? A developer? Or just a distrohopper?

You had to either learn all those package manager commands to install/remove/list/update software, to google for commands (if you have working internet, which might not always be the case). There was no third solution - until now.

Few years ago I developed not so hard, but really large by testing & knowledge script that allows you to work with at least 20 package managers with the same, short, easy-to-remember commands. I did published in on my pastebin, and updated it few times. Now I'm re-publishing updated version of it with this large descriptive documentation!

So, with my little script (by the way, it's ONE-TIME run only, then you can delete it!), you can install software on any linux distro with the same commands.

Linux unified packager

Alias manager. It helps you to install, update, remove and work with the software in the same manner in any linux distro.

Why this is important? Who needs this?

  • If you would like to test new distro but don't wont to search for new commands (hobby)
  • If you're professional tester or developer (work)
  • If you're distrohopper (change distributions from time to time)
  • Just if you're curious
  • If you would like to learn, how to work with distribution package managers from the scripts
  • If you want to learn how to write bash scripts
  • Your personal reason? Make an issue or pull request :)

Supported linux distributions (and package managers)

Totally this script supports 10 categories of package managers, 20 pcs.

  • Debian family: Ubuntu, Debian (apt-get), etc.
  • SUSE family: OpenSUSE (zypper),
  • RedHat family: Fedora, CentOS, RedHat (yum/dnf),
  • Mandriva family: Mandriva, Mageia (urpmi).
  • Slackware distros: Slackware (slackpkg), Vector (slapt-get), Zenwalk (netpkg),
  • Independent distros: Sabayon (equo), Arch/Manjaro (pacman), Foresight, rPath (conary), Alpine (apk).
  • Multi-distro (distro-agnostic) package managers: Mandria, OpenSUSE (smart), Fedora, Ubuntu, openSUSE, Mandriva (pkcon).
  • Source package managers: Gentoo (emerge), Lunar (lin), Source Mage (cast),
  • New, binary pac.-man. systems: NixOS (nix), Void (xbps), Ubuntu (snappy),
  • FreeBSD: 10.0+ (pkg).

How to make this script work?

Note: you need to download & run the script only once.

  1. At first, you have to use either wget, curl, git (only one of them) or manually copy-paste the internals of .SH script.
    sudo apt install git
  2. Download the script with the software of your choice (I choose git, if you choose other the command changes of course):
    git clone https://github.com/sxiii/linux-unified-packager
  3. Open the terminal & go to directory where you did download the script.
    cd linux-unified*
  4. Make the script executable
    chmod +x *sh
  5. Execute the script
    ./makealias.sh
  6. That's all. The script is needed only once so you can remove it.
    cd .. ; rm -rf ./linux-unified*

If the script returned some errors on step 5 and you don't know what to do with them, please post these errors in this project issues.

But still who needs this? And how does it work?

It creates short aliases (cli commands) that can be used as simple as:

Alias (short cmd)Actual action/result (what this command does)
iinstall package
iiinstall package (from file)
rremove
upupdate repos (repositories; it means update list of available packages from the server)
ugupgrade package or system
lilist installed packages (warning: may be large!)
rllist repositories (list packages that are available in repositories - "repo list")
raadd new repository or PPA ("repository add")
rrremove repository or PPA ("repository remove")
lsbsystem information ("linux standard base")

For example, to install vlc and midori with ANY supported linux package manager, just type i vlc midori. As another example, to remove google-chrome package, use r google-chrome. To update list of repositories just run up, and to update the whole system you need only ug. Nice, isn't it?

Of course, you have to ensure you don't have these short programs or aliases in your system already. But in the most cases (I believe, 99.9%) they won't be such, as I choosed them wisely. Only if you added themselves :) At least these commands are free on basic installations of Ubuntu and ArchLinux.

Note: in Linux world, words "program" or "software" usually replaced by more correct word "package". But it's synonyms.

As already was said, this scripts works with most distros (it knows at least 20 package managers). You may think about it as an abstruction layer between you and package manager, which works predictably the same in any distro (even tho some distros has specific package management logic).

It also adds "lsb" command which shows you info about your distro & packages. And you don't have to look which actual package manager your system uses! Comfortable? Indeed!

Software requirements

  • Basic: Bash on recent Linux (but you can check with old too)
  • Script dependencies: shopt, hash (they usually come pre-installed)

If you don't have shopt or hash utility pre-installed, you will have to install they buy hand first (but that's rear case!). Consult the next link to find out more.

Base of Universal Multi-Distro Aliases Script

The script was based on package management article from distrowatch:

Working details

This script was written in the idea of uniting several package management system into one single command that can be issued easily. This script DOES NOT detect your distros because it is not so important, while we just want to see if you have any package managers installed. That wouldn't be a problem because small amount of people uses more than one package managers (guys you might have to fix this script in this case).

It took me few nights to write and debug this script. The time has passed but currently I did tested it many times only on my two main distros - Manjaro (Arch-based linux) and Ubuntu (Debian-based one). I hope the script will be improved by you & the community (read next).

Developers & testers needed

If you just tested the script on your local PC and it works well, you can write an issue about that or commit here exact name & version of your system. More importantly, if the script DOES NOT work well, you should commit the issue to this repo with all details on your system, please. It will help whole community.

Exactly supported distros

  • Manjaro Linux 17.1.4 kernel Linux sx-pc 4.15.0-1-MANJARO
  • Ubuntu Linux 16.04.3
  • Yours?

Thanks for commiting to my work and stay in touch.

Yours independed steemit & golos author

@sxiii aka Den Ivanov



Posted on Utopian.io - Rewarding Open Source Contributors

Sort:  

Thank you for the contribution. It has been approved.

That's something nice. There is a mew package manager for the same purpose made in Python you must check it out.

And I tested it on Debian. I had two package manager installed so I need to tweak the script a bit to make it work. up worked with my second package manager but ug didnt worked not sure why But I will check it out If I can find the reason of it.

You can contact us on Discord.

[utopian-moderator]

Hey @ms10398. Firstly, GREAT thanks for your approval.

I thought I will never get approval since 4 of my previous contributions wasn't approved with always different reasons (not informative contribution, not professional contribution, small contibution codewise - even tho SMART coding is usually shorter and better, not whole (airdrops) tutorial published, and when I did published as a whole - rejected because "it's hardly a tutorial, it's just a nice post containing all of the airdrop manuals. I can't see a category on which it would fit when it comes to Utopian either".

The fun & sad part is that I spend HOURS making these contributions and publishing them. And I did read the rules multiple times and tried to follow them all. And even when I followed the advices of moderators they still had to reject my work.

I really was trying to write good documentation, with good github repos, which are useful, high-quality, etc. But in most cases it just depends on the moderators mood as far as I can see :)

I started to think that Utopian doesen't need my contributions at all. But with you I can see that it's still might BE light out there.


As for "mew", I heard about it, but I never used it. I will definetly give it a try.

Thanks for testing it on Debian. Did it worked easily? Actually, there should not be difference in "up" and "ug" commands as for debian the "apt-get" basic command is used (just like for ubuntu), so the result command for up is sudo apt-get update and for ug is sudo apt-get upgrade they both should work normally. It would be interesting if you find the reason for this.

Thanks again :)
Den

Yes I will be testing it more right now I am switching distros too much!

actually it did not run because instead of apt-get it used different package manager as I had two installed in my PC.

and the second package manager was unable to upgrade.

And I have seen your work it seems nice to me.

Thanks for expressing your feelings and your work towards open source is most welcome to the community.

Thanks,

Regards,
Mohit

Hey @sxiii I am @utopian-io. I have just upvoted you!

Achievements

  • You have less than 500 followers. Just gave you a gift to help you succeed!
  • Seems like you contribute quite often. AMAZING!

Community-Driven Witness!

I am the first and only Steem Community-Driven Witness. Participate on Discord. Lets GROW TOGETHER!

mooncryption-utopian-witness-gif

Up-vote this comment to grow my power and help Open Source contributions like this one. Want to chat? Join me on Discord https://discord.gg/Pc8HG9x

Coin Marketplace

STEEM 0.18
TRX 0.16
JST 0.029
BTC 76024.68
ETH 2926.23
USDT 1.00
SBD 2.60