Click Here
home features news forums classifieds faqs links search
6071 members 
Amiga Q&A /  Free for All /  Emulation /  Gaming / (Latest Posts)
Login

Nickname

Password

Lost Password?

Don't have an account yet?
Register now!

Support Amigaworld.net
Your support is needed and is appreciated as Amigaworld.net is primarily dependent upon the support of its users.
Donate

Menu
Main sections
» Home
» Features
» News
» Forums
» Classifieds
» Links
» Downloads
Extras
» OS4 Zone
» IRC Network
» AmigaWorld Radio
» Newsfeed
» Top Members
» Amiga Dealers
Information
» About Us
» FAQs
» Advertise
» Polls
» Terms of Service
» Search

IRC Channel
Server: irc.amigaworld.net
Ports: 1024,5555, 6665-6669
SSL port: 6697
Channel: #Amigaworld
Channel Policy and Guidelines

Who's Online
23 crawler(s) on-line.
 64 guest(s) on-line.
 1 member(s) on-line.


 pavlor

You are an anonymous user.
Register Now!
 pavlor:  1 min ago
 Rob:  11 mins ago
 NutsAboutAmiga:  12 mins ago
 Ratta:  47 mins ago
 DiscreetFX:  54 mins ago
 amig_os:  55 mins ago
 Hondo:  1 hr 3 mins ago
 AndreasM:  1 hr 7 mins ago
 amigakit:  1 hr 29 mins ago
 matthey:  2 hrs 3 mins ago

/  Forum Index
   /  Amiga Development
      /  How detect on OS4 (not AROS or MorphOS) from a Shell script?
Register To Post

PosterThread
ChrisH 
How detect on OS4 (not AROS or MorphOS) from a Shell script?
Posted on 7-Jan-2013 16:59:29
#1 ]
Elite Member
Joined: 30-Jan-2005
Posts: 6679
From: Unknown

As the title says, how can I detect whether a script is running on AmigaOS4 (rather than some other OS)?

I was thinking of using IF EXISTS Env:AppDir , but that doesn't seem very reliable (apart from failing on OS4.0, it would be wrong if any other OSes or user decided to create an Env:AppDir folder).

So how else could I do it?

_________________
Author of the PortablE programming language.
It is pitch black. You are likely to be eaten by a grue...

 Status: Offline
Profile     Report this post  
OlafS25 
Re: How detect on OS4 (not AROS or MorphOS) from a Shell script?
Posted on 7-Jan-2013 17:13:00
#2 ]
Elite Member
Joined: 12-May-2010
Posts: 6338
From: Unknown

@ChrisH

http://www.amigacoding.de/index.php?topic=98.msg253#msg253
http://www.amigacoding.de/index.php?topic=107.msg285#msg285

 Status: Offline
Profile     Report this post  
itix 
Re: How detect on OS4 (not AROS or MorphOS) from a Shell script?
Posted on 7-Jan-2013 17:18:03
#3 ]
Elite Member
Joined: 22-Dec-2004
Posts: 3398
From: Freedom world

@ChrisH

Version command without arguments. (I suppose it prints something like AmigaOS 4.0.)

_________________
Amiga Developer
Amiga 500, Efika, Mac Mini and PowerBook

 Status: Offline
Profile     Report this post  
ChrisH 
Re: How detect on OS4 (not AROS or MorphOS) from a Shell script?
Posted on 7-Jan-2013 17:21:38
#4 ]
Elite Member
Joined: 30-Jan-2005
Posts: 6679
From: Unknown

Unfortunately neither of those solves my problem. For the moment I'm going to use IF EXISTS Sys:Kickstart unless anyone has any better ideas...

_________________
Author of the PortablE programming language.
It is pitch black. You are likely to be eaten by a grue...

 Status: Offline
Profile     Report this post  
Boot_WB 
Re: How detect on OS4 (not AROS or MorphOS) from a Shell script?
Posted on 7-Jan-2013 17:56:39
#5 ]
Super Member
Joined: 14-Feb-2006
Posts: 1134
From: Kingston upon Hull, UK

