theo 1 rok temu
rodzic
commit
e5f54fe96b
12 zmienionych plików z 38 dodań i 17 usunięć
  1. 1 0
      .gitignore
  2. 16 0
      Makefile
  3. 2 2
      bin/addmailalias
  4. 2 2
      bin/addtogroups
  5. 2 2
      bin/creategroup
  6. 2 2
      bin/createperson
  7. 2 2
      bin/person2posix
  8. 2 2
      bin/removefromgroups
  9. 2 2
      bin/removeperson
  10. 2 2
      bin/resetpassword
  11. 0 0
      ldap-utils.conf.example
  12. 5 1
      lib/funcs

+ 1 - 0
.gitignore

@@ -1 +1,2 @@
 .env
+ldap-utils.conf

+ 16 - 0
Makefile

@@ -0,0 +1,16 @@
+install: 
+	mkdir -p /usr/local/lib/ldap-utils
+	mkdir -p /usr/local/bin
+	cp -f bin/* /usr/local/bin
+	cp -f lib/funcs /usr/local/lib/ldap-utils
+
+uninstall:
+	rm -fr /usr/local/lib/ldap-utils
+	rm -f	/usr/local/bin/addmailalias\
+		/usr/local/bin/addtogroups\
+		/usr/local/bin/creategroup\
+		/usr/local/bin/createperson\
+		/usr/local/bin/person2posix\
+		/usr/local/bin/removefromgroups\
+		/usr/local/bin/removeperson\
+		/usr/local/bin/resetpassword

+ 2 - 2
addmailalias → bin/addmailalias

@@ -1,6 +1,6 @@
 #!/bin/bash
-. .env
-. funcs
+. /etc/ldap-utils.conf
+. /usr/local/lib/ldap-utils/funcs
 
 uid=$1
 alias=$2

+ 2 - 2
addtogroups → bin/addtogroups

@@ -1,6 +1,6 @@
 #!/bin/bash
-. .env
-. funcs
+. /etc/ldap-utils.conf
+. /usr/local/lib/ldap-utils/funcs
 
 uid=$1
 

+ 2 - 2
creategroup → bin/creategroup

@@ -1,6 +1,6 @@
 #!/bin/bash
-. .env
-. funcs
+. /etc/ldap-utils.conf
+. /usr/local/lib/ldap-utils/funcs
 
 # Check if option -p is passed, and if so prepare for a posixGroup creation
 if [ "$1" = "-p" ]; then

+ 2 - 2
createperson → bin/createperson

@@ -1,6 +1,6 @@
 #!/bin/bash -e
-. .env
-. funcs
+. /etc/ldap-utils.conf
+. /usr/local/lib/ldap-utils/funcs
 
 usage() {
 	echo "Usage : $(basename $0) -u <uid> -n <First name> -s <Last Name> [-p] [-g group1,group2,...]"

+ 2 - 2
person2posix → bin/person2posix

@@ -1,6 +1,6 @@
 #!/bin/bash
-. .env
-. funcs
+. /etc/ldap-utils.conf
+. /usr/local/lib/ldap-utils/funcs
 uid=$1
 
 if user_exists $uid; then

+ 2 - 2
removefromgroups → bin/removefromgroups

@@ -1,6 +1,6 @@
 #!/bin/bash
-. .env
-. funcs
+. /etc/ldap-utils.conf
+. /usr/local/lib/ldap-utils/funcs
 
 uid=$1
 

+ 2 - 2
removeperson → bin/removeperson

@@ -1,6 +1,6 @@
 #!/bin/bash
-. .env
-. funcs
+. /etc/ldap-utils.conf
+. /usr/local/lib/ldap-utils/funcs
 
 # Check if option -y is passed
 if [ "$1" = "-y" ]; then

+ 2 - 2
resetpassword → bin/resetpassword

@@ -1,6 +1,6 @@
 #!/bin/bash -e
-. .env
-. funcs
+. /etc/ldap-utils.conf
+. /usr/local/lib/ldap-utils/funcs
 
 usage() {
 	echo "Usage : $(basename $0) -u <uid> -n <First name> -s <Last Name> [-p] [-g group1,group2,...]"

+ 0 - 0
.env.example → ldap-utils.conf.example


+ 5 - 1
funcs → lib/funcs

@@ -1,6 +1,10 @@
 #!/bin/bash
 
-. .env
+if [ -e /etc/ldap-utils.conf ]; then
+	. /etc/ldap-utils.conf
+else
+	exit 1
+fi
 
 user_exists() {
 	res=$($PEOPLESEARCHCMD "(&(uid=$1)(objectClass=inetOrgPerson))" | grep uid: | cut -f2 -d' ')