Skip to content

Commit

Permalink
Stéphane Peter - Tue Jul 25 19:49:06 PDT 2000
Browse files Browse the repository at this point in the history
 * Rewrote the extractor backend to use a plugin subsystem. Plugins can
   either be compiled in or used as shared library objects (.so files).
Ryan C. Gordon - Wed Jul 26 16:10:29 PDT 2000
 * Added plugin for the Outrage PKG format.
Stéphane Peter - Thu Jul 27 14:02:27 PDT 2000
 * Added new 'nobinaries' tag for the product element, so that installations
   that don't install new binaries won't prompt the user for a path.
Stéphane Peter - Fri Jul 28 18:39:28 PDT 2000
 * Added new 'required' attribute for the 'option' element, for options that
   have to be always installed.
  • Loading branch information
megastep committed Jul 31, 2000
1 parent 056d773 commit 8f6eb8b
Show file tree
Hide file tree
Showing 41 changed files with 3,520 additions and 1,879 deletions.
13 changes: 12 additions & 1 deletion CHANGES
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
1.3.1:
1.4.0:
St�phane Peter - Tue Jul 25 19:49:06 PDT 2000
* Rewrote the extractor backend to use a plugin subsystem. Plugins can
either be compiled in or used as shared library objects (.so files).
Ryan C. Gordon - Wed Jul 26 16:10:29 PDT 2000
* Added plugin for the Outrage PKG format.
St�phane Peter - Thu Jul 27 14:02:27 PDT 2000
* Added new 'nobinaries' tag for the product element, so that installations
that don't install new binaries won't prompt the user for a path.
St�phane Peter - Fri Jul 28 18:39:28 PDT 2000
* Added new 'required' attribute for the 'option' element, for options that
have to be always installed.
St�phane Peter - Tue Jun 13 19:30:42 PDT 2000
* Added new 'splash' attribute to specify alternate splash image.
* Added support for meta-installations.
Expand Down
31 changes: 25 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@

DISTDIR = ..
PACKAGE = setup-1.0
PACKAGE = setup-1.3

arch := $(shell ./print_arch)
libc := $(shell ./print_libc)
#USE_RPM = true
# USE_RPM = true
# DYN_PLUGINS = true

CC = gcc

Expand All @@ -21,23 +22,31 @@ OPTIONS = -DSTUB_UI
ifeq ($(USE_RPM),true)
OPTIONS += -DRPM_SUPPORT
endif
ifeq ($(DYN_PLUGINS),true)
OPTIONS += -DDYNAMIC_PLUGINS
endif

CFLAGS += $(OPTIMIZE) $(HEADERS) $(OPTIONS)

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

SRCS = $(OBJS:.o=.c) $(CONSOLE_OBJS:.o=.c) $(GUI_OBJS:.o=.c)

LIBS = `xml-config --prefix`/lib/libxml.a -lz
LIBS = plugins/libplugins.a `xml-config --prefix`/lib/libxml.a -lz

ifeq ($(USE_RPM),true)
LIBS += -lrpm -ldb
endif
ifeq ($(DYN_PLUGINS),true)
LIBS += -ldl
endif

CONSOLE_LIBS = $(LIBS)
GUI_LIBS = $(LIBS) -Wl,-Bdynamic $(shell gtk-config --libs) $(shell libglade-config --prefix)/lib/libglade.a -rdynamic

all: setup setup.gtk
all: do-plugins setup setup.gtk

testxml: testxml.o
$(CC) -o $@ $^ $(LIBS)
Expand All @@ -48,13 +57,22 @@ setup: $(CONSOLE_OBJS)
setup.gtk: $(GUI_OBJS)
$(CC) -o $@ $^ $(GUI_LIBS)

do-plugins:
$(MAKE) -C plugins DYN_PLUGINS=$(DYN_PLUGINS) USE_RPM=$(USE_RPM) all

install.dbg: all
ifeq ($(DYN_PLUGINS),true)
$(MAKE) -C plugins DYN_PLUGINS=true USE_RPM=$(USE_RPM) install.dbg
endif
@if [ -d image/setup.data/bin/$(arch)/$(libc) ]; then \
cp -v setup image/setup.data/bin/$(arch); \
cp -v setup.gtk image/setup.data/bin/$(arch)/$(libc); \
fi

