RPM install

Someone recently asked me: “What is the lifecycle of the rpm -i packagename.rpm command?”, which is a fancy way of saying: “what happens when you install a package using rpm?”.

The question reminded me that despite the fact that I’ve used the command often, I actually forgot many of the details behind the scenes. We take rpm for granted, just as we do for other tools such as sed, awk & co.

So I decided it might be fun to take a look around and see what actually happens when you run “rpm -i packagename.rpm”. I downloaded CentOS 7, installed it in a VM and started digging.

As a forewarning to readers, this post won’t go into the type of detail some other people went to. I won’t be chasing voltage level changes through the computer wires and I’ll be focusing instead on the actual high level steps executed by rpm as is installs the package.

So, let’s get to it.

In order to best understand what happens during a package installation I decided that I’ll make a couple of RPM packages myself, so that I’d be able to control the package installation fully. I started slowly, by looking around for documentation and I as usual, stackoverflow.com for the win!

Based on the basic example from there and from the excellent documentation on rpm.org I created two small RPM specs.

The source code for them can be found here: RPM samples.

I’ll disect one of the rpmspec files:

# Don't try fancy stuff like debuginfo, which is useless on binary-only
# packages. Don't strip binary too
# Be sure buildpolicy set to do nothing
%define        __spec_install_post %{nil}
%define          debug_package %{nil}
%define        __os_install_post %{_dbpath}/brp-compress

A bit of boilerplate. As a note, everything starting with “%” defines a rpmspec section, so it’s important.

Summary: A test dependency rpm package
Name: testdependency
Version: 1.0
Release: 1
License: MIT
Group: Development/Tools
SOURCE0 : %{name}-%{version}.tar.gz
URL: http://blog.oblio360.com/

Package metadata. Out of these, name, version and release are important as they are actually used as variables throughout the spec.

BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root

Kind of self explanatory: RPM build root.

%description
%{summary}

Again, kind of self explanatory: package description/summary.

%prep
# Empty section

The rpm build preparation phase/script.

%build
# Empty section.

The actual rpm build phase/script. In this case it doesn’t do anything since the package isn’t fancy.

 %clean
 rm -rf %{buildroot}

Build clean up.

%pre
echo 'Hello from the pre-install script.'

Pre-install script. This script is run just before the actual installation.

%install
rm -rf %{buildroot}
mkdir -p  %{buildroot}

# in builddir
cp -a * %{buildroot}

Actual installation: copies all the files to their destination.

 %post
 echo 'Hello from the post-install script.'

Post install script. Run immediately after the installation.

 %preun
 echo 'Hello from the preun-install script'

Pre uninstall script.

 %postun
  echo 'Hello from the postun-install script'

Post uninstall script.

