zsh.li Pinkhat Memories Me About ?

Dear My
Linux

ARCHIVES_DATE 2020

how fedi amin reads you


Today you will learn how your admin (@admin@gentoo.live), reads you, notifications on account are shown in my terminal using shell scripts, the only requirement is to install this python app (toot) toot

This works for me because I always have several terminals opened, each time I have a new prompt (i.e, after running a command) my admin notifications are displayed if there are new.

1. First I run this script with cron each 15 minutes (*/15 * * * * *):

#! /bin/bash
if ping -c 1 -q duckduckgo.com >&/dev/null ; then
toot notifications | head -20 > /tmp/admin
fi

2. I created the following script:

#! /bin/sh
cd /tmp
if  ! sha256sum -c admin.sum >/dev/null; then
cat /tmp/admin
sha256sum admin > admin.sum
fi

3. Add the following environment variable to .bashrc to run the second script:

PROMPT_COMMAND="sh script.sh"

If you are using zsh in .zshrc add this code besides the environment variable:

precmd() { eval "$PROMPT_COMMAND" }

That's all!


Live Gentoo installation


Recently created my social network instance https://gentoo.live, so I remembered that this post was pending.

Long time ago I did a live Debian SID installation on Twitter, on November 2019 was Gentoo turn, on the Fediverse Network (Mastodon, Gnusocial, Pleroma) I posted my Gentoo installation commands:

Warning! This is not a Gentoo install guide, also my errors were posted!

1. screen
#This command allows me to resume my shell session if I close the terminal

2. mkfs.ext4 /dev/sda7
# I'm formatting an existing partition of my hard disk.

3. mount /dev/sda7 /mnt/tmp/

4. cd /tmp && wget http://distfiles.gentoo.org/releases/amd64/autobuilds/20191110T214504Z/stage3-amd64-20191110T214504Z.tar.xz
#Downloading Gentoo, my network is slow, one hour remaining.

5. cd /mnt/tmp/ && tar xpvf /tmp/stage3-*.tar.xz --xattrs-include='*.*' --numeric-owner
# Extracts the Gentoo tarball into the partition.

6. mount --bind /run/ /mnt/tmp/run/ && mount --bind /proc /mnt/tmp/proc && mount --bind /dev /mnt/tmp/dev/ && mount --bind /sys/ /mnt/tmp/sys/ && chroot /mnt/tmp/
# Chroot into gentoo.

7. source /etc/profile

8. nano /etc/portage/make.conf

# There I added this line:
MAKEOPTS="-j3"
The number is the double of the cpu cores plus one.
And modified the COMMON FLAGS variable to this value:
-march=native -O2 -pipe

9. mkdir --parents /etc/portage/repos.conf && cp /usr/share/portage/config/repos.conf /etc/portage/repos.conf/gentoo.conf && emerge --sync
#note: out of the chroot cp the /etc/resolv.conf to the chroot

# 10.  I had an unexpected error I had never had in life. I solved in this way:

rm -rf /usr/portage/app-crypt/openpgp-keys-gentoo-release && emerge --sync
# Thanks forums!

11. emerge -1 mirrorselect
# This is taking a while, meanwhile I can practice the Lotus pose and listen at sacred music.

#11.5  I remembered that is a good idea to mount a tmpfs into /var/tmp, I will do so when the mirrorselect compilation ends. 

12. mirrorselect -i -o >> /mnt/gentoo/etc/portage/make.conf
# I selected some mirrors here

13. mount -t tmpfs tmpfs /var/tmp/
# Mounted a tmpfs into /var/tmp

14. eselect profile list

15. eselect profile set 5
# Chose the desktop profile

16. emerge --ask app-portage/cpuid2cpuflags

Calculating dependencies... done!
[ebuild N ] app-portage/cpuid2cpuflags-6
Would you like to merge these packages? [Yes/No] Yes

17. echo "*/* $(cpuid2cpuflags)" >> /etc/portage/package.use/00cpuflags

18. emerge -NaDu @world
# Updating the system

18.5 emerge etc-update
# I cancel the system update, portage is not happy with the USEs, I'm going to install etc-update for helping me editing uses files:

18.9 # I made a mistake, etc-update is part of the base system.

19. etc-update
# Ask for user input, I merge the uses file (/etc/portage/package.use/00cpuflags) with -3:

20. emerge -NaDu @world

# I retry the world update, this will recompile the system # I said yes and the compilation started

20.5 # Killed the system update by accident, I resumed using:
emerge --resume

20.6 Still compiling...

20.7 I will take a nap

20.8 . # Your sleepy beauty is back, but a package failed to compile

20.9 # I realized that I selected the wrong profile, in my day, only the 13.0 profiles were available, from the 2017 seems that Gentoo uses 17s profiles. Probably the first apps I will  install will be Wine and steam to check the multi lib support. 
So, in the end I will have to perform an extra step to migrate from 17.0 to 17.1, ah, also it can be a good idea to remove some global uses.

20.99 The base system and the basic X libraries have been being compiled for 8 hours, I will sleep, nini !! This step (number 20) will be completed during my sleep time

SECOND DAY
21. emerge --ask app-portage/gentoolkit
# I need this tool to check the uses descriptions

22. emerge --info | grep ^USE
# I will disable global uses

23. # I added this line to /etc/portake/make.conf
USE="-kde -bluetooth -ipv6 -nls -gmp -qt5"

24. emerge -NDu @world
# I will rebuild the affected packages to maintain USEs coherency in the future, also added the consolekit, networkmanager and dbus global use

25. # I canceled the rebuild, disabling nls affects gcc (it will be recompiled)

emerge genlop
# genlop is need for measure the compiling time
# I enabled the timezone for reporting the correct time:
echo "America/Mexico_City" > /etc/timezone

genlop -t gcc
pinkstar / # genlop -t sys-devel/gcc-9.2.0-r2
!!! Error: no merge found for 'sys-devel/gcc-9.2.0-r2'


# It seems that I haven't recompiled the toolchain. Welp, I will resume the world rebuilding

emerge -aNDu --with-bdeps=y @world

25.5 # Also added dbus as global use

26. emerge -1v app-portage/unsymlink-lib
# Time to migrate from 17.0 profile to 17.1 (this is an extra step because I chose a wrong profile)

27. unsymlink-lib --migrate

28. eselect profile set default/linux/amd64/17.1/desktop
# Since this is a new Gentoo installation, the past two steps was not needed, instead it only was need to change the profile to the new one.

29. # I'm moving the Slackware kernel sources to /usr/src in Gentoo. I'm not sure, but this will save me 6 hours of compilation and the kernel configuration part which is the most exciting thing in Gentoo. 

30. cd /usr/linux/src && make install
# Since the grub is managed by slackware, I will modify the grub in Slackware

30.5 # Added to /etc/fstab:
/dev/sda7 / ext4 noatime 0 1

31. emerge -a xorg-server

31.5 I had modified the VIDEO_CARDS variable in /etc/portage/make.conf

31.6 Added libinput keyboard mouse to INPUT_DEVICES in make.conf

32. # I almost forgot in /usr/src/linux:
make modules_install

33. emerge awesome
# This will install the windows manager.

34. emerge -a networkmanager-openvpn openvpn dhcpcd lynx links dhcpcd networkmanager nm-applet screenfetch zsh sakura spacefm cryptsetup btrfs-progs squashfs-tools lvm2 gnuchess bsd-games xautolock slock

# I will install some apps, however I created an uses file in /etc/portage/package.use/apps with this content:
sys-fs/squashfs lz4 lzma lzo
net-wireless/wpa_supplicant ap eap-sim eapol_test fasteap macsec p2p privsep smartcard tdls uncommon-eap-types -wimax wps
media-video/ffmpeg x265 vpx wavpack webp theora twolame opus libass libcaca gmp fontconfig openh264 wavpack
net-misc/networkmanager connection-sharing
And modified some others with etc-update

35. Bad news and good news.
The bad news is that my computer had a kernel panic. Which made me to reboot my computer interrupting the Gentoo installation.
The good news is that I was able to boot into Gentoo with the awesome WM and my custom wallpaper.
However I had to reboot the computer using REISUB since I am not in the sudoers file nor root has a pass!!
And my keyboard is not working in xorg, but I think that is because is one of these old ps/2 keyboards. It's easy to solve.

35.5 However I just installed Gentoo, but we want perfection, don't we?

36. emerge -a sudo

37. visudo
# Uncomment the wheel group
38. gpasswd -a $myuser wheel

39. emerge --resume
# This will take a while

40 ln -s /usr/share/X11/xorg.conf.d/40-libinput.conf /etc/X11/xorg.conf.d/
# I will try to solve the keyboard issue with this command, I'm still compiling software.

41. Everything works perfect, I'm sending this post from Gentoo, I will use Gentoo forever! and remember, you never end to install Gentoo. It took me two days using a Celeron processor.