install: all
ifeq ($(DYN_PLUGINS),true)
$(MAKE) -C plugins DYN_PLUGINS=true USE_RPM=$(USE_RPM) install
endif
@if [ -d image/setup.data/bin/$(arch)/$(libc) ]; then \
cp -v setup image/setup.data/bin/$(arch); \
strip image/setup.data/bin/$(arch)/setup; \
Expand All @@ -63,6 +81,7 @@ install: all
fi

clean:
$(MAKE) -C plugins clean
rm -f setup setup.gtk testxml foo.xml *.o

dist: clean
Expand All @@ -73,7 +92,7 @@ dist: clean

po/setup.po: $(SRCS)
libglade-xgettext image/setup.data/setup.glade > po/setup.po
xgettext -p po -j -d setup --keyword=_ $(SRCS)
xgettext -p po -j -d setup --keyword=_ $(SRCS) plugins/*.c

gettext: po/setup.po
for lang in $(LOCALES); do \
Expand Down
4 changes: 4 additions & 0 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ You should edit the setup.data/setup.xml file to match your product,
and add a new splash.xpm which will be displayed during the install.
There is documentation for the XML setup specification in README.xml

Make sure to copy over the setup.glade file in your setup.data directory
every time you update 'setup', because the interface definition may
change between revisions and be incompatible with earlier versions.

The binaries for your product are expected to be in bin/<arch>/<libc>/
on the CD. The appropriate binary for the current architecture will
be chosen at install time. The <libc> portion of the path is optional.
Expand Down
30 changes: 30 additions & 0 deletions README.plugins
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
How to write extractor plugins for setup
========================================

Starting from version 1.4.0, setup can be easily extended to recognize
some additional archive formats through a plugin system. This document
describes the basic guidelines to write such a plugin.

- Use the sample plugin as a basis for the new plugin (sample.c). You
should probably copy this file in the plugins directory to a relevant
name.

- Look at other plugins to get an idea of what the implementation of the
Copy() and Size() functions should be like. The most important is probably
that you MUST use the I/O functions from file.h in order for the files
created by your plugin to be registered in setup (for uninstallation purposes).
Also it will give you transparent access to compressed files through Zlib, so
you may want to register additional extensions for your plugin (i.e. .ext.gz).
Also you must call explicitly the 'update' function given to you whenever you
can, to update the installation status that the user is presented with.

- Add your plugin on the 'PLUGINS = ...' line in the Makefile in the plugins
directory.

- Edit plugins/plugindefs.h and add declarations for your plugin's SetupPlugin
structure in there (this will allow it to be statically linked if desired).

- Test it! It's done...


St�phane Peter <[email protected]>
7 changes: 7 additions & 0 deletions README.xml
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,10 @@ There are several optional attributes of the install element:
named 'uninstall', which can be a problem if you need to
install different products in the same directory.

nobinaries When set to "yes", then setup won't prompt the user for a
path for binaries. Set this when this installation won't
actually install any binary file.

meta When this attribute is set to "yes", then setup will act as
a meta-installer, i.e. it will allow the user to select a
product and set-up will respawn itself for the selected
Expand Down Expand Up @@ -172,6 +176,9 @@ There are several optional attributes of the option element:
install If this attribute is set to "true", then the option will
be installed by default. It may be deselected by the user.

required If this attribute is set to "true", the option will always
be installed. The user won't be able to disable it.

help This attribute is a help string which is displayed to the
user if the user requests more information about the option.
This string can be translated to other languages using the 'help'
Expand Down
57 changes: 32 additions & 25 deletions console_ui.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ static yesno_answer prompt_warning(const char *warning)
should continue (used for exclusive options) */
static int parse_option(install_info *info, xmlNodePtr node, int exclusive)
{
const char *help;
const char *help = "";
char line[BUFSIZ];
char prompt[BUFSIZ];
const char *wanted;
Expand Down Expand Up @@ -151,21 +151,26 @@ static int parse_option(install_info *info, xmlNodePtr node, int exclusive)
return retval;
}

