check kernel go to pet store

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Post Reply
Message
Author
User avatar
Lobster
Official Crustacean
Posts: 15522
Joined: Wed 04 May 2005, 06:06
Location: Paradox Realm
Contact:

check kernel go to pet store

#1 Post by Lobster »

Here is the plan
run shell to find kernel and go to required Puppy pet store
Sadly my code skills amount to:

Code: Select all

#!/bin/sh
# Lobster ver 0.1 Sept 2010 
# check kernel and go to pet repository 

kernel_version=`rxvt -e uname -r`

if [ $kernel_version = "2.6.33.1" ]
 then
   defaultbrowser http://distro.ibiblio.org/pub/linux/distributions/quirky/
fi
What am I doing wrong? :roll:
Many thanks :)
Puppy Raspup 8.2Final 8)
Puppy Links Page http://www.smokey01.com/bruceb/puppy.html :D

User avatar
Mobeus
Posts: 94
Joined: Thu 26 Aug 2010, 15:49

#2 Post by Mobeus »

Hi
Are you the Lobster from 2005, or 2010? :)

Code: Select all

#!/bin/sh
# Lobster ver 0.1 Sept 2010
# check kernel and go to pet repository

kernel_version=`uname -r`

if [ $kernel_version = "2.6.33.1" ]
 then
   defaultbrowser http://distro.ibiblio.org/pub/linux/distributions/quirky/
fi 
Mobeus

big_bass
Posts: 1740
Joined: Mon 13 Aug 2007, 12:21

#3 Post by big_bass »

Hey Lobster
this will get you closer to what you want


Code: Select all

#!/bin/bash

# big_bass  9-23-2010
# simple  condition test  using yaf-splash
# preset  kernel value to the correct value

 KERNEL_VER=(`uname -r`)

yaf-splash -font "8x16" -outline 0 -margin 4  -fg black -text " string test The kernel used is  --->  "$KERNEL_VER"" &

clear
 
 
 if [[ $KERNEL_VER = "2.6.33.1" ]]; then
               echo " the condition is true  --->  $KERNEL_VER "   
               #do something here  
 

 elif ! [[ $KERNEL_VER = "2.6.33.1" ]]; then
               echo " the condition is false  --->  try plan b   "
               # do plan b here 
 fi

User avatar
Lobster
Official Crustacean
Posts: 15522
Joined: Wed 04 May 2005, 06:06
Location: Paradox Realm
Contact:

#4 Post by Lobster »

Thanks Joe - will look at that :)

Mobeus, there is a zen saying
'No one steps into the same river twice'

It means that the stream of the river and the stream of time
is constantly changing

So the answer to your question is no
- even though most people would say yes
However I prefer to answer in a completely different way . . .

. . . what was the question again?
Puppy Raspup 8.2Final 8)
Puppy Links Page http://www.smokey01.com/bruceb/puppy.html :D

User avatar
Mobeus
Posts: 94
Joined: Thu 26 Aug 2010, 15:49

#5 Post by Mobeus »

:shock: and here I thought your answer would be.. I'm from "over there" or "that way" :lol:

big_bass
Posts: 1740
Joined: Mon 13 Aug 2007, 12:21

#6 Post by big_bass »

Hey Lobster
what was the question again?
I thought it was hey I want to do something like this
but for some strange reason it is not cooperating
I bet there must be a hundred other ways to do this
anyone want to give it a try?

Joe

Code: Select all

#!/bin/bash

# big_bass  9-23-2010
# simple  condition test  using Xdialog
# preset  kernel value to the correct value

 KERNEL_VER=(`uname -r`)


Xdialog --title "string check " \
        	     --infobox "\n string check The kernel version is  $KERNEL_VER\n" 0 0 4000

 
 
 if [[ $KERNEL_VER = "2.6.33.1" ]]; then
               echo " the condition is true  --->  $KERNEL_VER "   
               Xdialog --title "true " \
               --infobox "\n The kernel version is  $KERNEL_VER\n" 0 0 4000
               #do something here 
 

 elif ! [[ $KERNEL_VER = "2.6.33.1" ]]; then
               echo " the condition is false  --->  try plan b   "
               Xdialog --title "false " \
               --infobox "\n you need the 2.6.33.3 ! this is what you have -->  $KERNEL_VER\n" 0 0 4000
               # do plan b here
 fi

User avatar
technosaurus
Posts: 4853
Joined: Mon 19 May 2008, 01:24
Location: Blue Springs, MO
Contact:

#7 Post by technosaurus »

I have the snippet you are looking for in my zdrv cutter... just need to dig it up.
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].

User avatar
Lobster
Official Crustacean
Posts: 15522
Joined: Wed 04 May 2005, 06:06
Location: Paradox Realm
Contact:

#8 Post by Lobster »

Thanks guys - have set this up for quirky 1.3
What would it be for your Puppy kernel if different?

Code: Select all

#!/bin/sh
# Lobster, BigBass ver 0.2 Sept 2010 
# check kernel and go to pet repository 

kernel_version=(`uname -r`)

