# steveL's favourite tips

## steveL

I'm just collecting stuff I've learnt from others here, so it's all in one place in case I lose all my data and hopefully it'll be of use to others.

Top tip so far:

If you have a problem with software in portage file a bug with a patch to add whatever it is that's missing. Be aware of bugzilla ettiquette -- it's not a place for discussion unless it's technical and specific to the bug. If you're unhappy with how you're dealt with, discuss it on the project mailing-list if you don't feel able to file a userrel or devrel bug.

Installation

Understanding the boot process

Rough Guide to Kernel Building

 - to search for CONFIG_NET_WIRELESS, press / and then type NET_WIRELESS in the resulting dialog

 - nowadays we just use make nconfig

lspci -k to see what modules the live-disk kernel uses for your devices.

Setting up hard-drives (migration to libata, but covers it all afaict.)

Troubleshooting hard-drives: megaSAS in this case, but great overview of how to chase down issues.

UEFI and nvidia

Resuming an Install

Salvaging an Install

Fix Networking

Don't forget to set your hostname

Xorg Modelines (last resort: start with a blank config, as X should work out of the box)

X for 3d cards: ATI needs DRI loaded, nvidia needs DRI unloaded. (correct me if any of this seems wrong)

USB-2 and USB-3 working together

Dual-booting Windows (Win7 and MBR specifically, but good discussion overall); see here for Win 8.1 EFI.

Maintenance

The basics

Tweaking your install

use FEATURES=buildpkg to keep backups of all emerged packages so you can rollback in case of problems.

- you can also use this to build binary packages for multiple machines

Cleaning out logfiles

Getting portage messages for an emerge

Use update

- by default does our system update procedure:

emerge -uDN @world --with-bdeps y

  (with --pretend first, to review the list: recommended procedure)

- review and edit USE flags on a per-package basis, or globally, by pressing E for the edit list dialog.

- followed by:

glsa-check

depclean

@preserved-rebuild (if required)

revdep-rebuild

- to get the same with --changed-use use: update -auDU

To run: emerge -uD --changed-use @world without bdeps, use: update -auDU @world

..and take out the a if you just want to run it without confirming. It supports parallel builds.

Full procedure without bdeps: update -auDN --bdeps=n

IOW: if you give it a parameter like a pkg-name, it just wraps emerge. If not, it does a system upgrade.

except: you have to tell it to install a package to world with -i, eg: update -ia kate

By default it just updates the package, ie: emerge -1 package which pulls in needed dependencies, with your flags.

Recover from a snafu see also Reinstalling python on next page.

in the cli: euse -i USEFLAG is your friend

Listing overlay packages

to check whether you have a module:

lsmod = loaded modules, modprobe -l = all built modules

- just add |grep -F module to find it if you have a specific module in mind.

