From 5da727083ef1012b1e03035f2526f2c8351327ca Mon Sep 17 00:00:00 2001 From: ballen4705 <ballen4705@4ea69e1a-61f1-4043-bf83-b5c94c648137> Date: Fri, 11 Oct 2002 12:15:50 +0000 Subject: [PATCH] Automatic versioning in Makefile and executables git-svn-id: https://smartmontools.svn.sourceforge.net/svnroot/smartmontools/trunk@25 4ea69e1a-61f1-4043-bf83-b5c94c648137 --- sm5/Makefile | 51 +++++++++++++++++++++++++++++------------- sm5/VERSION | 1 + sm5/add | 8 +++++++ sm5/atacmds.h | 7 +++--- sm5/smartctl.c | 13 +++++------ sm5/smartctl.cpp | 13 +++++------ sm5/smartd.c | 14 +++++++----- sm5/smartd.cpp | 14 +++++++----- sm5/smartmontools.spec | 2 +- 9 files changed, 75 insertions(+), 48 deletions(-) create mode 100644 sm5/VERSION create mode 100755 sm5/add diff --git a/sm5/Makefile b/sm5/Makefile index e0865f9c9..d2b5fe14c 100644 --- a/sm5/Makefile +++ b/sm5/Makefile @@ -1,6 +1,6 @@ # Makefile for smartmontools # -# $Id: Makefile,v 1.9 2002/10/11 09:20:32 ballen4705 Exp $ +# $Id: Makefile,v 1.10 2002/10/11 12:15:49 ballen4705 Exp $ # # Copyright (C) 2002 Bruce Allen <smartmontools-support@lists.sourceforge.net> # @@ -17,6 +17,15 @@ CC = gcc # CFLAGS = -fsigned-char -Wall -g CFLAGS = -fsigned-char -Wall -O2 +releasefiles=atacmds.c atacmds.h ataprint.c ataprint.h CHANGELOG COPYING extern.h Makefile\ + README scsicmds.c scsicmds.h scsiprint.c scsiprint.h smartctl.8 smartctl.c smartctl.h\ + smartd.8 smartd.c smartd.h smartd.initd TODO + +counter=$(shell cat VERSION) +newcounter=$(shell ./add ) +pkgname=smartmontools-5.0 +pkgname2=$(pkgname)-$(counter) + all: smartd smartctl smartctl: atacmds.o scsicmds.o smartctl.c smartctl.h ataprint.o scsiprint.o atacmds.h ataprint.h scsicmds.h scsiprint.h @@ -37,8 +46,14 @@ atacmds.o: atacmds.h atacmds.c scsicmds.o: scsicmds.h scsicmds.c ${CC} ${CFLAGS} -c scsicmds.c +atacmds.h: VERSION + cat atacmds.h | sed '/SMARTMONTOOLS_VERSION/d' > temp.atacmds.h + echo "#define SMARTMONTOOLS_VERSION " $(counter) > temp.head + cat temp.head temp.atacmds.h > atacmds.h + rm -f temp.atacmds.h temp.head + clean: - rm -f *.o smartctl smartd *~ \#*\# smartmontools*.tar.gz smartmontools*.rpm + rm -f *.o smartctl smartd *~ \#*\# smartmontools*.tar.gz smartmontools*.rpm temp.* install: smartctl smartd smartctl.8 smartd.8 smartd.initd install -m 755 -o root -g root -D smartctl $(DESTDIR)/usr/sbin/smartctl @@ -50,27 +65,31 @@ install: smartctl smartd smartctl.8 smartd.8 smartd.initd echo "To Automatically start smartd on bootup, run /sbin/chkconfig --add smartd" uninstall: - rm -f /usr/sbin/smartctl /usr/sbin/smartd /usr/share/man/man8/smartctl.8 /usr/share/man/man8/smartd.8 /usr/share/man/man8/smartctl.8.gz /usr/share/man/man8/smartd.8.gz + rm -f /usr/sbin/smartctl /usr/sbin/smartd /usr/share/man/man8/smartctl.8 /usr/share/man/man8/smartd.8\ + /usr/share/man/man8/smartctl.8.gz /usr/share/man/man8/smartd.8.gz /sbin/chkconfig --del smartd /etc/rc.d/init.d/smartd stop rm -f /etc/rc.d/init.d/smartd -releasefiles=atacmds.c atacmds.h ataprint.c ataprint.h CHANGELOG COPYING extern.h Makefile\ - README scsicmds.c scsicmds.h scsiprint.c scsiprint.h smartctl.8 smartctl.c smartctl.h\ - smartd.8 smartd.c smartd.h smartd.initd TODO - -pkgname=smartmontools-5.0 -workdir=$(pkgname) - +# All this mess is to automatically increment the release numbers. +# The number of the next release is kept in the file "VERSION" release: $(releasefiles) - rm -rf $(workdir) - mkdir $(workdir) - cp -a $(releasefiles) $(workdir) - tar zcvf $(pkgname).tar.gz $(workdir) - rm -rf $(workdir) - cp $(pkgname).tar.gz /usr/src/redhat/SOURCES + rm -rf $(pkgname) + mkdir $(pkgname) + cp -a $(releasefiles) $(pkgname) + tar zcvf $(pkgname).tar.gz $(pkgname) + mv -f $(pkgname) $(pkgname2) + tar zcvf $(pkgname2).tar.gz $(pkgname2) + rm -rf $(pkgname2) + mv -f $(pkgname).tar.gz /usr/src/redhat/SOURCES/ + cat smartmontools.spec | sed '/Release:/d' > temp.spec + echo "Release: " $(counter) > temp.version + cat temp.version temp.spec > smartmontools.spec + rm -f temp.spec temp.version rpm -ba smartmontools.spec mv /usr/src/redhat/RPMS/i386/$(pkgname)*.rpm . mv /usr/src/redhat/SRPMS/$(pkgname)*rpm . rm -f /usr/src/redhat/SOURCES/$(pkgname).tar.gz + echo $(newcounter) > VERSION + diff --git a/sm5/VERSION b/sm5/VERSION new file mode 100644 index 000000000..d00491fd7 --- /dev/null +++ b/sm5/VERSION @@ -0,0 +1 @@ +1 diff --git a/sm5/add b/sm5/add new file mode 100755 index 000000000..7e5e77a96 --- /dev/null +++ b/sm5/add @@ -0,0 +1,8 @@ +#!/bin/bash +# +# This is a utility called in the Makefile. It's used together with +# the file "counter" to automatically increment release numbers. +# +a=`cat counter` +let a+=1 +echo $a diff --git a/sm5/atacmds.h b/sm5/atacmds.h index d7a3a06b2..5e2fcce8a 100644 --- a/sm5/atacmds.h +++ b/sm5/atacmds.h @@ -1,4 +1,5 @@ -// $Id: atacmds.h,v 1.5 2002/10/11 09:20:32 ballen4705 Exp $ +#define SMARTMONTOOLS_VERSION 2 +// $Id: atacmds.h,v 1.6 2002/10/11 12:15:49 ballen4705 Exp $ /* * atacmds.h * @@ -20,8 +21,8 @@ // These are the major and minor versions for smartd and smartctl #define PROJECTHOME "http://smartmontools.sourceforge.net/" -#define VERSION_MAJOR 5 -#define VERSION_MINOR 0 +#define RELEASE_MAJOR 5 +#define RELEASE_MINOR 0 #include <sys/ioctl.h> #include <linux/hdreg.h> diff --git a/sm5/smartctl.c b/sm5/smartctl.c index 914e69cc0..cc09bf587 100644 --- a/sm5/smartctl.c +++ b/sm5/smartctl.c @@ -1,4 +1,4 @@ -// $Id: smartctl.c,v 1.5 2002/10/11 09:20:32 ballen4705 Exp $ +// $Id: smartctl.c,v 1.6 2002/10/11 12:15:50 ballen4705 Exp $ /* * smartctl.c * @@ -57,10 +57,6 @@ unsigned char printcopyleft = FALSE; void Usage ( void){ - - printf( "smartctl version %i.%i - S.M.A.R.T. Control Program\n", - VERSION_MAJOR, VERSION_MINOR); - printf("Home page of project is " PROJECTHOME "\n\n"); printf( "usage: smartctl -[options] [device]\n"); printf( "Read Only Options:\n"); printf( "\t\t%c\t\tPrint Copyright and License information\n", @@ -218,18 +214,19 @@ int main (int argc, char **argv){ int fd; char *device; + printf("smartctl version %d.%d-%d Copyright (C) 2002 Bruce Allen\n",RELEASE_MAJOR,RELEASE_MINOR,SMARTMONTOOLS_VERSION); + printf("Home page of project is %s\n\n",PROJECTHOME); + // Part input arguments ParseOpts (argc,argv); // Print Copyright/License info if needed if (printcopyleft){ - printf("smartctl version %d.%d Copyright (C) 2002 Bruce Allen\n",VERSION_MAJOR,VERSION_MINOR); - printf("Home page of project is %s\n\n",PROJECTHOME); printf("smartctl comes with ABSOLUTELY NO WARRANTY. This\n"); printf("is free software, and you are welcome to redistribute it\n"); printf("under the terms of the GNU General Public License Version 2.\n"); printf("See http://www.gnu.org for further details.\n\n"); - printf("CVS version ID %s\n","$Id: smartctl.c,v 1.5 2002/10/11 09:20:32 ballen4705 Exp $"); + printf("CVS version ID %s\n","$Id: smartctl.c,v 1.6 2002/10/11 12:15:50 ballen4705 Exp $"); exit(0); } diff --git a/sm5/smartctl.cpp b/sm5/smartctl.cpp index ecbd9cb6f..ee8bd2c80 100644 --- a/sm5/smartctl.cpp +++ b/sm5/smartctl.cpp @@ -1,4 +1,4 @@ -// $Id: smartctl.cpp,v 1.5 2002/10/11 09:20:32 ballen4705 Exp $ +// $Id: smartctl.cpp,v 1.6 2002/10/11 12:15:50 ballen4705 Exp $ /* * smartctl.c * @@ -57,10 +57,6 @@ unsigned char printcopyleft = FALSE; void Usage ( void){ - - printf( "smartctl version %i.%i - S.M.A.R.T. Control Program\n", - VERSION_MAJOR, VERSION_MINOR); - printf("Home page of project is " PROJECTHOME "\n\n"); printf( "usage: smartctl -[options] [device]\n"); printf( "Read Only Options:\n"); printf( "\t\t%c\t\tPrint Copyright and License information\n", @@ -218,18 +214,19 @@ int main (int argc, char **argv){ int fd; char *device; + printf("smartctl version %d.%d-%d Copyright (C) 2002 Bruce Allen\n",RELEASE_MAJOR,RELEASE_MINOR,SMARTMONTOOLS_VERSION); + printf("Home page of project is %s\n\n",PROJECTHOME); + // Part input arguments ParseOpts (argc,argv); // Print Copyright/License info if needed if (printcopyleft){ - printf("smartctl version %d.%d Copyright (C) 2002 Bruce Allen\n",VERSION_MAJOR,VERSION_MINOR); - printf("Home page of project is %s\n\n",PROJECTHOME); printf("smartctl comes with ABSOLUTELY NO WARRANTY. This\n"); printf("is free software, and you are welcome to redistribute it\n"); printf("under the terms of the GNU General Public License Version 2.\n"); printf("See http://www.gnu.org for further details.\n\n"); - printf("CVS version ID %s\n","$Id: smartctl.cpp,v 1.5 2002/10/11 09:20:32 ballen4705 Exp $"); + printf("CVS version ID %s\n","$Id: smartctl.cpp,v 1.6 2002/10/11 12:15:50 ballen4705 Exp $"); exit(0); } diff --git a/sm5/smartd.c b/sm5/smartd.c index 23e54c513..57485c9a4 100644 --- a/sm5/smartd.c +++ b/sm5/smartd.c @@ -1,4 +1,4 @@ -// $Id: smartd.c,v 1.6 2002/10/11 09:20:32 ballen4705 Exp $ +// $Id: smartd.c,v 1.7 2002/10/11 12:15:50 ballen4705 Exp $ /* * smartd.c * @@ -64,8 +64,8 @@ void printout(int priority,char *fmt, ...){ /* prints help information for command syntax */ void Usage ( void){ - printout(LOG_INFO,"smartd version %i.%i - S.M.A.R.T. Daemon\n", - VERSION_MAJOR, VERSION_MINOR); + printout(LOG_INFO,"smartd version %d.%d-%d - S.M.A.R.T. Daemon\n", + RELEASE_MAJOR, RELEASE_MINOR,SMARTMONTOOLS_VERSION); printout(LOG_INFO,"usage: smartd -[opts] \n"); printout(LOG_INFO,"Read Only Commands:\n"); printout(LOG_INFO,"\t\t%c\t\tStart smartd in debug Mode\n",DEBUGMODE); @@ -264,7 +264,7 @@ char copyleftstring[]= "is free software, and you are welcome to redistribute it\n" "under the terms of the GNU General Public License Version 2.\n" "See http://www.gnu.org for further details.\n\n" -"CVS Version ID $Id: smartd.c,v 1.6 2002/10/11 09:20:32 ballen4705 Exp $\n"; +"CVS Version ID $Id: smartd.c,v 1.7 2002/10/11 12:15:50 ballen4705 Exp $\n"; const char opts[] = { DEBUGMODE, EMAILNOTIFICATION, PRINTCOPYLEFT,'\0' }; @@ -304,12 +304,14 @@ int main (int argc, char **argv){ if (printcopyleft){ debugmode=1; - printout(LOG_INFO,"smartd version %d.%d Copyright (C) Bruce Allen 2002\n",VERSION_MAJOR,VERSION_MINOR); + printout(LOG_INFO,"smartd version %d.%d-%d Copyright (C) Bruce Allen 2002\n", + RELEASE_MAJOR,RELEASE_MINOR,SMARTMONTOOLS_VERSION); printout(LOG_INFO,copyleftstring); exit(0); } - printout(LOG_INFO,"smartd version %d.%d Copyright (C) Bruce Allen 2002\n",VERSION_MAJOR,VERSION_MINOR); + printout(LOG_INFO,"smartd version %d.%d-%d Copyright (C) Bruce Allen 2002\n", + RELEASE_MAJOR,RELEASE_MINOR,SMARTMONTOOLS_VERSION); if (!debugmode){ daemon_init(); diff --git a/sm5/smartd.cpp b/sm5/smartd.cpp index 9a749fc82..78d210495 100644 --- a/sm5/smartd.cpp +++ b/sm5/smartd.cpp @@ -1,4 +1,4 @@ -// $Id: smartd.cpp,v 1.6 2002/10/11 09:20:32 ballen4705 Exp $ +// $Id: smartd.cpp,v 1.7 2002/10/11 12:15:50 ballen4705 Exp $ /* * smartd.c * @@ -64,8 +64,8 @@ void printout(int priority,char *fmt, ...){ /* prints help information for command syntax */ void Usage ( void){ - printout(LOG_INFO,"smartd version %i.%i - S.M.A.R.T. Daemon\n", - VERSION_MAJOR, VERSION_MINOR); + printout(LOG_INFO,"smartd version %d.%d-%d - S.M.A.R.T. Daemon\n", + RELEASE_MAJOR, RELEASE_MINOR,SMARTMONTOOLS_VERSION); printout(LOG_INFO,"usage: smartd -[opts] \n"); printout(LOG_INFO,"Read Only Commands:\n"); printout(LOG_INFO,"\t\t%c\t\tStart smartd in debug Mode\n",DEBUGMODE); @@ -264,7 +264,7 @@ char copyleftstring[]= "is free software, and you are welcome to redistribute it\n" "under the terms of the GNU General Public License Version 2.\n" "See http://www.gnu.org for further details.\n\n" -"CVS Version ID $Id: smartd.cpp,v 1.6 2002/10/11 09:20:32 ballen4705 Exp $\n"; +"CVS Version ID $Id: smartd.cpp,v 1.7 2002/10/11 12:15:50 ballen4705 Exp $\n"; const char opts[] = { DEBUGMODE, EMAILNOTIFICATION, PRINTCOPYLEFT,'\0' }; @@ -304,12 +304,14 @@ int main (int argc, char **argv){ if (printcopyleft){ debugmode=1; - printout(LOG_INFO,"smartd version %d.%d Copyright (C) Bruce Allen 2002\n",VERSION_MAJOR,VERSION_MINOR); + printout(LOG_INFO,"smartd version %d.%d-%d Copyright (C) Bruce Allen 2002\n", + RELEASE_MAJOR,RELEASE_MINOR,SMARTMONTOOLS_VERSION); printout(LOG_INFO,copyleftstring); exit(0); } - printout(LOG_INFO,"smartd version %d.%d Copyright (C) Bruce Allen 2002\n",VERSION_MAJOR,VERSION_MINOR); + printout(LOG_INFO,"smartd version %d.%d-%d Copyright (C) Bruce Allen 2002\n", + RELEASE_MAJOR,RELEASE_MINOR,SMARTMONTOOLS_VERSION); if (!debugmode){ daemon_init(); diff --git a/sm5/smartmontools.spec b/sm5/smartmontools.spec index 898efeb5f..91ce66921 100644 --- a/sm5/smartmontools.spec +++ b/sm5/smartmontools.spec @@ -1,7 +1,7 @@ +Release: 3 Summary: SMARTmontools - for monitoring S.M.A.R.T. disks and devices Name: smartmontools Version: 5.0 -Release: 1 License: GPL Group: Applications/System Source0: http://prdownloads.sourceforge.net/%{name}-%{version}.tar.gz -- GitLab