diff options
author | Nalin Dahyabhai <nalin.dahyabhai@pobox.com> | 2008-03-20 12:01:32 -0400 |
---|---|---|
committer | Nalin Dahyabhai <nalin.dahyabhai@pobox.com> | 2008-03-20 12:01:32 -0400 |
commit | a44c5a9a86c54fbc0d82a15973c8f7d1eda584cb (patch) | |
tree | 904c2aee751b8ab9d19a25c3818d7c8e73b543d9 | |
parent | d339fae17b11e1bd9843d329abc477bc7d4bcab3 (diff) | |
download | autologin-a44c5a9a86c54fbc0d82a15973c8f7d1eda584cb.tar.gz autologin-a44c5a9a86c54fbc0d82a15973c8f7d1eda584cb.tar.xz autologin-a44c5a9a86c54fbc0d82a15973c8f7d1eda584cb.zip |
- start adding an archive target
-rw-r--r-- | Makefile | 50 | ||||
-rw-r--r-- | autologin.c | 3 | ||||
-rw-r--r-- | autologin.spec | 27 |
3 files changed, 60 insertions, 20 deletions
@@ -1,15 +1,57 @@ CFLAGS=-Wall -Wextra LDFLAGS=-lpam -lutempter -ldl +SBINDIR=/sbin +MANDIR=/usr/share/man + all: autologin clean: $(RM) autologin -install: $(DESTDIR)/sbin/autologin $(DESTDIR)/usr/man/man8/autologin.8.gz +install: $(DESTDIR)$(SBINDIR)/autologin $(DESTDIR)$(MANDIR)/man8/autologin.8.gz + +$(DESTDIR)$(SBINDIR) $(DESTDIR)$(MANDIR): + mkdir -p $@ -$(DESTDIR)/sbin/autologin: autologin +$(DESTDIR)$(SBINDIR)/autologin: $(DESTDIR)$(SBINDIR) autologin install -m 711 $^ $@ -$(DESTDIR)/usr/man/man8/autologin.8.gz: autologin.8 - cat autologin.8 | gzip > $(DESTDIR)/usr/man/man8/autologin.8.gz +$(DESTDIR)$(MANDIR)/man8/autologin.8.gz: $(DESTDIR)$(MANDIR) autologin.8 + cat autologin.8 | gzip > $(DESTDIR)$(MANDIR)/man8/autologin.8.gz + +GITTAG=autologin-$(shell rpm -q --specfile autologin.spec --qf '%{version}-%{release}\n' | head -n1) +distdir=$(shell rpm -q --specfile --qf '%{name}-%{version}-%{release}\n' autologin.spec | head -n1) + +tag: + git tag $(GITTAG) + +force-tag: + git tag -f $(GITTAG) + +ARCHIVEOUTDIR=$(pwd) + +local-archive: + $(MAKE) archive ORIGIN=$(ARCHIVEOUTDIR) + +archive: + repo=`pwd`; \ + tmpdir=`mktemp -d /tmp/make_archive_XXXXXX`; \ + if test -d "$$tmpdir" ; then \ + git clone $(ORIGIN) $$tmpdir/autologin;\ + cd $$tmpdir/autologin;\ + git checkout $(GITTAG) $(distdir);\ + tar --exclude=.git cvzf $(distdir).tar.gz $(distdir); \ + mkdir -p $$tmpdir/rpm-build-top;\ + rpmbuild \ + --define "_topdir $$tmpdir/rpm-build-top" \ + --define "_sourcedir $$tmpdir/rpm-build-top" \ + --define "_specdir $$tmpdir/rpm-build-top" \ + --define "_builddir $$tmpdir/rpm-build-top" \ + --define "_srpmdir $$tmpdir/rpm-build-top" \ + --define "_rpmdir $$tmpdir/rpm-build-top" \ + --define "_rpmdir $$tmpdir/rpm-build-top" \ + -tb $(distdir).tar.gz;\ + cp -v $(distdir).tar.gz $(ARCHIVEOUTDIR)/;\ + rm -fr $$tmpdir;\ + fi diff --git a/autologin.c b/autologin.c index 31eb1f8..03e2ac3 100644 --- a/autologin.c +++ b/autologin.c @@ -116,12 +116,13 @@ init_environment(pam_handle_t *pamh, struct passwd *pwd) "/bin:/usr/bin:/usr/X11R6/bin:/sbin:/usr/sbin"; } - asprintf(&tmp, "PATH=%s", path); + tmp = malloc(5 + strlen(path) + 1); if (tmp == NULL) { fprintf(stderr, "out of memory!\n"); sleep(SLEEPYTIME); _exit(1); } + sprintf(tmp, "PATH=%s", path); putenv(tmp); /* Set any environment variables which PAM would like for us to set. */ diff --git a/autologin.spec b/autologin.spec index d770d73..52b47b2 100644 --- a/autologin.spec +++ b/autologin.spec @@ -1,14 +1,10 @@ -%define name autologin -%define version 0.02 -%define release 1 - Summary: Auto Login Utility -Name: %{name} -Version: %{version} -Release: %{release} +Name: autologin +Version: 0.02 +Release: 1 License: GPLv2 Group: Security Violations -Source: autologin.tar.gz +Source: autologin-%{version}.tar.gz BuildRoot: %{_tmppath}/%{name}-%{version}-root %description @@ -17,17 +13,14 @@ it boots. This program is normally run from /etc/inittab replacing one of your mingetty lines. This program is a huge security hole. %prep -%setup -n %{name} +%setup %build make %install - -mkdir -p $RPM_BUILD_ROOT/sbin/ -mkdir -p $RPM_BUILD_ROOT/usr/man/man8/ -install autologin $RPM_BUILD_ROOT/sbin/ -cat autologin.8 | gzip > $RPM_BUILD_ROOT/usr/man/man8/autologin.8.gz +rm -rf $RPM_BUILD_ROOT +make install DESTDIR=$RPM_BUILD_ROOT %clean rm -rf $RPM_BUILD_ROOT @@ -36,8 +29,12 @@ rm -rf $RPM_BUILD_ROOT %defattr(-,root,root) %doc README TODO %attr(711,root,root) /sbin/autologin -/usr/man/man8/autologin.8.gz +%{_mandir}/man8/autologin.8.gz %changelog +* Thu Mar 20 2008 Nalin Dahyabhai <nalin@redhat.com> +- try to clean up reliance on some non-portable functions +- set PAM's environment variables in the process environment + * Thu Mar 16 2000 Dale Lovelace <dale@redhat.com> - First RPM build |