How to use dep? (The man page is hard when you're tired) Top 3 thanks to mark_alec on IRC

dep -w, --pruneworld

dep -u, --usedesc for PKG

dep -e, --versions and status of PKG

-t, --tree-depends and -T, --reverse-tree of PKG

-U, --iuse list pkgs which declare a USE flag

- kudos to ecatmur for the script.

mount -t smbfs -o lfs allows large files (IRC)

For archive: no name, took it down a while ago, sorry:

Let's assume you want to write /usr/local into a file under /mnt/archive: 

find /usr/local -print | cpio -H tar -ov | bzip2 > /mnt/archive/usr_local.tar.bz2 

To list the contents of your archive: 

bunzip2 -c /mnt/archive/usr_local.tar.bz2 | cpio -itv 

To extract the archive, you can use:

bunzip2 -c /mnt/archive/usr_local.tar.bz2 | cpio -imdv

Now, let's assume your /usr/local/ contains the file /usr/local/bin/myscript. You can extract just this file by:

bunzip2 -c /mnt/archive/usr_local.tar.bz2 | cpio -imdv /usr/local/bin/myscript

or even extract all of your scripts that start with "my":

bunzip2 -c /mnt/archive/usr_local.tar.bz2 | cpio -imdv '/usr/local/bin/my*'

Note the quotes on the pattern so the shell doesn't interpret it.

AFAIR, there are some older versions of cpio, in which the -H tar didn't preserve the modification time correctly.

I usually prefer option -c or -H crc, which are, however, not compatible with tar.

cpio has many other interesting options, so it's worth having a look at the manpage.

Advanced usage

How to get a package stabilised

Daemonizing azureus - example initscript

Per-package CFLAGS using package.env. If that makes no sense, you should wait till you know Gentoo better.

Sneakernet (no-net install)

Read-only root eg SD-card

Building in a chroot snapshot using BTRFS.

Adding patches to an ebuild:

First try to see if the ebuild supports epatch_user already: if it inherits from eutils (perhaps indirectly) then it will.

Support for apply_user_patches has been proposed for EAPI 6.

You can also use the post_src_unpack() user hook and the profile.bashrc in the 

base profile for this. E.g.:

```
# mkdir -p /etc/portage/env/$category

# cat << END > /etc/portage/env/$category/$name

post_src_unpack() {

    epatch foo.patch

}

END
```

uberpinguin:

you need to edit the ebuild and use 'epatch' to apply the patch. once you've got the ebuild tweaked, you'll have to 'ebuild EBUILD digest' to fix the checksums.  I'd recommend creating an overlay to put your modded ebuild in, though.

read the man page for patch and look at the first couple lines of the patch to see what '-p' level to use; apply the patch; ebuild EBUILD digest to fix the checksums; try emerging it

The old method (I didn't take the author's name down, so sorry whoever you are.)

ebuild /usr/portage/pkg-category/some-package/some-package-1.0 unpack

cd /var/tmp/portage/pkg-category/some-package/work/...

patch -p1 < ~/my-patch-for-some-package

cd

ebuild /usr/portage/pkg-category/some-package/some-package-1.0 merge

Note Breaking old ebuilds with eclass changes is a QA violation (antarus i think)

Old install (in case it's useful): IDE Kernel Config (Written for Intel Chipset < ICH6 but easy to expand)Last edited by steveL on Tue Aug 18, 2015 11:38 am; edited 43 times in total

----------

## Fukai

 *steveL wrote:*   

> <t35t0r> i need an alias for ps -Af | grep someMatch | awk -F' ' '{print $2}'
> 
> 

 

```
man pgrep
```

----------

## steveL

Nice one Fukai.

----------

## steveL

First, emerge gentoolkit if you don't have it (you should!)

# Check for security updates: 

glsa-check -l affected 

# Check which packages will be emerged :

glsa-check -p affected

# Apply security updates: 

glsa-check -f affected

Thanks lefou!Last edited by steveL on Wed Sep 19, 2007 10:39 am; edited 2 times in total

----------

## steveL

Having device nodes for stuff udev doesn't handle:

<Kyuu> ..a tarballed udev tree which can be set in /etc/conf.d/rc

<MvG> RC_DEVICE_TARBALL="yes"

from rc file:

# Set to "yes" if you want to save /dev to a tarball on shutdown

# and restore it on startup.  This is useful if you have a lot of

# custom device nodes that udev does not handle/know about.

<MvG> You create the device node manually, and next time you reboot it's recreated from the tarball.

----------

## steveL

awk 'sub(/-[0-9].*/, "")' is the current recommendation for a pipe/ file of pkg names

[${x%-[0-9]*} if $x has the atom (I haven't tried this yet, but I trust xmb on #bash)

----------

## nanafunk

Don't trust xmb.

----------

## lefou

 *steveL wrote:*   

> SECURITY UPDATES:
> 
> First, `emerge gentoolkit' if you don't have it (you should!)
> 
> glsa-check -t all
> ...

 

Why not using glsa-check's simplier built-in options?

```
# Check for security updates:

glsa-check -l affected

# Apply security updates:

glsa-check -f affected
```

Last edited by lefou on Thu Jan 11, 2007 12:19 pm; edited 1 time in total

----------

## steveL

 *nanafunk wrote:*   

> Don't trust xmb.

 Well the awk script works, and that's his too.

----------

## nanafunk

2 functions from my ~/.bashrc, hopefully some use to someone.

pc -- package count, number of packages installed

pl -- package list, list of packages installed

```
pc(){ local i=0; while read; do ((i++)); done < <(printf "%s\n" /var/db/pkg/*/*/); echo "$i"; }

pl(){ local i; for i in /var/db/pkg/*/*; do i="${i#/*/*/*/}"; echo "${i%-[0-9]*}"; done; }

```

----------

## steveL

Excellent! Thanks nanafunk.

----------

## steveL

 *nanafunk wrote:*   

> Don't trust xmb.

 Funny, he keeps trying to get me to give him a root login to my machine lol.

Anyway, one more about compiling the kernel. Thanks again to Neddy Seagoon.

----------

## steveL

Note this is now the default method in portage (and has been for a few years.)

This is an excellent tip from zmedico for speeding up portage cache updates- by not doing them! Seems the metadata kept in /var/cache/edb is pretty similar to the metadata which is rsynced (slightly different format) and portage can be set just to use the rsynced version. Perfect!

All you do is:

```
echo "portdbapi.auxdbmodule = cache.metadata_overlay.database" > /etc/portage/modules
```

and set FEATURES="-metadata-transfer" in make.conf. You also need to delete the /var/cache/edb/dep/usr/portage directory recursively. (I tarred mine up cos i was scared :)

 *man portage wrote:*   

> modules
> 
>  This file can be used to override the metadata cache implementation.  In practice, portdbapi.auxdbmodule is the only variable that the user will want to override.
> 
>  Example:
> ...

 Last edited by steveL on Wed Oct 30, 2013 9:17 pm; edited 1 time in total

----------

## steveL

Transferring system:

from uberpinguin:

I have had excellent results from booting off a livecd, and 'tar -vcpj /mnt/gentoo/ --file=/remote/volume'.  Never had trouble with the restore.

boot from a livecd, mount your root filesystem in /mnt/gentoo/ and 'tar -xvcjpf /remote/volume/archive.tar.bz2 /mnt/gentoo/'

----------

## N-S

Link to Sneakernet is broken. It goes to the Xorg modelines page.

----------

## steveL

 *N-S wrote:*   

> Link to Sneakernet is broken. It goes to the Xorg modelines page.

 

Thanks N-S, fixed it. Dunno how that happened  :Smile: 

----------

## steveL

 *Alan McKinnon wrote:*   

> One thing I *LOVE* doing: run file in each directory, cut the output, sort, uniq it, and see what kind of files I have there. I've discovered that file recognizes many weird formats 

 

http://help.lockergnome.com/linux/gentoo-revdep-rebuild-gcj-ftopict393221.html

----------

## steveL

TriffidHunter: ..when you don't put INPUT_DEVICES="mouse keyboard" in your make.conf before emerging xorg.. add that, then emerge -avt1 xf86-input-{mouse,keyboard}

intel hd audio: if (kernel alsa) the modem driver (Intel/SiS/nVidia/AMD MC97 Modem) is enabled i cannot use my soundcard either (renihs)

zgrep SND_INTEL8X0M /proc/config.gz (zlin) good tip for checking whether your kernel has a setting.

----------

## steveL

 *MickKi wrote:*   

> To create a back up of your MBR and Master Partition Table on a floppy, using the dd command:
> 
> ```
> # dd if=/dev/hda of=/dev/fd0/boot.mbr bs=512 count=1
> ```
> ...

 

From this post.

----------

## steveL

Another NeddySeagoon post, this one on setting up IDE and DMA for hard disk and cdroms. Change the chipset line at the bottom to match yours.

----------

## steveL

This is really simple, but there's a small gotcha, which is you need a repo_name file in profiles subdir, or portage will complain that the PORTDIR directory structure is invalid. Secondly, there's no more old-style make.conf  PORTDIR_OVERLAY="/usr/local/portage", and we need to give it a layout.conf. The Wiki has a page on this, so check that too.

We normally use: /usr/local/portage since that keeps it out of the portage tree (eg if we want to use a different fs for the tree, or wipe it and reformat, when distfiles is another mount), and is in the correct place for just this machine:

```
mkdir -p /usr/local/portage/profiles /usr/local/portage/metadata

echo aname > /usr/local/portage/profiles/repo_name

echo 'masters = gentoo' > /usr/local/portage/metadata/layout.conf

chown -R portage:portage /usr/local/portage
```

In /etc/portage/repos.conf/local:

```
[aname]

location = /usr/local/portage

priority = 10000

auto-sync = no
```

Using the overlay:

Remember the directory structure should mirror the one under /usr/portage. So, for example, an apache ebuild you've patched would go in directory /usr/local/portage/www-servers/apache.

Before you can use it, you have to cd to the overlay ebuild directory and run:

```
repoman manifest
```

This will download any sources you need, but not any patches etc: they live in the files/ subdir under the ebuild directory. It's easiest just to try emerging the ebuild (-av will tell you it's coming from the right overlay; it'll show ::aname after the version) and cp any files needed from the portage tree.

You can also add licenses which are not in the main tree under licenses subdir, and patch eclasses (if you have to-- better for writing your own) in ofc, the eclass directory.

The /etc/portage/repos.conf/ directory is made by portage (on upgrade, here) with the file /etc/portage/repos.conf/gentoo.conf:

```
[DEFAULT]

main-repo = gentoo

[gentoo]

location = /usr/portage

sync-type = rsync

sync-uri = rsync://rsync.europe.gentoo.org/gentoo-portage
```

 where sync-uri is your $SYNC setting from make.conf.

Overlays are selected according to the priority; the gentoo one defaults to -1000. The example in the manpages shows how to do what I call "underlays", that is developer-overlays which defer to gentoo (at priority 0), instead of overriding it. In the older setup, PORTDIR was the default, and only consulted if the ebuild was not in the other overlays. We want our local one to be looked at first, though that's only where there's a choice of ebuilds with the same version. A higher-version in a lower-priority overlay, is still chosen as "best-visible." 

The "best-visible" is the latest one according to your profile and any masking/ keyword settings (plus ebuild dependencies.)

The newest best-visible is always picked, irrespective of which overlay it's in; the ordering only comes into play for equal versions of the same best-visible.

It can be confusing if you don't know about that aspect; the idea is that if the tree moves forward with a newer version, you want that version for the default user-case. If not, use a cat-foo/pkgbar::overlay mask.

Overlays were selected in inverse order to the listing in PORTDIR_OVERLAY (ie latest takes precedence). The newer setup is more flexible, at the price of a bit more complexity (and I wouldn't want to debug the interaction of more than a very few overlays;)

To see the current situation for your setup use:

```
portageq repos_config /
```

There's no manpage for portageq though portageq(1) is mentioned in man emerge.

Run portageq -h instead.

So by setting our priority to 10000, we have plenty of space below, for any overlays we might install, as well as underlays we might work on, and can still override by dropping a patched ebuild and/or files, into /usr/local/portage just as we always have.

(Note that if you want to use crossdev, its overlay needs a higher-priority still.)Last edited by steveL on Thu Nov 26, 2015 11:34 am; edited 13 times in total

----------

## steveL

To get anything you emerge with FEATURES=debug emerge blah to also have the proper CFLAGS etc for a debug build, use this in /etc/portage/bashrc:

```

if [[ $EBUILD_PHASE = setup && " $FEATURES " = *' debug '* ]]; then

   einfo 'bashrc: enabling debug settings'

   DEBUG=yes

   RESTRICT+=' strip'

   export CFLAGS="${CFLAGS/-fomit-frame-pointer/} -g3"

   export CXXFLAGS="${CXXFLAGS/-fomit-frame-pointer/} -g3"

fi

```

Thanks to solar for the definitive flag settings.

We need to do this with pre/post hooks, but this works for now.

add einfo

don't use crufty ${LDFLAGS}

 RESTRICT=strip v. nostrip (FEATURE)

 removed: export LDFLAGS="$LDFLAGS -ggdb" since ld ignores -g.

edit: see this post (on next page) for package.env method I use for per-package setup.Last edited by steveL on Sat Mar 08, 2014 7:01 pm; edited 4 times in total

----------

## steveL

Thargor: Just use dispatch-conf.

/etc/dispatch-conf.conf:

```
# Automerge files comprising only CVS interpolations (e.g. Header or Id)

# (yes or no)

replace-cvs=yes

# Automerge files comprising only whitespace and/or comments

# (yes or no)

replace-wscomments=yes

# Automerge files that the user hasn't modified

# (yes or no)

replace-unmodified=yes

# Ignore a version that is identical to the previously merged version,

# even though it is different from the current user modified version

# Note that emerge already has a similar feature enabled by default,

# which can be disabled by the emerge --noconfmem option.

# (yes or no)

ignore-previously-merged=no
```

Then run dispatch-conf.

The first few files, everything will be like it is now, but with the config from above, dispatch-conf stores every file and does replace it automatically if you have not changed it.

==

edit: add comment about --noconfmem, and set  ignore-previously-merged to no instead of yes, so that we see changes when we use the latter option.Last edited by steveL on Fri Sep 26, 2014 3:17 am; edited 1 time in total

----------

## steveL

Nice post which gives a good summary of how to setup Gentoo in production. update handles binpkgs nicely ofc :)

----------

## steveL

Great post on making an updated install stage. I've been building chroots for the last couple of months while working on update and am thinking to write a script to replicate my current setup from a stage3. I've built loads of chroots, especially since I started using a binhost, and have started a script which takes care of the base build based on user menu selection.

Anyhow, I'll add stuff to this post, so far we have:

Hostname, and configs

  We can copy from existing system, or the config file dir. And the user should be able to edit any config file from a selection and revert changes in case of problems. Eg making sure the CFLAGS are correct (for a single-user reinstall) is important, as are any base USE settings.

Update system then emerge -e  world 

  First run of system and world we can do -X, imo. It's better to build it up slowly, get the machine booting and see.

umount /dev /proc from the chroot and then tar the installation (this is within chroot): 

```
cd / && tar -cvjp ./ -f $(date +%Y%m%d)-baseline.tar.bz2 
```

 Gives a base stage. It would be fun to play with that in a vm as well.

 *Suicidal wrote:*   

> For future installs I just update the existing chroot and then tar it up like I did before.

 

edit: cd / only applies in chroot.Last edited by steveL on Wed Oct 30, 2013 9:21 pm; edited 1 time in total

----------

## steveL

Lovely set of tips from bssteph, which I'm quoting directly (not put in quotes as it makes it harder to read):

Random incomplete tips for the budding Gentoo user:

 * Use a breakbox if you can early on, when you're still getting your Gentoo legs. Put it on something you don't care about too much and go nuts. Even if it isn't your only Gentoo box, have that be the one where you try out an overlay, or switching to ~arch, or whatever.

 * Don't plow through big updates. My "rule" is as follows: less than a month, unless the package list is huge, emerge -uDN world is safe. Otherwise, do things in parts, if the system is working fine. emerge -uDN cups, make sure that works, make sure everything works with the new glibc, and then (and ONLY then) move on to KDE or the next thing with 20 or so packages to upgrade. It saves a lot of headache, leaves a system with a better chance of being usable after each step, and makes determining what broke much easier.

 * NEVER plow through dispatch-conf (or whatever you use to update your config files). If you can't spend time on each config file immediately after an update, making sure you merge the configs correctly, leave it be and don't reboot/restart any related services until you can get to the configs. NEVER reboot with a dispatch-conf run pending.

 * Pay attention to every new package and changed USE flag in an emerge -pvuDN world. A new package here means new deps, obviously. Find out if the deps are optional, see if you should perhaps be using a different (new) package to replace that USE flag that just went away. Trust emerge, but never blindly accept it.

 * Clean out your world file every now and then, removing packages that are deps of other packages in world, unless you remember wanting that specific package. (That is, unless you were writing code that used it, you probably don't need libpng in your world file, you only want USE="png".) This can clear up funny problems or point you to better alternatives, especially with virtuals. (Example: I had a FAM library in my world file (I don't even remember the name of it) and it would occasionally spin and take 100% CPU in KDE. One day I did some cleaning and let emerge install gamin, which was the default choice for FAM, which turned out to work much better.)

 * Use --depclean. Even if you always --pretend it, just do it to get a sense of things. You may not run the --depclean, but you may still identify some packages you can remove. Look for stuff you don't use anymore when poking around in your world file (or the bold items in emerge output, these days).

 * Run one of those cruft scripts, or write your own, for older boxes, but by all means, only if you're perfectly comfortable with it. Verify its output before removing anything.

 * Look at /var/log/messages every now and again.

If those points worry you or seem wholly unacceptable, this may not be the distro for you. Sorry. It's a tough thing to say, especially without offending, but in my experience, not being mindful of things like the above will just lead to worse problems later.

----------

## bssteph

 *steveL wrote:*   

> [Me.]

 

Hah! Very nice, I approve. (I thought while writing that maybe hidden in some unrelated thread isn't the best place for them, but looks like you solved that.) Feel free to clean them up or whatever. There are probably dozens of such little tips/headache avoiders floating around, keep threads like this coming.

----------

## steveL

Great post from delta407 on reinstalling python if you're unfortunate enough to lose it (written *ages* ago and still working in Dec 2007 apparently!):

You might be able to reinstall Python using this:

```
# cd

# tar xzf /usr/portage/distfiles/Python-2.2.1.tgz

# cd Python-2.2.1

# ./configure --with-fpectl --infodir=/usr/share/info/ --mandir=/usr/share/man

# make

# make install prefix=/usr

# rm /usr/bin/python 2>/dev/null

# ln -s /usr/bin/python2 /usr/bin/python
```

Hopefully this will be enough of Python to let you "emerge python" again.

---

Another in same thread from desultory: (more recent)

If the python interpreter is actually nonfunctional, as opposed to some mishap with configuration or selection, try the following.

Download the package from the tinderbox repository which matches the architecture of the system. Place that file in $PKGDIR on that system. Then unpack that package directly under /, tar xvjf $PKGDIR/python-2.4.4-r6.tbz2 should do it, though $PKGDIR will likely need to be manually expanded as it is not typically present in the environment. Next ln -s /usr/bin/python2.4 /usr/bin/python. Finally, emerge -K dev-lang/python.

edit: more up to date packages for amd64 and for x86 are on Patrick's tinderbox.Last edited by steveL on Fri Sep 19, 2014 1:28 pm; edited 1 time in total

----------

## steveL

PORTAGE_BINHOST="http://tinderbox.dev.gentoo.org/default-linux/<arch>" 

PKGDIR="/path/to/store" 

in make.conf; You can browse from: http://tinderbox.dev.gentoo.org/

PORTAGE_BINHOST="http://packages.gentooexperimental.org/packages/<arch-setup>" is another good one, usually more up to date as Patrick does tinderbox runs.

If you do use these, consider donating some money to help the people who provide the binhosts, or they'll get shut down if they use too much resource. For gentoo, it's solar who runs it: I'm sure any help can just go to Gentoo itself, and for gentooexperimental, it's bonsaikitten who you can find in #gentoo-chat on irc.freenode.org.

You can use update with -g or -G for nice support for binhosts over the web. You can also put binHost=1 or binOnly=1 in /etc/update to do this on every run.

edit: no more html url for dev.gentoo.org

edit2: new gentooexperimental address. 3: browse urlLast edited by steveL on Sun Dec 23, 2012 6:26 pm; edited 4 times in total

----------

## steveL

From this post by Coldwind:

You can look through your package.keywords and spot those that annoy you, then you look if they work fine and have been for at least 30 days in ~arch. If those requisites are met, then file a stabilisation bug. That's an easy way to contribute to make stable tree better ;-)

 this applies to anybody who is capable of checking the ChangeLog to see how much time was the ebuild in the tree, search bugzilla for related bugs, and file a bug. 

A template bug is something like this: 

Product: Gentoo Linux 

Severity: Enhancement 

Summary: Stabilize foo/bar-1.0 

Description: 

foo/bar-1.0 is in the tree for X time and works fine on amd64. 

emerge --info: 

<Paste emerge --info output here> 

..or something like that. If the maintainer thinks it's fine to stabilize, he'll CC ATs and they'll stabilize the package, if not, the bug will stay open or closed with LATER. 

If bug is closed or ATs are not CC'ed, DON'T TAKE IT AS AN OFFENSE, probably there's a reason for not stabilizing the package yet.Last edited by steveL on Sun Aug 02, 2015 11:08 am; edited 1 time in total

----------

## steveL

Here's a one line fn to search for a package in any overlay (blame xenoterracide ;), stick it in .bashrc. NB you need to emerge html2text first.

```
search() { [[ $1 && $1 != *[[:space:]]* ]] && curl -s "http://gentoo.zapto.org/packages/search?description=$1" | html2text -nobs|awk '/results for query/ { i=1 }; (i && $1 != "[Home]") { print }'; }
```

Note that it requires network connectivity and thanks to zapto :)Last edited by steveL on Thu Apr 17, 2008 11:11 am; edited 1 time in total

----------

## XenoTerraCide

it's all my fault  :Razz: 

----------

## steveL

Hehe, yup :)

I like your blogs and the ideas xenoterracide, but don't agree with forking Gentoo. Yeah there are some people in it I can't stand, and I think they do a grave disservice to everyone else, most especially the people who provide the software, but I don't care about them. Hopefully they'll leave me alone (and my /ignore list includes all of them;) and it'd be doing the other 99.99% a disservice to tar them with the same brush.

Hopefully things'll get better once the new Trustees sort out the Foundation, the officers and the finances. I don't really expect them to make much of an impact on the social side (which is under their remit and always has been) until they get that done, and I wouldn't want them to shirk it in any way.

In any event I can just go offline for a bit when I get fed up of the trolls: life's too short to let other people spoil the fun ;P

----------

## XenoTerraCide

 *Quote:*   

>  but don't agree with forking Gentoo

 

The nice thing is, you don't have to  :Wink: .

Honestly though, I hope it doesn't come down to that. I hope new council/trustees whatever do better, than what has been happening. But something just seem to be in grid lock (in other words the people making the decisions don't seem to care). Like I said though, I hope that a fork isn't the solution.

 *Quote:*   

> I like your blogs and the ideas xenoterracide

 

Thanks, hopefully enough like them to actually implement them.

----------

## steveL

edit: See this post below for package.env method which is much better.

Something like this is how we do phase hooks; this is in bashrc, but you can do similar stuff in an /etc/portage/env/cat/pkg file by just using the function and not the surrounding if.

```

DEBUG_PKGS='sys-libs/glibc some-other/thing'

if hasq "$CATEGORY/$PN" $DEBUG_PKGS; then

   pre_pkg_setup() {

      local x

      for x in installsources splitdebug ; do

         if ! hasq "$x" $FEATURES; then

            elog "bashrc is adding $x to FEATURES for $PN"

            FEATURES+=" $x"

         fi

      done

   

      if ! hasq -ggdb $CFLAGS; then

         elog 'bashrc is adding "-ggdb" to CFLAGS for '"$PN"

         CFLAGS="$CFLAGS -ggdb"

      fi

   }

fi

unset DEBUG_PKGS

```

Many thanks to zmedico for this, and ofc for the excellent package manager that we know and love, which has built every Gentoo system out there ;-)

Bear in mind the earlier post on the first page; I'd use this for supporting libs/apps, and add -g3 -ggdb for stuff we actually follow. wrt splitting, it's not an issue for stuff compiled via gcc (including C++, Fortran..) but would be for any other compilation system afaik. If you're on 32-bit, you'll want to strip -fomit-frame-pointer (it doesn't have any effect on 64-bit aiui) as in the previous post.Last edited by steveL on Sat Mar 08, 2014 7:07 pm; edited 1 time in total

----------

## steveL

Running a cronjob as a service which isn't allowed to login will give pam errors. Casshan shows how to use the apache user's crontab:

```
crontab -u apache -e
```

----------

## steveL

Make sure you set FEATURES="buildpkg" in make.conf. Portage will then build a binpkg every time it compiles a package, so you can roll-back to any version of anything ever installed on your system (til you eclean the binpkg, or otherwise delete it.) If you do that, you'll never again have a problem you can't recover from using what you've already built.

PKGDIR is the base directory where portage will save packages it builds, (see man make.conf), which defaults to /usr/portage/packages. The packages will be in category sub-directories underneath that.

I use: PKGDIR="/var/pkg" in /etc/portage/make.conf since /var is the namespace for this sort of thing (the directory is root:root, not portage here, as I don't want users to be able to write to it.) So my packages are in directories like /var/pkg/sys-apps.

Obviously you have to make the directory (as root) first:

```
mkdir -p  /var/pkg
```

or:

```
mkdir -p  /usr/portage/packages
```

You can also drop packages from binhosts, or set a binhost as above, in the category sub-directory under PKGDIR, should you need to download one to recover with (eg if your backup is bad too.) eg:

```
emerge -K =sys-apps/gawk-4.0.2
```

See man emerge for --usepkgonly option.

edit: gawk versionLast edited by steveL on Thu Sep 11, 2014 7:06 pm; edited 1 time in total

----------

## steveL

Here's what I use to inspect initscript dependencies.

It's my /root/.bashrc but you can stick it into /etc/bash/bashrc or your own ~/.bashrc ofc. I wrote it to be POSIX-sh compliant, so it should work in busybox too (apart from the first line, which is nothing to do with the functions, but just testing that the shell is interactive: a case construct would be used in POSIX sh.)

```
[[ $- = *i* ]] || return

## init.d functions

# you can add other directories (space-separated) in here

readonly INIT_D_DIR='/etc/init.d'

# show a function from initscript/s (and/or glob/s eg 's*')

ifunc(){

   local d f r s=$1 fn="^[[:blank:]]*$1"'\(\)' br='[[:blank:]]*\{'

   shift

   for d in $INIT_D_DIR; do

      for g; do

         for f in "$d/"$g; do

            [ -f "$f" ] || continue

            r=$(sed -En "/$fn($br)?/,/^}/{/^}/q;/$fn$br/n;/$fn/{N;n;};p}" "$f")

            [ "$r" ] && printf '%s\n%s\n' "$f: $s" "$r"

         done

      done

   done

}

# convenience wrappers for the common funcs

idepend(){

   ifunc depend "$@"

}

istart(){

   ifunc start "$@"

}

istop(){

   ifunc stop "$@"

}

ireload(){

   ifunc reload "$@"

}

icheckconfig(){

   ifunc checkconfig "$@"

}

# show the functions defined by an initscript/glob, or all if no args

ishow(){

   local d f

   for d in $INIT_D_DIR; do

      if [ "$*" ]; then

         for f; do

            [ "$f" ] && _ishow "$d/$f"

         done

      else

         _ishow "$d"/*

      fi

   done

}

_ishow(){

   local f

   for f; do

      [ -e "$f" ] || continue

      grep -H '^[[:blank:]]*[[:alpha:]_][[:alnum:]_]*()' "$f" | {

         curr= p=

         while IFS='    :' read -r fname func _; do

            if [ "$fname" != "$curr" ]; then

               [ -n "$curr" ] && echo "${curr##*/}:$p"

               curr=$fname p=

            fi

            p="$p ${func%%'()'*}"

         done

         [ -n "$curr" ] && echo "${curr##*/}:$p"

      } || : # POSIX. zsh: true or: emulate sh; NULLCMD=:

   done

}
```

I knocked the above up while I was updating my udev initscript after the last udev upgrade. I wanted udev to start as soon after localmount as possible, and to do that I needed to inspect the dependency tree. Here are some examples:

```
$ idepend xdm

/etc/init.d/xdm: depend

        need localmount xdm-setup

        # this should start as early as possible

        # we can't do 'before *' as that breaks it

        # (#139824) Start after ypbind and autofs for network authentication

        # (#145219 #180163) Could use lirc mouse as input device

        # (#70689 comment #92) Start after consolefont to avoid display corruption

        # (#291269) Start after quota, since some dm need readable home

        # (#390609) gdm-3 will fail when dbus is not running

        # (#366753) starting keymaps after X causes problems

        after bootmisc consolefont modules netmount

        after readahead-list ypbind autofs openvpn gpm lircmd

        after quota keymaps

        before alsasound

        # Start before X

        use consolekit dbus xfs
```

To see what functions are in an initscript, use ishow:

```
$ ishow xdm

xdm: depend setup_dm vtstatic start stop
```

And ifunc to see what a script-specific function does:

```
$ ifunc vtstatic xdm

/etc/init.d/xdm: vtstatic

        if [ -e /etc/inittab ] ; then

                grep -Eq "^[^#]+.*\<tty$1\>" /etc/inittab

        elif [ -e /etc/ttys ] ; then

                grep -q "^ttyv$(($1 - 1))" /etc/ttys

        else

                return 1

        fi
```

Note that these take standard shell parameters, so you can check multiple initscripts at a time, eg idepend xdm udev and istart /usr/local/etc/init.d/web*.

They also take globs if you quote them so the shell doesn't expand them as files in the current directory. For example  ireload 'sys*' here shows me here that out of sysctl, sysfs and syslog-ng, only the last has a reload function, which is ofc what we'd expect, and what that function does. So the last example above would be better handled by putting the directory in the INIT_D_DIR variable at the top and using: istart 'web*' instead.

edit: oops quote "$1" in _ishow()

change expansion and use a for to handle no parm case correctly

no += in POSIX sh; make the conditions more obvious

try to keep true returnLast edited by steveL on Tue Jan 26, 2016 10:18 pm; edited 4 times in total

----------

## steveL

I use this function to quickly look up ebuilds that have come up when I'm running update; sometimes you want to review the actual ebuild itself. It uses the wonderful eix command to find the ebuild that emerge would install, if I don't give a full version. (This is needed because we might not have the package installed, and even if we do, we really want to check whichever version is current, for our configuration.)

```
# vebuild pkgname | cat/pkg | cat/pkg-version

vebuild() {

   local f c=${1%/*} p=${1#*/} cp=${1%%-[0-9]*}

   if [[ $p != "${cp#*/}" ]] && [[ $1 != "$cp" ]]; then

      f=/usr/portage/$cp/$p.ebuild

      [[ -f $f ]] && {

         echo "$f">&2

         if [[ $DISPLAY ]]; then

            xdg-open "$f"

         elif [[ $EDITOR ]]; then

            $EDITOR "$f"

         fi

         return 0

      }

   fi

   [[ ${FUNCNAME[1]} = $FUNCNAME ]] && return 1

   local a=$(eix -e --format '<bestversion:NAMEVERSION>' "$1")

   [[ $a ]] && $FUNCNAME "$a"

}

```

edit: Thanks to Swoon for the lovely xdg-open command which makes the above use your preferred gui editor.Last edited by steveL on Sat Oct 27, 2012 6:01 pm; edited 1 time in total

----------

## Swoon

 *steveL wrote:*   

> 
> 
> ```
> 
> ...
> ...

 

I would suggest using kde-open or xdg-open. These programs would trigger the prefered editor, so you can change the editor without changing any scripts. Actually, they open the application that is specified for the file's type. And since ebuilds appear as "text/plain" files, it should open your default editor.

kde-open is part of kde-base/kioclient and xdg-open belongs to x11-misc/xdg-utils (which is a dependency of kdelibs).

I personally have an alias "open" that maps to kde-open. Hence, I can open folders from terminal via "open /etc/", edit files "open file.txt", view images "open image.jpg"…

----------

## steveL

 *Swoon wrote:*   

> I would suggest using kde-open or xdg-open. These programs would trigger the preferred editor, so you can change the editor without changing any scripts. Actually, they open the application that is specified for the file's type. And since ebuilds appear as "text/plain" files, it should open your default editor.
> 
> kde-open is part of kde-base/kioclient and xdg-open belongs to x11-misc/xdg-utils (which is a dependency of kdelibs).

 

Thanks, Swoon, that was excellent advice: I never knew about xdg-open, and it is perfect: no need to worry about backgrounding as it returns pretty quickly after forking off the editor. Plus it's not tied to a DE :-)

I modded to detect whether under X: it's practically at the stage I can use it in update directly :-) [I'll just change it to use PORTDIR, but I don't want the bashrc function to do any kind of lookup for it.] So thanks again, in that respect.

 *Quote:*   

> I personally have an alias "open" that maps to kde-open. Hence, I can open folders from terminal via "open /etc/", edit files "open file.txt", view images "open image.jpg"…

 

That sounds handy. I'd want to alias xopen=xdg-open personally, since I'd rather make it explicit that it's tied to X. (I'm a little bit uneasy about clash with open(2) as well, which has a very different semantic. A command like wait has pretty much the same meaning as wait(2).) Any reason you prefer kde-open to xdg-open?

----------

## steveL

Tidied up front page after adding these two:

Building in a chroot snapshot using BTRFS.

Read-only root eg SD-card

----------

## mv

Sorry for digging up, but I can't resist:

 *Swoon wrote:*   

> I would suggest using kde-open or xdg-open.

 

Even better: Use zsh with

```
autoload -Uz zsh-mime-setup

zstyle ":mime:*" current-shell true

zsh-mime-setup
```

Then just enter /path/to/*.txt and have your mime-configured editor started in background with the file...   :Wink: 

----------

## steveL

In contrast to the earlier bashrc post, I now use this to add heavier debug info (-g3 -ggdb) to specific packages, and occasionally to turn off default (which uses -g) eg for libreoffice and firefox. I originally used the heavier settings by default, and used to get massive disk bloat with firefox such that it'd run out of space on a 15G partition. (I don't actually use libreoffice any more, but it did too.) No doubt this is to do with -lto (istr it adds it) and asking for all possible debug info; in any event now it takes less than 2G :)

current /etc/portage/package.env:

```
## default is: -g -fno-asynchronous-unwind-tables -feliminate-unused-debug-types

# with: FEATURES="splitdebug compressdebug"

# no -g: apps which take a lot of memory and/or time

dev-libs/boost       no-debug.conf

dev-qt/qtwebkit      no-debug.conf

kde-base/pykde4      no-debug.conf

www-client/firefox   no-debug.conf

# -g3 -ggdb:

#        devel.conf
```

As you can see I'm not bothering with full debug info for anything: I leave it to add for recompiling specific packages, should I want that, and I'll use it for software we develop when we put it in ebuild form.

By default we have enough debug info for backtraces. /etc/portage/make.conf:

```
CFLAGS="-O2 -pipe -g -march=native -falign-jumps=1 -falign-loops=1 -falign-labels=1 \

-fno-asynchronous-unwind-tables -feliminate-unused-debug-types"

CXXFLAGS="$CFLAGS"

FFLAGS="$CFLAGS"

FCFLAGS="$FFLAGS"

# default: -Wl,-O1 -Wl,--as-needed

LDFLAGS="$LDFLAGS -Wl,--sort-common -Wl,--hash-style=gnu -Wl,-z,relro -Wl,-z,now -Wl,-z,combreloc"
```

I'm not interested in arguing about the flags, but you'd take out the -falign-* ones for a standard setup. They get stripped for packages like gcc and glibc, so we only end up with:

"-O2 -pipe -g -march=native".

I left them in to show how things change with flags you might have, vs debug ones.

Here's the actual files:

/etc/portage/env/no-debug.conf

```
CFLAGS="-O2 -pipe -march=native -falign-jumps=1 -falign-loops=1 -falign-labels=1"

CXXFLAGS=$CFLAGS

FFLAGS=$CFLAGS

FCFLAGS=$FFLAGS

FEATURES="-splitdebug -compressdebug"
```

/etc/portage/env/devel.conf

```
CFLAGS="-O2 -pipe -g3 -ggdb -march=native -falign-jumps=1 -falign-loops=1 -falign-labels=1 \

-fno-asynchronous-unwind-tables -feliminate-unused-debug-types"

CXXFLAGS=$CFLAGS

FFLAGS=$CFLAGS

FCFLAGS=$FFLAGS

FEATURES=nostrip
```

Note that you can use more than one .conf per package in package.env: it's a space-separated list.

edit: add FEATURES=nostrip to debug.conf

debug.conf -> devel.conf; FEATURES="-splitdebug -compressdebug" to nodebug.confLast edited by steveL on Thu May 04, 2017 3:23 am; edited 2 times in total

----------

## NeddySeagoon

/me checks in.

New lessons are always welcome

----------

## steveL

Hey Neddy, good to see you :)

We actually crossed posts in another topic as well: I wrote the above up for that, then realised I hadn't put the same info in here, and there you are mentioning exactly the same thing. Hehe.

See you online soon,

igli.

----------

## steveL

Nice succinct setup from schorsch_76: 

```

#################################################

# the bridge br0 contains eth0 and tap0

# tap0: virtual machine

# tap1: VPN 

# eth0: Network

#################################################

config_eth0="null"

tuntap_tap0="tap"

config_tap0="null"

tunctl_tap0="-t tap0 -u me"

config_br0="192.168.178.19/24"

routes_br0="default via 192.168.178.1"

brctl_br0="setfd 0 sethello 10 stp off"

bridge_br0="eth0 tap0"

depend_br0() {

    need net.eth0

    need net.tap0

}

```

 [again not quoting, for clarity]:

In the bridge setup, only the bridge interface has an IP address.

The important thing to remember is, that the tap device and eth0 are in the same bridge, and only the br0 has the IP address.

The tap devices get assigned to the QEMU/kvm VMs.

----------

## steveL

From a post by Joseph Koshy on the elftoolchain-developers list.

==

You can run svn switch to migrate a checked-out SVN source tree:

```
cd /ROOT/OF/YOUR/SVN/CHECKOUT

old=http://elftoolchain.svn.sourceforge.net/svnroot/elftoolchain

new=https://svn.code.sf.net/p/elftoolchain/code/trunk

svn switch --relocate "$old" "$new" elftoolchain-code

```

Developers would need to use a svn+ssh:// URL (and https old for sf):

```
old=https://elftoolchain.svn.sourceforge.net/svnroot/elftoolchain

new=svn+ssh://YOURLOGIN@svn.code.sf.net/p/elftoolchain/code/

svn --username YOURLOGIN switch --relocate "$old" "$new"

```

For git-svn users,  the 'git-svn-relocate' script may be used to relocate a git-svn repository:

```
git-svn-relocate "$old" "$new"
```

----------

## steveL

Great info on setting your hostname by khayyam:

You need to edit /etc/hosts and add the hostname ... eg:

```
127.0.0.1 myhost.lan myhost localhost

::1 myhost.lan myhost localhost
```

where myhost is whatever you have set in /etc/conf.d/hostname.

The first entry after 127.0.0.1 will be taken as the FQDN:

```
# grep '^127' /etc/hosts

127.0.0.1 myhost.lan myhost localhost

# hostname

myhost

# hostname -f

myhost.lan

```

So the order should follow the above schema.

--

I'm always forgetting to do this when I install, and it's good to show the IPv6 format as well. (Although many people are on an IP4 lan, behind a NAT router.)

krinn made the point, that it's better to set hostname on the interface instead of localhost, like so:

```
127.0.0.1 localhost

::1 localhost

192.168.0.4 beleg.yourdomain beleg 

192.168.0.6 faramir.yourdomain faramir 

192.168.0.8 hurin.yourdomain hurin 

192.168.0.12 aka.yourdomain aka 

192.168.0.10 cirdan.yourdomain cirdan 

192.168.0.100 router.yourdomain router

```

..so you can easy share all hostnames to your computers in one line [awkified]:

```
awk '$1 ~ /^192\.168\.0\./ { print $1 }' /etc/hosts | xargs -I {} echo scp /etc/hosts {}:/etc

```

 (remove echo to actually run the command.)

--

I like this, however, I also prefer for traffic for my local machine to be seen as local traffic, usually. It depends on the circumstance, but I've had issues in the past with firewall rules and servers. Still it's not hard to move a line or name for your host.

I wouldn't prefer IPv6 for localhost, especially on a LAN where many hosts may not even run it. Maybe that's foolish if you are running a dual-stack on your host. However this is designed to be copied.

So swap the first two lines if you do want to prefer IPv6 for local routing.

----------

## steveL

Great tip from desultory:

emerge -1 /path/to/something/ selects all packages which installed files into that directory as a set to be rebuilt.

It operates analogously given names of individual installed files.

----------

## steveL

```
lspci -k | less
```

 to view in a pager.

```
lspci -k > ~/lspci.out
```

 to save to a file in homedir.

```
lspci -k | wgetpaste -r
```

 to get a pastebin url others can look at, usually on IRC.

I prefer sprunge for pasting, though you need curl installed to use it quickly from the command-line, and wget comes in the stage. Still, sh is quick :)

You put this function in: ~/.bashrc then: sprunge *.c   or: cmd.. | sprunge

```
sprunge() {

   if [ $# -eq 0 ] || { [ $# -eq 1 ] && [ x- = "x$1" ]; }; then

      curl -F 'sprunge=<-' http://sprunge.us

   else

      local f

      for f; do

         [ -f "$f" ] || continue

         echo "Paste of: $f"

         curl -F 'sprunge=<-' http://sprunge.us < "$f"

      done

   fi

}
```

It's written to be POSIX sh-compatible, hence the use of [ instead of [[

----------

## steveL

Nice little howto from Tractor Girl (as usual quoting directly):

Udev is part of systemd. For now it can be used separately without systemd but its current situation is somewhat blurry and causes constant confusion and problems. 

To handle that, gentoo devs created a udev fork: eudev. Eudev is and will be completely independent from systemd. 

So if you don't need/want to use systemd and don't want to be bother with crazy stuff on every udev update, you should switch to eudev:

```
# to keep sane net-names:

echo 'sys-fs/eudev -rule-generator' >> /etc/portage/package.use

emerge -avC udev

emerge -av eudev

dispatch-conf # or etc-update etc.

/etc/init.d/udev --nodeps restart

# if you use insane net-names, eg during transition, run this:

# rc-update add udev-postmount default
```

optionally:

```
emerge -av @preserved-rebuild
```

==

You may need to remove virtual/udev after removing sys-fs/udev, as "program666" mentioned in the next post ("This fixed everything." ;)

For that I'd use: 

```
emerge -cq virtual/udev
```

 since other apps will depend on it in the tree. (You may well not need to, since the upgrade path is supposed to be working now.)

If you get the error: You're missing a /dev/fd symlink to /proc/self/fd when emerging eudev, then run: 

```
ln -sf /proc/self/fd /dev/fd
```

Don't worry nothing will be broken so long as you don't reboot or crash in-between removing udev and emerging eudev. The virtual will be reinstalled as soon as you emerge something that needs it (world will do); it'll be satisfied by eudev.

Don't forget to run dispatch-conf (or w/e you use to etc-update.) I've put it in immediately after above, but you may need to run it after restart (I haven't switched yet. Will do soon:) Just be sure you've checked it to your satisfaction, before reboot.

edit: /dev/fd symlink to /proc/self/fd; run dispatch-conf after installing eudev, explanation.

USE: -rule-generator, no need for postmountLast edited by steveL on Thu Oct 23, 2014 12:35 am; edited 6 times in total

----------

## mv

 *steveL wrote:*   

> The virtual will be reinstalled as soon as you emerge something; it'll be satisfied by eudev.

 

Although most gentoo users will know, one should perhaps point out that you do not have to worry if the virtual is not reinstalled. There are many reason why this might not happen (e.g.: nothing depends on it, the emerged package does not depend on it, etc.) Nothing bad happens if a virtual is not installed.

----------

## steveL

Just my git setup, in case I need to recover it sometime.

I use the command-line (F12 for yakuake which rocks) for most things, and kdiff3 as my git difftool. Normally I view the history with gitview, especially before I push as it shows it in a different context. I'm lazy so I do this via sh aliases instead of git ones (these are from my ~/.bashrc file):

```
alias status='git status'

alias branch='git branch'

alias vbranch='git branch -lvv'

alias co='git checkout'

alias add='git add'

alias unadd='git reset HEAD'

alias gdiff='git diff'

alias staged='git diff --staged'

alias vdiff='git difftool -y'

alias vstaged='git difftool -y --staged'

alias ddiff='git difftool -d --no-symlinks'

alias commit='git commit'

alias merge='git merge --ff-only'

alias pull='git remote update -p; git merge --ff-only @{u}'

alias lol='git log --oneline --graph --decorate --all'

alias view='gitview --all 2>/dev/null &'
```

and this is my ~/.gitconfig; I'm including it all (apart from [user]) as the colour stuff and ps viewer is useful, and you might get some ideas for other things. Really you just need to run 

```
git config --global diff.tool kdiff3
```

 to make the aliases using git difftool above work. You very likely don't want pack.threads setting: I find it useful as I'm on an old core2-duo. 

```
[core]

   excludesfile = $HOME/.gitignore

   abbrev = 12

[pack]

   threads = 0

[diff]

   tool = kdiff3

[difftool]

#   prompt = 0

#   default = current - push to same name, upstream @{u}, simple @{u} if same name, never

# simple is new default in 2.0; 1.x+ was: matching = all branches with same name

[push]

   default = simple

# only allow linear pull (= fetch + merge.)

# NOTE merge of branches (ie: annotated tags) normally:

# default: ff = true   # attempt to ff, merge if not, ie:

#  git merge --no-ff   # fork.

# manual setting forces reflection.

[merge]

   ff = only

[branch]

# track (git pull merges from starting branch) if branching from:

# true = remote, always = local + remote, false

# writes: merge = refs/heads/foo  for branch: foo

   autosetupmerge = false

# use: git push --set-upstream origin foobar  

# rebase when merging, from remote (= .  for local) ie upstream

# if tracking: branch -t local, git clone/fetch new remote

# never, local, remote, always

   autosetuprebase = local

# for local tracking branches, to push back to server:

# git config branch.foo.pushremote origin

[rerere]

   enabled = true # store resolved rebase steps even when aborted

[alias]

   unadd = reset HEAD

   up = "!git remote update -p; git merge --ff-only @{u}"

# show postscript diffs via util, mark as binary

# http://www.kernel.org/pub/software/scm/git/docs/gitattributes.html

[diff "ps"]

   textconv = ps2ascii

   binary = true

# see https://github.com/grosser/dotfiles/blob/master/gitconfig

[color]

   ui = auto

   branch = auto

   diff = auto

   status = auto

[color "branch"]

   current = green

   local = blue

   remote = yellow

#normal status has added/changed = green untracked/deleted/conflic = red -> more colors

[color "status"]

   added = green

   changed = yellow

   untracked = cyan

[color "diff"]

   whitespace = cyan

[pager]

   color = true
```

Also, you likely don't want the branch stuff, but I quite like forcing merges to ff-only, as it means by default everything is linear, and true merges only happen when I explicitly git merge --no-ff (which I haven't had to do yet, as it's only small-team projects.) It's important for pulls, which are defined as fetch followed by merge; hence the git up alias from the web, which I just run directly via pull in terminal. The lol (log one-liner) alias is handy too; I got it from someone in the #git channel on IRC chat.freenode.net, which I highly recommend.

Similarly, the abbrev = 12 set with 

```
git config --global core.abbrev 12
```

 I find useful for pushing specific commits, selected from the branch history in lol, eg: 

```
git push origin $SHA_ID:master
```

 In such cases I feel more confident with more hex digits.

kdiff3 works really well; typically I just use vdiff somefile to review what I've been working on before, which shows me the whole file, instead of the standard coloured diff in terminal, which I use more before committing stuff I've just written. git diff --staged (staged or vstaged alias) really helps to review the commit before you move on to the next one; you can still tweak it after view, and commit --amend.

Also, I always use add -p to make better commits, in preference to rebasing after the event, which i find trickier to reason about; and anyway I'd like to avoid rebasing as a work habit. There's no real benefit to spending time editing, moving and squashing commits to "package" feature changes ime. Just do those on a separate rebased branch if it matters, and use the vcs to record your actual workflow, as it's about the work and the results, not presentation of a manufactured history. Smaller commits may be interrelated, with other commits in-between, but because they're smaller, they're easier to review, if someone really does care.

And if not, whom are we packaging it for anyway? Posterity? lul. They're more likely to be looking at the actual code, and git blame if it matters, and from what I've read people tend to be more interested in how code was actually written, when looking historically; which let's face it, isn't going to be a factor for most of our code. ;)

edit: git config --global

edit: Sometimes I'm tired, and forget the basics, especially for commands I don't use often.

Setting up a new repo (if you use a different email address eg: for FLOSS projects vs work), check: 

```
git config --get user.email
```

 and set with: 

```
git config --add user.email nick@example.com
```

 though usually I just edit the config to put in settings as above, from another repo config file.

git config -l to see what's happening (note that later settings are from your local repo config), then review the .git/config (where .git may be a --separate-git-dir.)Last edited by steveL on Wed Dec 09, 2015 4:09 am; edited 2 times in total

----------

## steveL

A user in #gentoo, coming from another OS, wanted to know: where the vmlinuz and initrd.img files on a Gentoo minimal install .iso (amd64) are:

 *iamben wrote:*   

> in isolinux/gentoo (kernel) and isolinux/gentoo.igz (initramfs)
> 
> See isolinux.cfg for what kernel parameters are passed.

 

Latter is in reference to "Could not find the root block device in ." during boot.

May seem obvious, but could help someone down the road; iamben is always on the ball, ofc.

----------

## steveL

Great tip from Yamakuzure (direct quoting, as usual):

```
$ grep -A 1 -B 1 vm.swap /etc/sysctl.conf

# Reduce swappiness from server like 60 to 32GB RAM notebook 0

vm.swappiness=0

vm.vfs_cache_pressure=50
```

Note: swappiness=0 does not mean that swap is disabled.

A value of 0 instructs the kernel not to initiate swap until the amount of free and file-backed pages is less than the high water mark in a zone.

Current memory state: 

```
$ free -m
```

----------

## steveL

Gnome3 crapfest getting you down? Tired of trying to keep it off your machine and still retain some semblance of a Unix? Fed up of an interface that is nowhere near as useful as Gnome2?

Tony0945 writes:

If you search the forum, you will find several threads on converting to Mate with masks posted. I participated in several of those threads, but on the final machine that I converted, I just removed all the gnome use flags, changed profile from Gnome to plain Desktop (very important), emerge'd -C anything from gnome, --depclean, then unmasked and emerge'd Mate which brought several things back. I don't know if I can really recommend that approach, but it was simple. If you have a lot of customization in Gnome, I'd look for more expert advice than mine.

If you don't need remote login, I recommend SLiM, http://wiki.gentoo.org/wiki/SLiM. That will give you the chance to choose your desktop at each login. 

Personally, I've gone back to vanilla XDM as I run only Mate now and sometimes do remote login with XDMCP.

==

wrt "expert advice": try #gentoo and #gentoo-desktop as well as #mate on IRC: chat.freenode.net (in addition to the forums.)

----------

## depontius

 *steveL wrote:*   

> 
> 
> Personally, I've gone back to vanilla XDM as I run only Mate now and sometimes do remote login with XDMCP.
> 
> 

 

I'm still using some carefully masked GNOME libraries, because...

gnucash pulls in some GNOME bits'n'pieces.

I like gthumb for my photos, as does my wife.

I currently need gdm:

1 - It does autologin for my wife on her machine, making it appliance-like for a better W.A.F.

2 - It manages to allow remote X connections - too many display managers imply "-nolisten tcp" with no easy way to change.

3 - On occasion I actually do use XDCMP.

4 - I like reboot/shutdown controls on the login screen.

From what I can tell, gdm is the only one that does all 4 - I'd be happy to have something else and get rid of as much GNOME as I can.  I have in the past had a tk hack that added reboot/shutdown buttons to xdm, but lost them somewhere along the way, nor am I sure how to do XDCMP with xdm.

If you've got a tip for this, I'm all ears.

----------

## steveL

@depontius: I don't use GNOME so can't advise; was hoping tony0945 might respond. I recommend starting a new topic for it in Desktop Environments.

----------

## steveL

From Donahue and NeddySeagoon in this topic:

To specify the root device on the kernel command-line use 

```
root=PARTUUID=foo
```

where foo is a PARTUUID from 

```
blkid
```

 which gives output like: 

```
/dev/sdc1: LABEL="OCZ128" UUID="f7bd2bec-3688-4336-8c63-e6921ae5e3bf" TYPE="reiserfs" 

  PARTLABEL="OCZ128" PARTUUID="89bc9633-fbc9-4a90-8a67-e058cb655d95"
```

 without quotes, so the above would give a kernel-parm of: 

```
root=PARTUUID=89bc9633-fbc9-4a90-8a67-e058cb655d95
```

This works with MSDOS Partition tables too.

==

PARTUUID is preferable because it's kernel-level, and doesn't require any interaction with the filesystem, so it's more robust.

Unless you have specific esoteric needs, in which case you know about it, I'd recommend this.

Though I'd also recommend building in the drivers for your rootfs (ext4 handles ext2/3 partitions as well), and motherboard PCI and hard-disk controllers, to the kernel unconditionally when you install. This usually means you can simply specify /dev/sda and sdb etc. 

But if you have races at bring-up, consider PARTUUID before you look at label-based solutions.

----------

## steveL

And more broadly SDL; info from Naib, not quoting/edited a bit, as usual:

Since steam uses SDL, it will by default use pulse.

You can override that with SDL_AUDIODRIVER=alsa

The steam runtime ships with libpulse, but does not require pulse to run.

==

So you might put in /etc/bash/bashrc for the system: 

```
export SDL_AUDIODRIVER=alsa
```

Though I think you'd be better off if you add a new file in /etc/profile.d/:

```
mkdir -p /etc/profile.d

echo 'export SDL_AUDIODRIVER=alsa' > /etc/profile.d/sdl-alsa.sh
```

Those are read by /etc/profile (a shell-script) at the bottom.

Another option is to use /etc/env.d/: 

```
echo 'SDL_AUDIODRIVER=alsa' > /etc/env.d/99sdl-alsa
```

And run env-update (or reboot.)

Though that's more distro-level; profile.d is better for local-admin, imo.

You might want to use the above if you're running a centralised setup, though.

----------

## mv

 *steveL wrote:*   

> Another option is to use /etc/env.d/

 

/etc/env.d is usually not CONFIG_PROTECT'ed. I would even go one level highter  */etc/portage/env/media-libs/libsdl wrote:*   

> post_src_install() {
> 
>         einfo "local additions to /etc/env.d"
> 
>         echo 'SDL_MOUSE_RELATIVE=0' >50sdlmouse || die
> ...

  and then reemerge libsdl. (I added SDL_MOUSE_RELATIVE=0, because I realized that most sdl games behave strange without this)

----------

## steveL

 *mv wrote:*   

> /etc/env.d is usually not CONFIG_PROTECT'ed. I would even go one level higher..

 

Yeah I was just thinking it should be done as part of ebuild.

Didn't realise we could put bash function def'ns in portage/env (though it makes sense in bash terms, I thought that was read by python shlex, which only supported variables, so we had to use bashrc instead.) nice :)

 *Quote:*   

> and then reemerge libsdl. I added SDL_MOUSE_RELATIVE=0, because I realized that most sdl games behave strange without this

 

Ah good one, thanks. I think I might just shove that in an overlay (we can select env for overlay in same way as on system, on newer portage. I'd still like the same for bashrc.) If needs be, I'll patch the ebuild, just so I don't have to bother about separate files.

----------

## steveL

Nice tip from Ant P on viewing crash logs under EFI:

Enable pstore and efivars pstore backend in the kernel, then next time it hangs you can reboot, mount /sys/fs/pstore and get the dmesg log from when it crashed

----------

## steveL

Lovely set of instructions from NeddySeagoon:

You can make a i586 hardened tarball from an i686 one.  You need a i686 host to do it though.

Your [i3/core2 etc] should do nicely.  The process is just like a stage1 install, except you will do it in a directory.

On your i686 host, make a directory called /home/<me>/hardened-i586

Untar the hardened i686 tarball here.

Do the chroot preparation steps but do not chroot yet.

If the host is gentoo, bind mount /usr/portage at  /home/<me>/hardened-i586/usr/portage because there is no point in getting another copy of the portage tree and more distfiles.

Take care to put the i586 /usr/portage/packages at say, /usr/portage/packages-i586, since you don't want to overwrite  /usr/portage/packages for the host.

In make.conf (in the chroot: ie /home/<me>/hardened-i586/etc/portage/make.conf) change the CHOST to be correct for a i586

Set CFLAGS for your [target machine=runtime CHOST in the root].  You MUST NOT use -march=native

Set any USE flags to your taste to save rebuilds later.

run emerge --sync to ensure your tree is up to date.

Now you can get into the chroot.

Check make.conf - this is a good time to discover that you have edited make.conf on the host  :)

Execute the script /usr/portage/scripts/bootstrap.sh

This will build the toolchain for your new CHOST.  This is actually the stage1 from a stage1 install.

You need to run this in one go as it can't be resumed.

Select your compiler - it should have i586 in its name now.

Run 

```
emerge -e @system
```

to rebuild all of the system set packages using your new CFLAGS.

This is the step that corresponds with stage2 

Once that completes you have a hardened-i586 in the location where you started with a i686 tarball.

If you wish, you can build more packages now.

When you are done, exit the chroot, umount all the external things mounted inside /home/<me>/hardened-i586, then tar it up.

----------

## steveL

Added link for Understanding the boot process (another NeddySeagoon special;) to OP.

----------

## steveL

Taken from dufeu's excellent post; as usual not quoted (+ minor edits) for readability.

==

The 'need' is a place to define custom additions/exceptions for portage values reflected in but not limited to:package.use

package.mask

package.keywords

package.unmask

package.licenseBy default, new installations have all of these custom portage variable lists, as files under /etc/portage/

You have the option of creating any or all of these as directories instead and moving the files themselves to their corresponding directories, eg: 

```
cd /etc/portage

mv package.use use && mkdir package.use

cp -p use package.use/base
```

 You can use w/e file name you like instead of 'base': they're read in (ASCII) alphabetical ordering, so earlier is likely better if you're adding overrides.

When you set your portage variable lists under directories, all the files in each directory will be processed for additions/exceptions for each category {use, mask, unmask, keyword etc.}

Now why would you want to do this?

There are two very good reasons for moving from single category list files to list directories.'emerge' has had the ability now for a while to recommend and automatically update your custom portage value lists. When you set it up to do that, it will include a lot of 'comment' information telling you what it did.

You'll also find that the older your gentoo installation gets, the more custom additions/exceptions portage values you'll accumulate because of personal desires and on-going package changes.

It gets very old very fast scrolling through pages and pages of 'package.use' and 'package.mask' trying to figure out what you did or to untangle deprecated values.

[ed: Although you should regularly review and remove any cruft, especially versioned atoms which no longer apply.]

I've converted all my value list files to directories. To make this whole issue very clear, here is an example of what one of my new installs looks like:

```
# ls -l /etc/portage/package.use/

total 56

-rw-r--r-- 1 root root  75 Mar 15 07:59 calibre

-rw-r--r-- 1 root root  33 Mar 14 14:06 fs

-rw-r--r-- 1 root root  33 Feb 22 13:06 iputils

-rw-r--r-- 1 root root  59 Jun  7 07:28 kde

-rw-r--r-- 1 root root 112 Mar 15 18:45 lxqt

-rw-r--r-- 1 root root 505 May 12 15:07 media

-rw-r--r-- 1 root root 188 Mar 24 06:29 misc

-rw-r--r-- 1 root root 166 Apr  8 17:43 network

-rw-r--r-- 1 root root  23 Apr  6 10:02 office

-rw-r--r-- 1 root root  38 Mar 24 06:04 qt

-rw-r--r-- 1 root root  82 Jun 30 06:31 samba

-rw-r--r-- 1 root root  24 Mar 13 13:31 system

-rw-r--r-- 1 root root 206 Apr  6 09:24 temp

-rw-r--r-- 1 root root 217 Mar 14 23:20 tools
```

```
# cat /etc/portage/package.use/calibre 

>=dev-qt/qtwebkit-5.4.1 printsupport

>=dev-lang/python-2.7.9-r2:2.7 sqlite
```

```
# cat /etc/portage/package.use/office

media-gfx/nomac opencv
```

```
# cat /etc/portage/package.use/samba

net-fs/samba aio client syslog winbind

>=app-crypt/heimdal-1.5.3-r2 -ssl -threads
```

```
# cat /etc/portage/package.use/temp

# =gnome-base/librsvg-2.40.9 -tools

# =dev-java/icedtea-bin-7.2.5.3 -cups -X -nsplugin

# =media-libs/libjpeg-turbo-1.4.0 -java

# =net-libs/glib-networking-2.42.1 -libproxy

# =dev-vcs/subversion-1.8.11 -kde
```

```
# cat /etc/portage/package.use/tools 

dev-util/cmake -qt5

>=dev-libs/libpcre-8.36 pcre16

sys-apps/hwloc plugins

app-arch/p7zip rar

>=dev-vcs/subversion-1.8.11 -dso

x11-terms/qterminal -qt4

x11-libs/qtermwidget -qt4

app-portage/layman bazaar cvs mercurial
```

As you can see, my 'use' values are organized and grouped as makes sense to me. I use the 'temp' list as a placeholder for values I need temporarily in order to do things like complete an 'emerge @world', or I find a package which is borked in some way and I have to wait until it's either fixed by upstream or perhaps for some gentoo-dev package-maintenance love. ;)

Using explicit value lists or directories is your choice and you can mix and match them as makes sense for you. Generally, I make 'package.use', 'package.mask', 'package.keywords' and 'package.unmask' be directories. The rest remain lists.

I hope this gives you a better understanding and context regarding your options here. :)

