Skip to content

Commit

Permalink
Added a sample CD-ROM layout
Browse files Browse the repository at this point in the history
  • Loading branch information
Sam Lantinga committed Sep 11, 1999
1 parent 4909728 commit 0f7a2a5
Show file tree
Hide file tree
Showing 11 changed files with 240 additions and 11 deletions.
38 changes: 30 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,16 +1,38 @@

arch := $(shell ./print_arch)
libc := $(shell ./print_libc)

CC = gcc
X11DIR = /usr/X11R6
CFLAGS = -g -I/usr/lib/glib/include -I$(X11DIR)/include
OBJS = main.o console_ui.o install.o detect.o copy.o file.o log.o install_log.o gtk_ui.o
LIBS = -lxml -lz -lgtk -lgdk -L$(X11DIR)/lib -lX11

all: testxml setup
OPTIMIZE = -g -O2 -funroll-loops
HEADERS = -I/usr/lib/glib/include -I/usr/X11R6/include
OPTIONS = -DSTUB_UI
CFLAGS += $(OPTIMIZE) $(HEADERS) $(OPTIONS)

OBJS = main.o install.o detect.o copy.o file.o log.o install_log.o
CONSOLE_OBJS = $(OBJS) console_ui.o
GUI_OBJS = $(OBJS) gtk_ui.o

LIBS = -Wl,-Bstatic -lxml -lz
CONSOLE_LIBS = $(LIBS)
GUI_LIBS = $(LIBS) -Wl,-Bdynamic -lgtk -lgdk

all: setup setup.gtk

testxml: testxml.o
$(CC) -o $@ $^ $(LIBS)

setup: $(OBJS)
$(CC) -o $@ $^ $(LIBS)
setup: $(CONSOLE_OBJS)
$(CC) -o $@ $^ $(CONSOLE_LIBS) -static

setup.gtk: $(GUI_OBJS)
$(CC) -o $@ $^ $(GUI_LIBS)

install: all
strip setup
cp -v setup image/setup.data/bin/$(arch)
strip setup.gtk
cp -v setup.gtk image/setup.data/bin/$(arch)/$(libc)

clean:
rm -f setup testxml foo.xml *.o
rm -f setup setup.gtk testxml foo.xml *.o
11 changes: 11 additions & 0 deletions autorun.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/* Simple AUTORUN.EXE file to display a README file */

#include <windows.h>

/* This is where execution begins [windowed apps] */
int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR szCmdLine, int sw)
{
ShellExecute(GetDesktopWindow(), "open", "win32\\README.htm",
NULL, NULL, SW_SHOWNORMAL);
return(TRUE);
}
7 changes: 7 additions & 0 deletions console_ui.c
Original file line number Diff line number Diff line change
Expand Up @@ -207,3 +207,10 @@ int console_okay(Install_UI *UI)

return(1);
}

#ifdef STUB_UI
int gtkui_okay(Install_UI *UI)
{
return(0);
}
#endif
12 changes: 9 additions & 3 deletions gtk_ui.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* GTK-based UI
$Id: gtk_ui.c,v 1.5 1999-09-10 11:26:30 hercules Exp $
$Id: gtk_ui.c,v 1.6 1999-09-11 00:55:40 hercules Exp $
*/

#include <limits.h>
Expand All @@ -12,7 +12,6 @@
#include "install.h"
#include "install_ui.h"
#include "detect.h"
#include "loki_logo.xpm"

/* Globals */

Expand Down Expand Up @@ -907,7 +906,7 @@ static install_state gtkui_init(install_info *info, int argc, char **argv)
_window = gtk_window_new( GTK_WINDOW_TOPLEVEL );
sprintf(tmpbuf,"%s Setup", info->desc);
gtk_window_set_title( GTK_WINDOW(_window), tmpbuf);
gtk_window_set_policy( GTK_WINDOW(_window), 0, 0, 1 );
gtk_window_set_policy( GTK_WINDOW(_window), TRUE, TRUE, TRUE );
gtk_container_set_border_width( GTK_CONTAINER(_window), 20 );
gtk_signal_connect( GTK_OBJECT(_window), "destroy",
GTK_SIGNAL_FUNC(slot_abortInstall), NULL );
Expand Down Expand Up @@ -1008,3 +1007,10 @@ int gtkui_okay(Install_UI *UI)
return(0);
}
}

