summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Phillips <rphillips@gentoo.org>2002-08-09 07:36:00 +0000
committerRyan Phillips <rphillips@gentoo.org>2002-08-09 07:36:00 +0000
commit14e35115da5d32e6ef26a31496917b6b2594e13b (patch)
treed53c15bff87351182f811f8bf599e6c93bae23ce /sys-libs/nss-mysql
parentadded sed statements for icc (diff)
downloadgentoo-2-14e35115da5d32e6ef26a31496917b6b2594e13b.tar.gz
gentoo-2-14e35115da5d32e6ef26a31496917b6b2594e13b.tar.bz2
gentoo-2-14e35115da5d32e6ef26a31496917b6b2594e13b.zip
New package. Fixes #5110. Submitted by Christian Skarby
Diffstat (limited to 'sys-libs/nss-mysql')
-rw-r--r--sys-libs/nss-mysql/ChangeLog14
-rw-r--r--sys-libs/nss-mysql/files/digest-nss-mysql-0.401
-rw-r--r--sys-libs/nss-mysql/files/gentoo.sql.nss-mysql-0.40.gentoo51
-rw-r--r--sys-libs/nss-mysql/nss-mysql-0.40.ebuild105
4 files changed, 171 insertions, 0 deletions
diff --git a/sys-libs/nss-mysql/ChangeLog b/sys-libs/nss-mysql/ChangeLog
new file mode 100644
index 000000000000..cb1f03a37a8e
--- /dev/null
+++ b/sys-libs/nss-mysql/ChangeLog
@@ -0,0 +1,14 @@
+# ChangeLog for sys-libs/nss-mysql
+# Copyright 2002 Gentoo Technologies, Inc.; Distributed under the GPL
+# $Header: /var/cvsroot/gentoo-x86/sys-libs/nss-mysql/ChangeLog,v 1.1 2002/08/09 07:36:00 rphillips Exp $
+
+*nss-mysql-0.40 (9 Aug 2002)
+
+ 9 Aug 2002; Ryan Phillips <rphillips@gentoo.org> nss-mysql-0.40.ebuild :
+
+ Added initial ChangeLog which should be updated whenever the package is
+ updated in any way. This changelog is targetted to users. This means that the
+ comments should well explained and written in clean English. The details about
+ writing correct changelogs are explained in the skel.ChangeLog file which you
+ can find in the root directory of the portage repository.
+
diff --git a/sys-libs/nss-mysql/files/digest-nss-mysql-0.40 b/sys-libs/nss-mysql/files/digest-nss-mysql-0.40
new file mode 100644
index 000000000000..3b5751708c73
--- /dev/null
+++ b/sys-libs/nss-mysql/files/digest-nss-mysql-0.40
@@ -0,0 +1 @@
+MD5 0d695d86a2adaea93c79578dfe6e309d nss-mysql-0.40.tar.gz 216701
diff --git a/sys-libs/nss-mysql/files/gentoo.sql.nss-mysql-0.40.gentoo b/sys-libs/nss-mysql/files/gentoo.sql.nss-mysql-0.40.gentoo
new file mode 100644
index 000000000000..765e643ef010
--- /dev/null
+++ b/sys-libs/nss-mysql/files/gentoo.sql.nss-mysql-0.40.gentoo
@@ -0,0 +1,51 @@
+# Copyright 2002 Interhost ANS, Norway - www.interhost.no
+# Distributed under the terms of the GNU General Public License, v2 or later
+# Written for Portage by Christian Skarby (Interhost ANS, Norway) christian.skarby@interhost.no
+
+CREATE DATABASE IF NOT EXISTS nss_mysql;
+USE nss_mysql;
+
+CREATE TABLE IF NOT EXISTS groups (
+ group_id int(11) NOT NULL auto_increment primary key,
+ group_name varchar(30) DEFAULT '' NOT NULL,
+ status char(1) DEFAULT 'A',
+ group_password varchar(64) DEFAULT 'x' NOT NULL,
+ gid int(11) NOT NULL
+);
+
+CREATE TABLE IF NOT EXISTS user_group (
+ user_id int(11) DEFAULT '0' NOT NULL,
+ group_id int(11) DEFAULT '0' NOT NULL
+ );
+
+CREATE TABLE IF NOT EXISTS user (
+ user_id int(11) NOT NULL auto_increment primary key,
+ user_name varchar(50) DEFAULT '' NOT NULL,
+ realname varchar(32) DEFAULT '' NOT NULL,
+ shell varchar(20) DEFAULT '/bin/sh' NOT NULL,
+ password varchar(40) DEFAULT '' NOT NULL,
+ status char(1) DEFAULT 'N' NOT NULL,
+ uid int(11) NOT NULL,
+ gid int(11) DEFAULT '65534' NOT NULL,
+ homedir varchar(32) DEFAULT '/bin/sh' NOT NULL,
+ lastchange int(11),
+ min int(11),
+ max int(11),
+ warn int(11),
+ inact int(11),
+ expire int(11)
+ );
+
+GRANT select(user_name,user_id,uid,gid,realname,shell,homedir,status)
+ on nss_mysql.user to nss@localhost identified by 'password';
+GRANT select(group_name,group_id,gid,group_password,status)
+ on nss_mysql.groups to nss@localhost identified by 'password';
+GRANT select(user_id,group_id)
+ on nss_mysql.user_group to nss@localhost identified by 'password';
+GRANT SELECT,INSERT,UPDATE,DELETE
+ on nss_mysql.user to 'nss-shadow'@localhost identified by 'another_password';
+GRANT SELECT,INSERT,UPDATE,DELETE
+ on nss_mysql.groups to 'nss-shadow'@localhost identified by 'another_password';
+GRANT SELECT,INSERT,UPDATE,DELETE
+ on nss_mysql.user_group to 'nss-shadow'@localhost identified by 'another_password';
+FLUSH PRIVILEGES;
diff --git a/sys-libs/nss-mysql/nss-mysql-0.40.ebuild b/sys-libs/nss-mysql/nss-mysql-0.40.ebuild
new file mode 100644
index 000000000000..c471259718d5
--- /dev/null
+++ b/sys-libs/nss-mysql/nss-mysql-0.40.ebuild
@@ -0,0 +1,105 @@
+# Copyright 1999-2002 Gentoo Technologies, Inc.
+# Distributed under the terms of the GNU General Public License, v2 or later
+# Written for Portage by Christian Skarby (Interhost ANS, Norway) christian.skarby@interhost.no
+# $Header: /var/cvsroot/gentoo-x86/sys-libs/nss-mysql/nss-mysql-0.40.ebuild,v 1.1 2002/08/09 07:36:00 rphillips Exp $
+
+DESCRIPTION="NSS MySQL Module"
+HOMEPAGE="http://savannah.gnu.org/projects/nss-mysql"
+SRC_URI="http://savannah.gnu.org/download/nss-mysql/nss-mysql.pkg/0.40/${P}.tar.gz"
+SLOT="0"
+KEYWORDS="*"
+DEPEND=">=virtual/glibc-2.1* >=dev-db/mysql-3.23.51-r1"
+REPEND="${DEPEND}"
+LICENSE="GPL-2"
+
+
+src_compile() {
+ use static && myconf="--enable-static"
+ ./configure ${myconf} \
+ --host=${CHOST} \
+ --prefix=/usr \
+ --infodir=/usr/share/info \
+ --sysconfdir=/etc/nss-mysql \
+ --libdir=/lib \
+ --mandir=/usr/share/man || die "./configure failed"
+ emake || die
+ cp -a /usr/portage/${CATEGORY}/nss-mysql/files/gentoo.sql.${P}.gentoo ${S}/gentoo.sql
+}
+
+src_install () {
+ make DESTDIR=${D} install || die
+ dodoc AUTHORS COPYING ChangeLog INSTALL NEWS README SHADOW THANKS TODO UPGRADE sample.sql gentoo.sql
+}
+
+pkg_postinst() {
+ einfo
+ einfo "Execute ebuild /var/db/pkg/${CATEGORY}/${PF}/${PF}.ebuild config"
+ einfo "to autosetup nss-mysql and the mysql tables."
+ einfo "You should then edit your /etc/nsswitch.conf file to activate nss_mysql"
+ einfo "and suit your intentions. Below is an partial example:"
+ einfo
+ einfo "passwd: files mysql"
+ einfo "shadow: files mysql"
+ einfo "group: files mysql"
+ einfo
+}
+
+pkg_config() {
+ echo "In order to continue we'll need to know a MySQL username with enough"
+ echo "privleges to create databases, mysql-users and grant privleges,"
+ echo "typically a user named root."
+ echo
+ echo -n "MySQL-root-user [root]: "
+ read USERNAME
+ if [ -z "${USERNAME}" ]; then
+ USERNAME="root"
+ fi
+ echo -n "Is it required to use a password in order to access mysql with ${USERNAME} [Y/n]: "
+ read NEEDPASS
+ POPT="-p"
+ if [ "${NEEDPASS}" == "n" ]; then
+ POPT=""
+ fi
+ cmd="${ROOT}/usr/bin/makepasswd --minchars=10 --maxchars=12"
+ if [ -f "${cmd}" ]; then
+ PASS=`$cmd`
+ PAS2=`$cmd`
+ fi
+ cmd="${ROOT}/usr/bin/passook"
+ if [ -f "${cmd}" ]; then
+ PASS=`$cmd`
+ PAS2=`$cmd`
+ fi
+ if [ -z "${PASS}" ]; then
+ echo "";
+ echo "Didn't manage to find a passwd-generator, please type a passwords of your choise";
+ echo -n "Shadow-access-password (root-only): ";
+ read PASS
+ echo -n "Select-public-info-password: ";
+ read PAS2
+ fi
+ if [ -z "${PAS2}" ]; then
+ PAS2="badbadbadPASSWDMHALL20020715";
+ fi
+ if [ -z "${PASS}" ]; then
+ einfo "I will not accept that you leave that the shadow-access-password empty"
+ die
+ fi
+ if [ ! -z "$POPT" ]; then
+ einfo "Pass the mysql-users \"${USERNAME}\"s password to mysql:";
+ echo -n "mysql> "
+ fi
+ ( gunzip -c /usr/share/doc/${P}/gentoo.sql.gz | sed s/another_password/${PASS}/ | sed s/"'password'"/"'${PAS2}'"/ | mysql ${POPT} -u ${USERNAME} ) || die
+ FILE="/etc/nss-mysql/nss-mysql-root.conf"; sed -e s/"shadow.db_password ="/"shadow.db_password = ${PASS};#oldpass:"/ < ${FILE} | cat > ${FILE}
+ FILE="/etc/nss-mysql/nss-mysql.conf"; sed -e s/"users.db_password ="/"users.db_password = ${PAS2};#oldpass:"/ < ${FILE} | cat > ${FILE}
+ chown -R 0.0 /etc/nss-mysql
+ chmod 600 /etc/nss-mysql/nss-mysql-root.conf
+ chmod 644 /etc/nss-mysql/nss-mysql.conf
+ einfo "nss_mysql-configfiles and mysql-tables should now be setup"
+ einfo "remember to activate nss-mysql in /etc/nsswitch.conf with someting simillar to:"
+ einfo
+ einfo "passwd: files mysql"
+ einfo "shadow: files mysql"
+ einfo "group: files mysql"
+ einfo
+}