Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Fri 01 Aug 2014, 06:30
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
check kernel go to pet store
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 1 [10 Posts]  
Author Message
Lobster
Official Crustacean


Joined: 04 May 2005
Posts: 15117
Location: Paradox Realm

PostPosted: Wed 29 Sep 2010, 07:45    Post subject:  check kernel go to pet store  

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

Code:
#!/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? Rolling Eyes
Many thanks Smile

_________________
Puppy WIKI
Back to top
View user's profile Send private message Visit poster's website 
Mobeus


Joined: 26 Aug 2010
Posts: 94

PostPosted: Wed 29 Sep 2010, 09:30    Post subject:  

Hi
Are you the Lobster from 2005, or 2010? Smile
Code:
#!/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
Back to top
View user's profile Send private message 
big_bass

Joined: 13 Aug 2007
Posts: 1747

PostPosted: Wed 29 Sep 2010, 09:50    Post subject:  

Hey Lobster
this will get you closer to what you want



Code:
#!/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

_________________
debian wheezy ,linux mint, slackware I use them all and they all have good points
Mint would be best for general users though
Back to top
View user's profile Send private message 
Lobster
Official Crustacean


Joined: 04 May 2005
Posts: 15117
Location: Paradox Realm

PostPosted: Wed 29 Sep 2010, 12:14    Post subject:  

Thanks Joe - will look at that Smile

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 WIKI
Back to top
View user's profile Send private message Visit poster's website 
Mobeus


Joined: 26 Aug 2010
Posts: 94

PostPosted: Wed 29 Sep 2010, 12:21    Post subject:  

Shocked and here I thought your answer would be.. I'm from "over there" or "that way" Laughing
Back to top
View user's profile Send private message 
big_bass

Joined: 13 Aug 2007
Posts: 1747

PostPosted: Wed 29 Sep 2010, 12:55    Post subject:  

Hey Lobster

Quote:
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:
#!/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

_________________
debian wheezy ,linux mint, slackware I use them all and they all have good points
Mint would be best for general users though
Back to top
View user's profile Send private message 
technosaurus


Joined: 18 May 2008
Posts: 4292

PostPosted: Wed 29 Sep 2010, 13:27    Post subject:  

I have the snippet you are looking for in my zdrv cutter... just need to dig it up.
_________________
Web Programming - Pet Packaging 100 & 101
Back to top
View user's profile Send private message 
Lobster
Official Crustacean


Joined: 04 May 2005
Posts: 15117
Location: Paradox Realm

PostPosted: Wed 29 Sep 2010, 13:46    Post subject:  

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


Code:
#!/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 WIKI
Back to top
View user's profile Send private message Visit poster's website 
big_bass

Joined: 13 Aug 2007
Posts: 1747

PostPosted: Thu 30 Sep 2010, 11:58    Post subject:  

Lobster
Quote:

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:


 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:
#!/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

_________________
debian wheezy ,linux mint, slackware I use them all and they all have good points
Mint would be best for general users though
Back to top
View user's profile Send private message 
01micko


Joined: 11 Oct 2008
Posts: 7785
Location: qld

PostPosted: Thu 30 Sep 2010, 16:39    Post subject:  

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:
#!/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... Laughing

Cheers

edit: ok.. home from work, ran code fixed errors.. Laughing

_________________
Woof Mailing List | keep the faith Cool |
Back to top
View user's profile Send private message Visit poster's website 
Display posts from previous:   Sort by:   
Page 1 of 1 [10 Posts]  
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Off-Topic Area » Programming
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0870s ][ Queries: 12 (0.0037s) ][ GZIP on ]