Knowledge Base

Preserving for the future: Shell scripts, AoC, and more

SPICE available on EL9 using a COPR

Red Hat famously removed support for SPICE consoles in RHEL 9. One good conversation about it is over on the Rocky Linux 9 forums.

To find all this info, I started with an Internet search: rocky 9 spice graphics are not supported with this QEMU

But some wonderful and enterprising individual rebuilds the Fedora packages for EL9, and has put them in a copr! So all us EL addicts can get our SPICE kvm guest consoles back so everything works.

The instructions are very simple. To enable the repository, run this dnf command.

# dnf -y copr enable ligenix/enterprise-qemu-spice ; dnf update

And then install qemu-kvm with spice support. Or if it is already installed, just update.

dnf install virt-manager

This information will enable my work for some future blog posts.

Luanti contributions, part 4

Here is a summary of what I've been up to in the Luanti world since the last time.

  • Mod respawn new "teleport_choose" feature

    I added a teleport_choose formspec so you can easily teleport to your destinations. It pairs nicely with snippets:button with this command:

    -- this dot dot dot means the parameters, and snippets button node will run this snippet
    -- with one parameter, the name of the player who used it
    local name = ...
    core.log("action",name .. " opened teleport_choose.")
    respawn.choose(name,nil,true)
    

    Screenshot of teleport_choose feature

  • Mod sickles improvements

    I fixed up scythes so that they correctly replant other plants that they already affected. It wasn't my intention that they work on potatoes and beetroots, but since they did, I fixed it so they replant them at level 0 or 1. Also, the scythe now also waits 2 seconds before pulling seeds from your inventory, because in Mineclonia, item drops do not immediately enter your inventory for being deducted (as "replanting" the seed).

Read more…

Progressive web app with share target for Android

I have known for a while that "progressive web apps" (apparently only supported in one browser) can be "installed" as an "app" on a mobile device, and they can be the target for receiving shared items! I finally bothered to learn how to do this with my flask app stackbin!

There's a large number of steps required, and I ripped pretty much all of this (minus flask-specific troubleshooting) from reference 1. The main parts include:

  1. Add file manifest.json on the top level virtual path of your application. I had to add some jinja2 templating to handle the static prefix for my app.

Read more…

Run Android in QEMU

I recently found some fascinating little games in f-droid, and I wanted to set them up on my desktop. I've tried virtualizing Android before, but this time I got it going! This is basically going to be ripping off Reference 1 entirely.

Fetch the android-x86 iso: https://www.android-x86.org/.

Use virt-manager to install a new vm and use the downloaded iso. That was basically it. I customized the installation, and installed f-droid and installed the little games I wanted to play!

Screenshot of android x86 running in virt-manager

References

Weblinks

  1. How to install Android x86 in Linux?

Chromebook: control reactions to power button

