#!/bin/bash # # On our build system we have ntpdate set with the run-as-root bit set # (ie: chmod 4755 /usr/sbin/ntpdate) so that anyone can sync the time # though you probably wouldn't do this on any old server. If you need # root privs to run ntpdate then "sudo" it below instead. # # This script uses SCP to copy the tarball and the resulting package # to the server ACER64DEBIAN. Remember to set up a key pair so that # you do not need to enter a password all the time... # cd ~/.ssh # ssh-keygen -b 1024 -t dsa -f id_dsa -P '' # touch authorized_keys2 # cat id_dsa.pub >> authorized_keys2 # chmod 400 id_dsa # scp authorized_keys2 acer64debian:~/.ssh/ # MYHOST=acer64debian # Set the current date/time #echo "Enter the root password so I can sync the local clock" > /dev/stderr #sudo /usr/sbin/ntpdate au.pool.ntp.org /usr/sbin/ntpdate au.pool.ntp.org echo "If prompted enter the password for $MYHOST so I can get the file 'release'" > /dev/stderr scp $MYHOST:cvs/release . VERSION=`cat release` echo "If promoted enter the password for $MYHOST so I can get the file 'cvsnt-$VERSION.tar.gz'" > /dev/stderr scp $MYHOST:cvs/cvsnt-$VERSION.tar.gz . tar xzf cvsnt-$VERSION.tar.gz cvsnt-$VERSION/sles/cvsnt.spec.in rm -rf cvsnt.spec if [ -f cvsnt.spec ]; then echo "cannot remove old local spec"; exit 1; fi sed "s/@VERSION@/$VERSION/" cvsnt.spec if [ ! -f cvsnt.spec ]; then echo "cannot create new local spec"; exit 1; fi rm -rf cvsnt-$VERSION # sudo cp cvsnt.spec /usr/src/packages/SPECS rm -rf /usr/src/packages/SPECS/cvsnt.spec if [ -f /usr/src/packages/SPECS/cvsnt.spec ]; then echo "cannot remove old spec"; exit 1; fi cp cvsnt.spec /usr/src/packages/SPECS if [ ! -f /usr/src/packages/SPECS/cvsnt.spec ]; then echo "cannot copy new spec"; exit 1; fi # sudo mv cvsnt-$VERSION.tar.gz /usr/src/packages/SOURCES mv cvsnt-$VERSION.tar.gz /usr/src/packages/SOURCES echo "Enter the root password so I can begin rpmbuild" > /dev/stderr # sudo rpmbuild -bb /usr/src/packages/SPECS/cvsnt.spec rpmbuild -bb /usr/src/packages/SPECS/cvsnt.spec mkdir rpm rm rpm/* cp /usr/src/packages/RPMS/x86_64/cvsnt-$VERSION-1.x86_64.rpm rpm cp /usr/src/packages/RPMS/x86_64/cvsnt-database-*-$VERSION-1.x86_64.rpm rpm cp /usr/src/packages/RPMS/x86_64/cvsnt-protocol-*-$VERSION-1.x86_64.rpm rpm ( cd rpm; tar czf ../cvsnt-$VERSION-sl9-rpm.tar.gz * ) echo "If prompted enter the password for $MYHOST so I can put the file 'cvsnt-$VERSION-sl9-rpm.tar.gz'" > /dev/stderr scp cvsnt-$VERSION-sl9-rpm.tar.gz $MYHOST:cvs