Note that when you add to a file, eg:

```
# echo 'kde-apps/kde4-l10n minimal' >> /etc/portage/package.use
```

you MUST use two right-angled bracket symbols to add to your list and not overwrite it!

On my systems which follow the example above, I executed this:

```
# echo 'kde-apps/kde4-l10n minimal' >> /etc/portage/package.use/kde
```

==

As stated, you don't have to switch to directories, but it helps with overlays which ship files for such directories, and crossdev requires it.

----------

## steveL

I recently ran out of inodes on /usr/portage so needed to reinitialise the tree after I'd reformatted.

(It was originally built with -b 1024 -N 200000 several years ago, but it turns out we get more inodes, and more filesystem blocks with the defaults.)

This post is an amalgamation of the wiki pages on initialising webrsync and the handbook instructions in case I need to do this again (we've done similar in installer.)

Thanks to mira(bilos) for more detailed info wrt gpg.

The issue here is that you can't emerge anything, including app-crypt/gentoo-keys, until you have the portage tree; again, exactly like installation time.

Firstly I had to find where the releng pages moved to, and then I was curious because the key id didn't match anything on that page (there used to be a key of 0x239C75C4 according to the script)

```
$ md5sum -c portage-20151215.tar.xz.md5sum

portage-20151215.tar.xz: OK

$ gpg --verify portage-20151215.tar.xz.gpgsig portage-20151215.tar.xz

gpg: Signature made Wed 16 Dec 2015 00:57:34 GMT using RSA key ID C9189250

gpg: Can't check signature: No public key
```

So anyhow let's proceed with pulling the gpg key, id as per-the page and the wiki articles.

I found that subkeys.pgp.net was unresponsive, though I could ping it, whereas keys.gnupg.net mentioned in the GPG wiki article had quick ping times and responded instantaneously:

```
# mkdir /etc/portage/gpg

# chmod 0700 /etc/portage/gpg

# gpg --homedir /etc/portage/gpg  --keyserver keys.gnupg.net --recv-keys 0xDB6B8C1F96D8BF6D

gpg: requesting key 96D8BF6D from hkp server keys.gnupg.net

gpg: /etc/portage/gpg/trustdb.gpg: trustdb created

gpg: key 96D8BF6D: public key "Gentoo Portage Snapshot Signing Key (Automated Signing Key)" imported

gpg: no ultimately trusted keys found

gpg: Total number processed: 1

gpg:               imported: 1  (RSA: 1)
```

The other aspect is that you do not need to fully nor ultimately trust the key to verify the signature.

The webrsync page shows the user ultimately trusting it (5), and the handbook uses full (4); I started with the minimal level of trust to check (3 for marginal.)

You can always pass --trusted-key to those gpg invocations that need it, should that come up, ideally with GNUPGHOME set (default: ~/.gnupg) implying no need to trust(db) at all.

You can see the subkey C9189250 comes in here for automated use:

```
# gpg --homedir /etc/portage/gpg --edit-key 0xDB6B8C1F96D8BF6D trust

gpg (GnuPG) X.Y.Z; Copyright (C) 2XXX Free Software Foundation, Inc.

This is free software: you are free to change and redistribute it.

There is NO WARRANTY, to the extent permitted by law.

pub  4096R/96D8BF6D  created: 2011-11-25  expires: 2016-07-01  usage: C   

                     trust: unknown       validity: unknown

sub  4096R/C9189250  created: 2011-11-25  expires: 2016-07-01  usage: S   

[ unknown] (1). Gentoo Portage Snapshot Signing Key (Automated Signing Key)

pub  4096R/96D8BF6D  created: 2011-11-25  expires: 2016-07-01  usage: C   

                     trust: unknown       validity: unknown

sub  4096R/C9189250  created: 2011-11-25  expires: 2016-07-01  usage: S   

[ unknown] (1). Gentoo Portage Snapshot Signing Key (Automated Signing Key)

Please decide how far you trust this user to correctly verify other users' keys

(by looking at passports, checking fingerprints from different sources, etc.)

  1 = I don't know or won't say

  2 = I do NOT trust

  3 = I trust marginally

  4 = I trust fully

  5 = I trust ultimately

  m = back to the main menu

Your decision? 3

pub  4096R/96D8BF6D  created: 2011-11-25  expires: 2016-07-01  usage: C   

                     trust: marginal      validity: unknown

sub  4096R/C9189250  created: 2011-11-25  expires: 2016-07-01  usage: S   

[ unknown] (1). Gentoo Portage Snapshot Signing Key (Automated Signing Key)

Please note that the shown key validity is not necessarily correct

unless you restart the program.

gpg> save

Key not changed so no update needed.
```

 You can just 'quit' if you used the trust parm.

So a quick check to verify the import:

```
# gpg --homedir /etc/portage/gpg --list-keys

gpg: checking the trustdb

gpg: no ultimately trusted keys found

/etc/portage/gpg/pubring.gpg

------------------------------

pub   4096R/96D8BF6D 2011-11-25 [expires: 2016-07-01]

uid                  Gentoo Portage Snapshot Signing Key (Automated Signing Key)

sub   4096R/C9189250 2011-11-25 [expires: 2016-07-01]
```

And finally we can verify the signature on the tarball:

```
# gpg --homedir /etc/portage/gpg --verify portage-20151215.tar.xz.gpgsig portage-20151215.tar.xz

gpg: Signature made Wed 16 Dec 2015 00:57:34 GMT using RSA key ID C9189250

gpg: Good signature from "Gentoo Portage Snapshot Signing Key (Automated Signing Key)"

gpg: WARNING: This key is not certified with a trusted signature!

gpg:          There is no indication that the signature belongs to the owner.

Primary key fingerprint: DCD0 5B71 EAB9 4199 527F  44AC DB6B 8C1F 96D8 BF6D

     Subkey fingerprint: E1D6 ABB6 3BFC FB4B A02F  DF1C EC59 0EEA C918 9250

# echo $?

0
```

The cmd exit status, which is what we'd use in scripts, shows it worked with the warning.

And finally, to wrap up this use-case: 

```
# tar -xvJf portage-20151215.tar.xz -C /usr
```

I imagine we'd want the "Gentoo-keys Team Signing key" as ultimately trusted in a setup using /etc/portage/gpg, with the signing key fully-trusted, as the trustdb is local to the $GNUPGHOME; but then we'd use app-crypt/gentoo-keys once we've actually got a signed tree snapshot verified and untarred, which means keys under /var/lib/gentoo/gkeys:

```
gpg --homedir /var/lib/gentoo/gkeys/keyrings/gentoo/release --with-fingerprint --list-keys
```

 per the wiki.

Still, something to bear in mind if you don't like the keys being silently updated whenever the package is, which I'd guess is the reason not to put them under /etc (dispatch-conf on key changes.) 

If you know better (about anything) holler, as ever.

I have a feeling this is about to be obsoleted wrt sync-via-git, but key-import is still needed to verify the stage3[1], and once I'm updated to newer portage, I think I'll try the webrsync module, for which the above approach seems to be correct initialisation.

[1] 0xBB572E0E2D182910  "Automated Weekly Release Key": 

```
pub   4096R/2D182910 2009-08-25  [expires: 2017-08-25]
```

----------

## steveL

More bashrc git-fu; I didn't get any feedback with a better way to do this in #git. If you know one, feel free to share.

The issue is we want to preserve the original committer timestamp, to keep ordering. Given that, we might as well preserve the identity, though ofc we cannot sign any tags as them.

A couple of util functions first. Note this is written to work in sh, and it only copies the first line of any message.

```
# Public-domain, or where not recognised:

# MIT/BSD-2 (C) 2015 Steven J. Long.

err() {

   printf '!! %s\n' "$*" >&2

}

warn() {

   printf '! %s\n' "$*" >&2

}

# cp_tag 0.14 fubar-0.14

cp_tag(){

   [ -n "$1" ] && [ -n "$2" ] || return

   [ "$1" = "$2" ] && return 2

   local tag cid oid tstamp user email data

   cid=$(git describe --long "tags/$1") || { err "cp_tag '$1': not found"; return 100; }

   tag=$(git describe --long "tags/$2" 2>/dev/null) && { "cp_tag $*: dupe tag: '$tag'"; return 2; }

   case $cid in

   "$1"-0-g*) cid=${cid#"$1"-0-g}

;;   *) err "cp_tag '$1': not a defined tag?${cid:+ [$cid]}"; return 120

   esac

   data=$(git_tagdata "$1") || { err 'cp_tag: unexpected tag format?'; return 123; }

   {   IFS='   ' read -r oid tstamp email user

      read -r; msg=$REPLY

   } << EOF

$data

EOF

   case $oid in

   "$cid"*):

;;   *) err "cp_tag $1: git error? cid '$cid' does not match object: '$oid'"; return 120

   esac

   # git commit-tree strips '<', '>' (and '\n')

   if GIT_COMMITTER_NAME="$user" GIT_COMMITTER_EMAIL="$email"   \

     GIT_COMMITTER_DATE="$tstamp" git tag "$2" "$oid" ${msg:+-m "$msg"}  \

     && tag=$(git describe --long "tags/$2"); then

      case $tag in # described wrt existing tag $1 in testing

      "$1-0-g$cid"|"$2-0-g$cid") return 0

      esac

      err "cp_tag $1 $2: git error? new tag $2: does not match cid: '$cid'"

      warn ": git describe --long tags/$2 => $tag"

   else

      err "cp_tag: unable to tag '$2'"

   fi

   return 120

}

git_tagdata(){

   git cat-file -p "tags/$1" | awk '/^object / && cid == "" { cid = $2 }

   # tagger user blah name <email.addr> ts tz

   /^tagger / && NF > 4 {   if (cid == "") exit

      tz = $NF; ts = $(NF - 1); email = $(NF - 2)

      u = $2

      for (i = 3; i < NF - 2; ++i)

         u = u " " $i

       printf("%s\t%s %s\t%s\t%s\n", cid, ts, tz, email, u)

       do {

          if (0 >= getline) {

             $0 = ""

             break

          }

       } while (! NF)

       print (/^----/? "": $0)

       f = 1

      exit

   }

   END { exit(!f) }'

}

mv_tag(){

   cp_tag "$1" "$2" && git tag -d "$1"

}

# eed "$file" '/^funcname/-2;/^}/+1p'

eed() { local f; f=$1; shift; printf '%s\n' H "$@" | ed -s "$f"; }

# SCNR ;)
```

----------

## steveL

<Griz64> the bot was down and when i tried to get in, i found tmux had been updated and it was a bit of a chore.

```
$ pgrep tmux

3179

$ /proc/3179/exe attach
```

You can attach to the old binary, kill the bot, exit the shell nicely and start the "New & Improved" version, then restart the bot.

----------

