From 1e26fedc2264b5cbdb9167211ef4691c5b3eadd3 Mon Sep 17 00:00:00 2001 From: EnumDev Date: Sun, 24 May 2026 15:57:21 +0300 Subject: [PATCH] Initial commit --- .gitignore | 3 + check-version.sh | 9 +++ pkg.info | 47 +++++++++++ source-files/Xsession | 95 ++++++++++++++++++++++ source-files/lightdm.conf | 163 ++++++++++++++++++++++++++++++++++++++ source-files/lightdm.esv | 4 + source-files/lightdm.sh | 8 ++ source-files/polkit-rules | 15 ++++ source-files/sysusers | 1 + source.sh | 43 ++++++++++ 10 files changed, 388 insertions(+) create mode 100644 .gitignore create mode 100644 check-version.sh create mode 100644 pkg.info create mode 100644 source-files/Xsession create mode 100644 source-files/lightdm.conf create mode 100644 source-files/lightdm.esv create mode 100644 source-files/lightdm.sh create mode 100644 source-files/polkit-rules create mode 100644 source-files/sysusers create mode 100644 source.sh diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9d96df7 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +# Ignore BPM archives and signatures +*.bpm +*.bpm.sig diff --git a/check-version.sh b/check-version.sh new file mode 100644 index 0000000..ea59d16 --- /dev/null +++ b/check-version.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +# Github repository +REPO="ubuntu/lightdm" + +# Get tag name using Github Rest API +TAG_NAME=$(curl -s -L -H "X-GitHub-Api-Version: 2022-11-28" -H "Authorization: token ${GITHUB_API_TOKEN}" https://api.github.com/repos/"$REPO"/releases/latest | jq -r '.tag_name') + +echo "$TAG_NAME" diff --git a/pkg.info b/pkg.info new file mode 100644 index 0000000..00e0d4f --- /dev/null +++ b/pkg.info @@ -0,0 +1,47 @@ +name: lightdm +description: A lightweight display manager +version: 1.32.0 +revision: 1 +url: https://github.com/canonical/lightdm +license: GPL-3.0-or-later AND (LGPL-2.0-only OR LGPL-3.0-only) +maintainers: + - enumdev@enumerated.dev +architecture: any +type: source +depends: + - glib + - libgcrypt + - libx11 + - libxcb + - libxdmcp + - libxklavier + - pam + - polkit + - sysusers + - xorg-server + - xorg-xmodmap + - xorg-xrdb +optional_depends: + - accountsservice:For enhanced user accounts handling + - lightdm-gtk-greeter:For the GTK greeter +make_depends: + - gobject-introspection + - gtk-doc + - intltool + - itstool + - vala + - yelp-tools +downloads: + - url: https://github.com/ubuntu/lightdm/releases/download/${BPM_PKG_VERSION}/lightdm-${BPM_PKG_VERSION}.tar.xz + extract_to: ${BPM_SOURCE} + extract_strip_components: 1 + checksum: 12f5ab432748f0387c7cf8b94430495a558a035a4f8465e5181af6faff133e4b +keep: + - etc/apparmor.d/lightdm-guest-session + - etc/lightdm/keys.conf + - etc/lightdm/lightdm.conf + - etc/lightdm/users.conf + - etc/lightdm/Xsession + - etc/pam.d/lightdm + - etc/pam.d/lightdm-autologin + - etc/pam.d/lightdm-greeter diff --git a/source-files/Xsession b/source-files/Xsession new file mode 100644 index 0000000..56c35a4 --- /dev/null +++ b/source-files/Xsession @@ -0,0 +1,95 @@ +#!/bin/sh +# +# LightDM wrapper to run around X sessions. + +echo "Running X session wrapper" + +# From https://github.com/sddm/sddm/blob/develop/data/scripts/Xsession +# Note that the respective logout scripts are not sourced. +case $SHELL in + */bash) + [ -z "$BASH" ] && exec $SHELL --login $0 "$@" + shopt -q login_shell || exec $SHELL --login $0 "$@" + set +o posix + ;; + */zsh) + [ -z "$ZSH_NAME" ] && exec $SHELL --login $0 "$@" + [[ -o login ]] || exec $SHELL --login $0 "$@" + emulate -R sh + ;; + */csh|*/tcsh) + # [t]cshrc is always sourced automatically. + # Note that sourcing csh.login after .cshrc is non-standard. + xsess_tmp=`mktemp /tmp/xsess-env-XXXXXX` + $SHELL -c "if (-f /etc/csh.login) source /etc/csh.login; if (-f ~/.login) source ~/.login; /bin/sh -c 'export -p' >! $xsess_tmp" + . $xsess_tmp + rm -f $xsess_tmp + ;; + */fish) + [ -f /etc/profile ] && . /etc/profile + [ -f $HOME/.profile ] && . $HOME/.profile + xsess_tmp=`mktemp /tmp/xsess-env-XXXXXX` + $SHELL --login -c "/bin/sh -c 'export -p' > $xsess_tmp" + . $xsess_tmp + rm -f $xsess_tmp + ;; + *) # Plain sh, ksh, and anything we do not know. + [ -f /etc/profile ] && . /etc/profile + [ -f "$HOME/.profile" ] && . "$HOME/.profile" + ;; +esac + +[ -f /etc/xprofile ] && . /etc/xprofile +[ -f /usr/local/etc/xprofile ] && . /usr/local/etc/xprofile +[ -f "$HOME/.xprofile" ] && . "$HOME/.xprofile" + +# Load resources +for file in "/etc/X11/Xresources" "$HOME/.Xresources"; do + if [ -f "$file" ]; then + echo "Loading resource: $file" + xrdb -merge "$file" + fi +done + +# Load keymaps +for file in "/etc/X11/Xkbmap" "$HOME/.Xkbmap"; do + if [ -f "$file" ]; then + echo "Loading keymap: $file" + setxkbmap `cat "$file"` + XKB_IN_USE=yes + fi +done + +# Load xmodmap if not using XKB +if [ -z "$XKB_IN_USE" ]; then + for file in "/etc/X11/Xmodmap" "$HOME/.Xmodmap"; do + if [ -f "$file" ]; then + echo "Loading modmap: $file" + xmodmap "$file" + fi + done +fi + +unset XKB_IN_USE + +# Run all system xinitrc shell scripts +xinitdir="/etc/X11/xinit/xinitrc.d" +if [ -d "$xinitdir" ]; then + for script in $xinitdir/*; do + echo "Loading xinit script $script" + if [ -x "$script" -a ! -d "$script" ]; then + . "$script" + fi + done +fi + +# Run user xsession shell script +script="$HOME/.xsession" +if [ -x "$script" -a ! -d "$script" ]; then + echo "Loading xsession script $script" + . "$script" +fi + +echo "X session wrapper complete, running session $@" + +exec $@ diff --git a/source-files/lightdm.conf b/source-files/lightdm.conf new file mode 100644 index 0000000..afd4369 --- /dev/null +++ b/source-files/lightdm.conf @@ -0,0 +1,163 @@ +# +# General configuration +# +# start-default-seat = True to always start one seat if none are defined in the configuration +# greeter-user = User to run greeter as +# minimum-display-number = Minimum display number to use for X servers +# minimum-vt = First VT to run displays on +# lock-memory = True to prevent memory from being paged to disk +# user-authority-in-system-dir = True if session authority should be in the system location +# guest-account-script = Script to be run to setup guest account +# logind-check-graphical = True to on start seats that are marked as graphical by logind +# log-directory = Directory to log information to +# run-directory = Directory to put running state in +# cache-directory = Directory to cache to +# sessions-directory = Directory to find sessions +# remote-sessions-directory = Directory to find remote sessions +# greeters-directory = Directory to find greeters +# backup-logs = True to move add a .old suffix to old log files when opening new ones +# dbus-service = True if LightDM provides a D-Bus service to control it +# +[LightDM] +#start-default-seat=true +#greeter-user=lightdm +#minimum-display-number=0 +#minimum-vt=7 +#lock-memory=true +#user-authority-in-system-dir=false +#guest-account-script=guest-account +#logind-check-graphical=true +#log-directory=/var/log/lightdm +#run-directory=/var/run/lightdm +#cache-directory=/var/cache/lightdm +#sessions-directory=/usr/share/lightdm/sessions:/usr/share/xsessions:/usr/share/wayland-sessions +#remote-sessions-directory=/usr/share/lightdm/remote-sessions +#greeters-directory=$XDG_DATA_DIRS/lightdm/greeters:$XDG_DATA_DIRS/xgreeters +#backup-logs=true +#dbus-service=true + +# +# Seat configuration +# +# Seat configuration is matched against the seat name glob in the section, for example: +# [Seat:*] matches all seats and is applied first. +# [Seat:seat0] matches the seat named "seat0". +# [Seat:seat-thin-client*] matches all seats that have names that start with "seat-thin-client". +# +# type = Seat type (local, xremote) +# pam-service = PAM service to use for login +# pam-autologin-service = PAM service to use for autologin +# pam-greeter-service = PAM service to use for greeters +# xserver-command = X server command to run (can also contain arguments e.g. X -special-option) +# xmir-command = Xmir server command to run (can also contain arguments e.g. Xmir -special-option) +# xserver-config = Config file to pass to X server +# xserver-layout = Layout to pass to X server +# xserver-allow-tcp = True if TCP/IP connections are allowed to this X server +# xserver-share = True if the X server is shared for both greeter and session +# xserver-hostname = Hostname of X server (only for type=xremote) +# xserver-display-number = Display number of X server (only for type=xremote) +# xdmcp-manager = XDMCP manager to connect to (implies xserver-allow-tcp=true) +# xdmcp-port = XDMCP UDP/IP port to communicate on +# xdmcp-key = Authentication key to use for XDM-AUTHENTICATION-1 (stored in keys.conf) +# greeter-session = Session to load for greeter +# greeter-hide-users = True to hide the user list +# greeter-allow-guest = True if the greeter should show a guest login option +# greeter-show-manual-login = True if the greeter should offer a manual login option +# greeter-show-remote-login = True if the greeter should offer a remote login option +# user-session = Session to load for users +# allow-user-switching = True if allowed to switch users +# allow-guest = True if guest login is allowed +# guest-session = Session to load for guests (overrides user-session) +# session-wrapper = Wrapper script to run session with +# greeter-wrapper = Wrapper script to run greeter with +# guest-wrapper = Wrapper script to run guest sessions with +# display-setup-script = Script to run when starting a greeter session (runs as root) +# display-stopped-script = Script to run after stopping the display server (runs as root) +# greeter-setup-script = Script to run when starting a greeter (runs as root) +# session-setup-script = Script to run when starting a user session (runs as root) +# session-cleanup-script = Script to run when quitting a user session (runs as root) +# autologin-guest = True to log in as guest by default +# autologin-user = User to log in with by default (overrides autologin-guest) +# autologin-user-timeout = Number of seconds to wait before loading default user +# autologin-session = Session to load for automatic login (overrides user-session) +# autologin-in-background = True if autologin session should not be immediately activated +# exit-on-failure = True if the daemon should exit if this seat fails +# +[Seat:*] +#type=local +#pam-service=lightdm +#pam-autologin-service=lightdm-autologin +#pam-greeter-service=lightdm-greeter +#xserver-command=X +#xmir-command=Xmir +#xserver-config= +#xserver-layout= +#xserver-allow-tcp=false +#xserver-share=true +#xserver-hostname= +#xserver-display-number= +#xdmcp-manager= +#xdmcp-port=177 +#xdmcp-key= +greeter-session=lightdm-gtk-greeter +#greeter-hide-users=false +#greeter-allow-guest=true +#greeter-show-manual-login=false +#greeter-show-remote-login=true +#user-session=default +#allow-user-switching=true +#allow-guest=true +#guest-session= +session-wrapper=/etc/lightdm/Xsession +#greeter-wrapper= +#guest-wrapper= +#display-setup-script= +#display-stopped-script= +#greeter-setup-script= +#session-setup-script= +#session-cleanup-script= +#autologin-guest=false +#autologin-user= +#autologin-user-timeout=0 +#autologin-in-background=false +#autologin-session= +#exit-on-failure=false + +# +# XDMCP Server configuration +# +# enabled = True if XDMCP connections should be allowed +# port = UDP/IP port to listen for connections on +# listen-address = Host/address to listen for XDMCP connections (use all addresses if not present) +# key = Authentication key to use for XDM-AUTHENTICATION-1 or blank to not use authentication (stored in keys.conf) +# hostname = Hostname to report to XDMCP clients (defaults to system hostname if unset) +# +# The authentication key is a 56 bit DES key specified in hex as 0xnnnnnnnnnnnnnn. Alternatively +# it can be a word and the first 7 characters are used as the key. +# +[XDMCPServer] +#enabled=false +#port=177 +#listen-address= +#key= +#hostname= + +# +# VNC Server configuration +# +# enabled = True if VNC connections should be allowed +# command = Command to run Xvnc server with +# port = TCP/IP port to listen for connections on +# listen-address = Host/address to listen for VNC connections (use all addresses if not present) +# width = Width of display to use +# height = Height of display to use +# depth = Color depth of display to use +# +[VNCServer] +#enabled=false +#command=Xvnc +#port=5900 +#listen-address= +#width=1024 +#height=768 +#depth=8 diff --git a/source-files/lightdm.esv b/source-files/lightdm.esv new file mode 100644 index 0000000..c930e53 --- /dev/null +++ b/source-files/lightdm.esv @@ -0,0 +1,4 @@ +name: lightdm +description: Start the LightDM Display Manager +type: background +start_cmd: /etc/esvm/scripts/lightdm.sh diff --git a/source-files/lightdm.sh b/source-files/lightdm.sh new file mode 100644 index 0000000..1cd61ac --- /dev/null +++ b/source-files/lightdm.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +install -d -m0711 -olightdm -glightdm /var/run/lightdm + +rm -rf /var/lib/lightdm{,-data} +install -d -m770 -olightdm -glightdm /var/lib/lightdm{,-data} + +exec /usr/sbin/lightdm diff --git a/source-files/polkit-rules b/source-files/polkit-rules new file mode 100644 index 0000000..eda155b --- /dev/null +++ b/source-files/polkit-rules @@ -0,0 +1,15 @@ +polkit.addRule(function(action, subject) { + if (subject.user == "lightdm") { + polkit.log("action=" + action); + polkit.log("subject=" + subject); + if (action.id.indexOf("org.freedesktop.login1.") == 0) { + return polkit.Result.YES; + } + if (action.id.indexOf("org.freedesktop.consolekit.system.") == 0) { + return polkit.Result.YES; + } + if (action.id.indexOf("org.freedesktop.upower.") == 0) { + return polkit.Result.YES; + } + } +}); diff --git a/source-files/sysusers b/source-files/sysusers new file mode 100644 index 0000000..134c374 --- /dev/null +++ b/source-files/sysusers @@ -0,0 +1 @@ +u lightdm - "Light Display Manager" /var/lib/lightdm diff --git a/source.sh b/source.sh new file mode 100644 index 0000000..90c421f --- /dev/null +++ b/source.sh @@ -0,0 +1,43 @@ +# This is the source.sh script. It is executed by BPM in a temporary directory when compiling a source package +# BPM Expects the source code to be extracted into the automatically created 'source' directory which can be accessed using $BPM_SOURCE +# BPM Expects the output files to be present in the automatically created 'output' directory which can be accessed using $BPM_OUTPUT + +# The build function is executed in the source directory +# This function is used to compile the source code +build() { + ./configure \ + --prefix=/usr \ + --localstatedir=/var \ + --sysconfdir=/etc \ + --disable-static \ + --disable-tests \ + --enable-gtk-doc \ + --with-greeter-user=lightdm \ + --with-greeter-session=lightdm-gtk-greeter + make +} + +# The package function is executed in the source directory +# This function is used to move the compiled files into the output directory +package() { + make DESTDIR="$BPM_OUTPUT" install + + # Install lightdm config file + install -Dm644 "$BPM_WORKDIR"/lightdm.conf "$BPM_OUTPUT"/etc/lightdm/lightdm.conf + + # Install Xsession file + install -Dm755 "$BPM_WORKDIR"/Xsession "$BPM_OUTPUT"/etc/lightdm/Xsession + + # Install sysusers file + install -Dm644 "$BPM_WORKDIR"/sysusers "$BPM_OUTPUT"/usr/lib/sysusers.d/lightdm.conf + + # Install polkit rules + install -Dm644 "$BPM_WORKDIR"/polkit-rules "$BPM_OUTPUT"/usr/share/polkit-1/rules.d/lightdm.rules + + # Install esvm service + install -Dm644 "$BPM_WORKDIR"/lightdm.esv "$BPM_OUTPUT"/etc/esvm/services/lightdm.esv + install -Dm755 "$BPM_WORKDIR"/lightdm.sh "$BPM_OUTPUT"/etc/esvm/scripts/lightdm.sh + + # Install package license + install -Dm644 "$BPM_SOURCE"/COPYING* -t "$BPM_OUTPUT"/usr/share/licenses/lightdm +}