summarylogtreecommitdiffstats
path: root/add-autologin-group.script
diff options
context:
space:
mode:
authorSam Burgos2018-06-26 10:56:35 -0600
committerSam Burgos2018-06-26 10:56:35 -0600
commite2ed01bae7e1ecdb80100e85cd777021f447db83 (patch)
tree90a59c35e5e0d6722d5f2c350613c6d679d8981d /add-autologin-group.script
parent1a3967097bc7b70b30126e5680cfc09ea12874d1 (diff)
downloadaur-e2ed01bae7e1ecdb80100e85cd777021f447db83.tar.gz
updated to version 1.2.2 and added new files for easy installation (ported from manjaro settings)
Diffstat (limited to 'add-autologin-group.script')
-rw-r--r--add-autologin-group.script39
1 files changed, 39 insertions, 0 deletions
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
+
+
+