BASH Post Services

Viewing: 1752986547_nscde.sh

Try wget https://bash.commongrounds.cc/uploads/1752986547_nscde.sh from the console

Raw File Link

#!/bin/bash

#sudo apt-get install fvwm libx11-dev libxpm-dev libxt-dev libxext-dev libstfl0-dev python3-pyqt5 xterm stterm x11-xserver-utils x11-utils xfonts-base xfonts-100dpi xfonts-75dpi fonts-dejavu-core fonts-liberation libyaml-dev

#cd /tmp
#wget https://github.com/NsCDE/NsCDE/releases/download/2.3/nscde_2.3-1_amd64.deb
#sudo dpkg -i nscde_2.3-1_amd64.deb
#sudo apt-get install -f

#sudo apt-get install lightdm

#nscde_setup

#!/bin/bash

# Script to install NsCDE on Devuan GNU+Linux
# Tested for Devuan Daedalus 5.0 and Chimaera 4.0
# Run as root or with sudo

# Exit on error
set -e

# Logging setup
LOGFILE="/var/log/nscde_install_$(date +%F_%H-%M-%S).log"
exec 1> >(tee -a "$LOGFILE")
exec 2>&1
echo "NsCDE Installation Log - $(date)"
echo "-----------------------------------"

# Variables
NSCDE_VERSION="2.3"
NSCDE_DEB_URL="https://github.com/NsCDE/NsCDE/releases/download/${NSCDE_VERSION}/nscde_${NSCDE_VERSION}-1_amd64.deb"
NSCDE_DEB_FILE="/tmp/nscde_${NSCDE_VERSION}-1_amd64.deb"
DISPLAY_MANAGER="lightdm"

# Function to check if running as root
check_root() {
    if [ "$EUID" -ne 0 ]; then
        echo "ERROR: This script must be run as root or with sudo."
        exit 1
    fi
}

# Function to check internet connectivity
check_internet() {
    echo "Checking internet connectivity..."
    if ! ping -c 3 8.8.8.8 > /dev/null 2>&1; then
        echo "ERROR: No internet connection. Please ensure you have an active network."
        exit 1
    fi
}

# Function to update system
update_system() {
    echo "Updating system packages..."
    apt-get update
    apt-get upgrade -y
}

# Function to install dependencies
install_dependencies() {
    echo "Installing NsCDE dependencies..."
    apt-get install -y \
        fvwm \
        libx11-dev \
        libxpm-dev \
        libxt-dev \
        libxext-dev \
        libstfl0-dev \
        python3-pyqt5 \
        xterm \
        stterm \
        x11-xserver-utils \
        x11-utils \
        xfonts-base \
        xfonts-100dpi \
        xfonts-75dpi \
        fonts-dejavu-core \
        fonts-liberation \
        libyaml-dev \
        || {
            echo "ERROR: Failed to install dependencies."
            exit 1
        }
}

# Function to install display manager
install_display_manager() {
    echo "Installing display manager ($DISPLAY_MANAGER)..."
    if ! dpkg -l | grep -q "$DISPLAY_MANAGER"; then
        apt-get install -y "$DISPLAY_MANAGER" || {
            echo "ERROR: Failed to install $DISPLAY_MANAGER."
            exit 1
        }
    else
        echo "$DISPLAY_MANAGER is already installed."
    fi
}

# Function to download and install NsCDE
install_nscde() {
    echo "Downloading NsCDE v${NSCDE_VERSION}..."
    if ! wget -q "$NSCDE_DEB_URL" -O "$NSCDE_DEB_FILE"; then
        echo "ERROR: Failed to download NsCDE package from $NSCDE_DEB_URL."
        echo "Check the URL or try building from source: https://github.com/NsCDE/NsCDE"
        exit 1
    fi

    echo "Installing NsCDE..."
    if ! dpkg -i "$NSCDE_DEB_FILE"; then
        echo "WARNING: dpkg encountered issues. Attempting to fix dependencies..."
        apt-get install -f -y || {
            echo "ERROR: Failed to install NsCDE or resolve dependencies."
            exit 1
        }
    fi

    echo "Cleaning up downloaded package..."
    rm -f "$NSCDE_DEB_FILE"
}

# Function to configure NsCDE
configure_nscde() {
    echo "Configuring NsCDE for all users..."
    for user_home in /home/*; do
        if [ -d "$user_home" ]; then
            username=$(basename "$user_home")
            echo "Setting up NsCDE for user: $username"
            su - "$username" -c "nscde_setup" || {
                echo "WARNING: Failed to run nscde_setup for $username. Run 'nscde_setup' manually as the user."
            }
        fi
    done

    echo "Updating font cache..."
    fc-cache -fv
    xset fp rehash || echo "WARNING: xset fp rehash failed. Fonts may not display correctly."
}

# Function to ensure NsCDE session file exists
setup_session_file() {
    echo "Setting up NsCDE session file..."
    SESSION_FILE="/usr/share/xsessions/nscde.desktop"
    if [ ! -f "$SESSION_FILE" ]; then
        cat << EOF > "$SESSION_FILE"
[DesktopEntry]
Name=NsCDE
Comment=Not so Common Desktop Environment
Exec=/usr/bin/nscde_start
Type=Application
EOF
        chmod 644 "$SESSION_FILE"
        echo "Created $SESSION_FILE."
    else
        echo "$SESSION_FILE already exists."
    fi
}

# Main installation process
main() {
    echo "Starting NsCDE installation on Devuan..."
    check_root
    check_internet
    update_system
    install_dependencies
    install_display_manager
    install_nscde
    configure_nscde
    setup_session_file

    echo "-----------------------------------"
    echo "NsCDE installation completed successfully!"
    echo "Log out and select the NsCDE session in $DISPLAY_MANAGER."
    echo "Log file: $LOGFILE"
    echo "If issues occur, check https://github.com/NsCDE/NsCDE or https://nscde.fedorapeople.org/"
}

# Execute main function
main

exit 0


BASH to Home