I discovered a better way to control what my Acer Chromebook C720-ZHN does in reaction to my pressing the power button. I want it to pull up my logout manager, but init/acpi/something (apparently "elogind," frickin' systemd people) really wants to react to it. I previously wrote a very complicated elogind-inhibit script available on one of my previous posts about this topic.

But here is a simpler way which I discovered after I reinstalled and before I got my custom package installed again.

# file: /etc/elogind/logind.conf.d/40-stackrpms.conf
# Startdate: 2025-03-02-1 15:56
# Reference:
#    unix.se 288731
#    /etc/elogind/logind.conf
[Login]
HandlePowerKey=ignore
HandleRebootKey=ignore
HandleSuspendKey=ignore
HandleHibernateKey=ignore
HandleLidSwitch=ignore

And then xev and other developer tools and window managers can react to that keystroke and run the logout manager.

# inside file: /etc/stackrpms-acer-chromebook/fluxbox.keys
124 :Exec logout-manager-gtk

References

  1. arch linux - Disable the Power button on a Chromebook - Unix & Linux Stack Exchange

Using Minecraft textures in Mineclonia

For when you want to look as close to Minecraft as possible, you can adapt a texture pack. There's multiple ways to do it. You can read my raw research notes down below. This is the official way I accomplished it to my satisfaction.

Building the texture pack

Adapting Minecraft texture

Download the conversion tool from https://codeberg.org/ostech/craft_to_clonia_textures. I compiled the source but binaries are also provided. Run it once to build a config.json and input directory.

Download the original textures from somewhere. I used https://github.com/Faithful-Pack/Default-Java but the Internet suggests that https://mcversions.net/ is a main place for that too. I placed them in new subdirectory input/, so input/Default-Java.

Here is my config.json.

{
"DefinedInput": false,
"DefinedOutput": true,
"ExportMinetest_Game": false,
"ExportMineclonia": true,
"InputDir": "./input",
"OutputDir": "/home/bgstack15/Downloads/converted4"
}

To use the configured OutputDir, you need to set DefinedOutput=true. Then run it, and place the new directory in ~/.var/app/net.minetest.Minetest/.minetest/textures. I called mine mc01 and customized the texture_pack.conf.

For my own systems, I tarballed it as .

References

  1. Faithful-Pack/Default-Java: The latest default textures of Minecraft Java Edition
  2. Minecraft Texture Pack - Page 2 - Luanti Forums

Research and alternatives

  1. get source assets from https://github.com/Faithful-Pack/Default-Java and used mineclonia tools/Texture_Converter.py which got almost everything. Made grass and water gray instead of green/blue.
  2. used same source assets, and project https://forum.luanti.org/viewtopic.php?p=443213#p443213

shell: if dot-sourced

I keep searching this so it's time to put it on my blog for myself.

# BEGIN IS-SOURCED
sourced=0
if [ -n "$ZSH_VERSION" ]; then 
   case $ZSH_EVAL_CONTEXT in *:file) sourced=1;; esac
elif [ -n "$KSH_VERSION" ]; then
   [ "$(cd -- "$(dirname -- "$0")" && pwd -P)/$(basename -- "$0")" != "$(cd -- "$(dirname -- "${.sh.file}")" && pwd -P)/$(basename -- "${.sh.file}")" ] && sourced=1
elif [ -n "$BASH_VERSION" ]; then
   (return 0 2>/dev/null) && sourced=1 
else # All other shells: examine $0 for known shell binary filenames.
   # Detects `sh` and `dash`; add additional shell filenames as needed.
   case ${0##*/} in sh|-sh|dash|-dash) sourced=1;; esac
fi
# END BEGIN IS-SOURCED

References

Weblinks

  1. Ripped directly from bash - How to detect if a script is being sourced - Stack Overflow

soundcore 2 review and notes

The product in question is bluetooth speaker SoundCore 2 A3105 which was $44.99ish before tax.

I am not getting paid or compensated in any way for this information. If you wish to change that, please contact me!

Behavior of button play/pause

Here is some additional info not in the manual about the play/pause button:

  • 3 times: restart this track
  • 4 times: skip back

Here is what is published in the manual.

  • 1 time: play/pause
  • 2 times: skip forward

Thoughts

Bass doesn't sound as thorough as JBL Flip 3, but that one was damaged or broken and kept freezing up for no good reason.

Links

Auxiliary notes

Internet search bluetooth speaker skip backward showed that some bluetooth speakers skip back when you press play/pause 3+ times. My research shows this can work on the Soundcore 2 speaker!

After more time

Sometimes the words sound a little mushy/slurred. Overall I'd say this is a rather disappointing bluetooth speaker. It also suffers from the random freezing as my old device. Maybe I have a jellyfin problem. So I'm still just using the much clearer (when it's working) JBL Flip 3.

Devuan laptop: use external monitor with sound

I used arandr to set up 2-monitor display after plugging in the HDMI display, and saved the config to ~/.screenlayout/2mon.sh. I then added the pulseaudio command to set the default profile to output audio to the hdmi.

xrandr --output eDP-1 --primary --mode 1920x1080 --pos 0x0 --rotate normal --output DP-1 --off --output HDMI-1 --off --output DP-2 --off --output HDMI-2 --mode 1920x1080 --pos 1920x0 --rotate normal
pacmd set-card-profile 0 output:hdmi-stereo

References

  1. pacmd interactive terminal