@ChrisH

Go on, dirty up your scripts!

run >NIL: c:version >env:vertemp
search >NIL: env:vertemp PATTERN "AmigaOS 4."
if warn
skip gracefulexit
else
do funky stuff
endif

lab gracefulexit
delete env:vertemp



(Assuming version outputs Amiga OS4.#?)

Last edited by Boot_WB on 07-Jan-2013 at 05:58 PM.
Last edited by Boot_WB on 07-Jan-2013 at 05:57 PM.
Last edited by Boot_WB on 07-Jan-2013 at 05:57 PM.

_________________
Troll - n., A disenfranchised former potential customer who remains interested enough to stay informed and express critical opinions.
opp., the vast majority who voted silently with their feet.

 Status: Offline
Profile     Report this post  
ChrisH 
Re: How detect on OS4 (not AROS or MorphOS) from a Shell script?
Posted on 7-Jan-2013 18:09:06
#6 ]
Elite Member
Joined: 30-Jan-2005
Posts: 6679
From: Unknown

@Boot_WB Quote:
(Assuming version outputs Amiga OS4.#?)

No it doesn't. Also, I wasn't aware "Search" was a standard AmigaDOS 3.x command (so there seems no likelyhood it is also available on AROS & MorphOS nor works in the same way).

_________________
Author of the PortablE programming language.
It is pitch black. You are likely to be eaten by a grue...

 Status: Offline
Profile     Report this post  
Zylesea 
Re: How detect on OS4 (not AROS or MorphOS) from a Shell script?
Posted on 7-Jan-2013 18:36:17
#7 ]
Elite Member
Joined: 16-Mar-2004
Posts: 2263
From: Ostwestfalen, FRG

@ChrisH

Maybe it works the other way around. Exclude it's MorphOS (version says "MorphOS) or AROS (dunno what AROS version command says) or OS3 (Well, version below 46) and assume it must be OS4 then.

_________________
My programs: via.bckrs.de
MorphOS user since V0.4 (2001)

 Status: Offline
Profile     Report this post  
broadblues 
Re: How detect on OS4 (not AROS or MorphOS) from a Shell script?
Posted on 7-Jan-2013 18:46:42
#8 ]
Amiga Developer Team
Joined: 20-Jul-2004
Posts: 4446
From: Portsmouth England

@ChrisH

uname ?? (probably needs SDK installed)

if exist sys:kickstart ??? (or do others have a kickstart dir?)

if exist sys:kickstart/kernel.kmod


[edit]

Oh I didn't spot you allready suggest edthe sys:kickstart one yourself.

[/edit]


Last edited by broadblues on 07-Jan-2013 at 06:48 PM.

_________________
BroadBlues On Blues BroadBlues On Amiga Walker Broad

 Status: Offline
Profile     Report this post  
itix 
Re: How detect on OS4 (not AROS or MorphOS) from a Shell script?
Posted on 7-Jan-2013 18:50:07
#9 ]
Elite Member
Joined: 22-Dec-2004
Posts: 3398
From: Freedom world

@ChrisH

Search command exists in 2.x/3.x: http://winuaehelp.back2roots.org/background/amigados.htm

It also exists in AROS and MorphOS and takes similar arguments:

Quote:

Ram Disk:> version
MorphOS 3.2, Ambient 1.43, Kickstart 51.37
Ram Disk:> search ?
FROM/M,SEARCH/A,ALL/S,NONUM/S,QUIET/S,QUICK/S,FILE/S,PATTERN/S,CASE/S,LINES/N


Search command in MorphOS is from AROS and should be 99% compatible.

_________________
Amiga Developer
Amiga 500, Efika, Mac Mini and PowerBook

 Status: Offline
Profile     Report this post  
broadblues 
Re: How detect on OS4 (not AROS or MorphOS) from a Shell script?
Posted on 7-Jan-2013 19:14:04
#10 ]
Amiga Developer Team
Joined: 20-Jul-2004
Posts: 4446
From: Portsmouth England

@itix

Given that MorphOS and AROS do not have workbench per se, what happens if you test the result of

FAILAT 25
VERSION WORKBENCH VERSION 50 >NIL:
IF WARN
;Amigaos < 3.x
ENDIF

IF ERROR
; Not amiga os 4
ENDIF




Last edited by broadblues on 07-Jan-2013 at 07:24 PM.

_________________
BroadBlues On Blues BroadBlues On Amiga Walker Broad

 Status: Offline
Profile     Report this post  
broadblues 
Re: How detect on OS4 (not AROS or MorphOS) from a Shell script?
Posted on 7-Jan-2013 19:22:45
#11 ]
Amiga Developer Team
Joined: 20-Jul-2004
Posts: 4446
From: Portsmouth England

@broadblues

ASK "Are You Running AmigaOS 4.x?"

_________________
BroadBlues On Blues BroadBlues On Amiga Walker Broad

 Status: Offline
Profile     Report this post  
Boot_WB 
Re: How detect on OS4 (not AROS or MorphOS) from a Shell script?
Posted on 7-Jan-2013 19:35:18
#12 ]
Super Member
Joined: 14-Feb-2006
Posts: 1134
From: Kingston upon Hull, UK

@ChrisH

Quote:
Also, I wasn't aware "Search" was a standard AmigaDOS 3.x command (so there seems no likelyhood it is also available on AROS & MorphOS nor works in the same way


It's been in the AmigaDOS user guide since 1986.

_________________
Troll - n., A disenfranchised former potential customer who remains interested enough to stay informed and express critical opinions.
opp., the vast majority who voted silently with their feet.

 Status: Offline
Profile     Report this post  
Nibunnoichi 
Re: How detect on OS4 (not AROS or MorphOS) from a Shell script?
Posted on 7-Jan-2013 21:48:20
#13 ]
Cult Member
Joined: 18-Nov-2004
Posts: 969
From: Roma + Lecco, Italia

@ChrisH

Ignition's makefile uses the command uname ...dunno how reliable it is on MorphOS and AROS though... here it is, should you find it useful:


#############################################
# find out the HOST operating system
# on which this makefile is run
HOST ?= $(shell uname)
ifeq ($(HOST), AmigaOS)
ifeq ($(shell uname -m), powerpc)
HOST = AmigaOS4
endif
ifeq ($(shell uname -m), ppc)
HOST = AmigaOS4
endif
endif

# if no host is identifed (no uname tool)
# we assume a AmigaOS build
ifeq ($(HOST),)
HOST = AmigaOS
endif

#############################################
# now we find out the target OS for
# which we are going to compile Ignition in case
# the caller didn't yet define OS himself
ifndef (OS)
ifeq ($(HOST), AmigaOS4)
OS = os4
else
ifeq ($(HOST), AmigaOS)
OS = os3
else
ifeq ($(HOST), MorphOS)
OS = mos
else
ifeq ($(HOST), AROS)
# now we find out which CPU system aros will be used
ifeq ($(shell uname -m), powerpc)
OS = aros-ppc
endif
ifeq ($(shell uname -m), ppc)
OS = aros-ppc
endif
ifeq ($(shell uname -m), i386)
OS = aros-i386
endif
ifeq ($(shell uname -m), i686)
OS = aros-i686
endif
ifeq ($(shell uname -m), x86_64)
OS = aros-x86_64
endif
else
OS = os4
endif
endif
endif
endif
endif


edit: sorry, pasting has completely f***ed up indentatio... how can i paste code?

Last edited by Nibunnoichi on 07-Jan-2013 at 09:51 PM.

_________________
Proud Amigan since 1987
Owner of various Commodore and a SAM440ep\OS4.1FE
See them on http://retro.furinkan.org/

 Status: Offline
Profile     Report this post  

[ home ][ about us ][ privacy ] [ forums ][ classifieds ] [ links ][ news archive ] [ link to us ][ user account ]
Copyright (C) 2000 - 2019 Amigaworld.net.
Amigaworld.net was originally founded by David Doyle