#ifdef STUB_UI
int console_okay(Install_UI *UI)
{
return(0);
}
#endif
3 changes: 3 additions & 0 deletions image/autorun.inf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[autorun]
open = win32\autorun.exe
icon = icon.bmp
File renamed without changes.
104 changes: 104 additions & 0 deletions image/setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
#!/bin/sh
#
# Product setup script - Loki Entertainment Software

# Go to the proper setup directory (if not already there)
cd `dirname $0`

# Return the appropriate architecture string
function DetectARCH {
status=1
case `uname -m` in
i?86) echo "x86"
status=0;;
ppc) echo "ppc"
status=0;;
alpha) echo "alpha"
status=0;;
*) echo "unknown";;
esac
return $status
}

# Return the appropriate version string
function DetectLIBC {
status=1
if [ -f /lib/libc.so.6 ]; then
if fgrep GLIBC_2.1 /lib/libc.so.6 2>&1 >/dev/null; then
echo "glibc-2.1"
status=0
else
echo "glibc-2.0"
status=0
fi
elif [ -f /lib/libc.so.5 ]; then
echo "libc5"
status=0
else
echo "unknown"
fi
return $status
}

# Detect the Linux environment
arch=`DetectARCH`
libc=`DetectLIBC`

# Find the installation program
function try_run
{
setup=$1
shift
fatal=$1
if [ "$1" != "" ]; then
shift
fi

# First find the binary we want to run
failed=0
setup_bin="setup.data/bin/$arch/$libc/$setup"
if [ ! -f "$setup_bin" ]; then
setup_bin="setup.data/bin/$arch/$setup"
if [ ! -f "$setup_bin" ]; then
failed=1
fi
fi
if [ "$failed" -eq 1 ]; then
if [ "$fatal" != "" ]; then
cat <<__EOF__
This installation doesn't support $libc on $arch
Please contact Loki Technical Support at [email protected]
__EOF__
exit 1
fi
return $failed
fi

# Try to run the binary
# The executable is here but we can't execute it from CD
setup="$HOME/.setup$$"
cp "$setup_bin" "$setup"
chmod 700 "$setup"
if [ "$fatal" != "" ]; then
"$setup" $*
failed=$?
else
"$setup" $* 2>/dev/null
failed=$?
fi
rm -f "$setup"
return $failed
}


# Try to run the setup program
status=0
rm -f "$setup"
if ! try_run setup.gtk && ! try_run setup -fatal; then
echo "The setup program seems to have failed on $arch/$libc"
echo
echo "Please contact Loki Technical Support at [email protected]"
status=1
fi
exit $status
33 changes: 33 additions & 0 deletions image/win32/README.htm
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<HTML>
<HEAD>
<TITLE>Welcome to Linux!</TITLE>
</HEAD>

<BODY BGCOLOR="#FFFFFF" LINK="#FF0000">
<H1>Welcome To Linux!</H1>

<P>
You have just bought a game that was specially written for Linux, a free
operating system written by thousands of people all over the world.
</P>

<P>
If you already have Linux installed, please reboot into it, mount your
CD-ROM with the <EM>mount</EM> command (e.g. <B>mount /mnt/cdrom</B>)
and then read the README file for instructions on installing this game.
</P>

<P>
If you don't yet have Linux, you can buy it from your favorite software reseller or download it for
free. You can find out more about Linux and where you can download it at
<A HREF="http://www.linux.org/">http://www.linux.org/</A>.
</P>

<P>
Thank you for supporting Linux, games, and free software!
</P>
- <A HREF="http://www.lokigames.com/">Loki Entertainment Software</A>

</BODY>
</HTML>

Binary file added image/win32/autorun.exe
Binary file not shown.
19 changes: 19 additions & 0 deletions print_arch
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/sh

# Return the appropriate architecture string
function DetectARCH {
status=1
case `uname -m` in
i?86) echo "x86"
status=0;;
ppc) echo "ppc"
status=0;;
alpha) echo "alpha"
status=0;;
*) echo "unknown";;
esac
return $status
}

# Detect the Linux environment
DetectARCH
24 changes: 24 additions & 0 deletions print_libc
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/sh

# Return the appropriate version string
function DetectLIBC {
status=1
if [ -f /lib/libc.so.6 ]; then
if fgrep GLIBC_2.1 /lib/libc.so.6 2>&1 >/dev/null; then
echo "glibc-2.1"
status=0
else
echo "glibc-2.0"
status=0
fi
elif [ -f /lib/libc.so.5 ]; then
echo "libc5"
status=0
else
echo "unknown"
fi
return $status
}

# Detect the Linux environment
DetectLIBC

0 comments on commit 0f7a2a5

Please sign in to comment.