summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormharmsen <mharmsen@c9f7a03b-bd48-0410-a16d-cbbf54688b0b>2009-06-18 16:59:21 +0000
committermharmsen <mharmsen@c9f7a03b-bd48-0410-a16d-cbbf54688b0b>2009-06-18 16:59:21 +0000
commit6ed9ce296a7f85f855ff0eba8e4a794be4f55be5 (patch)
treebe595b5e4f622608ed17a2ec07896239c3fe4c87
parent546af162c1ad036aafc4c495aff8a895d94700b1 (diff)
Bugzilla Bug #505674 - Deprecate 'pki-manage' rpm on Linux.
git-svn-id: svn+ssh://svn.fedorahosted.org/svn/pki/trunk@627 c9f7a03b-bd48-0410-a16d-cbbf54688b0b
-rwxr-xr-xpki/base/manage/pki-install86
-rwxr-xr-xpki/base/manage/pki-uninstall101
2 files changed, 187 insertions, 0 deletions
diff --git a/pki/base/manage/pki-install b/pki/base/manage/pki-install
index ac1490a9a..d69fc24f3 100755
--- a/pki/base/manage/pki-install
+++ b/pki/base/manage/pki-install
@@ -126,6 +126,9 @@ my $ROOTUID = 0;
my $MIN_ARGS = 2;
my $MAX_ARGS = 3;
+my $YUM = "/usr/bin/yum";
+my $DOGTAG_WIKI = "http://pki.fedoraproject.org";
+
##############################################################
# Local Data Structures
@@ -879,6 +882,64 @@ sub is_Windows()
# no args
+# return 1 - true, or
+# return 0 - false
+sub is_Linux()
+{
+ if( $^O eq "linux" ) {
+ return 1;
+ }
+
+ return 0;
+}
+
+
+# no args
+# return 1 - true, or
+# return 0 - false
+sub is_Fedora()
+{
+ if( is_Linux() && (-e "/etc/fedora-release") ) {
+ return 1;
+ }
+
+ return 0;
+}
+
+
+# no args
+# return 1 - true, or
+# return 0 - false
+sub is_RHEL() {
+ if( (! is_Fedora()) && (-e "/etc/redhat-release") ) {
+ return 1;
+ }
+
+ return 0;
+}
+
+
+# no args
+# return 1 - true, or
+# return 0 - false
+sub is_RHEL4() {
+ if( is_RHEL() ) {
+ my $releasefd = new FileHandle;
+ if( $releasefd->open("< /etc/redhat-release")) {
+ my $line = "";
+ while( defined($line = <$releasefd>) ) {
+ if($line =~ /Nahant/i) {
+ return 1;
+ }
+ }
+ }
+ }
+
+ return 0;
+}
+
+
+# no args
# return 1 - success, or
# return 0 - failure
sub check_for_root_UID()
@@ -1423,6 +1484,31 @@ sub main()
{
my $result = 0;
+ # On Linux, "yum" basically renders this utility obsolete!
+ if( is_Linux ) {
+ if( is_Fedora() ) {
+ print( STDOUT
+ "\nTHIS PROGRAM IS DEPRECATED!\n\n"
+ . "Please use '$YUM' instead.\n\n"
+ . "For details regarding the PKI yum repo, please see:\n\n"
+ . " '$DOGTAG_WIKI'\n\n" );
+ print( STDOUT
+ "===============================================================================\n\n" );
+ usage();
+ } elsif( ( is_RHEL() ) && (! is_RHEL4() ) ) {
+ print( STDOUT
+ "\nTHIS PROGRAM IS DEPRECATED!\n\n"
+ . "Please use '$YUM' instead.\n\n" );
+ print( STDOUT
+ "===============================================================================\n\n" );
+ usage();
+ } else {
+ print( STDERR
+ "\nERROR: Unsupported Linux distro!\n\n" );
+ }
+ exit 255;
+ }
+
# On Linux/UNIX, insure that this script is being run as "root".
$result = check_for_root_UID();
if( !$result ) {
diff --git a/pki/base/manage/pki-uninstall b/pki/base/manage/pki-uninstall
index 7c1fb85ac..a7434c096 100755
--- a/pki/base/manage/pki-uninstall
+++ b/pki/base/manage/pki-uninstall
@@ -122,6 +122,9 @@ my $ROOTUID = 0;
my $MIN_ARGS = 1;
my $MAX_ARGS = 2;
+my $PACKAGE_CLEANUP = "/usr/bin/package-cleanup";
+my $DOGTAG_WIKI = "http://pki.fedoraproject.org";
+
##############################################################
# Local Data Structures
@@ -848,6 +851,64 @@ sub is_Windows()
# no args
+# return 1 - true, or
+# return 0 - false
+sub is_Linux()
+{
+ if( $^O eq "linux" ) {
+ return 1;
+ }
+
+ return 0;
+}
+
+
+# no args
+# return 1 - true, or
+# return 0 - false
+sub is_Fedora()
+{
+ if( is_Linux() && (-e "/etc/fedora-release") ) {
+ return 1;
+ }
+
+ return 0;
+}
+
+
+# no args
+# return 1 - true, or
+# return 0 - false
+sub is_RHEL() {
+ if( (! is_Fedora()) && (-e "/etc/redhat-release") ) {
+ return 1;
+ }
+
+ return 0;
+}
+
+
+# no args
+# return 1 - true, or
+# return 0 - false
+sub is_RHEL4() {
+ if( is_RHEL() ) {
+ my $releasefd = new FileHandle;
+ if( $releasefd->open("< /etc/redhat-release")) {
+ my $line = "";
+ while( defined($line = <$releasefd>) ) {
+ if($line =~ /Nahant/i) {
+ return 1;
+ }
+ }
+ }
+ }
+
+ return 0;
+}
+
+
+# no args
# return 1 - success, or
# return 0 - failure
sub check_for_root_UID()
@@ -1477,6 +1538,46 @@ sub main()
{
my $result = 0;
+ # On Linux, "yum-utils" basically renders this utility obsolete!
+ if( is_Linux ) {
+ if( is_Fedora() ) {
+ print( STDOUT
+ "\nTHIS PROGRAM IS DEPRECATED!\n\n" );
+ if( -x $PACKAGE_CLEANUP ) {
+ print( STDOUT
+ "Please use '$PACKAGE_CLEANUP' instead.\n\n" );
+ } else {
+ print( STDOUT
+ "Please download and install the latest 'yum-utils'\n"
+ . "RPM, and use '$PACKAGE_CLEANUP' instead.\n\n" );
+ }
+ print( STDOUT
+ "For details regarding the PKI yum repo, please see:\n\n"
+ . " '$DOGTAG_WIKI'\n\n" );
+ print( STDOUT
+ "===============================================================================\n\n" );
+ usage();
+ } elsif( ( is_RHEL() ) && (! is_RHEL4() ) ) {
+ print( STDOUT
+ "\nTHIS PROGRAM IS DEPRECATED!\n\n" );
+ if( -x $PACKAGE_CLEANUP ) {
+ print( STDOUT
+ "Please use '$PACKAGE_CLEANUP' instead.\n\n" );
+ } else {
+ print( STDOUT
+ "Please download and install the latest 'yum-utils'\n"
+ . "RPM, and use '$PACKAGE_CLEANUP' instead.\n\n" );
+ }
+ print( STDOUT
+ "===============================================================================\n\n" );
+ usage();
+ } else {
+ print( STDERR
+ "\nERROR: Unsupported Linux distro!\n\n" );
+ }
+ exit 255;
+ }
+
# On Linux/UNIX, insure that this script is being run as "root".
$result = check_for_root_UID();
if( !$result ) {