%files
%defattr(-,root,root,-)
%config(noreplace) %{_sysconfdir}/%{name}/%{name}.conf
%{_bindir}/*

Files included in the installation. This section uses two RPM files directives:

  • deffattr defines file attributes: permissions and ownership; we keep the original permissions and set the ownership to root:root
  • config marks the conf files as config files so that they get special treatment from RPM when installed

And the last bit:

%changelog
Tue Aug 23 2016 Oblio Point <[email protected]> 1.0-1
First Build

Human readable changelog.

The second spec looks much the same, except for the fact that it specificies this rpm as a dependency.

Now that we’ve gone through all this hard work to create two sample RPMs, let’s see how the actuall installation looks like:

sudo ./install.sh 
Preparing packages...
Hello from the pre-install script.
testdependency-1.0-1.x86_64
Hello from the post-install script.
Hello from the pre-install script.
testprogram-1.0-1.x86_64
Hello from the post-install script.

So RPM:

  • figured out the dependency order
  • triggered the installation of these dependencies
  • for each dependency:
    • ran the pre-install script
    • ran the installation
    • ran the post-installation script

To be honest, this was much more straightforward that I remembered it to be from the last time I dabbled in RPM building. Things do become more complex along the way, as you can see in this wonderful article:

  1. Run N’s %pre script.
  2. Copy N’s new files to the file system.
  3. Run N’s %post script.
  4. Run all installation triggers (those marked %triggerin in other packages) set off by the installation of N.
  5. Execute all of N’s installation triggers.
  6. Run all of n’s uninstallation (%triggerun) triggers.
  7. Run all the uninstallation triggers (those found in other packages) set off by the uninstallation of n.
  8. Execute the %preun hook of n.
  9. Remove any files not overwritten by the install of N.
  10. Execute all the uninstallation triggers (%triggerpostun) found in n.

So there you have it, the whole shebang of running an RPM install!


... Read more

Best Druid cards to craft

Malfurion Stormrage

This article is a part of the Hearthcraft series of article, where I present the best cards to craft if you want to have a rich card collection that will allow you to create as many powerful decks with a minimal investment of cash or time.

I'll be presenting the cards which I think are the most efficient Druid cards. When I say "efficient" I mean that these cards have a great ratio of power level (how strong the cards actually are) coupled flexibility (if they can be used in multiple decks and deck types) to cost (how much $$$ or time or gold/arcane dust you have to spend on them).

Druid cards have a very clear theme: flexibility. Most of the Druid cards can be used in one of two ways. Each option individually is not very strong but once they are coupled in the same card they become quite strong.

If you’re looking for neutral cards (for example you might be wondering why Dr. Boom isn’t here), then you should head over here:

Now that you’ve finished the articles about the neutral cards and are wondering which Druid cards you should craft first, read on :wink:


Druid

Keeper of the Grove

Keeper of the Grove

Good, old, trustworthy Keeper of the Grove. As a new player the 4 mana 2/4 minion doesn’t seem much (the standard for a 4 mana minion is 4/5). But the effect makes up for the fact that the stats on the actual minion are low.

Keeper of the Grove can either do 2 damage to an enemy or silence an enemy. This provides any deck which includes it a lot of flexibility as the Keeper can take out a small threat, such as a Knife Juggler, finish off a damaged larger enemy or silence a minion with a very dangerous effect (such as Sylvanas Windrunner). In case of emergencies it can even do 2 face damage to finish off an enemy.

The effect provided by him is very powerful and the body, even though understatted, is still good. It especially good at fighting off small minions, such as those in aggro decks. Keeper of the Grove can even 3 for 1 aggro minions (1 with its effect, 2 with its body).

One of the most reliable Druid cards, seen in aggro, midrange and control Druid decks.


Darnassus Aspirant

Darnassus Aspirant

One of the latest entries (it was introduced in The Grant Tournament), Darnassus Aspirant is a 2 mana 2/3 minion which comes with 2 effects: its battlecry increases your total mana by 1 and its deathrattle decreases it by 1.

If not killed on time Darnassus Aspirant allows the Druid to play cards which cost more mana ahead of time (this is called “ramping”). Very dangerous, since the Druid has access to very powerful big cards such as Cenarius or to a very strong and famous combo: Force of Nature / Savage Roar.

Also, in a similar way to the Keeper of the Grove, its body is also a defensive one: 2/3 instead of 3/2. This means that the Aspirant can also trade favorably with smaller minions. The 3 health also makes it harder to kill under some circumstances, therefore allowing it to survive longer so that the player can take advantage of its battlecry.

The Aspirant is also seen in many types of decks ranging from aggro to control.


Druid of the Claw

Druid of the Claw

Another staple of Druid decks, Druid of the Claw is the best known “transformer” in the game. When played for 5 mana, Druid of the Claw can either become a Bear (4/6 with Taunt) or a Cat (/4/4 with Charge).

Both forms are strong, although there is a slight preference for the Bear. The Cat form is usually chosen when an enemy minion really needs to be destroyed this turn and there’s no alternative way to do it or the enemy can be killed this round.

Druid of the Claw is so solid and versatile that he can be seen in all types of Druid decks. The Cat is greatly appreciated in aggro decks while the Bear is welcome in midrange or control Druid decks.


Force of Nature

Force of Nature

One of the best known spells in the game. Not on its own. But as part of the most famous Hearthstone combo: Force of Nature / Savage Roar. On its own Force of Nature is not something to write home about, for 6 mana it provides just 6 damage. Fireball provides the same amount of damage for 6 mana. Force of Nature shines because it is a versatile spell (the core characteristic of all Druid cards). It can do 6 damage to the enemy’s face or to his minions. Since it spawns 3 minions with charge, each of them can be used independently to focus another target, for example for clearing the opponent’s board.

But its highlight is when it is paired with Savage Roar. For 9 mana this combo does a total of 14 damage (2 from the hero itself and 4 from each treant). As a result every Druid opponent has to make sure that he has a taunt up when his life total is below 15 HP.


Wrath

Wrath

Wrath is a 2 mana cost spell that is used for removing a small but very threatening minion, finishing off a larger minion or drawing a card (when it only does 1 damage).

This flexibility comes at a cost as Wrath can only target minions, but the flexibility greatly surpasses this downside and as a result Wrath is seen in almost all Druid decks.

It is frequently used to fend off very aggressive decks or to draw 1 more card when the Druid player is out of fuel (usually when he is the one playing the beatdown deck).

Used in all but the most aggressive of Druid decks.


Ancient of Lore

Ancient of Lore

The venerable tre(e)ant is another example of a very versatile card. For 7 mana you get a 5/5 body that can either heal you for 5 or draw 2 cards.

The 5/5 body is a little under the standard for a 5 mana minion while its effect costs either a little under 2 mana (Holy Light) or a little under 3 mana (Arcane Intellect). The whole package definitely deserves paying 7 mana for.

In general the effect is used to draw cards, especially when “fishing” for the parts of the Force of Nature / Savage Roar combo. But against aggro decks it can also be used to heal yourself and gain a bit more time to stabilize on board and eventually win the game.

Ancient of Lore is seen in all but the most aggressive of Druid decks and is one of the core cards of the decks he’s part of.


Living Roots

Living Roots

Living Roots is another new entry in the Druid arsenal. It was introduced in TGT, together with Darnassus Aspirant, and it was widely adopted by the community.

Its uses are multiple: fend off aggressive decks through the Saplings or the nuke, damage the enemy’s face (probably just before winning the game), provide more “boots on the ground” to be used next round for Savage Roar.

Some of the fastest wins in the game have involved Living Roots (2x Living Roots provide 4 minions, and when Savage Roar is used these 4 minions total 12 damage, 2x Savage Roar and the damage goes up to 20 damage; add the 2 / 4 damage that the hero gets from Savage Roar and a quick win is possible).


Honorable mentions

Card name Why is it a good card?
Savage Combatant Provides an aggressive minion and some extra damage for removal.
Cenarius Hard to remove, can provide 2 taunts or extra stats for burst damage.
Ancient of War One of the biggest, baddest taunts available. Very hard hard to remove through minion combat.
Druid of the Saber Stealthy aggro minion.
Druid of the Flame Hard to remove minion or threatening small minion, depending on mode.
Go top ↑

... Read more

How to beat Naxxramas using basic cards (part 2)

Curse of Naxxramas

And now we continue the Naxxramas series with the second part, a guide explaining how to beat the second Naxxramas wing, the Plague Quarter, using only basic cards.

The first part can be found here, if you'd like to read it first: How to beat Naxxramas using basic cards (part 1).

In case you skipped the previous part, TommyJ has managed to beat all the bosses from the current adventures using only basic cards: cards you start out with and cards you get while leveling up heroes. He has made guides for defeating the heroic bosses using decks he created.

With his blessing I'm republishing his guides as I think they're a great resource for newer players, especially since the same decks can be used for finishing normal mode (heroic mode is much harder than the normal mode). This article contains his second guide, for beating the Plague Quarter from the Curse of Naxxramas.

TommyJ:

Naxxramas Heroic Bosses

Plague Quarter

Hey guys, so this time around I’ve managed to beat the Plague Quarter in heroic using basic cards. Similarly to last time, when I say basic cards, I mean only cards that you can get before opening a pack (and again, no cards you get by beating Curse of Naxxramas on normal in either wing were used).

Heroic Noth the Plaguebringer

Heroic Heigan the Unclean

Heroic Loatheb

For Noth, I used a Priest deck, for Heigan, I used a Warlock deck and for Loatheb, I used another Priest deck.

Decks used for the Plague Quarter

So in this quarter I found the fights to be a lot harder. I tried a whole lot of different decks on almost every fight, and I’m not sure some are possible at all with certain classes. Noth was relatively easy – he didn’t take too many attempts though I may have gotten lucky with him. I found that as a long as you were able to get good value for your minions and survive until around turn 5 or 6 without any trouble the fight was actually ok.

Heigan took me a while; I first gave shaman a go and while I got him under 15 a few times in the end I didn’t have enough options when it came to dealing with the demons, so I went with warlock since they have some great anti warlock cards available to them from the get go! Once I tried warlock all it took was the attempts in the video, so yeah, that one was pretty cruisy.

Loatheb was perhaps the most difficult, I started off with shaman for a while - hoping to essentially just drop minions, destroy the spores and then give the strongest things windfury for a quick kill, but that didn’t really work out too well, mostly because of the Fen Creeper. I then tried a spam warrior deck which involved pretty much dumping a whole heap of low cost minions on the board and giving them all charge but it relied on execute to deal with that damn Fen Creeper so wasn’t really reliable, and if any other strong minions went down it was pretty much game over.

So for Loatheb I ended up swapping to priest, which is a bit easier but definitely relies on Shadow Word: Pain in your opening hand or first 2 draws. Also, on my kill for that Loatheb didn’t drop anything on one of his turns which allowed me to gain momentum and I’m fairly sure that was incredibly lucky.

If you’re looking to make your own free to play decks, I would highly recommend adding in some of the Naxx cards as they would probably help you out a ton (for example Loatheb or even the Gargoyle against Noth since he uses all those damn secrets or to get self heals every turn or Nerubian Eggs against Heigan).

Anyway, I will continue to do this for all of the coming wings, again it was an absolute ton of fun!

Stay tuned for part 3!


... Read more

How to beat Naxxramas using basic cards (part 1)

Curse of Naxxramas

Curse of Naxxramas is Hearthstone's first adventure, released in July 2014. Adventures are Hearthstone "mini-expansions" in which the player has to defeat Hearthstone "bosses" (heroes with special hero abilities and custom decks which can contain unique cards). For each boss defeated the player receives a reward: a card or a pair of cards. These cards cannot be obtained through crafting, the only way to obtain them is to buy the adventure (with cash or gold) and to beat the boss.

Each adventure has a normal mode and a heroic mode. The normal mode is the one that offers the cards as rewards while the heroic mode is much more difficult and has as a reward a special card back. The card back is available once all the heroic mode bosses have been defeated.

TommyJ has managed to beat all the bosses from the current adventures using only basic cards: cards you start out with and cards you get while leveling up heroes. He has made guides for defeating the heroic bosses using decks he created.

With his blessing I'm republishing his guides as I think they're a great resource for newer players, especially since the same decks can be used for finishing normal mode (heroic mode is much harder than the normal mode). This article contains his first guide, for beating the Arachnid Quarter from the Curse of Naxxramas.

TommyJ:

Naxxramas Heroic Bosses

Arachnid Quarter

So I set out yesterday with the goal of beating all 3 bosses of the Arachnid Quarter in heroic using only basic cards and managed to actually get it. When I say basic cards, I mean only cards that you can get before opening a pack (not including the cards that you can get by beating the quarter on normal - I didn’t use any of them).

Heroic Anub’Rekhan:

Heroic Grand Widow Faerlina

Heroic Maexxna

For Anub’Rekhan, I used a Shaman deck, for Grand Widow Faerlina I used a Warlock deck and for Maexxna I used a Warrior deck.

Decks used to beat Arachnid Quarter

Heroic Maexxna was by far the most challenging; I tried it with several decks (Priest, Warlock, Druid and Shaman) with various different combos before attempting it with the Warrior. I actually managed to 1 shot Anub and 2 Shot Faerlina (first attempt was with the Shaman deck from Anub but couldn’t ditch my cards fast enough so got completely stomped by her hero ability). It’s definitely worth mentioning that I didn’t life tap against Faerlina; I went with the Warlock because they have cards that will discard others when used such as the Succubus so her hero power was pretty useless.

Stay tuned for part 2!


... Read more

Reaching legend rank

So you're not really a great Hearthstone player and you don't have a full Hearthstone collection but you still want to reach legend?
Well, that makes two of us: Hearthstone is my first collectible card game and I'm also playing on a budget.
I reached legend by playing a rather unorthodox deck and I decided to write a guide to help others like me: average Joes that don't have all the cards in the game.

TL;DR:
  1. Hearthstone is P2W. Pay for the core cards or be prepared to play hundreds and hundreds of hours to be on par with other players.
  2. Keep an eye on your win rate. Either use tracking software or do it old school style, but do it.
  3. Stop playing when you're tilting. If you're on a loss streak, just do something else. It's only going to get worse.
  4. Play to win. Risk more in match ups which do not favor you.
  5. Go for the surprise factor. A strange deck or a strange tech card can help you win games.
  6. Be patient. It will probably take hundreds of games to reach legend.

Keep reading if you want more details :wink:

Pay to win

Hearthstone is P2W

Ok, let’s face the hard truth: Hearthstone is a P2W (pay-to-win) game. You either pay with your time or with cash. And paying with time is very inefficient. So if you really like the game and can spare $40-$60 per year, do it. It will save you hundreds of hours of grinding.

Saying that Hearthstone is P2W is the quite controversial statement so I’ll explain: no, you cannot actually pay to win a game in Hearthstone. But you can pay for shortcuts by buying great cards through adventures or tons of card packs.

Let’s say that Joe and Mike are about as good at Hearthstone. If they play 100 games, they should each win about 50. However, if Joe doesn’t have key cards to counter Mike then Joe’s never going to win 50. He’ll win maybe 40 if he’s lucky.

Of course, skill is a factor. At different skill levels nothing can save you from having a sub-50% win rate against a better player. But skill levels equalize as you climb: players are better and better and you can’t just weasel your way out of a bad situation through sheer luck and brainpower.

If you want the legend climb to be fun, get at least 1 competitive deck that is not completely countered by the current meta. You will probably have to tech in cards.

You might even be forced to switch decks to another competitive deck. Or maybe even to a third one. So you need at least 2-3-4 competitive decks and their corresponding tech cards.

In my case I decided that I’d buy all the adventures with cash and get the rest of the cards through buying packs with gold. I sometimes feel that I would have enjoyed the game more if I had actually bought the adventures with cash as well as the pre-order packs (50 packs) for each expansion.

Keep an eye on your win rate

And now we get to win rate… Win rate is the thing that will either take you to legend or won’t. You will lose games. You will be annoyed by losses. But in the end, it doesn’t matter, as long as you’re still climbing and therefore winning more games than you are losing.

If you have a higher win rate, you’ll climb a lot faster.

Win rate Games from rank 20 to rank 5 Games from rank 5 to legend
45% 2743 111416 (!)
50% 444 929
51% 372 617
55% 223 227
60% 147 120
66% 101 76
70% 83 62
75% 67 49

If you’re playing on a PC you should probably use a deck tracker. If you’re playing on a phone or tablet… you’re out of luck. I’m playing on a tablet so I had to keep track of things the old fashioned way. When I reached legend I actually used a very simple system. I started at rank 3 and 0 starts with Raptor Rogue and I had 0 wins with Rogue on ladder. I needed 16 wins to get to legend. So I set myself a limit of 30 wins to get to legend. This meant that I had to sustain quite a high win rate since at 50% I’d just be back where I started.

Related to this: don’t get really angry when you lose. Win rate = rate at which you’re winning. This means that you’re also losing from time to time, it’s normal. Just make sure to notice when you’re losing more than you’re winning.

Tilt alert

Stop playing when you’re tilting

You need to be very focused. As I said, the opponents are at least as good you are at Hearthstone. If you’re tilting, you’re turning into a worse player. This means that you’re giving your opponents an advantage over you.

As a simple rule of thumb, I stopped playing after 3 consecutive losses, no matter what. In your case it might be 2 losses or 5 losses, depending on how easily you tilt. Still, stop playing ladder at least if you’re tilting.

You want to make life for your opponents harder, not easier, when they’re facing you :smile:

Play to win

There will be match ups where you’re not the favorite. If you’re Freeze Mage against Control Warrior, you’re most likely going to lose. So if you’re playing it safely, you’re going to lose. Your only real shot against a competent opponent is going all in. Where “all in” depends on how desperate the match up is.

This might mean doing things which seem silly in most match ups, like keeping a 5 or 6 drop during the mulligan phase, because being guaranteed to play it on turn 5 or 6 and having it left unanswered is one of the few ways to win the match up.

Of course, if at some point you notice that you’re encountering only unfavorable match ups, it’s probably time to switch decks. This is a judgment call, I generally did it when I noticed I wasn’t climbing after a higher number of games played (15-20).

Acidic Swamp Ooze

Go for the surprise factor

Almost all the good players I’ve seen at some point or another try a strange deck or add a strange tech card in their deck. This is because the surprise factor is important in multiplayer games. Predictability is good for your own actions (this is why Ogre Brute is a bad card, because you can’t guarantee what it’s going to attack) but it is not good when your opponent can reliably predict your actions. Of course, in most games you win you’re just going to use your deck’s main win condition.

But especially above rank 5, if your deck is popular enough, opponents will find or make decks that will counter that a main win condition. So it doesn’t hurt to have a plan B.

In my case I just took advantage of the surprise factor of the deck I was playing: Raptor Rogue. Most opponents facing a Rogue would be mulliganing for Oil Rogue (the most popular Rogue variety) and would often not have the required tools to react to a Rogue that plays more like Zoolock.

If using or creating a brand new deck is not possible (and usually it isn’t) then surprising tech cards can work as well. Acidic Swamp Ooze has destroyed many Doomhammer dreams over the years :smile:

Be patient

The last but most important point. Reaching legend, even if you’re on a hot win streak, will still take at least 100 games. Probably 200 or 300. When you go above rank 5 each win starts mattering more and more.

So you have to be patient and remember that you have to play a lot of Hearthstone games to reach legend. You also have to be patient during the actual games and take the time to think through your moves 1, 2 or even 3 turns in advance.

In the end you may ask yourself, is it worth it? I don’t know. It was probably worth it for me as I generally like achievements in game and this is probably the greatest achievement a non-pro player can get.

Reaching legend.


... Read more

Personal opinions about history, news, computers and programming.