/* See if the user wants this option */
sprintf(prompt, _("Install %s?"), get_option_name(info,node,line,BUFSIZ));

wanted = xmlGetProp(node, "install");
if ( wanted && (strcmp(wanted, "true") == 0) ) {
default_response = RESPONSE_YES;
} else {
default_response = RESPONSE_NO;
}
help = get_option_help(info, node);
if ( help ) {
response = prompt_yesnohelp(prompt, default_response);
} else {
response = console_prompt(prompt, default_response);
}
/* Check for required option */
if ( xmlGetProp(node, "required") ) {
printf(_("'%s' option will be installed.\n"), get_option_name(info,node,line,BUFSIZ));
response = RESPONSE_YES;
} else {
/* See if the user wants this option */
snprintf(prompt, sizeof(prompt), _("Install %s?"), get_option_name(info,node,line,BUFSIZ));
wanted = xmlGetProp(node, "install");
if ( wanted && (strcmp(wanted, "true") == 0) ) {
default_response = RESPONSE_YES;
} else {
default_response = RESPONSE_NO;
}
help = get_option_help(info, node);
if ( help ) {
response = prompt_yesnohelp(prompt, default_response);
} else {
response = console_prompt(prompt, default_response);
}
}

switch(response) {
case RESPONSE_YES:
Expand Down Expand Up @@ -195,7 +200,7 @@ static int parse_option(install_info *info, xmlNodePtr node, int exclusive)
if ( help ) {
printf("%s\n", help);
} else {
printf("No help available\n");
printf(_("No help available\n"));
}
parse_option(info, node, exclusive);
break;
Expand Down Expand Up @@ -231,7 +236,7 @@ static install_state console_license(install_info *info)
char command[512];

sleep(1);
sprintf(command, PAGER_COMMAND " \"%s\"", GetProductEULA(info));
snprintf(command, sizeof(command), PAGER_COMMAND " \"%s\"", GetProductEULA(info));
system(command);
if ( console_prompt(_("Do you agree with the license?"), RESPONSE_YES) ==
RESPONSE_YES ) {
Expand All @@ -250,9 +255,9 @@ static install_state console_readme(install_info *info)
if ( readme && ! access(readme, R_OK) ) {
char prompt[256];

sprintf(prompt, _("Would you like to read the %s file ?"), readme);
snprintf(prompt, sizeof(prompt), _("Would you like to read the %s file ?"), readme);
if ( console_prompt(prompt, RESPONSE_YES) == RESPONSE_YES ) {
sprintf(prompt, PAGER_COMMAND " \"%s\"", readme);
snprintf(prompt, sizeof(prompt), PAGER_COMMAND " \"%s\"", readme);
system(prompt);
}
}
Expand Down Expand Up @@ -294,7 +299,7 @@ static install_state console_setup(install_info *info)
printf("%d) %s\n", index, get_option_name(info, node, NULL, 0));
wanted = xmlGetProp(node, "install"); /* Look for a default value */
if ( wanted && (strcmp(wanted, "true") == 0) ) {
sprintf(path,"%d", index);
snprintf(path, sizeof(path), "%d", index);
}
++ index;
}
Expand Down Expand Up @@ -361,9 +366,11 @@ static install_state console_setup(install_info *info)
/* Find out where to install the binary symlinks, unless the binary path
was provided as a command line argument */
if ( ! disable_binary_path ) {
if ( ! prompt_user(_("Please enter the path for binary installation"),
info->symlinks_path, path, sizeof(path)) ) {
return SETUP_ABORT;
if ( ! GetProductHasNoBinaries(info) ) {
if ( ! prompt_user(_("Please enter the path for binary installation"),
info->symlinks_path, path, sizeof(path)) ) {
return SETUP_ABORT;
}
}
} else {
printf(_("Binary path set to: %s\n"), info->symlinks_path);
Expand Down Expand Up @@ -476,7 +483,7 @@ static int run_lynx(const char *url)
int retval;

retval = 0;
sprintf(command, "lynx \"%s\"", url);
snprintf(command, sizeof(command), "lynx \"%s\"", url);
if ( system(command) != 0 ) {
retval = -1;
}
Expand Down
Loading

0 comments on commit 8f6eb8b

Please sign in to comment.