diff options
-rw-r--r-- | .SRCINFO | 11 | ||||
-rw-r--r-- | PKGBUILD | 31 | ||||
-rw-r--r-- | add-autologin-group.install | 45 | ||||
-rw-r--r-- | add-autologin-group.script | 39 | ||||
-rw-r--r-- | add-autologin-group.service | 10 |
5 files changed, 126 insertions, 10 deletions
@@ -1,8 +1,9 @@ pkgbase = lightdm-settings pkgdesc = A configuration tool for the LightDM display manager - pkgver = 1.2.1 + pkgver = 1.2.2 pkgrel = 1 url = https://github.com/linuxmint/lightdm-settings + install = add-autologin-group.install arch = any license = GPL3 makedepends = desktop-file-utils @@ -13,8 +14,12 @@ pkgbase = lightdm-settings depends = python-gobject depends = python-setproctitle depends = python-xapp - source = lightdm-settings-1.2.1.tar.gz::https://github.com/linuxmint/lightdm-settings/archive/1.2.1.tar.gz - sha256sums = d175ffa71e77f4c45697e2a69bfb7d2c9b50753bffb6b1a9ccc7dfce4e62cd21 + source = lightdm-settings-1.2.2.tar.gz::https://github.com/linuxmint/lightdm-settings/archive/1.2.2.tar.gz + source = add-autologin-group.script + source = add-autologin-group.service + sha256sums = ca558b6733baeb55e614e16c3995edaa8d3a0e9afa08794a0c09830a44495d21 + sha256sums = 475bb4805a419aca106f9f42bcb837c7dc53eeb84b5c50d8ee8d892b55d6c2b4 + sha256sums = a356ee9dc1e876d73c49ab30fdc6417edb7a817639122fff7fe0ebff72e33190 pkgname = lightdm-settings @@ -1,16 +1,28 @@ # Maintainer: Sam Burgos < sam dot burgos1089 at gmail dot com > -pkgname='lightdm-settings' -pkgver=1.2.1 +pkgname=lightdm-settings +pkgver=1.2.2 pkgrel=1 -pkgdesc="A configuration tool for the LightDM display manager " +pkgdesc="A configuration tool for the LightDM display manager" +_add_group=add-autologin-group arch=('any') url="https://github.com/linuxmint/${pkgname}" license=('GPL3') -depends=('hicolor-icon-theme' 'lightdm-slick-greeter' 'polkit' 'python-gobject' 'python-setproctitle' 'python-xapp') -makedepends=('desktop-file-utils' 'gettext') -source=("${pkgname}-${pkgver}.tar.gz::$url/archive/${pkgver}.tar.gz") -sha256sums=('d175ffa71e77f4c45697e2a69bfb7d2c9b50753bffb6b1a9ccc7dfce4e62cd21') +depends=('hicolor-icon-theme' + 'lightdm-slick-greeter' + 'polkit' + 'python-gobject' + 'python-setproctitle' + 'python-xapp') +makedepends=('desktop-file-utils' + 'gettext') +install=$_add_group.install +source=("${pkgname}-${pkgver}.tar.gz::$url/archive/${pkgver}.tar.gz" + "$_add_group.script" + "$_add_group.service") +sha256sums=('ca558b6733baeb55e614e16c3995edaa8d3a0e9afa08794a0c09830a44495d21' + '475bb4805a419aca106f9f42bcb837c7dc53eeb84b5c50d8ee8d892b55d6c2b4' + 'a356ee9dc1e876d73c49ab30fdc6417edb7a817639122fff7fe0ebff72e33190') build() { cd $pkgname-$pkgver @@ -20,4 +32,9 @@ build() { package() { cd $pkgname-$pkgver cp -r usr $pkgdir + +#install systemd service + cd /$srcdir + install -Dm755 $_add_group.script $pkgdir/usr/bin/$_add_group + install -Dm644 $_add_group.service $pkgdir/etc/systemd/system/$_add_group.serv } diff --git a/add-autologin-group.install b/add-autologin-group.install new file mode 100644 index 000000000000..c70fc5f03b74 --- /dev/null +++ b/add-autologin-group.install @@ -0,0 +1,45 @@ +# Colored makepkg-like functions +msg_blue() { + printf "${blue}==>${bold} $1${all_off}\n" +} + +note() { + printf "${blue}==>${yellow} NOTE:${bold} $1${all_off}\n" +} + +all_off="$(tput sgr0)" +bold="${all_off}$(tput bold)" +blue="${bold}$(tput setaf 4)" +yellow="${bold}$(tput setaf 3)" + +post_install() { + + systemctl is-active add-autologin-group >/dev/null || systemctl enable add-autologin-group + + echo "" + note "We have enabled autologin for all users." + note "Reboot your system the first time, so changes will take affect." + echo "" +} + +post_upgrade() { + + post_install +} + +post_remove() { + + ! systemctl is-active add-autologin-group >/dev/null || systemctl disable add-autologin-group + + grep autologin /etc/group + if [[ "$?" -eq 0 ]]; then + groupdel autologin >/dev/null + else echo "" + note"Autologin group already removed" + echo "" + echo "" + note "We have disabled autologin for all users and removed autologin group." + note "Reboot your system, so changes will take affect." + echo "" + fi +} diff --git a/add-autologin-group.script b/add-autologin-group.script new file mode 100644 index 000000000000..c8399ec361f3 --- /dev/null +++ b/add-autologin-group.script @@ -0,0 +1,39 @@ +#!/bin/bash + +##Bash script to add autologin group into /etc/group and after creation add all users present in /etc/paswd. Systemd service + +#Collect users +_users=$(awk -F'[/:]' '{if ($3 >= 1000 && $3 != 65534) print $1}' /etc/passwd) + +#Check if autologin group not exist and if not do the job +install() { +grep "autologin" /etc/group + if [ "$?" -eq 1 ]; then + #Add autologin group + groupadd -r autologin + #Add users + for i in $_users; do + gpasswd -a $i autologin + done + fi +} + +#Check if a new user is created +check-new-user() { + for i in $_users ; do + if groups $i | grep &>/dev/null '\bautologin\b'; then + : #echo "User $i ok" + else gpasswd -a $i autologin + fi + done +} + +#Job +grep autologin /etc/group + if [ "$?" -eq 1 ]; then + install + else check-new-user + fi + + + diff --git a/add-autologin-group.service b/add-autologin-group.service new file mode 100644 index 000000000000..77f727de4a96 --- /dev/null +++ b/add-autologin-group.service @@ -0,0 +1,10 @@ +[Unit] +Description=Check if autologin group exist and also add the users. + +[Service] +Type=oneshot +ExecStart=/usr/bin/add-autologin-group + +[Install] +WantedBy=multi-user.target + |