Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/perl
- check_config_file();
- exit 0;
- sub check_config_file {
- $filename = '/etc/lhg-tools.conf';
- if (-e $filename) {
- # file exists, read configuration
- $uid = get_conf_value("ANONYMOUS_USER_ID");
- $umail = get_conf_value("USER_EMAIL");
- }else {
- print "No HW Scan executed so far. \n";
- print "This normally should happen only during installation. \n";
- print "Please execute: sudo /usr/bin/lhg-service \n";
- exit 2;
- }
- # load web page with scan results
- if (`which sensible-browser 2>/dev/null`) {
- system "`which sensible-browser` http://www.linux-hardware-guide.com/hardware-profile/uid-$uid";
- # added blackPanther OS specified item
- }elsif (`which default-browser 2>/dev/null`) {
- system "`which default-browser` http://www.linux-hardware-guide.com/hardware-profile/uid-$uid";
- }elsif (`which xdg-open 2>/dev/null`) {
- system "`which xdg-open` http://www.linux-hardware-guide.com/hardware-profile/uid-$uid";
- }elsif (`which firefox 2>/dev/null`) {
- system "`which firefox` --new-tab http://www.linux-hardware-guide.com/hardware-profile/uid-$uid";
- }elsif (`which chromium-browser 2>/dev/null`) {
- system "`which chromium-browser` --app=http://www.linux-hardware-guide.com/hardware-profile/uid-$uid";
- } else {
- print "\nExiting...Missing a known browser! Please install one..\n\n";
- }
- }
- sub get_conf_value {
- my $confstrg = shift;
- my $confstrgl = length($confstrg);
- my $confvalue;
- open FILE, "/etc/lhg-tools.conf";
- while (<FILE>) {
- #print "S: $_ ";
- if ( substr($_,0,$confstrgl) eq $confstrg) {
- #print $_;
- $confvalue = $_;
- $confvalue =~ s/$confstrg//;
- $confvalue =~ s/=//;
- $confvalue =~ s/ //g;
- $confvalue =~ s/(\r)|(\n)//g;
- }
- }
- close FILE;
- #print "Val: $confvalue";
- return $confvalue;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement