Page 1 of 1
check kernel go to pet store
Posted: Wed 29 Sep 2010, 11:45
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?
Many thanks
Posted: Wed 29 Sep 2010, 13:30
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
Posted: Wed 29 Sep 2010, 13:50
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
Posted: Wed 29 Sep 2010, 16:14
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?
Posted: Wed 29 Sep 2010, 16:21
by Mobeus
and here I thought your answer would be.. I'm from "over there" or "that way"
Posted: Wed 29 Sep 2010, 16:55
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
Posted: Wed 29 Sep 2010, 17:27
by technosaurus
I have the snippet you are looking for in my zdrv cutter... just need to dig it up.
Posted: Wed 29 Sep 2010, 17:46
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
Posted: Thu 30 Sep 2010, 15:58
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
Posted: Thu 30 Sep 2010, 20:39
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...
Cheers
edit: ok.. home from work, ran code fixed errors..