Skip to content

Instantly share code, notes, and snippets.

@KernelGhost
Last active December 1, 2024 12:31
Show Gist options
  • Select an option

  • Save KernelGhost/9d02c308d4b74cdceba96901d1304b96 to your computer and use it in GitHub Desktop.

Select an option

Save KernelGhost/9d02c308d4b74cdceba96901d1304b96 to your computer and use it in GitHub Desktop.
This guide provides step-by-step instructions for compiling, packaging, and installing Nody Greeter on Fedora Linux 40 using podman containers.

Installing Nody Greeter on Fedora Linux 40

Author: Rohan Barar
Date: 29/03/2024

Compilation from Source

Create Container

I prefer to use podman containers to build and compile software to prevent cluttering the main system with superfluous packages.

  1. Install podman.

    sudo dnf install podman
  2. Retrieve the latest image of Fedora Linux.

    podman pull fedora:latest
  3. Create a new container based on the Fedora Linux image. This command will initiate the container and directly place you at the command line.

    podman run -it --name fedora --hostname fedora --network host fedora:latest /bin/bash

Install Dependencies

  1. Compilation of Nody Greeter requires version 18 (LTS) of node.js. This necessitates the installation of a version management system, such as nvm. The installation command provided below was taken from the project's GitHub page. Please refer directly to the project page for up-to-date installation instructions.

    curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.0/install.sh | bash
    source ~/.bash_profile
    nvm install 18
    nvm use 18
  2. Compilation of Nody Greeter requires an older version of python since distutils was removed in python version 3.12. Install conda and create an environment based on python version 3.11.9.

    1. Install conda.

      sudo dnf install conda
    2. Create an environment using python version 3.11.9.

      conda create -n "pyNody" python=3.11.9
    3. Restart the podman container.

      1. Exit the container.

        exit
      2. Start the container.

        podman start -ia fedora
        cd ~
    4. Activate the python environment.

      conda activate pyNody
  3. Install other dependencies.

    sudo dnf install git patch lightdm lightdm-gobject lightdm-gobject-devel gobject-introspection-devel cairo-devel gcc gcc-c++ glibc-devel libxcb-devel libX11-devel make nano

Compile Nody Greeter

  1. Clone the repository.

    git clone --recursive https://github.com/JezerM/nody-greeter.git
    cd nody-greeter
  2. Compile the software.

    npm install
    npm run rebuild
    npm run build

RPM Packaging

  1. Install tools required for creating RPM packages.

    sudo dnf install rpmdevtools rpmlint
  2. Create a directory structure suitable for RPM package development. This will create a folder named rpmbuild.

    cd ~
    rpmdev-setuptree
  3. Generate a .tar.gz archive comprising the compiled binaries and transfer it into ~/rpmbuild/SOURCES.

    cp -r ~/nody-greeter/build/unpacked ~/nody-greeter-1.6.2
    tar --create --file nody-greeter-1.6.2.tar.gz nody-greeter-1.6.2
    mv nody-greeter-1.6.2.tar.gz ~/rpmbuild/SOURCES
  4. Create a new file at ~/rpmbuild/SPECS/nody-greeter.spec containing the following. Note: nano ~/rpmbuild/SPECS/nody-greeter.spec can be used to achieve this.

    %define name nody-greeter
    %define version 1.6.2
    %define release 1
    %define arch x86_64
    
    Name: %{name}
    Version: %{version}
    Release: %{release}
    BuildArch: %{arch}
    License: GPL-3.0
    Source: %{name}-%{version}.tar.gz
    Summary: A LightDM Greeter
    
    %description
    A LightDM greeter made with Electron.js and NodeGTK
    
    %prep
    # Unpack the source archive into the build directory
    %setup -q
    
    %install
    # Clean build directory
    rm -rf $RPM_BUILD_ROOT
    
    # Create build directory
    mkdir -p $RPM_BUILD_ROOT
    
    # Copy all folders from extracted archive into $RPM_BUILD_ROOT
    cp -r * $RPM_BUILD_ROOT/
    
    %post
    # Create symbolic link
    ln -sf /opt/nody-greeter/nody-greeter /usr/bin/nody-greeter
    
    # Set executable permission
    chmod +x /opt/nody-greeter/nody-greeter
    
    # Update application shortcuts and menu entries
    update-desktop-database /usr/share/applications || true
    
    %preun
    # Remove symbolic link
    rm -f /usr/bin/nody-greeter
    
    %postun
    # Update application shortcuts and menu entries
    update-desktop-database /usr/share/applications || true
    
    %files
    # Set default file attributes
    %defattr(-,root,root)
    
    # Include all files and directories under 'etc', 'opt' and 'usr'
    /etc/*
    /opt/*
    /usr/*
    
    %changelog
    * Fri Aug 02 2024 JezerM <amyuki4@gmail.com> 1.6.2-1
    - Initial RPM creation for version 1.6.2
    
  5. Build the RPM package. It will be placed at ~/rpmbuild/RPMS/x86_64/nody-greeter-1.6.2-1.x86_64.rpm.

    rpmbuild -bb ~/rpmbuild/SPECS/nody-greeter.spec
  6. Exit the podman container.

    exit
  7. Copy the RPM file out of the podman container.

    cd ~
    podman ps -a # Identify Container ID (e.g. 4330d4f27107)
    podman cp 4330d4f27107:/root/rpmbuild/RPMS/x86_64/nody-greeter-1.6.2-1.x86_64.rpm ~/

Installation

  1. Install Nody Greeter.

    sudo dnf install nody-greeter-1.6.2-1.x86_64.rpm
  2. Inside /etc/lightdm/lightdm.conf below a 'Seat' configuration, add:

    greeter-session=nody-greeter
    
  3. Test Nody Greeter using nody-greeter or nody-greeter --debug.

Post-Install

  1. [OPTIONAL] You can delete the podman container. For example:

    podman rm 4330d4f27107
  2. [OPTIONAL] You can delete the fedora image. For example:

    podman images --all # Identify Image ID (e.g. dbd38aa67e87)
    podman rmi dbd38aa67e87
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment