From 0227d4d3beee7c000d77c0c7c8aa1823f2372e4a Mon Sep 17 00:00:00 2001 From: Dan Fandrich Date: Wed, 13 Dec 2023 18:38:13 -0800 Subject: Add new scripts These were being used on duvel. --- mga-createrepo | 5 +++++ mga-useredit | 22 ++++++++++++++++++++++ mga-userpasswd | 24 ++++++++++++++++++++++++ mgacreatehome | 27 +++++++++++++++++++++++++++ mgagit-format-commit-email | 19 +++++++++++++++++++ 5 files changed, 97 insertions(+) create mode 100755 mga-createrepo create mode 100755 mga-useredit create mode 100755 mga-userpasswd create mode 100755 mgacreatehome create mode 100755 mgagit-format-commit-email diff --git a/mga-createrepo b/mga-createrepo new file mode 100755 index 0000000..43ac911 --- /dev/null +++ b/mga-createrepo @@ -0,0 +1,5 @@ +#!/bin/bash +for d in /distrib/bootstrap/distrib/cauldron/SRPMS/*/*/ /distrib/bootstrap/distrib/cauldron/*/media/{core,nonfree,tainted}/*/ /distrib/bootstrap/distrib/cauldron/*/media/debug/{core,nonfree,tainted}/*/ +do + time createrepo_c --no-database --update --workers=10 $d +done diff --git a/mga-useredit b/mga-useredit new file mode 100755 index 0000000..892f793 --- /dev/null +++ b/mga-useredit @@ -0,0 +1,22 @@ +#!/bin/bash + +cLDAP_URL="ldaps://ldap.mageia.org" +cLDAP_BASE_DN="ou=People,dc=mageia,dc=org" + +if [ "x$USER" == "xroot" ] +then + echo "Please what's your LDAP uid ?" + read -a vUID +else + vUID=$USER +fi + +if [ "x$1" == "x" ] +then + echo "Please give the uid you want to edit ?" + read -a vEDIT_UID +else + vEDIT_UID=$1 +fi + +/usr/bin/ldapvi -q --tls allow -h ${cLDAP_URL} -D "uid=${vUID},${cLDAP_BASE_DN}" -b "uid=${vEDIT_UID},${cLDAP_BASE_DN}" diff --git a/mga-userpasswd b/mga-userpasswd new file mode 100755 index 0000000..2e49c43 --- /dev/null +++ b/mga-userpasswd @@ -0,0 +1,24 @@ +#!/bin/bash + +cLDAP_URL="ldaps://ldap.mageia.org" +cLDAP_BASE_DN="ou=People,dc=mageia,dc=org" + +if [ "x$USER" == "xroot" ] +then + echo "Please what's your LDAP uid ?" + read -a vUID +else + vUID=$USER +fi + +if [ "x$1" == "x" ] +then + echo "Please give the uid you want to edit ?" + read -a vEDIT_UID +else + vEDIT_UID=$1 +fi +echo "First you'll be asked to provide the new password, then youl'll be asked YOUR LDAP password..." +echo "" +sleep 2 +/usr/bin/ldappasswd -x -H ${cLDAP_URL} -D "uid=${vUID},${cLDAP_BASE_DN}" -W -S "uid=${vEDIT_UID},${cLDAP_BASE_DN}" diff --git a/mgacreatehome b/mgacreatehome new file mode 100755 index 0000000..3c0fc14 --- /dev/null +++ b/mgacreatehome @@ -0,0 +1,27 @@ +#!/bin/sh + +# script to create home directory with ssh key +# takes two arguments : +# - login +# - URL for ssh key + +test $# -eq 2 || exit 1 +login="$1" +sshkeyurl="$2" +sshkeyfile=`mktemp` +homeroot='/home' + +id "$login" || exit 2 +wget -O "$sshkeyfile" "$sshkeyurl" || exit 2 +cat "$sshkeyfile" +echo "Press enter to validate" +read z + +test ! -d "$homeroot/$login" && cp -a /etc/skel "$homeroot/$login" +mkdir "$homeroot/$login/.ssh" +cat "$sshkeyfile" >> "$homeroot/$login/.ssh/authorized_keys" +rm -f "$sshkeyfile" +chmod 700 "$homeroot/$login/.ssh" +chmod 600 "$homeroot/$login/.ssh/authorized_keys" +chown -R "$login":mga-users "$homeroot/$login" + diff --git a/mgagit-format-commit-email b/mgagit-format-commit-email new file mode 100755 index 0000000..f41c3fc --- /dev/null +++ b/mgagit-format-commit-email @@ -0,0 +1,19 @@ +#!/bin/sh + +REV=$1 +if [ -z "$1" ]; then + echo "Unknown Commit" + exit +fi +if [ -z "$GL_REPO" ]; then + echo "Cannot find Gitolite Repository" + exit +fi + +echo '-----------------------------------------------------------------------' +echo +echo "http://gitweb.mageia.org/$GL_REPO/commit/?id=$REV" +echo +echo +git show -C $REV +echo -- cgit v1.2.1