# Revision history [back]

Try which rpm and which gdebi to determine the type of installation. For example:

# !/bin/bash

if which rpm > /dev/null 2> /dev/null then echo This is an rpm system else echo This is a debian system fi

Unfortunately, all scripts have issues and so does this one. If you have a file named 'rpm' named in any of the directories in $PATH, this script will fail. If anyone has an idea to improve this, you are most welcome. :) HTH, James Try which rpm and which gdebi to determine the type of installation. For example: # !/bin/bash #!/bin/bash if which rpm > /dev/null 2> /dev/null then echo This is an rpm system else echo This is a debian system fifi  Unfortunately, all scripts have issues and so does this one. If you have a file named 'rpm' named in any of the directories in$PATH, this script will fail. If anyone has an idea to improve this, you are most welcome. :)

HTH, James

Try which rpm and which gdebi to determine the type of installation. For example:

#!/bin/bash

if which rpm > /dev/null 2> /dev/null
then echo This is an rpm system
else echo This is a debian system
fi


If you are looking for a C alternative, here:

#include <stdio.h>
#include <stdlib.h>

int main( int argc, char *argv[] )
{

FILE *fp;
int status;
char path[1035];

/* Open the command for reading. */
fp = popen("/usr/bin/which rpm", "r");
if (fp == NULL) {
printf("This is a debian system\n" );
exit;
}
else{
printf("This is an rpm system\n");
exit;
}

return 0;
}


Unfortunately, all scripts have issues and so does this one. do these. If you have a file named 'rpm' named in any of the directories in $PATH, this the first script will fail. In the second one, which is needed for it to work (it should be there, though). On both my Ubuntu and Fedora, these work and compile fine. If anyone has an idea to improve this, you are most welcome. :) HTH, James Try which rpm and which gdebi to determine the type of installation. For example: #!/bin/bash if which rpm gdebi > /dev/null 2> /dev/null then echo This is an rpm debian system else echo This is a debian rpm system fi  If you are looking for a C alternative, here: #include <stdio.h> #include <stdlib.h> int main( int argc, char *argv[] ) { FILE *fp; int status; char path[1035]; /* Open the command for reading. */ fp = popen("/usr/bin/which rpm", gdebi", "r"); if (fp == NULL) { printf("This is a debian system\n" ); exit; } else{ printf("This is an rpm system\n"); exit; } return 0; }  Unfortunately, all scripts have issues EDIT: I don't think gdebi can be installed for Fedora and so do these. If RPM based distros. So, if you have a file named 'rpm' named in any of the directories in$PATH, the first script will fail. In the second one, which is needed for it to work (it should be there, though). On both my Ubuntu and Fedora, these work and compile fine. If anyone has an idea to improve this, gdebi, you are most welcome. :)have .deb.

HTH, James

Try which rpm and which gdebi to determine the type of installation. For example:

#!/bin/bash

if which gdebi > /dev/null 2> /dev/null
then echo This is an debian system
else echo This is a rpm system
fi


If you are looking for a C alternative, here:

#include <stdio.h>
#include <stdlib.h>

int main( int argc, char *argv[] )
{

FILE *fp;
int status;
char path[1035];

/* Open the command for reading. */
fp = popen("/usr/bin/which gdebi", "r");
if (fp == NULL) {
printf("This is a debian rpm system\n" );
exit;
}
else{
printf("This is an rpm debian system\n");
exit;
}

return 0;
}


EDIT: I don't think gdebi can be installed for Fedora and RPM based distros. So, if you have gdebi, you have .deb.