if [[ $kernel_version = "2.6.33.2" ]]; then
   defaultbrowser http://distro.ibiblio.org/pub/linux/distributions/quirky/ &
    echo " the condition is true  --->  try plan b   "
 elif ! [[ $kernel_version = "2.6.33.2" ]]; then
               echo " the condition is false  --->  try plan b   "
               Xdialog --title "false " \
               --infobox "\n you need the 2.6.33.3 ! this is what you have -->  $KERNEL_VER\n" 0 0 4000
               # do plan b here
fi
Puppy Raspup 8.2Final 8)
Puppy Links Page http://www.smokey01.com/bruceb/puppy.html :D

big_bass
Posts: 1740
Joined: Mon 13 Aug 2007, 12:21

#9 Post by big_bass »

Lobster
What would it be for your Puppy kernel if different?
just add another else if but positive "elif" without the "!"

using the above code with this edit to see what changed and where <snip>

Code: Select all


 elif [[ $KERNEL_VER = "2.6.27.7" ]]; then
               echo " the condition is true  --->  $KERNEL_VER "   
               Xdialog --title "true " \
               --infobox "\n You are using TXZ_PUP. The kernel version is  $KERNEL_VER\n" 0 0 4000
               #do something here
               defaultbrowser  http://www.puppy2.org/slaxer/
 

Code: Select all

#!/bin/bash

# big_bass  9-30-2010
# simple  condition test  using Xdialog
# preset  kernel value to the correct value

 KERNEL_VER=(`uname -r`)


Xdialog --title "string check " \
                --infobox "\n string check The kernel version is  $KERNEL_VER\n" 0 0 4000

 

 if [[ $KERNEL_VER = "2.6.33.1" ]]; then
               echo " the condition is true  --->  $KERNEL_VER "   
               Xdialog --title "true " \
               --infobox "\n The kernel version is  $KERNEL_VER\n" 0 0 4000
               #do something here
 
 
 
 
 
 elif [[ $KERNEL_VER = "2.6.27.7" ]]; then
               echo " the condition is true  --->  $KERNEL_VER "   
               Xdialog --title "true " \
               --infobox "\n You are using TXZ_PUP. The kernel version is  $KERNEL_VER\n" 0 0 4000
               #do something here
               defaultbrowser  http://www.puppy2.org/slaxer/
 
 
 
 
 elif ! [[ $KERNEL_VER = "2.6.33.1" ]]; then
               echo " the condition is false  --->  try plan b   "
               Xdialog --title "false " \
               --infobox "\n you need the 2.6.33.3 or the 2.6.27.7 ! this is what you have -->  $KERNEL_VER\n" 0 0 4000
               # do plan b here
 fi

User avatar
01micko
Posts: 8741
Joined: Sat 11 Oct 2008, 13:39
Location: qld
Contact:

#10 Post by 01micko »

Lobster et al

It may be better to go on puppy version.. take a look at this code (it has the capabilty to test for kernel ver too, and of course can be added as a function to be used in any or all of the cases)

Code: Select all

#!/bin/sh
#for a generic version of lobster's program maybe we need 3 checks
#first we see if it is woof built
[ -f /etc/DISTRO_SPECS ]&&. /etc/DISTRO_SPECS 2>/dev/null   #if the puppy is NOT woof built error is suppressed

case $DISTRO_FILE_PREFIX in
qrky|qret)
   echo "you have quirky"
   # whatever quirky repo code you want goes here
   ;;
wary)
   echo "you have wary"
   # wary5 repo code
        ;;
lupu|luci|luma|upup)
        echo "you have lupu or upup" #maybe more filtering needed here
       #lupu or whatever repo code here
   ;;
dpup|spup)
   if [[ $DISTRO_FILE_PREFIX = "dpup" ]];then
    echo "you have dpup"
    # puppy5 repo code
     else echo "you have spup"
    # puppy5 repo code
   fi
   ;;
pup|ppup)
   echo "you have puppy"
   # puppy4 repo code
   ;;
apup)
	echo "you have apup"
   # arch puppy repo code
   ;;
*)  #Now we cover non woof pups
PUPPYVER=`cat /etc/puppyversion`
     case $PUPPYVER in
      412|411|410|420|421|450) 
      echo "you have older puppy4" #ok, now we use the kernel version stuff to distinguish if we have slaxer or TXZ
      #something like big_bass kernel filter goes here
      ;;
      300|301)
      echo "you have older puppy3"
      #puppy 3 repo
      ;;
      214|217|215|218)
      echo "you have puppy2" #other 2 series go here
         #and respective repos go here, maybe some filtering for ttuuxxx 214X and a special repo for that
      ;;
      *)
       echo "Bow wow! You do have a rather old Puppy!"
       # ok, might have missed some, but they are probably old
       ;;
      esac ## end of sub case
    ;;
esac ## end of woof case
     
      
NOTE: I didn't run this code, I just hacked it out, off to work now.. ho hum... :lol:

Cheers

edit: ok.. home from work, ran code fixed errors.. :lol:
Puppy Linux Blog - contact me for access

Post Reply