Added new core vanilla PKGBUILDs

This commit is contained in:
root 2009-10-09 21:17:35 -05:00
parent 11e8dac30c
commit 50ef08f63c
336 changed files with 51700 additions and 0 deletions

View file

@ -0,0 +1,20 @@
infodir=/usr/share/info
filelist=(autoconf.info)
post_install() {
for file in ${filelist[@]}; do
install-info $infodir/$file.gz $infodir/dir 2> /dev/null
done
}
post_upgrade() {
post_install $1
}
pre_remove() {
for file in ${filelist[@]}; do
install-info --delete $infodir/$file.gz $infodir/dir 2> /dev/null
done
}
# vim:set ts=2 sw=2 et:

View file

@ -0,0 +1,22 @@
infodir=/usr/share/info
filelist=(automake.info automake.info-1 automake.info-2)
post_install() {
[ -x usr/bin/install-info ] || return 0
for file in ${filelist[@]}; do
install-info $infodir/$file.gz $infodir/dir 2> /dev/null
done
}
post_upgrade() {
post_install $1
}
pre_remove() {
[ -x usr/bin/install-info ] || return 0
for file in ${filelist[@]}; do
install-info --delete $infodir/$file.gz $infodir/dir 2> /dev/null
done
}
# vim:set ts=2 sw=2 et:

View file

@ -0,0 +1,22 @@
# $Id: PKGBUILD 356 2008-04-18 22:56:27Z aaron $
# Maintainer: Thomas Baechler <thomas@archlinux.org>
pkgname=b43-fwcutter
pkgver=012
pkgrel=1
pkgdesc="firmware extractor for the bcm43xx kernel module"
url="http://linuxwireless.org/en/users/Drivers/b43"
depends=('glibc')
license=('GPL')
arch=('i686' 'x86_64')
source=(http://bu3sch.de/b43/fwcutter/${pkgname}-${pkgver}.tar.bz2)
md5sums=('69eadf67b459f313a8d6b37aaabef96c')
build()
{
cd $startdir/src/$pkgname-$pkgver
make || return 1
install -D -m755 b43-fwcutter $startdir/pkg/usr/bin/b43-fwcutter || return 1
install -D -m644 b43-fwcutter.1 $startdir/pkg/usr/share/man/man1/b43-fwcutter.1 || return 1
}

21
core/bash/bash.install Normal file
View file

@ -0,0 +1,21 @@
info_dir=/usr/share/info
info_files=(bash.info)
post_install() {
[ -x usr/bin/install-info ] || return 0
for f in ${info_files[@]}; do
usr/bin/install-info ${info_dir}/$f.gz ${info_dir}/dir 2> /dev/null
done
}
post_upgrade() {
post_install $1
}
pre_remove() {
[ -x usr/bin/install-info ] || return 0
for f in ${info_files[@]}; do
usr/bin/install-info --delete ${info_dir}/$f.gz ${info_dir}/dir 2> /dev/null
done
}
# vim:set ts=2 sw=2 et:

View file

@ -0,0 +1,15 @@
--- src/bash-4.0/config-top.h 2009-01-04 11:32:23.000000000 -0800
+++ config-top.h 2009-08-25 08:41:08.000000000 -0700
@@ -75,10 +75,10 @@
#define KSH_COMPATIBLE_SELECT
/* System-wide .bashrc file for interactive shells. */
-/* #define SYS_BASHRC "/etc/bash.bashrc" */
+#define SYS_BASHRC "/etc/bash.bashrc"
/* System-wide .bash_logout for login shells. */
-/* #define SYS_BASH_LOGOUT "/etc/bash.bash_logout" */
+#define SYS_BASH_LOGOUT "/etc/bash.bash_logout"
/* Define this to make non-interactive shells begun with argv[0][0] == '-'
run the startup files when not in posix mode. */

31
core/bash/system.bashrc Normal file
View file

@ -0,0 +1,31 @@
#
# /etc/bash.bashrc
#
# This file is the systemwide bashrc file. While most of the
# environment is preserved when running an interactive shell
# the PS[1-4] variables, aliases and functions are reset.
#
# When running a non-login shell, apply the following settings:
# - Prompt defaults (PS[1-4], PROMPT_COMMAND)
# - bash_completion if it exists
# - source /etc/bash.bashrc.local
PS1='[\u@\h \W]\$ '
PS2='> '
PS3='> '
PS4='+ '
export PS1 PS2 PS3 PS4
if test "$TERM" = "xterm" -o \
"$TERM" = "xterm-color" -o \
"$TERM" = "xterm-256color" -o \
"$TERM" = "rxvt" -o \
"$TERM" = "rxvt-unicode" -o \
"$TERM" = "xterm-xfree86"; then
PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/$HOME/~}\007"'
export PROMPT_COMMAND
fi
[ -r /etc/bash_completion ] && . /etc/bash_completion
[ -r /etc/bash.bashrc.local ] && . /etc/bash.bashrc.local

24
core/bin86/PKGBUILD Normal file
View file

@ -0,0 +1,24 @@
# $Id: PKGBUILD 38691 2009-05-10 06:48:07Z tpowa $
# Maintainer: judd <jvinet@zeroflux.org>
pkgname=bin86
pkgver=0.16.17
pkgrel=4
pkgdesc="A complete 8086 assembler and loader"
arch=(i686 x86_64)
license=('GPL')
url="http://www.debath.co.uk/"
groups=('base-devel')
depends=('glibc')
source=(http://homepage.ntlworld.com/robert.debath/dev86/$pkgname-$pkgver.tar.gz
bin86-0.16.17-x86_64-1.patch)
md5sums=('c9e8d72dd2e7457b52d0e3164fc199a1' '92bdce7b0655cd2e9f83c83fc56d128e')
build() {
cd $srcdir/$pkgname-$pkgver
if [ "$CARCH" = "x86_64" ]; then
patch -Np1 -i ../bin86-0.16.17-x86_64-1.patch || return 1
fi
make PREFIX=/usr || return 1
mkdir -p $pkgdir/usr/bin $pkgdir/usr/share/man/man1
make PREFIX=$pkgdir/usr MANDIR=$pkgdir/usr/share/man/man1 install
}

View file

@ -0,0 +1,44 @@
Submitted By: Ken Moffat <ken@kenmoffat.uklinux.net>
Date: 2005-06-28
Initial Package Version: 0.16.14
Upstream Status: Submitted Upstream
Origin: from ROCK Linux
Description: Allows bin86 to compile on x86_64, which permits lilo to
be used in a 64-bit system. I'm dubious about ROCK's attempts to
automatically add dual-licensing to all their patches, but bin86 is
already GPL'd. I've heard from the maintainer that this will be
included in the next upload.
# --- ROCK-COPYRIGHT-NOTE-BEGIN ---
#
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
# Please add additional copyright information _after_ the line containing
# the ROCK-COPYRIGHT-NOTE-END tag. Otherwise it might get removed by
# the ./scripts/Create-CopyPatch script. Do not edit this copyright text!
#
# ROCK Linux: rock-src/package/x86/bin86/x86_64.patch
# ROCK Linux is Copyright (C) 1998 - 2005 Clifford Wolf
#
# This patch file is dual-licensed. It is available under the license the
# patched project is licensed under, as long as it is an OpenSource license
# as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
# of the GNU General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option) any later
# version.
#
# --- ROCK-COPYRIGHT-NOTE-END ---
diff -urN bin86-0.16.14-orig/ld/x86_aout.h bin86-0.16.14/ld/x86_aout.h
--- bin86-0.16.14-orig/ld/x86_aout.h 2004-11-07 20:07:31.506442000 +0100
+++ bin86-0.16.14/ld/x86_aout.h 2004-11-07 20:07:41.106982496 +0100
@@ -12,6 +12,9 @@
#if defined(i386) || defined(__BCC__) || defined(MSDOS)
typedef long Long;
#define __OUT_OK 1
+#elif defined(__x86_64__)
+typedef int Long;
+#define __OUT_OK 1
#else
typedef char Long[4];
#endif

View file

@ -0,0 +1,38 @@
===================================================================
RCS file: /cvs/src/src/bfd/elflink.c,v
retrieving revision 1.328
retrieving revision 1.329
diff -u -r1.328 -r1.329
--- src/bfd/elflink.c 2009/01/29 16:35:03 1.328
+++ src/bfd/elflink.c 2009/01/31 11:44:37 1.329
@@ -3199,6 +3199,16 @@
return 0;
}
+static bfd_boolean
+on_needed_list (const char *soname, struct bfd_link_needed_list *needed)
+{
+ for (; needed != NULL; needed = needed->next)
+ if (strcmp (soname, needed->name) == 0)
+ return TRUE;
+
+ return FALSE;
+}
+
/* Sort symbol by value and section. */
static int
elf_sort_symbol (const void *arg1, const void *arg2)
@@ -4434,8 +4444,11 @@
if (!add_needed
&& definition
- && dynsym
- && h->ref_regular)
+ && ((dynsym
+ && h->ref_regular)
+ || (h->ref_dynamic
+ && (elf_dyn_lib_class (abfd) & DYN_AS_NEEDED) != 0
+ && !on_needed_list (elf_dt_name (abfd), htab->needed))))
{
int ret;
const char *soname = elf_dt_name (abfd);

View file

@ -0,0 +1,21 @@
infodir=/usr/share/info
filelist=(as.info bfd.info binutils.info configure.info gprof.info ld.info standards.info)
post_install() {
[ -x usr/bin/install-info ] || return 0
for file in ${filelist[@]}; do
install-info $infodir/$file.gz $infodir/dir 2> /dev/null
done
}
post_upgrade() {
post_install $1
}
pre_remove() {
[ -x usr/bin/install-info ] || return 0
for file in ${filelist[@]}; do
install-info --delete $infodir/$file.gz $infodir/dir 2> /dev/null
done
}

11
core/bison/ChangeLog Normal file
View file

@ -0,0 +1,11 @@
2008-12-11 Eric Belanger <eric@archlinux.org>
* bison 2.4.1-1
* Upstream update
2008-11-08 Eric Belanger <eric@archlinux.org>
* bison 2.4-1
* Upstream update
* Added info file support
* Added ChangeLog

18
core/bison/bison.install Normal file
View file

@ -0,0 +1,18 @@
infodir=/usr/share/info
filelist=(bison.info.gz)
post_install() {
for file in ${filelist[@]}; do
install-info $infodir/$file $infodir/dir 2> /dev/null
done
}
post_upgrade() {
post_install $1
}
pre_remove() {
for file in ${filelist[@]}; do
install-info --delete $infodir/$file $infodir/dir 2> /dev/null
done
}

View file

@ -0,0 +1,26 @@
# $Id: PKGBUILD 13092 2008-09-25 22:04:38Z ronald $
# Maintainer:
# Contributor: Judd Vinet <judd@archlinux.org>
pkgname=bridge-utils
pkgver=1.4
pkgrel=2
pkgdesc="Layer2 ethernet bridging for Linux"
arch=(i686 x86_64)
url="http://www.linuxfoundation.org/en/Net:Bridge"
license=('GPL2')
backup=('etc/conf.d/bridges')
depends=('glibc')
source=(http://downloads.sourceforge.net/bridge/bridge-utils-$pkgver.tar.gz \
bridges.conf.d)
build() {
cd $srcdir/$pkgname-$pkgver
aclocal
autoconf
./configure --prefix=/usr --sysconfdir=/etc --mandir=/usr/share/man
make || return 1
make DESTDIR=$pkgdir install || return 1
# install config file
install -D -m644 ../bridges.conf.d $startdir/pkg/etc/conf.d/bridges
}

View file

@ -0,0 +1,27 @@
#
# Settings for layer-2 bridges
#
# For each bridge interface declared in INTERFACES (in rc.conf), declare
# a bridge_${IF} variable that contains the real ethernet interfaces that
# should be bridged togeether.
#
# Then list the bridge interface name in the BRIDGE_INTERFACES array.
#
# example:
#
# in /etc/rc.conf:
# eth0="eth0 up"
# eth1="eth1 up"
# br0="br0 192.168.0.2 netmask 255.255.255.0 up"
# INTERFACES=(lo eth0 eth1 br0)
#
# in /etc/conf.d/bridges
# bridge_br0="eth0 eth1"
# BRIDGE_INTERFACES=(br0)
#
#bridge_br0="eth0 eth1"
#BRIDGE_INTERFACES=(br0)

View file

@ -0,0 +1,32 @@
# $Id: PKGBUILD 45448 2009-07-11 18:23:55Z pierre $
# Maintainer: Pierre Schmitz <pierre@archlinux.de>
pkgname=ca-certificates
pkgver=20090709
pkgrel=1
pkgdesc='Common CA certificates'
arch=('i686' 'x86_64')
url='http://packages.qa.debian.org/c/ca-certificates.html'
license=('MPL' 'GPL')
source=("http://ftp.debian.org/debian/pool/main/c/${pkgname}/${pkgname}_${pkgver}.tar.gz")
depends=('bash' 'run-parts' 'openssl' 'findutils' 'coreutils' 'sed')
makedepends=('ruby')
install=ca-certificates.install
backup=('etc/ca-certificates.conf')
md5sums=('55ba562c19fc388cdc14cb560a828627')
build() {
cd ${srcdir}/${pkgname}-${pkgver}
install -d -m755 $pkgdir/{etc/ca-certificates/update.d,usr/{sbin,share/ca-certificates}}
install -D -m644 sbin/update-ca-certificates.8 $pkgdir/usr/share/man/man8/update-ca-certificates.8
make
make install DESTDIR=$pkgdir
(
echo "# Automatically generated by ${pkgname}-${pkgver}-${pkgrel}"
echo "# "
cd $pkgdir/usr/share/ca-certificates
find . -name '*.crt' | sort | cut -b3-
) > $pkgdir/etc/ca-certificates.conf
}

View file

@ -0,0 +1,7 @@
post_install() {
usr/sbin/update-ca-certificates --fresh
}
post_upgrade() {
usr/sbin/update-ca-certificates
}

View file

@ -0,0 +1,68 @@
diff -urNp coreutils-7.2-orig/gnulib-tests/gnulib.mk coreutils-7.2/gnulib-tests/gnulib.mk
--- coreutils-7.2-orig/gnulib-tests/gnulib.mk 2009-03-31 14:28:30.000000000 +0200
+++ coreutils-7.2/gnulib-tests/gnulib.mk 2009-04-01 12:37:00.000000000 +0200
@@ -606,9 +606,9 @@ EXTRA_DIST += test-mbsstr1.c test-mbsstr
## begin gnulib module memchr-tests
-TESTS += test-memchr
-check_PROGRAMS += test-memchr
-EXTRA_DIST += test-memchr.c zerosize-ptr.h
+#TESTS += test-memchr
+#check_PROGRAMS += test-memchr
+#EXTRA_DIST += test-memchr.c zerosize-ptr.h
## end gnulib module memchr-tests
@@ -910,9 +910,9 @@ EXTRA_DIST += test-strtod.c
## begin gnulib module strverscmp-tests
-TESTS += test-strverscmp
-check_PROGRAMS += test-strverscmp
-EXTRA_DIST += test-strverscmp.c
+#TESTS += test-strverscmp
+#check_PROGRAMS += test-strverscmp
+#EXTRA_DIST += test-strverscmp.c
## end gnulib module strverscmp-tests
diff -urNp coreutils-6.11-orig/tests/test-lib.sh coreutils-6.11/tests/test-lib.sh
--- coreutils-6.11-orig/tests/test-lib.sh 2008-04-19 23:34:23.000000000 +0200
+++ coreutils-6.11/tests/test-lib.sh 2008-04-24 14:18:59.000000000 +0200
@@ -97,8 +97,8 @@ skip_if_()
require_selinux_()
{
- case `ls -Zd .` in
- '? .'|'unlabeled .')
+ case `ls --scontext -d . | cut -f1 -d" "` in
+ '?'|'unlabeled')
skip_test_ "this system (or maybe just" \
"the current file system) lacks SELinux support"
;;
diff -urNp coreutils-7.1-orig/src/ls.c coreutils-7.1/src/ls.c
--- coreutils-7.1-orig/src/ls.c 2009-02-25 13:23:59.000000000 +0100
+++ coreutils-7.1/src/ls.c 2009-02-25 13:25:20.000000000 +0100
@@ -38,10 +38,6 @@
#include <config.h>
#include <sys/types.h>
-#ifdef HAVE_CAP
-# include <sys/capability.h>
-#endif
-
#if HAVE_TERMIOS_H
# include <termios.h>
#endif
@@ -84,6 +80,10 @@
#include "system.h"
#include <fnmatch.h>
+#ifdef HAVE_CAP
+# include <sys/capability.h>
+#endif
+
#include "acl.h"
#include "argmatch.h"
#include "dev-ino.h"

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,422 @@
--- coreutils-6.7/src/Makefile.am.pam 2006-11-24 21:28:10.000000000 +0000
+++ coreutils-6.7/src/Makefile.am 2007-01-09 17:00:01.000000000 +0000
@@ -103,7 +103,7 @@
# If necessary, add -lm to resolve use of pow in lib/strtod.c.
uptime_LDADD = $(LDADD) $(POW_LIB) $(GETLOADAVG_LIBS)
-su_LDADD = $(LDADD) $(LIB_CRYPT)
+su_LDADD = $(LDADD) $(LIB_CRYPT) @LIB_PAM@
dir_LDADD += $(LIB_ACL)
ls_LDADD += $(LIB_ACL)
--- coreutils-6.7/src/su.c.pam 2007-01-09 17:00:01.000000000 +0000
+++ coreutils-6.7/src/su.c 2007-01-09 17:16:43.000000000 +0000
@@ -38,6 +38,16 @@
restricts who can su to UID 0 accounts. RMS considers that to
be fascist.
+#ifdef USE_PAM
+
+ Actually, with PAM, su has nothing to do with whether or not a
+ wheel group is enforced by su. RMS tries to restrict your access
+ to a su which implements the wheel group, but PAM considers that
+ to be fascist, and gives the user/sysadmin the opportunity to
+ enforce a wheel group by proper editing of /etc/pam.conf
+
+#endif
+
Compile-time options:
-DSYSLOG_SUCCESS Log successful su's (by default, to root) with syslog.
-DSYSLOG_FAILURE Log failed su's (by default, to root) with syslog.
@@ -59,6 +69,15 @@
prototype (returning `int') in <unistd.h>. */
#define getusershell _getusershell_sys_proto_
+#ifdef USE_PAM
+# include <signal.h>
+# include <sys/wait.h>
+# include <sys/fsuid.h>
+# include <unistd.h>
+# include <security/pam_appl.h>
+# include <security/pam_misc.h>
+#endif /* USE_PAM */
+
#include "system.h"
#include "getpass.h"
@@ -128,15 +147,22 @@
/* The user to become if none is specified. */
#define DEFAULT_USER "root"
+#ifndef USE_PAM
char *crypt (char const *key, char const *salt);
+#endif
char *getusershell (void);
void endusershell (void);
void setusershell (void);
extern char **environ;
-static void run_shell (char const *, char const *, char **, size_t)
+static void run_shell (char const *, char const *, char **, size_t,
+ const struct passwd *)
+#ifdef USE_PAM
+ ;
+#else
ATTRIBUTE_NORETURN;
+#endif
/* If true, pass the `-f' option to the subshell. */
static bool fast_startup;
@@ -225,7 +251,26 @@
}
#endif
+#ifdef USE_PAM
+static pam_handle_t *pamh = NULL;
+static int retval;
+static struct pam_conv conv = {
+ misc_conv,
+ NULL
+};
+
+#define PAM_BAIL_P if (retval) { \
+ pam_end(pamh, PAM_SUCCESS); \
+ return 0; \
+}
+#define PAM_BAIL_P_VOID if (retval) { \
+ pam_end(pamh, PAM_SUCCESS); \
+return; \
+}
+#endif
+
/* Ask the user for a password.
+ If PAM is in use, let PAM ask for the password if necessary.
Return true if the user gives the correct password for entry PW,
false if not. Return true without asking for a password if run by UID 0
or if PW has an empty password. */
@@ -233,6 +278,44 @@
static bool
correct_password (const struct passwd *pw)
{
+#ifdef USE_PAM
+ struct passwd *caller;
+ char *tty_name, *ttyn;
+ retval = pam_start(PROGRAM_NAME, pw->pw_name, &conv, &pamh);
+ PAM_BAIL_P;
+
+ if (getuid() != 0 && !isatty(0)) {
+ fprintf(stderr, "standard in must be a tty\n");
+ exit(1);
+ }
+
+ caller = getpwuid(getuid());
+ if(caller != NULL && caller->pw_name != NULL) {
+ retval = pam_set_item(pamh, PAM_RUSER, caller->pw_name);
+ PAM_BAIL_P;
+ }
+
+ ttyn = ttyname(0);
+ if (ttyn) {
+ if (strncmp(ttyn, "/dev/", 5) == 0)
+ tty_name = ttyn+5;
+ else
+ tty_name = ttyn;
+ retval = pam_set_item(pamh, PAM_TTY, tty_name);
+ PAM_BAIL_P;
+ }
+ retval = pam_authenticate(pamh, 0);
+ PAM_BAIL_P;
+ retval = pam_acct_mgmt(pamh, 0);
+ if (retval == PAM_NEW_AUTHTOK_REQD) {
+ /* password has expired. Offer option to change it. */
+ retval = pam_chauthtok(pamh, PAM_CHANGE_EXPIRED_AUTHTOK);
+ PAM_BAIL_P;
+ }
+ PAM_BAIL_P;
+ /* must be authenticated if this point was reached */
+ return 1;
+#else /* !USE_PAM */
char *unencrypted, *encrypted, *correct;
#if HAVE_GETSPNAM && HAVE_STRUCT_SPWD_SP_PWDP
/* Shadow passwd stuff for SVR3 and maybe other systems. */
@@ -257,6 +340,7 @@
encrypted = crypt (unencrypted, correct);
memset (unencrypted, 0, strlen (unencrypted));
return STREQ (encrypted, correct);
+#endif /* !USE_PAM */
}
/* Update `environ' for the new shell based on PW, with SHELL being
@@ -270,12 +354,18 @@
/* Leave TERM unchanged. Set HOME, SHELL, USER, LOGNAME, PATH.
Unset all other environment variables. */
char const *term = getenv ("TERM");
+ char const *display = getenv ("DISPLAY");
+ char const *xauthority = getenv ("XAUTHORITY");
if (term)
term = xstrdup (term);
environ = xmalloc ((6 + !!term) * sizeof (char *));
environ[0] = NULL;
if (term)
xsetenv ("TERM", term);
+ if (display)
+ xsetenv ("DISPLAY", display);
+ if (xauthority)
+ xsetenv ("XAUTHORITY", xauthority);
xsetenv ("HOME", pw->pw_dir);
xsetenv ("SHELL", shell);
xsetenv ("USER", pw->pw_name);
@@ -308,8 +398,13 @@
{
#ifdef HAVE_INITGROUPS
errno = 0;
- if (initgroups (pw->pw_name, pw->pw_gid) == -1)
+ if (initgroups (pw->pw_name, pw->pw_gid) == -1) {
+#ifdef USE_PAM
+ pam_close_session(pamh, 0);
+ pam_end(pamh, PAM_ABORT);
+#endif
error (EXIT_FAILURE, errno, _("cannot set groups"));
+ }
endgrent ();
#endif
if (setgid (pw->pw_gid))
@@ -318,6 +413,31 @@
error (EXIT_FAILURE, errno, _("cannot set user id"));
}
+#ifdef USE_PAM
+static int caught=0;
+/* Signal handler for parent process later */
+static void su_catch_sig(int sig)
+{
+ ++caught;
+}
+
+int
+pam_copyenv (pam_handle_t *pamh)
+{
+ char **env;
+
+ env = pam_getenvlist(pamh);
+ if(env) {
+ while(*env) {
+ if (putenv (*env))
+ xalloc_die ();
+ env++;
+ }
+ }
+ return(0);
+}
+#endif
+
/* Run SHELL, or DEFAULT_SHELL if SHELL is empty.
If COMMAND is nonzero, pass it to the shell with the -c option.
Pass ADDITIONAL_ARGS to the shell as more arguments; there
@@ -325,17 +445,49 @@
static void
run_shell (char const *shell, char const *command, char **additional_args,
- size_t n_additional_args)
+ size_t n_additional_args, const struct passwd *pw)
{
size_t n_args = 1 + fast_startup + 2 * !!command + n_additional_args + 1;
char const **args = xnmalloc (n_args, sizeof *args);
size_t argno = 1;
+#ifdef USE_PAM
+ int child;
+ sigset_t ourset;
+ int status;
+
+ retval = pam_open_session(pamh,0);
+ if (retval != PAM_SUCCESS) {
+ fprintf (stderr, "could not open session\n");
+ exit (1);
+ }
+
+/* do this at the last possible moment, because environment variables may
+ be passed even in the session phase
+*/
+ if(pam_copyenv(pamh) != PAM_SUCCESS)
+ fprintf (stderr, "error copying PAM environment\n");
+
+ /* Credentials should be set in the parent */
+ if (pam_setcred(pamh, PAM_ESTABLISH_CRED) != PAM_SUCCESS) {
+ pam_close_session(pamh, 0);
+ fprintf(stderr, "could not set PAM credentials\n");
+ exit(1);
+ }
+
+ child = fork();
+ if (child == 0) { /* child shell */
+ change_identity (pw);
+ pam_end(pamh, 0);
+#endif
if (simulate_login)
{
char *arg0;
char *shell_basename;
+ if(chdir(pw->pw_dir))
+ error(0, errno, _("warning: cannot change directory to %s"), pw->pw_dir);
+
shell_basename = last_component (shell);
arg0 = xmalloc (strlen (shell_basename) + 2);
arg0[0] = '-';
@@ -360,6 +512,66 @@
error (0, errno, "%s", shell);
exit (exit_status);
}
+#ifdef USE_PAM
+ } else if (child == -1) {
+ fprintf(stderr, "can not fork user shell: %s", strerror(errno));
+ pam_setcred(pamh, PAM_DELETE_CRED | PAM_SILENT);
+ pam_close_session(pamh, 0);
+ pam_end(pamh, PAM_ABORT);
+ exit(1);
+ }
+ /* parent only */
+ sigfillset(&ourset);
+ if (sigprocmask(SIG_BLOCK, &ourset, NULL)) {
+ fprintf(stderr, "%s: signal malfunction\n", PROGRAM_NAME);
+ caught = 1;
+ }
+ if (!caught) {
+ struct sigaction action;
+ action.sa_handler = su_catch_sig;
+ sigemptyset(&action.sa_mask);
+ action.sa_flags = 0;
+ sigemptyset(&ourset);
+ if (sigaddset(&ourset, SIGTERM)
+ || sigaddset(&ourset, SIGALRM)
+ || sigaction(SIGTERM, &action, NULL)
+ || sigprocmask(SIG_UNBLOCK, &ourset, NULL)) {
+ fprintf(stderr, "%s: signal masking malfunction\n", PROGRAM_NAME);
+ caught = 1;
+ }
+ }
+ if (!caught) {
+ do {
+ int pid;
+
+ pid = waitpid(-1, &status, WUNTRACED);
+
+ if (WIFSTOPPED(status)) {
+ kill(getpid(), SIGSTOP);
+ /* once we get here, we must have resumed */
+ kill(pid, SIGCONT);
+ }
+ } while (WIFSTOPPED(status));
+ }
+
+ if (caught) {
+ fprintf(stderr, "\nSession terminated, killing shell...");
+ kill (child, SIGTERM);
+ }
+ /* Not checking retval on this because we need to call close session */
+ pam_setcred(pamh, PAM_DELETE_CRED | PAM_SILENT);
+ retval = pam_close_session(pamh, 0);
+ PAM_BAIL_P_VOID;
+ retval = pam_end(pamh, PAM_SUCCESS);
+ PAM_BAIL_P_VOID;
+ if (caught) {
+ sleep(2);
+ kill(child, SIGKILL);
+ fprintf(stderr, " ...killed.\n");
+ exit(-1);
+ }
+ exit (WEXITSTATUS(status));
+#endif /* USE_PAM */
}
/* Return true if SHELL is a restricted shell (one not returned by
@@ -527,9 +739,9 @@
shell = xstrdup (shell ? shell : pw->pw_shell);
modify_environment (pw, shell);
+#ifndef USE_PAM
change_identity (pw);
- if (simulate_login && chdir (pw->pw_dir) != 0)
- error (0, errno, _("warning: cannot change directory to %s"), pw->pw_dir);
+#endif
- run_shell (shell, command, argv + optind, MAX (0, argc - optind));
+ run_shell (shell, command, argv + optind, MAX (0, argc - optind), pw);
}
--- coreutils-6.7/doc/coreutils.texi.pam 2006-10-27 15:30:48.000000000 +0100
+++ coreutils-6.7/doc/coreutils.texi 2007-01-09 17:00:01.000000000 +0000
@@ -13395,8 +13395,11 @@
@findex syslog
@command{su} can optionally be compiled to use @code{syslog} to report
failed, and optionally successful, @command{su} attempts. (If the system
-supports @code{syslog}.) However, GNU @command{su} does not check if the
-user is a member of the @code{wheel} group; see below.
+supports @code{syslog}.)
+
+This version of @command{su} has support for using PAM for
+authentication. You can edit @file{/etc/pam.d/su} to customize its
+behaviour.
The program accepts the following options. Also see @ref{Common options}.
@@ -12815,6 +12815,8 @@
@env{PATH} to a compiled-in default value. Change to @var{user}'s home
directory. Prepend @samp{-} to the shell's name, intended to make it
read its login startup file(s).
+Additionaly @env{DISPLAY} and @env{XAUTHORITY} environment variables
+are preserved as well for PAM functionality.
@item -m
@itemx -p
@@ -13477,33 +13480,6 @@
the exit status of the subshell otherwise
@end display
-@cindex wheel group, not supported
-@cindex group wheel, not supported
-@cindex fascism
-@subsection Why GNU @command{su} does not support the @samp{wheel} group
-
-(This section is by Richard Stallman.)
-
-@cindex Twenex
-@cindex MIT AI lab
-Sometimes a few of the users try to hold total power over all the
-rest. For example, in 1984, a few users at the MIT AI lab decided to
-seize power by changing the operator password on the Twenex system and
-keeping it secret from everyone else. (I was able to thwart this coup
-and give power back to the users by patching the kernel, but I
-wouldn't know how to do that in Unix.)
-
-However, occasionally the rulers do tell someone. Under the usual
-@command{su} mechanism, once someone learns the root password who
-sympathizes with the ordinary users, he or she can tell the rest. The
-``wheel group'' feature would make this impossible, and thus cement the
-power of the rulers.
-
-I'm on the side of the masses, not that of the rulers. If you are
-used to supporting the bosses and sysadmins in whatever they do, you
-might find this idea strange at first.
-
-
@node timeout invocation
@section @command{timeout}: Run a command with a time limit
--- coreutils-7.1/configure.ac.pam
+++ coreutils-7.1/configure.ac
@@ -44,6 +44,13 @@
AC_DEFINE([GNULIB_PORTCHECK], [1], [enable some gnulib portability checks])
fi
+dnl Give the chance to enable PAM
+AC_ARG_ENABLE(pam, dnl
+[ --enable-pam Enable use of the PAM libraries],
+[AC_DEFINE(USE_PAM, 1, [Define if you want to use PAM])
+LIB_PAM="-ldl -lpam -lpam_misc"
+AC_SUBST(LIB_PAM)])
+
AC_FUNC_FORK
optional_bin_progs=

View file

@ -0,0 +1,174 @@
On linux platforms, grok /proc/cpuinfo for the CPU/vendor info.
Prob not suitable for upstream seeing as how it's 100% linux-specific
http://lists.gnu.org/archive/html/bug-coreutils/2005-09/msg00063.html
Patch originally by Carlos E. Gorges <carlos@techlinux.com.br>, but
heavily reworked to suck less.
To add support for additional platforms, check out the show_cpuinfo()
func in the linux/arch/<ARCH>/ source tree of the kernel.
diff -Naur coreutils-7.6-orig/src/uname.c coreutils-7.6/src/uname.c
--- coreutils-7.6-orig/src/uname.c 2009-09-01 21:01:16.000000000 +1000
+++ coreutils-7.6/src/uname.c 2009-09-13 22:30:19.000000000 +1000
@@ -50,6 +50,11 @@
# include <mach-o/arch.h>
#endif
+#if defined (__linux__)
+# define USE_PROCINFO
+# define UNAME_HARDWARE_PLATFORM
+#endif
+
#include "system.h"
#include "error.h"
#include "quote.h"
@@ -155,6 +160,117 @@
exit (status);
}
+#if defined(USE_PROCINFO)
+
+# if defined(__s390__) || defined(__s390x__)
+# define CPUINFO_FILE "/proc/sysinfo"
+# define CPUINFO_FORMAT "%64[^\t :]%*[ :]%256[^\n]%c"
+# else
+# define CPUINFO_FILE "/proc/cpuinfo"
+# define CPUINFO_FORMAT "%64[^\t:]\t:%256[^\n]%c"
+# endif
+
+# define PROCINFO_PROCESSOR 0
+# define PROCINFO_HARDWARE_PLATFORM 1
+
+static void __eat_cpuinfo_space(char *buf)
+{
+ /* first eat trailing space */
+ char *tmp = buf + strlen(buf) - 1;
+ while (tmp > buf && isspace(*tmp))
+ *tmp-- = '\0';
+ /* then eat leading space */
+ tmp = buf;
+ while (*tmp && isspace(*tmp))
+ tmp++;
+ if (tmp != buf)
+ memmove(buf, tmp, strlen(tmp)+1);
+ /* finally collapse whitespace */
+ tmp = buf;
+ while (tmp[0] && tmp[1]) {
+ if (isspace(tmp[0]) && isspace(tmp[1])) {
+ memmove(tmp, tmp+1, strlen(tmp));
+ continue;
+ }
+ ++tmp;
+ }
+}
+
+static int __linux_procinfo (int x, char *fstr, size_t s)
+{
+ FILE *fp;
+
+ char *procinfo_keys[] = {
+ /* --processor --hardware-platform */
+ #if defined(__alpha__)
+ "cpu model", "system type"
+ #elif defined(__arm__)
+ "Processor", "Hardware"
+ #elif defined(__avr32__)
+ "processor", "cpu family"
+ #elif defined(__bfin__)
+ "CPU", "BOARD Name"
+ #elif defined(__cris__)
+ "cpu", "cpu model"
+ #elif defined(__frv__)
+ "CPU-Core", "System"
+ #elif defined(__i386__) || defined(__x86_64__)
+ "model name", "vendor_id"
+ #elif defined(__ia64__)
+ "family", "vendor"
+ #elif defined(__hppa__)
+ "cpu", "model"
+ #elif defined(__m68k__)
+ "CPU", "MMU"
+ #elif defined(__mips__)
+ "cpu model", "system type"
+ #elif defined(__powerpc__) || defined(__powerpc64__)
+ "cpu", "machine"
+ #elif defined(__s390__) || defined(__s390x__)
+ "Type", "Manufacturer"
+ #elif defined(__sh__)
+ "cpu type", "machine"
+ #elif defined(sparc) || defined(__sparc__)
+ "type", "cpu"
+ #elif defined(__vax__)
+ "cpu type", "cpu"
+ #else
+ "unknown", "unknown"
+ #endif
+ };
+
+ if ((fp = fopen(CPUINFO_FILE, "r")) != NULL) {
+ char key[65], value[257], eol, *ret = NULL;
+
+ while (fscanf(fp, CPUINFO_FORMAT, key, value, &eol) != EOF) {
+ __eat_cpuinfo_space(key);
+ if (!strcmp(key, procinfo_keys[x])) {
+ __eat_cpuinfo_space(value);
+ ret = value;
+ break;
+ }
+ if (eol != '\n') {
+ /* we need two fscanf's here in case the previous
+ * length limit caused us to read right up to the
+ * newline ... doing "%*[^\n]\n" wont eat the newline
+ */
+ fscanf(fp, "%*[^\n]");
+ fscanf(fp, "\n");
+ }
+ }
+ fclose(fp);
+
+ if (ret) {
+ strncpy(fstr, ret, s);
+ return 0;
+ }
+ }
+
+ return -1;
+}
+
+#endif
+
/* Print ELEMENT, preceded by a space if something has already been
printed. */
@@ -302,10 +418,14 @@
if (toprint & PRINT_PROCESSOR)
{
char const *element = unknown;
-#if HAVE_SYSINFO && defined SI_ARCHITECTURE
+#if ( HAVE_SYSINFO && defined SI_ARCHITECTURE ) || defined(USE_PROCINFO)
{
static char processor[257];
+#if defined(USE_PROCINFO)
+ if (0 <= __linux_procinfo (PROCINFO_PROCESSOR, processor, sizeof processor))
+#else
if (0 <= sysinfo (SI_ARCHITECTURE, processor, sizeof processor))
+#endif
element = processor;
}
#endif
@@ -358,9 +478,13 @@
if (element == unknown)
{
static char hardware_platform[257];
+#if defined(USE_PROCINFO)
+ if (0 <= __linux_procinfo (PROCINFO_HARDWARE_PLATFORM, hardware_platform, sizeof hardware_platform))
+#else
size_t s = sizeof hardware_platform;
static int mib[] = { CTL_HW, UNAME_HARDWARE_PLATFORM };
if (sysctl (mib, 2, hardware_platform, &s, 0, 0) >= 0)
+#endif
element = hardware_platform;
}
#endif

View file

@ -0,0 +1,21 @@
infodir=/usr/share/info
filelist=(coreutils.info)
post_install() {
[ -x usr/bin/install-info ] || return 0
for file in ${filelist[@]}; do
usr/bin/install-info $infodir/$file $infodir/dir 2> /dev/null
done
}
post_upgrade() {
post_install $1
}
pre_remove() {
[ -x usr/bin/install-info ] || return 0
for file in ${filelist[@]}; do
usr/bin/install-info --delete $infodir/$file $infodir/dir 2> /dev/null
done
}

29
core/cpio/PKGBUILD Normal file
View file

@ -0,0 +1,29 @@
# $Id: PKGBUILD 48163 2009-07-31 20:55:39Z tpowa $
# Maintainer: judd <jvinet@zeroflux.org>
pkgname=cpio
pkgver=2.10
pkgrel=1
pkgdesc="A tool to copy files into or out of a cpio or tar archive"
arch=(i686 x86_64)
license=('GPL')
url="http://www.gnu.org/software/cpio"
groups=('base')
depends=('glibc')
source=(ftp://ftp.gnu.org/gnu/cpio/cpio-${pkgver}.tar.gz)
install=cpio.install
md5sums=('351ab3d38d8949913e478cc23b9d6ad4')
build() {
cd ${srcdir}/${pkgname}-${pkgver}
./configure --prefix=/usr --mandir=/usr/share/man
make || return 1
make DESTDIR=${pkgdir} install
rm -f ${pkgdir}/usr/bin/mt ${pkgdir}/pkg/usr/share/man/man1/mt.1
mv ${pkgdir}/usr/bin ${pkgdir}/bin
rm -rf ${pkgdir}/usr/libexec
# remove mt manpage it conflicts with mt-st from extra
rm $pkgdir/usr/share/man/man1/mt.1 || return 1
# remove infodir
rm $pkgdir/usr/share/info/dir
}

139
core/cpio/cpio-gcc43.patch Normal file
View file

@ -0,0 +1,139 @@
http://bugs.gentoo.org/198817
from upstream gnulib for "extern inline" changes
diff --git a/lib/argp-fmtstream.h b/lib/argp-fmtstream.h
index 93fa651..50f1387 100644
--- a/lib/argp-fmtstream.h
+++ b/lib/argp-fmtstream.h
@@ -1,5 +1,5 @@
/* Word-wrapping and line-truncating streams.
- Copyright (C) 1997, 2006 Free Software Foundation, Inc.
+ Copyright (C) 1997, 2006-2007 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by Miles Bader <miles@gnu.ai.mit.edu>.
@@ -134,6 +134,7 @@ extern ssize_t argp_fmtstream_printf (argp_fmtstream_t __fs,
const char *__fmt, ...)
__attribute__ ((__format__ (printf, 2, 3)));
+#if _LIBC || !defined __OPTIMIZE__
extern int __argp_fmtstream_putc (argp_fmtstream_t __fs, int __ch);
extern int argp_fmtstream_putc (argp_fmtstream_t __fs, int __ch);
@@ -144,6 +145,7 @@ extern size_t __argp_fmtstream_write (argp_fmtstream_t __fs,
const char *__str, size_t __len);
extern size_t argp_fmtstream_write (argp_fmtstream_t __fs,
const char *__str, size_t __len);
+#endif
/* Access macros for various bits of state. */
#define argp_fmtstream_lmargin(__fs) ((__fs)->lmargin)
@@ -153,6 +155,7 @@ extern size_t argp_fmtstream_write (argp_fmtstream_t __fs,
#define __argp_fmtstream_rmargin argp_fmtstream_rmargin
#define __argp_fmtstream_wmargin argp_fmtstream_wmargin
+#if _LIBC || !defined __OPTIMIZE__
/* Set __FS's left margin to LMARGIN and return the old value. */
extern size_t argp_fmtstream_set_lmargin (argp_fmtstream_t __fs,
size_t __lmargin);
@@ -174,6 +177,7 @@ extern size_t __argp_fmtstream_set_wmargin (argp_fmtstream_t __fs,
/* Return the column number of the current output point in __FS. */
extern size_t argp_fmtstream_point (argp_fmtstream_t __fs);
extern size_t __argp_fmtstream_point (argp_fmtstream_t __fs);
+#endif
/* Internal routines. */
extern void _argp_fmtstream_update (argp_fmtstream_t __fs);
@@ -197,7 +201,28 @@ extern int __argp_fmtstream_ensure (argp_fmtstream_t __fs, size_t __amount);
#endif
#ifndef ARGP_FS_EI
-#define ARGP_FS_EI extern inline
+# ifdef __GNUC__
+ /* GCC 4.3 and above with -std=c99 or -std=gnu99 implements ISO C99
+ inline semantics, unless -fgnu89-inline is used. It defines a macro
+ __GNUC_STDC_INLINE__ to indicate this situation or a macro
+ __GNUC_GNU_INLINE__ to indicate the opposite situation.
+ GCC 4.2 with -std=c99 or -std=gnu99 implements the GNU C inline
+ semantics but warns, unless -fgnu89-inline is used:
+ warning: C99 inline functions are not supported; using GNU89
+ warning: to disable this warning use -fgnu89-inline or the gnu_inline function attribute
+ It defines a macro __GNUC_GNU_INLINE__ to indicate this situation. */
+# if defined __GNUC_STDC_INLINE__
+# define ARGP_FS_EI inline
+# elif defined __GNUC_GNU_INLINE__
+# define ARGP_FS_EI extern inline __attribute__ ((__gnu_inline__))
+# else
+# define ARGP_FS_EI extern inline
+# endif
+# else
+ /* With other compilers, assume the ISO C99 meaning of 'inline', if
+ the compiler supports 'inline' at all. */
+# define ARGP_FS_EI inline
+# endif
#endif
ARGP_FS_EI size_t
diff --git a/lib/argp.h b/lib/argp.h
index fb11de6..aa76eb4 100644
--- a/lib/argp.h
+++ b/lib/argp.h
@@ -520,9 +520,11 @@ extern void __argp_state_help (const struct argp_state *__restrict __state,
FILE *__restrict __stream,
unsigned int __flags);
+#if _LIBC || !defined __USE_EXTERN_INLINES
/* Possibly output the standard usage message for ARGP to stderr and exit. */
extern void argp_usage (const struct argp_state *__state);
extern void __argp_usage (const struct argp_state *__state);
+#endif
/* If appropriate, print the printf string FMT and following args, preceded
by the program name and `:', to stderr, and followed by a `Try ... --help'
@@ -551,6 +553,7 @@ extern void __argp_failure (const struct argp_state *__restrict __state,
const char *__restrict __fmt, ...)
__attribute__ ((__format__ (__printf__, 4, 5)));
+#if _LIBC || !defined __USE_EXTERN_INLINES
/* Returns true if the option OPT is a valid short option. */
extern int _option_is_short (const struct argp_option *__opt) __THROW;
extern int __option_is_short (const struct argp_option *__opt) __THROW;
@@ -559,6 +562,7 @@ extern int __option_is_short (const struct argp_option *__opt) __THROW;
options array. */
extern int _option_is_end (const struct argp_option *__opt) __THROW;
extern int __option_is_end (const struct argp_option *__opt) __THROW;
+#endif
/* Return the input field for ARGP in the parser corresponding to STATE; used
by the help routines. */
@@ -579,7 +583,28 @@ extern void *__argp_input (const struct argp *__restrict __argp,
# endif
# ifndef ARGP_EI
-# define ARGP_EI extern __inline__
+# ifdef __GNUC__
+ /* GCC 4.3 and above with -std=c99 or -std=gnu99 implements ISO C99
+ inline semantics, unless -fgnu89-inline is used. It defines a macro
+ __GNUC_STDC_INLINE__ to indicate this situation or a macro
+ __GNUC_GNU_INLINE__ to indicate the opposite situation.
+ GCC 4.2 with -std=c99 or -std=gnu99 implements the GNU C inline
+ semantics but warns, unless -fgnu89-inline is used:
+ warning: C99 inline functions are not supported; using GNU89
+ warning: to disable this warning use -fgnu89-inline or the gnu_inline function attribute
+ It defines a macro __GNUC_GNU_INLINE__ to indicate this situation. */
+# if defined __GNUC_STDC_INLINE__
+# define ARGP_EI __inline__
+# elif defined __GNUC_GNU_INLINE__
+# define ARGP_EI extern __inline__ __attribute__ ((__gnu_inline__))
+# else
+# define ARGP_EI extern __inline__
+# endif
+# else
+ /* With other compilers, assume the ISO C99 meaning of 'inline', if
+ the compiler supports 'inline' at all. */
+# define ARGP_EI inline
+# endif
# endif
ARGP_EI void

21
core/cpio/cpio.install Normal file
View file

@ -0,0 +1,21 @@
infodir=/usr/share/info
filelist=(cpio.info)
post_install() {
[ -x usr/bin/install-info ] || return 0
for file in ${filelist[@]}; do
usr/bin/install-info $infodir/$file $infodir/dir 2> /dev/null
done
}
post_upgrade() {
post_install $1
}
pre_remove() {
[ -x usr/bin/install-info ] || return 0
for file in ${filelist[@]}; do
usr/bin/install-info --delete $infodir/$file $infodir/dir 2> /dev/null
done
}

33
core/crda/PKGBUILD Normal file
View file

@ -0,0 +1,33 @@
# $Id: PKGBUILD 40883 2009-05-31 17:12:07Z thomas $
# Maintainer: Thomas Bächler <thomas@archlinux.org>
pkgname=crda
pkgver=1.1.0
pkgrel=1
pkgdesc="Central Regulatory Domain Agent"
arch=(i686 x86_64)
url="http://wireless.kernel.org/en/developers/Regulatory/CRDA"
license=('custom')
depends=('wireless-regdb' 'libnl' 'libgcrypt' 'udev' 'iw')
makedepends=('python-m2crypto')
install=crda.install
source=(http://wireless.kernel.org/download/crda/${pkgname}-${pkgver}.tar.bz2
crda.rc)
md5sums=('6004584d2e39e899f7642b141dd72028'
'014eef3f8655e9a130064ec6891317fc')
build() {
# Install crda, regdbdump and udev rules
msg "Compiling and installing crda ..."
cd ${srcdir}/${pkgname}-${pkgver}
make crda regdbdump || return 1
make DESTDIR=${pkgdir} install || return 1
# This rule automatically sets the regulatory domain when cfg80211 is loaded
echo 'ACTION=="add" SUBSYSTEM=="module", DEVPATH=="/module/cfg80211", RUN+="/etc/rc.d/wireless-regdom start >/dev/null"' >> ${pkgdir}/lib/udev/rules.d/85-regulatory.rules || return 1
msg "Installing license ..."
install -D -m644 ${srcdir}/${pkgname}-${pkgver}/LICENSE ${pkgdir}/usr/share/licenses/crda/LICENSE || return 1
msg "Installing boot script ..."
install -D -m755 ${srcdir}/crda.rc ${pkgdir}/etc/rc.d/wireless-regdom || return 1
}

18
core/crda/crda.install Normal file
View file

@ -0,0 +1,18 @@
## arg 1: the new package version
post_install() {
echo "Uncomment the right regulatory domain in /etc/conf.d/wireless-regdom."
echo "It will automatically be set when necessary."
}
## arg 1: the new package version
## arg 2: the old package version
post_upgrade() {
# In an upgrade from 1.0.1-1 or older, the wireless-regdom file moves from the crda package
# to the new wireless-regdb package. If the user changed the file, it is save to overwrite the one
# from wireless-regdb by the user-defined one
if [ $(vercmp $2 1.0.1-2) -lt 0 ]; then
if [ -f /etc/conf.d/wireless-regdom.pacorig -a -n "$(grep -v ^# /etc/conf.d/wireless-regdom.pacorig 2>/dev/null | grep -v ^$)" ]; then
mv /etc/conf.d/wireless-regdom.pacorig /etc/conf.d/wireless-regdom
fi
fi
}

26
core/crda/crda.rc Executable file
View file

@ -0,0 +1,26 @@
#!/bin/bash
. /etc/rc.conf
. /etc/rc.d/functions
. /etc/conf.d/wireless-regdom
case "$1" in
start)
if [ -n "${WIRELESS_REGDOM}" ]; then
stat_busy "Setting wireless regulatory domain: ${WIRELESS_REGDOM}"
if iw reg set ${WIRELESS_REGDOM}; then
stat_done
else
stat_fail
fi
fi
;;
stop)
;;
restart)
$0 start
;;
*)
echo "usage: $0 start"
esac
exit 0

39
core/cryptsetup/PKGBUILD Normal file
View file

@ -0,0 +1,39 @@
# $Id: PKGBUILD 47665 2009-07-25 01:02:38Z thomas $
# Maintainer: Judd Vinet <jvinet@zeroflux.org>
pkgname=cryptsetup
pkgver=1.0.7
pkgrel=1
pkgdesc="Userspace setup tool for transparent encryption of block devices using the Linux 2.6 cryptoapi"
arch=(i686 x86_64)
license=('GPL')
url="http://code.google.com/p/cryptsetup/"
groups=('base')
depends=('device-mapper' 'libgcrypt' 'popt' 'e2fsprogs')
conflicts=('mkinitcpio<0.5.24.99')
options=('!libtool' '!emptydirs')
source=(http://cryptsetup.googlecode.com/files/${pkgname}-${pkgver}.tar.bz2
encrypt_hook
encrypt_install
luksOpen-status.patch)
md5sums=('5eea2a77391a8a1a651b31cbaef59e22'
'6bdb1b83539453d403335aed1a579a5c'
'24b76e9cb938bc3c8dcff396cbab28c7'
'd4be8d2059d5427c057be4de4e948887')
build() {
cd $srcdir/$pkgname-${pkgver}
# suppress "Command successful" message on luksOpen
patch -p1 -i $srcdir/luksOpen-status.patch || return 1
./configure --prefix=/usr --disable-static
make || return 1
make DESTDIR=$pkgdir install
# include a static cryptsetup binary for initrd setups
make clean
cd $srcdir/$pkgname-${pkgver}
./configure --prefix=/usr --enable-static
make || return 1
install -D -m755 src/cryptsetup $pkgdir/sbin/cryptsetup.static || return 1
# install hook
install -D -m644 $srcdir/encrypt_hook $pkgdir/lib/initcpio/hooks/encrypt || return 1
install -D -m644 $srcdir/encrypt_install $pkgdir/lib/initcpio/install/encrypt || return 1
}

View file

@ -0,0 +1,129 @@
# vim: set ft=sh:
# TODO this one needs some work to work with lots of different
# encryption schemes
run_hook ()
{
/sbin/modprobe -a -q dm-crypt >/dev/null 2>&1
if [ -e "/sys/class/misc/device-mapper" ]; then
if [ ! -c "/dev/mapper/control" ]; then
read dev_t < /sys/class/misc/device-mapper/dev
/bin/mknod "/dev/mapper/control" c $(/bin/replace "${dev_t}" ':')
fi
[ "${quiet}" = "y" ] && CSQUIET=">/dev/null"
# Get keyfile if specified
ckeyfile="/crypto_keyfile.bin"
if [ "x${cryptkey}" != "x" ]; then
set -- $(/bin/replace "${cryptkey}" ':'); ckdev=$1; ckarg1=$2; ckarg2=$3
if poll_device "${ckdev}" ${rootdelay}; then
case ${ckarg1} in
*[!0-9]*)
# Use a file on the device
# ckarg1 is not numeric: ckarg1=filesystem, ckarg2=path
mkdir /ckey
mount -r -t ${ckarg1} ${ckdev} /ckey
dd if=/ckey/${ckarg2} of=${ckeyfile} >/dev/null 2>&1
umount /ckey
;;
*)
# Read raw data from the block device
# ckarg1 is numeric: ckarg1=offset, ckarg2=length
dd if=${ckdev} of=${ckeyfile} bs=1 skip=${ckarg1} count=${ckarg2} >/dev/null 2>&1
;;
esac
fi
[ ! -f ${ckeyfile} ] && echo "Keyfile could not be opened. Reverting to passphrase."
fi
if [ -n "${cryptdevice}" ]; then
DEPRECATED_CRYPT=0
set -- $(/bin/replace "${cryptdevice}" ':'); cryptdev="$1"; cryptname="$2";
else
DEPRECATED_CRYPT=1
cryptdev="${root}"
cryptname="root"
fi
warn_deprecated() {
echo "The syntax 'root=${root}' where '${root}' is an encrypted volume is deprecated"
echo "Use 'cryptdevice=${root}:root root=/dev/mapper/root' instead."
}
if poll_device "${cryptdev}" ${rootdelay}; then
if /bin/cryptsetup isLuks ${cryptdev} >/dev/null 2>&1; then
[ ${DEPRECATED_CRYPT} -eq 1 ] && warn_deprecated
dopassphrase=1
# If keyfile exists, try to use that
if [ -f ${ckeyfile} ]; then
if eval /bin/cryptsetup --key-file ${ckeyfile} luksOpen ${cryptdev} ${cryptname} ${CSQUIET}; then
dopassphrase=0
else
echo "Invalid keyfile. Reverting to passphrase."
fi
fi
# Ask for a passphrase
if [ ${dopassphrase} -gt 0 ]; then
echo ""
echo "A password is required to access the ${cryptname} volume:"
#loop until we get a real password
while ! eval /bin/cryptsetup luksOpen ${cryptdev} ${cryptname} ${CSQUIET}; do
sleep 2;
done
fi
if [ -e "/dev/mapper/${cryptname}" ]; then
if [ ${DEPRECATED_CRYPT} -eq 1 ]; then
export root="/dev/mapper/root"
fi
else
err "Password succeeded, but ${cryptname} creation failed, aborting..."
exit 1
fi
elif [ "x${crypto}" != "x" ]; then
[ ${DEPRECATED_CRYPT} -eq 1 ] && warn_deprecated
do_oldcrypto ()
{
if [ $# -ne 5 ]; then
err "Verify parameter format: crypto=hash:cipher:keysize:offset:skip"
err "Non-LUKS decryption not attempted..."
return 1
fi
exe="/bin/cryptsetup create ${cryptname} ${cryptdev}"
[ "x$(eval echo ${1})" != "x" ] && exe="${exe} --hash \"$(eval echo ${1})\""
[ "x$(eval echo ${2})" != "x" ] && exe="${exe} --cipher \"$(eval echo ${2})\""
[ "x$(eval echo ${3})" != "x" ] && exe="${exe} --key-size \"$(eval echo ${3})\""
[ "x$(eval echo ${4})" != "x" ] && exe="${exe} --offset \"$(eval echo ${4})\""
[ "x$(eval echo ${5})" != "x" ] && exe="${exe} --skip \"$(eval echo ${5})\""
if [ -f ${ckeyfile} ]; then
exe="${exe} --key-file ${ckeyfile}"
else
exe="${exe} --verify-passphrase"
echo ""
echo "A password is required to access the ${cryptname} volume:"
fi
eval "${exe} ${CSQUIET}"
}
msg "Non-LUKS encrypted device found..."
do_oldcrypto $(/bin/replace -q "${crypto}" ':')
if [ $? -ne 0 ]; then
err "Non-LUKS device decryption failed. verify format: "
err " crypto=hash:cipher:keysize:offset:skip"
exit 1
fi
if [ -e "/dev/mapper/${cryptname}" ]; then
if [ ${DEPRECATED_CRYPT} -eq 1 ]; then
export root="/dev/mapper/root"
fi
else
err "Password succeeded, but ${cryptname} creation failed, aborting..."
exit 1
fi
else
err "Failed to open encryption mapping: The device ${cryptdev} is not a LUKS volume and the crypto= paramater was not specified."
fi
fi
nuke ${ckeyfile}
fi
}

View file

@ -0,0 +1,22 @@
# vim: set ft=sh:
install ()
{
if [ -z "${CRYPTO_MODULES}" ]; then
MODULES=" dm-crypt $(all_modules "/crypto/") "
else
MODULES=" dm-crypt ${CRYPTO_MODULES} "
fi
BINARIES=""
add_dir "/dev/mapper"
add_file "/sbin/cryptsetup.static" "/bin/cryptsetup"
FILES=""
SCRIPT="encrypt"
}
help ()
{
cat<<HELPEOF
This hook allows for an encrypted root device.
HELPEOF
}

View file

@ -0,0 +1,13 @@
diff -Nur cryptsetup-luks-1.0.4.orig/src/cryptsetup.c cryptsetup-luks-1.0.4/src/cryptsetup.c
--- cryptsetup-luks-1.0.4.orig/src/cryptsetup.c 2006-10-04 15:47:00.000000000 +0200
+++ cryptsetup-luks-1.0.4/src/cryptsetup.c 2006-12-16 15:54:12.000000000 +0100
@@ -249,7 +249,8 @@
if (opt_readonly)
options.flags |= CRYPT_FLAG_READONLY;
r = crypt_luksOpen(&options);
- show_status(-r);
+ if(r)
+ show_status(-r);
return r;
}

30
core/dash/PKGBUILD Normal file
View file

@ -0,0 +1,30 @@
# $Id: PKGBUILD 31190 2009-03-25 02:19:41Z dan $
# Maintainer: Dan McGee <dan@archlinux.org>
pkgname=dash
pkgver=0.5.5.1
pkgrel=2
pkgdesc="A POSIX compliant shell that aims to be as small as possible"
arch=('i686' 'x86_64')
url="http://gondor.apana.org.au/~herbert/dash/"
license=('BSD')
groups=('base')
makedepends=('klibc>=1.5')
#provides=('sh')
source=("http://gondor.apana.org.au/~herbert/dash/files/dash-$pkgver.tar.gz")
md5sums=('7ac832b440b91f5a52cf8eb68e172616')
build() {
cd $srcdir/$pkgname-$pkgver
./configure --prefix=/usr --mandir=/usr/share/man --exec-prefix="" \
CC=klcc LD=klcc LDFLAGS="-static"
make || return 1
make DESTDIR=$pkgdir install || return 1
# license
install -m644 -D COPYING $pkgdir/usr/share/licenses/$pkgname/COPYING
#static dash is our default /bin/sh
#cd $pkgdir/bin
#ln -s dash sh
}

45
core/dcron/PKGBUILD Normal file
View file

@ -0,0 +1,45 @@
# $Id: PKGBUILD 39021 2009-05-11 07:16:44Z tpowa $
# Maintainer: judd <jvinet@zeroflux.org>
pkgname=dcron
pkgver=3.2
pkgrel=4
pkgdesc="Dillon's Cron Daemon"
arch=(i686 x86_64)
license=('GPL')
groups=('base')
url="http://apollo.backplane.com/FreeSrc/"
backup=(var/spool/cron/root)
depends=('glibc')
provides=('cron')
source=(http://apollo.backplane.com/FreeSrc/dcron32.tgz
dcron-3.1.patch
root.crontab
crond
crond.logrotate
run-cron
dcron-3.2.patch)
md5sums=('c2c816deb389b4bfb00761f26afe3efd'
'2f0c3f7497a12c8826c9be3f87843fcd'
'7fcc06b13708ebd667711b1fbf62ee6e'
'd7edac165ef19ebb9d0089bdc218b53a'
'aeabcd5e4924d1a7593c8782d1068c86'
'5ff0cdcb9ec99778938ac6ef26800327'
'44afe7dc25324baa21bdca37b9842514')
build() {
cd $srcdir/dcron
patch -Np1 -i ../dcron-3.1.patch || return 1
patch -Np1 -i ../dcron-3.2.patch || return 1
make || return 1
install -D -m4755 crontab $pkgdir/usr/bin/crontab
install -D -m755 crond $pkgdir/usr/sbin/crond
install -D -m644 crontab.1 $pkgdir/usr/share/man/man1/crontab.1
install -D -m644 crond.8 $pkgdir/usr/share/man/man8/crond.8
mkdir -p $pkgdir/var/spool/cron $pkgdir/etc/cron.d
mkdir -p $pkgdir/etc/{rc.d,cron.hourly,cron.daily,cron.weekly,cron.monthly}
install -D -m0600 ../root.crontab $pkgdir/var/spool/cron/root
install -D -m755 ../crond $pkgdir/etc/rc.d/crond
install -D -m644 ../crond.logrotate $pkgdir/etc/logrotate.d/crond
install -D -m755 ../run-cron $pkgdir/usr/sbin/run-cron
}

37
core/dcron/crond Executable file
View file

@ -0,0 +1,37 @@
#!/bin/bash
. /etc/rc.conf
. /etc/rc.d/functions
PID=`pidof -o %PPID /usr/sbin/crond`
case "$1" in
start)
stat_busy "Starting Cron Daemon"
[ -z "$PID" ] && /usr/sbin/crond >>/var/log/crond 2>&1
if [ $? -gt 0 ]; then
stat_fail
else
PID=`pidof -o %PPID /usr/sbin/crond`
echo $PID >/var/run/crond.pid
add_daemon crond
stat_done
fi
;;
stop)
stat_busy "Stopping Cron Daemon"
[ ! -z "$PID" ] && kill $PID &>/dev/null
if [ $? -gt 0 ]; then
stat_fail
else
rm_daemon crond
stat_done
fi
;;
restart)
$0 stop
$0 start
;;
*)
echo "usage: $0 {start|stop|restart}"
esac
exit 0

View file

@ -0,0 +1,5 @@
/var/log/crond {
sharedscripts
copytruncate
missingok
}

View file

@ -0,0 +1,33 @@
diff -Naur dcron-orig/defs.h dcron/defs.h
--- dcron-orig/defs.h 2006-04-29 10:20:58.000000000 -0700
+++ dcron/defs.h 2006-05-04 18:40:05.000000000 -0700
@@ -28,7 +28,7 @@
#define arysize(ary) (sizeof(ary)/sizeof((ary)[0]))
#ifndef CRONTABS
-#define CRONTABS "/var/spool/cron/crontabs"
+#define CRONTABS "/var/spool/cron"
#endif
#ifndef SCRONTABS
#define SCRONTABS "/etc/cron.d"
@@ -44,7 +44,7 @@
#if defined(__DragonFly__)
#define SENDMAIL "/usr/sbin/sendmail"
#else
-#define SENDMAIL "/usr/lib/sendmail"
+#define SENDMAIL "/usr/sbin/sendmail"
#endif
#endif
diff -Naur dcron-orig/subs.c dcron/subs.c
--- dcron-orig/subs.c 2006-04-27 10:29:56.000000000 -0700
+++ dcron/subs.c 2006-05-04 18:40:19.000000000 -0700
@@ -79,7 +79,7 @@
buf[0] = 0;
if (useDate)
- strftime(buf, 128, "%d-%b-%y %H:%M ", tp);
+ strftime(buf, 128, "%d-%b-%Y %H:%M ", tp);
vsnprintf(buf + strlen(buf), nmax, ctl, va);
return(strlen(buf));
}

View file

@ -0,0 +1,12 @@
diff -Naur dcron-orig/job.c dcron/job.c
--- dcron-orig/job.c 2009-04-24 16:35:20.000000000 +0400
+++ dcron/job.c 2009-04-24 16:35:41.000000000 +0400
@@ -213,7 +213,7 @@
/*
* note: 8 is a file descriptor
*/
- logfd(8, "unable to exec %s %s, user %s, output to sink null",
+ logfd(8, "unable to exec %s %s, user %s, output to sink null\n",
SENDMAIL,
SENDMAIL_ARGS,
file->cf_UserName

12
core/dcron/root.crontab Normal file
View file

@ -0,0 +1,12 @@
#
# DO NOT EDIT THIS FILE MANUALLY!! USE crontab -e INSTEAD.
#
# <minute> <hour> <day> <month> <dow> <command>
01 * * * * /usr/sbin/run-cron /etc/cron.hourly
02 00 * * * /usr/sbin/run-cron /etc/cron.daily
22 00 * * 0 /usr/sbin/run-cron /etc/cron.weekly
42 00 1 * * /usr/sbin/run-cron /etc/cron.monthly

14
core/dcron/run-cron Executable file
View file

@ -0,0 +1,14 @@
#!/bin/sh
if [ -z $1 ]; then
echo "Usage: $0 crondir"
exit 1
fi
for cron in $1/* ; do
if [ -x $cron ]; then
$cron
fi
done
unset cron

23
core/dialog/PKGBUILD Normal file
View file

@ -0,0 +1,23 @@
# $Id: PKGBUILD 41639 2009-06-06 06:27:06Z allan $
# Maintainer: Allan McRae <allan@archlinux.org>
# Contributor: Andreas Radke <andyrtr@archlinux.org>
pkgname=dialog
pkgver=1.1_20080819
_pkgver=1.1-20080819
pkgrel=2
pkgdesc="A tool to display dialog boxes from shell scripts"
arch=('i686' 'x86_64')
url="http://invisible-island.net/dialog/"
license=('GPL')
groups=('base')
depends=('ncurses>=5.6-8')
source=(ftp://invisible-island.net/${pkgname}/${pkgname}-$_pkgver.tgz)
md5sums=('3caebd641a9f337b980becb4444336c5')
build() {
cd ${srcdir}/$pkgname-$_pkgver
./configure --prefix=/usr --with-ncursesw --mandir=/usr/share/man
make || return 1
make DESTDIR=${pkgdir} install
}

View file

@ -0,0 +1,19 @@
infodir=/usr/share/info
filelist=(diff.info)
post_install() {
for file in ${filelist[@]}; do
install-info $infodir/$file $infodir/dir 2> /dev/null
done
}
post_upgrade() {
post_install $1
}
pre_remove() {
for file in ${filelist[@]}; do
install-info --delete $infodir/$file $infodir/dir 2> /dev/null
done
}

55
core/dmraid/PKGBUILD Normal file
View file

@ -0,0 +1,55 @@
# $Id: PKGBUILD 46313 2009-07-15 13:47:44Z tpowa $
# Maintainer: Tobias Powalowski <tpowa@archlinux.org>
#Contributor: Urs Wolfer <uwolfer @ fwo.ch>
pkgname=dmraid
pkgver=1.0.0.rc15
pkgrel=8
pkgdesc="Device mapper RAID interface"
url="http://people.redhat.com/~heinzm/sw/dmraid/"
depends=(device-mapper)
arch=('i686' 'x86_64')
license=('GPL')
source=(http://people.redhat.com/~heinzm/sw/dmraid/src/$pkgname-$pkgver.tar.bz2
dmraid-1.0.0.rc15-isw-raid10.patch
dmraid-1.0.0.rc15-isw-serial.patch
dmraid-1.0.0.rc15-rm_partitions.patch
dmraid-1.0.0.rc15-whitespace.patch
dmraid_install
dmraid_hook)
install=dmraid.install
md5sums=('2602887205a35f89b59eeba3a868150f'
'5a422c82e63321e65fbccb41dda70ea2'
'499864f61c36874c9cef69600da31b59'
'3d76f99972123b6efd7796bf51d543fa'
'0a3ec92f071a25a01753c6c34b4cb0df'
'db9a72cbf07560059d407c874f646240'
'afdb3cd655ea0145410e2aae247c7bcf')
build() {
cd $srcdir/$pkgname/$pkgver
# add fedora patches
patch -Np1 -i ../../dmraid-1.0.0.rc15-isw-raid10.patch || return 1
patch -Np1 -i ../../dmraid-1.0.0.rc15-isw-serial.patch || return 1
patch -Np1 -i ../../dmraid-1.0.0.rc15-rm_partitions.patch || return 1
patch -Np1 -i ../../dmraid-1.0.0.rc15-whitespace.patch || return 1
# create static bin
./configure --enable-static_link --prefix=/usr
make || return 1
make DESTDIR=$pkgdir exec_prefix=$pkgdir/usr install
mv $pkgdir/usr/sbin/dmraid $pkgdir/usr/sbin/dmraid.static
# create dynamic linked bin
./configure --prefix=/usr
make || return 1
make DESTDIR=$pkgdir exec_prefix=$pkgdir/usr install
mkdir -p $pkgdir/var/lock/dmraid
chmod 1777 $pkgdir/var/lock/
install -D -m644 $srcdir/dmraid_install $pkgdir/lib/initcpio/install/dmraid
install -D -m644 $srcdir/dmraid_hook $pkgdir/lib/initcpio/hooks/dmraid
# fix .a file
chmod 644 $pkgdir/usr/lib/libdmraid.a
# fix manpage
#mkdir -p $pkgdir/usr/share/man
#mv $pkgdir/usr/man/man8 $pkgdir/usr/share/man/
#rm -rf $pkgdir/usr/man
}

View file

@ -0,0 +1,12 @@
diff -up 1.0.0.rc15/lib/format/ataraid/isw.c~ 1.0.0.rc15/lib/format/ataraid/isw.c
--- 1.0.0.rc15/lib/format/ataraid/isw.c~ 2008-09-17 08:58:52.000000000 -0400
+++ 1.0.0.rc15/lib/format/ataraid/isw.c 2009-02-05 07:04:35.576126020 -0500
@@ -155,7 +155,7 @@ name(struct lib_context *lc, struct raid
while (i--) {
if (disk == isw->disk + i) {
- id = i % 2;
+ id = i / 2;
goto ok;
}
}

View file

@ -0,0 +1,88 @@
diff -up 1.0.0.rc15/lib/format/ataraid/isw.c~ 1.0.0.rc15/lib/format/ataraid/isw.c
--- 1.0.0.rc15/lib/format/ataraid/isw.c~ 2009-04-10 14:12:14.000000000 +0200
+++ 1.0.0.rc15/lib/format/ataraid/isw.c 2009-04-10 14:38:56.000000000 +0200
@@ -81,15 +81,43 @@ is_raid10(struct isw_dev *dev)
}
/* Find a disk table slot by serial number. */
+static const char *dev_info_serial_to_isw(const char *di_serial)
+{
+ static char isw_serial[1024];
+
+ int i, isw_serial_len = 0;
+
+ for (i = 0; di_serial[i] && isw_serial_len < 1023; i++) {
+ if (((unsigned char)di_serial[i]) > 0x20) {
+ /* ':' is reserved for use in placeholder serial
+ * numbers for missing disks */
+ if (di_serial[i] == ':')
+ isw_serial[isw_serial_len] = ';';
+ else
+ isw_serial[isw_serial_len] = di_serial[i];
+ isw_serial_len++;
+ }
+ }
+ isw_serial[isw_serial_len] = 0;
+
+ if (isw_serial_len > MAX_RAID_SERIAL_LEN)
+ memmove(isw_serial,
+ isw_serial + (isw_serial_len - MAX_RAID_SERIAL_LEN),
+ MAX_RAID_SERIAL_LEN);
+
+ return isw_serial;
+}
+
static struct isw_disk *
_get_disk(struct isw *isw, struct dev_info *di)
{
if (di->serial) {
int i = isw->num_disks;
struct isw_disk *disk = isw->disk;
+ const char *isw_serial = dev_info_serial_to_isw(di->serial);
while (i--) {
- if (!strncmp(di->serial, (const char *) disk[i].serial,
+ if (!strncmp(isw_serial, (const char *) disk[i].serial,
MAX_RAID_SERIAL_LEN))
return disk + i;
}
@@ -866,7 +894,8 @@ rd_by_serial(struct raid_set *rs, const
list_for_each_entry(rd, &rs->devs, devs) {
if (rd->di &&
- !strncmp(rd->di->serial, serial, MAX_RAID_SERIAL_LEN))
+ !strncmp(dev_info_serial_to_isw(rd->di->serial), serial,
+ MAX_RAID_SERIAL_LEN))
return rd;
}
@@ -1297,7 +1326,8 @@ isw_config_disks(struct lib_context *lc,
struct raid_dev *rd;
list_for_each_entry(rd, &rs->devs, devs) {
- strncpy((char *) disk[i].serial, rd->di->serial,
+ strncpy((char *) disk[i].serial,
+ dev_info_serial_to_isw(rd->di->serial),
MAX_RAID_SERIAL_LEN);
disk[i].totalBlocks = rd->di->sectors;
@@ -2421,7 +2451,8 @@ update_metadata(struct lib_context *lc,
while (i--) {
/* Check if the disk is listed. */
list_for_each_entry(di, LC_DI(lc), list) {
- if (!strncmp(di->serial, (const char *) disk[i].serial,
+ if (!strncmp(dev_info_serial_to_isw(di->serial),
+ (const char *) disk[i].serial,
MAX_RAID_SERIAL_LEN))
goto goon;
}
@@ -2517,7 +2548,8 @@ update_metadata(struct lib_context *lc,
new_disk->status = CONFIG_ON_DISK |
DISK_SMART_EVENT_SUPPORTED |
CLAIMED_DISK | DETECTED_DISK | USABLE_DISK | CONFIGURED_DISK;
- strncpy((char *) new_disk->serial, di->serial, MAX_RAID_SERIAL_LEN);
+ strncpy((char *) new_disk->serial, dev_info_serial_to_isw(di->serial),
+ MAX_RAID_SERIAL_LEN);
/* build new isw_disk array */
for (i = 0; i < isw->num_disks; i++) {

View file

@ -0,0 +1,222 @@
diff -up 1.0.0.rc15/include/dmraid/lib_context.h.rmparts 1.0.0.rc15/include/dmraid/lib_context.h
--- 1.0.0.rc15/include/dmraid/lib_context.h.rmparts 2008-06-20 16:17:35.000000000 +0200
+++ 1.0.0.rc15/include/dmraid/lib_context.h 2009-02-13 12:03:57.000000000 +0100
@@ -169,6 +169,7 @@ enum action {
PARTCHAR = 0x20000000,
#endif
+ RMPARTITIONS = 0x40000000,
};
/* Arguments allowed ? */
diff -up 1.0.0.rc15/lib/Makefile.in.rmparts 1.0.0.rc15/lib/Makefile.in
--- 1.0.0.rc15/lib/Makefile.in.rmparts 2008-06-11 15:07:04.000000000 +0200
+++ 1.0.0.rc15/lib/Makefile.in 2009-02-13 12:03:57.000000000 +0100
@@ -12,6 +12,7 @@ SOURCES=\
activate/activate.c \
activate/devmapper.c \
device/ata.c \
+ device/partition.c \
device/scan.c \
device/scsi.c \
display/display.c \
diff -up 1.0.0.rc15/lib/device/dev-io.h.rmparts 1.0.0.rc15/lib/device/dev-io.h
--- 1.0.0.rc15/lib/device/dev-io.h.rmparts 2008-06-12 12:54:32.000000000 +0200
+++ 1.0.0.rc15/lib/device/dev-io.h 2009-02-13 12:03:57.000000000 +0100
@@ -19,5 +19,6 @@
int discover_devices(struct lib_context *lc, char **devnodes);
int removable_device(struct lib_context *lc, char *dev_path);
+int remove_device_partitions(struct lib_context *lc, void *rs, int dummy);
#endif
diff -up /dev/null 1.0.0.rc15/lib/device/partition.c
--- /dev/null 2009-02-13 08:38:43.364262886 +0100
+++ 1.0.0.rc15/lib/device/partition.c 2009-02-13 12:03:57.000000000 +0100
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2009 Hans de Goede <hdegoede@redhat.com>, Red Hat Inc.
+ * All rights reserved.
+ *
+ * See file LICENSE at the top of this source tree for license information.
+ */
+#include <linux/blkpg.h>
+#include <sys/ioctl.h>
+#include <errno.h>
+#include <fcntl.h>
+#include "internal.h"
+
+static int
+_remove_subset_partitions(struct lib_context *lc, struct raid_set *rs)
+{
+ struct raid_dev *rd;
+ struct blkpg_partition part = { 0, };
+ struct blkpg_ioctl_arg io = {
+ .op = BLKPG_DEL_PARTITION,
+ .datalen = sizeof(part),
+ .data = &part,
+ };
+
+ list_for_each_entry(rd, &rs->devs, devs) {
+ int fd = open(rd->di->path, O_RDWR);
+ if (fd < 0)
+ LOG_ERR(lc, 0, "opening %s: %s\n", rd->di->path,
+ strerror(errno));
+
+ /* There is no way to enumerate partitions */
+ for (part.pno = 1; part.pno <= 256; part.pno++) {
+ if (ioctl(fd, BLKPG, &io) < 0 && errno != ENXIO &&
+ (part.pno < 16 || errno != EINVAL))
+ LOG_ERR(lc, 0,
+ "removing part %d from %s: %s\n",
+ part.pno, rd->di->path,
+ strerror(errno));
+ }
+ }
+ return 1;
+}
+
+/* Remove the partition block devices (ie sda1) from block devices (ie sda)
+ used in the set, so that things like hal / blkid won't try to access the
+ disks directly */
+int
+remove_device_partitions(struct lib_context *lc, void *v, int dummy)
+{
+ struct raid_set *subset, *rs = v;
+
+ /* Recursively walk down the chain of stacked RAID sets */
+ list_for_each_entry(subset, &rs->sets, list) {
+ /* Remove partitions from devices of set below this one */
+ if (!T_GROUP(rs) && !remove_device_partitions(lc, subset, 0))
+ return 0;
+ }
+
+ return _remove_subset_partitions(lc, rs);
+}
diff -up 1.0.0.rc15/lib/metadata/metadata.c.rmparts 1.0.0.rc15/lib/metadata/metadata.c
--- 1.0.0.rc15/lib/metadata/metadata.c.rmparts 2008-09-17 14:58:31.000000000 +0200
+++ 1.0.0.rc15/lib/metadata/metadata.c 2009-02-13 12:03:57.000000000 +0100
@@ -2147,6 +2147,9 @@ lib_perform(struct lib_context *lc, enum
if (get_metadata(lc, action, p, argv))
ret = p->post(lc, p->pre ? p->pre(p->arg) : p->arg);
+ if (ret && (RMPARTITIONS & action))
+ process_sets(lc, remove_device_partitions, 0, SETS);
+
if (LOCK == p->lock)
unlock_resource(lc, NULL);
diff -up 1.0.0.rc15/man/dmraid.8.rmparts 1.0.0.rc15/man/dmraid.8
--- 1.0.0.rc15/man/dmraid.8.rmparts 2008-06-11 15:07:20.000000000 +0200
+++ 1.0.0.rc15/man/dmraid.8 2009-02-13 12:10:11.000000000 +0100
@@ -8,6 +8,7 @@ dmraid \- discover, configure and activa
[-f|--format FORMAT[,FORMAT...]]
[{-P|--partchar} CHAR]
[-p|--no_partitions]
+ [-Z|--rm_partitions]
[--separator SEPARATOR]
[-t|--test]
[RAID-set...]
@@ -110,7 +111,11 @@ In case metadata format handlers are cho
Useful if devices have multiple metadata signatures.
When activating RAID sets,
.B -p
-disables the activation of partitions on them.
+disables the activation of partitions on them, and
+.B -Z
+will make dmraid tell the kernel to remove the partitions from the disks
+underlying the set, ie if sda is part of the set, remove sda1, sda2, etc.
+This prevents applications from directly accessiong the disks bypassing dmraid.
RAID set names given on command line don't need to be fully specified
(eg, "dmraid -ay sil" would activate all discovered Silicon Image Medley
RAID sets).
diff -up 1.0.0.rc15/tools/commands.c.rmparts 1.0.0.rc15/tools/commands.c
--- 1.0.0.rc15/tools/commands.c.rmparts 2008-06-20 22:25:33.000000000 +0200
+++ 1.0.0.rc15/tools/commands.c 2009-02-13 12:03:57.000000000 +0100
@@ -38,7 +38,7 @@ static char const *short_opts = "a:hipP:
#endif
"rR:s::tv"
#endif
- "VC:S::";
+ "VC:S::Z";
#ifdef HAVE_GETOPTLONG
static struct option long_opts[] = {
@@ -73,6 +73,7 @@ static struct option long_opts[] = {
{"version", no_argument, NULL, 'V'},
{"create", required_argument, NULL, 'C'},
{"spare", optional_argument, NULL, 'S'},
+ {"rm_partitions", no_argument, NULL, 'Z'},
{NULL, no_argument, NULL, 0}
};
#endif /* #ifdef HAVE_GETOPTLONG */
@@ -209,6 +210,7 @@ help(struct lib_context *lc, int arg)
"\t[-f|--format FORMAT[,FORMAT...]]\n"
"\t[-P|--partchar CHAR]\n"
"\t[-p|--no_partitions]\n"
+ "\t[-Z|--rm_partitions]\n"
"\t[--separator SEPARATOR]\n" "\t[RAID-set...]\n", c);
log_print(lc, "%s\t{-h|--help}\n", c);
log_print(lc, "%s\t{-V/--version}\n", c);
@@ -221,7 +223,7 @@ help(struct lib_context *lc, int arg)
"\t[-f|--format FORMAT[,FORMAT...]]\n"
"\t[-P|--partchar CHAR]\n" "\t[-p|--no_partitions]\n"
"\t[--separator SEPARATOR]\n" "\t[-t|--test]\n"
- "\t[RAID-set...]\n", c);
+ "\t[-Z|--rm_partitions] [RAID-set...]\n", c);
log_print(lc,
"%s\t{-b|--block_devices} *\n"
"\t[-c|--display_columns][FIELD[,FIELD...]]...\n"
@@ -274,7 +276,7 @@ static struct actions actions[] = {
UNDEF, /* Set in check_activate() by mandatory option argument. */
UNDEF,
ACTIVATE | DEACTIVATE | FORMAT | HELP | IGNORELOCKING | NOPARTITIONS |
- SEPARATOR
+ SEPARATOR | RMPARTITIONS
#ifndef DMRAID_MINI
| DBG | TEST | VERBOSE
#endif
@@ -293,7 +295,8 @@ static struct actions actions[] = {
# endif
| RAID_DEVICES | RAID_SETS,
ACTIVE | INACTIVE | COLUMN | DBG | DUMP | DMERASE | GROUP | HELP |
- IGNORELOCKING | NOPARTITIONS | SEPARATOR | TEST | VERBOSE
+ IGNORELOCKING | NOPARTITIONS | SEPARATOR | TEST | VERBOSE |
+ RMPARTITIONS
#else
, UNDEF
#endif
@@ -310,7 +313,7 @@ static struct actions actions[] = {
{'P',
PARTCHAR,
ACTIVATE | DEACTIVATE,
- FORMAT | HELP | IGNORELOCKING | SEPARATOR
+ FORMAT | HELP | IGNORELOCKING | SEPARATOR | RMPARTITIONS
#ifndef DMRAID_MINI
| DBG | TEST | VERBOSE
#endif
@@ -323,7 +326,7 @@ static struct actions actions[] = {
{'p',
NOPARTITIONS,
ACTIVATE | DEACTIVATE,
- FORMAT | HELP | IGNORELOCKING | SEPARATOR
+ FORMAT | HELP | IGNORELOCKING | SEPARATOR | RMPARTITIONS
#ifndef DMRAID_MINI
| DBG | TEST | VERBOSE
#endif
@@ -573,6 +576,15 @@ static struct actions actions[] = {
check_spare_argument,
LC_HOT_SPARE_SET,
},
+ {'Z',
+ RMPARTITIONS,
+ ACTIVATE, /* We cannot undo this on DEACTIVATE ! */
+ DBG | FORMAT | HELP | IGNORELOCKING | NOPARTITIONS | VERBOSE |
+ SEPARATOR,
+ ARGS,
+ NULL,
+ 0,
+ },
};
/*

View file

@ -0,0 +1,16 @@
===================================================================
RCS file: /cvs/dm/dmraid/lib/device/scsi.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- dmraid/lib/device/scsi.c 2008/09/19 14:31:11 1.3
+++ dmraid/lib/device/scsi.c 2008/10/31 12:22:35 1.4
@@ -110,7 +110,7 @@
}
ret = ret &&
- (di->serial = dbg_strdup((char *) &response[p->start + 1]));
+ (di->serial = dbg_strdup(remove_white_space (lc, (char *) &response[p->start + 1], serial_len)));
}
dbg_free(response);

View file

@ -0,0 +1,26 @@
post_upgrade() {
if [ "$(vercmp $2 1.0.0.rc15)" -lt 0 ]; then
# important upgrade notice
echo ">>>"
echo ">>> IMPORTANT DMRAID UPGRADE NOTICE"
echo ">>> -------------------------------"
echo ">>> Version 1.0.15rc introduce a new name scheme:"
echo ">>> You need to add an additional 'p' in front of your number."
echo ">>> e.g. <yourname><number> --> <yourname>p<number>"
echo ">>> firsthd1 --> firsthdp1"
echo ">>> Please change your bootloader and fstab accordingly."
echo ">>>"
fi
if [ "$(vercmp $2 1.0.0.rc14)" -gt 0 ]; then
# important downgrade notice
echo ">>>"
echo ">>> IMPORTANT DMRAID DOWNGRADE NOTICE"
echo ">>> -------------------------------"
echo ">>> Version 1.0.15rc introduced a new name scheme:"
echo ">>> You need to remove the additional 'p' in front of your number."
echo ">>> e.g. <yourname>p<number> --> <yourname><number>"
echo ">>> firsthdp1 --> firsthd1"
echo ">>> Please change your bootloader and fstab accordingly."
echo ">>>"
fi
}

17
core/dmraid/dmraid_hook Normal file
View file

@ -0,0 +1,17 @@
# vim: set ft=sh:
run_hook ()
{
/sbin/modprobe -q dm-mod >/dev/null 2>&1
/sbin/modprobe -q dm-mirror >/dev/null 2>&1
if [ -e "/sys/class/misc/device-mapper" ]; then
read dev_t < /sys/class/misc/device-mapper/dev
/bin/mknod "/dev/mapper/control" c $(/bin/replace "${dev_t}" ':')
msg ":: Activating dmraid arrays..."
if [ "${quiet}" = "y" ]; then
/sbin/dmraid -ay -Z >/dev/null
else
/sbin/dmraid -ay -Z
fi
fi
}

View file

@ -0,0 +1,19 @@
# vim: set ft=sh:
install ()
{
MODULES=" dm-mod dm-mirror "
BINARIES=""
FILES=""
SCRIPT="dmraid"
add_dir "/dev/mapper"
add_file "/usr/sbin/dmraid.static" "/sbin/dmraid"
}
help ()
{
cat<<HELPEOF
This hook loads the necessary modules for a dmraid root device.
HELPEOF
}

32
core/dnsutils/PKGBUILD Normal file
View file

@ -0,0 +1,32 @@
# $Id: PKGBUILD 46687 2009-07-19 16:41:59Z kevin $
# Maintainer: kevin <kevin@archlinux.org>
# Contributor: mario <mario_vazq@hotmail.com>
pkgname=dnsutils
# Use a period and not a hyphen before the patch level for proper versioning.
pkgver=9.6.1
_pkgver=9.6.1
pkgrel=2
pkgdesc="Various DNS utilities - dig host nslookup nsupdate"
arch=(i686 x86_64)
url="https://www.isc.org/software/bind"
license=('custom:ISC')
depends=('openssl>=0.9.8h')
replaces=('bind-tools' 'host')
options=('makeflags')
source=(http://ftp.isc.org/isc/bind9/${_pkgver}/bind-${_pkgver}.tar.gz
bind.so_bsdcompat.diff tools-only.patch)
md5sums=('516ac74d8eaaef30ad4c99ada8b715cd' '447d58721cfee0e1e377b46f7d50b327'
'329f7e15b8c45d3efefdf5b559bb878a')
build() {
cd "${srcdir}/bind-${_pkgver}"
patch -Np0 -i "${srcdir}/bind.so_bsdcompat.diff" || return 1
patch -Np1 -i "${srcdir}/tools-only.patch" || return 1
./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var \
--with-openssl=yes --disable-linux-caps --without-libxml2 || return 1
make || return 1
cd bin || return 1
make DESTDIR="${pkgdir}" install || return 1
install -m755 -d "${pkgdir}/usr/share/licenses/${pkgname}"
install -m644 ../COPYRIGHT "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE" || return 1
}

View file

@ -0,0 +1,11 @@
--- ./lib/isc/unix/socket.c.orig 2005-11-03 17:08:42.000000000 -0600
+++ ./lib/isc/unix/socket.c 2006-02-18 13:09:15.000000000 -0600
@@ -245,6 +245,8 @@
#define SOCK_DEAD(s) ((s)->references == 0)
+#undef SO_BSDCOMPAT
+
static void
manager_log(isc_socketmgr_t *sockmgr,
isc_logcategory_t *category, isc_logmodule_t *module, int level,

View file

@ -0,0 +1,22 @@
--- bind-9.3.1/bin/Makefile.in.orig 2005-05-06 01:52:36.000000000 -0400
+++ bind-9.3.1/bin/Makefile.in 2005-05-06 01:53:24.000000000 -0400
@@ -19,7 +19,7 @@
VPATH = @srcdir@
top_srcdir = @top_srcdir@
-SUBDIRS = named rndc dig dnssec tests nsupdate check
+SUBDIRS = dig nsupdate
TARGETS =
@BIND9_MAKE_RULES@
--- bind-9.3.1/lib/Makefile.in.orig 2005-05-06 02:05:12.000000000 -0400
+++ bind-9.3.1/lib/Makefile.in 2005-05-06 02:05:35.000000000 -0400
@@ -23,7 +23,7 @@
# Attempt to disable parallel processing.
.NOTPARALLEL:
.NO_PARALLEL:
-SUBDIRS = isc isccc dns isccfg bind9 lwres tests
+SUBDIRS = isc dns isccfg bind9 lwres
TARGETS =
@BIND9_MAKE_RULES@

View file

@ -0,0 +1,25 @@
Copyright (c) 2003-2007 Theodore Ts'o <tytso@mit.edu>
Copyright (c) 1997-2003 Yann Dirson <dirson@debian.org>
Copyright (c) 2001 Alcove <http://www.alcove.com/>
Copyright (c) 1997 Klee Dienes
Copyright (c) 1995-1996 Michael Nonweiler <mrn20@cam.ac.uk>
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject
to the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View file

@ -0,0 +1,20 @@
infodir=/usr/share/info
filelist=(libext2fs.info.gz)
post_install() {
[ -x usr/bin/install-info ] || return 0
for file in ${filelist[@]}; do
install-info $infodir/$file $infodir/dir 2> /dev/null
done
}
post_upgrade() {
post_install $1
}
pre_remove() {
[ -x usr/bin/install-info ] || return 0
for file in ${filelist[@]}; do
install-info --delete $infodir/$file $infodir/dir 2> /dev/null
done
}

28
core/ed/PKGBUILD Normal file
View file

@ -0,0 +1,28 @@
# $Id: PKGBUILD 47762 2009-07-26 18:57:16Z andyrtr $
# Maintainer: Andreas Radke <andyrtr@archlinux.org>
pkgname=ed
pkgver=1.4
pkgrel=1
pkgdesc="A POSIX-compliant line editor"
arch=('i686' 'x86_64')
license=('GPL')
url="http://www.gnu.org/software/ed/ed.html"
install=ed.install
groups=('base-devel')
depends=('glibc')
options=('!emptydirs')
source=(ftp://ftp.gnu.org/gnu/ed/${pkgname}-${pkgver}.tar.gz)
md5sums=('da0ddc0e0b0bec2da4b13b0d0d1bce2b')
build() {
cd ${srcdir}/${pkgname}-${pkgver}
./configure --prefix=/ --mandir=/usr/share/man --infodir=/usr/share/info
make || return 1
make DESTDIR=${pkgdir} install || return 1
cd ${pkgdir}/usr/share/info
ln ed.info red.info
rm ${pkgdir}/usr/share/info/dir
}

23
core/ed/ed.install Normal file
View file

@ -0,0 +1,23 @@
infodir=/usr/share/info
filelist=(ed.info red.info)
post_install() {
[ -x usr/bin/install-info ] || return 0
for file in ${filelist[@]}; do
install-info $infodir/$file $infodir/dir 2> /dev/null
done
}
post_upgrade() {
post_install $1
}
pre_remove() {
[ -x usr/bin/install-info ] || return 0
for file in ${filelist[@]}; do
install-info --delete $infodir/$file $infodir/dir 2> /dev/null
done
}
# vim:set ts=2 sw=2 et:

5
core/eventlog/ChangeLog Normal file
View file

@ -0,0 +1,5 @@
2009-01-03 Eric Belanger <eric@archlinux.org>
* eventlog 0.2.9-1
* Upstream update
* Added ChangeLog

View file

@ -0,0 +1,22 @@
infodir=/usr/share/info
filelist=(find-maint.info find.info)
post_install() {
[ -x usr/bin/install-info ] || return 0
for file in ${filelist[@]}; do
install-info $infodir/$file $infodir/dir 2> /dev/null
done
}
post_upgrade() {
post_install $1
}
pre_remove() {
[ -x usr/bin/install-info ] || return 0
for file in ${filelist[@]}; do
install-info --delete $infodir/$file $infodir/dir 2> /dev/null
done
}
# vim:set ts=2 sw=2 et:

View file

@ -0,0 +1,22 @@
diff -urNp flex-2.5.35.orig/flex.skl flex-2.5.35/flex.skl
--- flex-2.5.35.orig/flex.skl 2009-04-20 03:09:46.000000000 +0530
+++ flex-2.5.35/flex.skl 2009-04-20 07:46:58.000000000 +0530
@@ -217,6 +217,7 @@ m4preproc_include(`flexint.h')
/* begin standard C++ headers. */
#include <iostream>
#include <errno.h>
+#include <cstdio>
#include <cstdlib>
#include <cstring>
/* end standard C++ headers. */
diff -urNp flex-2.5.35.orig/skel.c flex-2.5.35/skel.c
--- flex-2.5.35.orig/skel.c 2009-04-20 03:09:46.000000000 +0530
+++ flex-2.5.35/skel.c 2009-04-20 07:46:40.000000000 +0530
@@ -284,6 +284,7 @@ const char *skel[] = {
"/* begin standard C++ headers. */",
"#include <iostream> ",
"#include <errno.h>",
+ "#include <cstdio>",
"#include <cstdlib>",
"#include <cstring>",
"/* end standard C++ headers. */",

22
core/flex/flex.install Normal file
View file

@ -0,0 +1,22 @@
infodir=/usr/share/info
filelist=(flex.info{,-1,-2})
post_install() {
[ -x usr/bin/install-info ] || return 0
for file in ${filelist[@]}; do
install-info $infodir/$file.gz $infodir/dir 2> /dev/null
done
}
post_upgrade() {
post_install $1
}
pre_remove() {
[ -x usr/bin/install-info ] || return 0
for file in ${filelist[@]}; do
install-info --delete $infodir/$file.gz $infodir/dir 2> /dev/null
done
}
# vim:set ts=2 sw=2 et:

22
core/gawk/gawk.install Normal file
View file

@ -0,0 +1,22 @@
infodir=/usr/share/info
filelist=(gawk.info.gz gawkinet.info.gz)
post_install() {
[ -x usr/bin/install-info ] || return 0
for file in ${filelist[@]}; do
install-info $infodir/$file $infodir/dir 2> /dev/null
done
}
post_upgrade() {
post_install $1
}
pre_remove() {
[ -x usr/bin/install-info ] || return 0
for file in ${filelist[@]}; do
install-info --delete $infodir/$file $infodir/dir 2> /dev/null
done
}
# vim:set ts=2 sw=2 et:

67
core/gcc-libs/PKGBUILD Normal file
View file

@ -0,0 +1,67 @@
# $Id: PKGBUILD 47566 2009-07-24 05:20:35Z allan $
# Maintainer: Jan de Groot <jgc@archlinux.org>
# Maintainer: Allan McRae <allan@archlinux.org>
# toolchain build order: kernel-headers->glibc->binutils->gcc-libs->gcc->binutils->glibc
pkgname=gcc-libs
pkgver=4.4.1
pkgrel=1
#_snapshot=4.4-20090630
pkgdesc="Runtime libraries shipped by GCC for C and C++ languages"
arch=('i686' 'x86_64')
license=('GPL' 'LGPL')
groups=('base')
url="http://gcc.gnu.org"
depends=('glibc>=2.10.1-3')
makedepends=('binutils>=2.19.1' 'gcc>=4.4' 'mpfr>=2.4.1' 'texinfo' 'flex' 'cloog-ppl>=0.15.3')
conflicts=('gcc-fortran' 'gcc-objc')
provides=("gcc-objc=${pkgver}")
options=('!libtool' '!emptydirs' '!docs')
source=(ftp://gcc.gnu.org/pub/gcc/releases/gcc-${pkgver}/gcc-{core,g++,fortran,objc}-${pkgver}.tar.bz2
#ftp://gcc.gnu.org/pub/gcc/snapshots/${_snapshot}/gcc-{core,g++,fortran,objc}-${_snapshot}.tar.bz2
gcc_pure64.patch
gcc-hash-style-both.patch)
md5sums=('d19693308aa6b2052e14c071111df59f'
'd449047b5761348ceec23739f5553e0b'
'47b92407bd15703a0ebb9e36e0314615'
'f7b2a606394036e81433b2f4c3251cba'
'4030ee1c08dd1e843c0225b772360e76'
'6fd395bacbd7b6e47c7b74854b478363')
build() {
if ! locale -a | grep ^de_DE; then
echo "You need the de_DE locale to build gcc."
return 1
fi
cd ${srcdir}/gcc-${pkgver}
#cd ${srcdir}/gcc-${_snapshot}
# Don't install libiberty
sed -i 's/install_to_$(INSTALL_DEST) //' libiberty/Makefile.in
if [ "${CARCH}" = "x86_64" ]; then
patch -Np1 -i ../gcc_pure64.patch || return 1
fi
patch -Np0 -i ${srcdir}/gcc-hash-style-both.patch || return 1
# Don't run fixincludes
sed -i -e 's@\./fixinc\.sh@-c true@' gcc/Makefile.in
mkdir build
cd build
../configure --prefix=/usr --enable-shared \
--enable-languages=c,c++,fortran,objc,obj-c++ --enable-threads=posix \
--enable-__cxa_atexit --disable-multilib --libdir=/usr/lib \
--libexecdir=/usr/lib --enable-clocale=gnu --disable-libstdcxx-pch \
--with-tune=generic
make || return 1
make -j1 DESTDIR=${pkgdir} install-target-libstdc++-v3 install-target-libmudflap install-target-libgomp install-target-libssp install-target-libgfortran install-target-libobjc install-target-libgcc || return 1
# Cleanup, libgomp installs the whole compiler it seems...
rm -rf ${pkgdir}/usr/include
rm -rf ${pkgdir}/usr/lib/gcc
rm -rf ${pkgdir}/usr/bin
rm -rf ${pkgdir}/usr{,share}/man
find ${pkgdir} -name gcc.mo -delete
}

View file

@ -0,0 +1,163 @@
#! /bin/sh -e
# DP: Link using --hash-style=both (alpha, amd64, ia64, i386, powerpc, ppc64, s390, sparc)
dir=
if [ $# -eq 3 -a "$2" = '-d' ]; then
pdir="-d $3"
dir="$3/"
elif [ $# -ne 1 ]; then
echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
exit 1
fi
case "$1" in
-patch)
patch $pdir -f --no-backup-if-mismatch -p0 < $0
#cd ${dir}gcc && autoconf
;;
-unpatch)
patch $pdir -f --no-backup-if-mismatch -R -p0 < $0
#rm ${dir}gcc/configure
;;
*)
echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
exit 1
esac
exit 0
2006-07-11 Jakub Jelinek <jakub@redhat.com>
* config/i386/linux.h (LINK_SPEC): Add --hash-style=both.
* config/i386/linux64.h (LINK_SPEC): Likewise.
* config/rs6000/sysv4.h (LINK_OS_LINUX_SPEC): Likewise.
* config/rs6000/linux64.h (LINK_OS_LINUX_SPEC32,
LINK_OS_LINUX_SPEC64): Likewise.
* config/s390/linux.h (LINK_SPEC): Likewise.
* config/ia64/linux.h (LINK_SPEC): Likewise.
* config/sparc/linux.h (LINK_SPEC): Likewise.
* config/sparc/linux64.h (LINK_SPEC, LINK_ARCH32_SPEC,
LINK_ARCH64_SPEC): Likewise.
* config/alpha/linux-elf.h (LINK_SPEC): Likewise.
--- gcc/config/alpha/linux-elf.h.orig 2007-08-04 08:55:58.000000000 +0200
+++ gcc/config/alpha/linux-elf.h 2007-09-01 15:47:26.605865578 +0200
@@ -39,7 +39,7 @@
#define ELF_DYNAMIC_LINKER LINUX_DYNAMIC_LINKER
-#define LINK_SPEC "-m elf64alpha %{G*} %{relax:-relax} \
+#define LINK_SPEC "-m elf64alpha --hash-style=both %{G*} %{relax:-relax} \
%{O*:-O3} %{!O*:-O1} \
%{shared:-shared} \
%{!shared: \
--- gcc/config/s390/linux.h.orig 2007-08-04 08:55:59.000000000 +0200
+++ gcc/config/s390/linux.h 2007-09-01 15:47:26.605865578 +0200
@@ -77,7 +77,7 @@
#undef LINK_SPEC
#define LINK_SPEC \
- "%{m31:-m elf_s390}%{m64:-m elf64_s390} \
+ "%{m31:-m elf_s390}%{m64:-m elf64_s390} --hash-style=both \
%{shared:-shared} \
%{!shared: \
%{static:-static} \
--- gcc/config/sparc/linux.h.orig 2007-08-04 08:56:01.000000000 +0200
+++ gcc/config/sparc/linux.h 2007-09-01 15:47:26.605865578 +0200
@@ -132,7 +132,7 @@
#undef LINK_SPEC
-#define LINK_SPEC "-m elf32_sparc -Y P,/usr/lib %{shared:-shared} \
+#define LINK_SPEC "-m elf32_sparc --hash-style=both -Y P,/usr/lib %{shared:-shared} \
%{!mno-relax:%{!r:-relax}} \
%{!shared: \
%{!ibcs: \
--- gcc/config/sparc/linux64.h.orig 2007-08-04 08:56:01.000000000 +0200
+++ gcc/config/sparc/linux64.h 2007-09-01 15:47:26.605865578 +0200
@@ -166,7 +166,7 @@
{ "link_arch_default", LINK_ARCH_DEFAULT_SPEC }, \
{ "link_arch", LINK_ARCH_SPEC },
-#define LINK_ARCH32_SPEC "-m elf32_sparc -Y P,%R/usr/lib %{shared:-shared} \
+#define LINK_ARCH32_SPEC "-m elf32_sparc --hash-style=both -Y P,%R/usr/lib %{shared:-shared} \
%{!shared: \
%{!ibcs: \
%{!static: \
@@ -175,7 +175,7 @@
%{static:-static}}} \
"
-#define LINK_ARCH64_SPEC "-m elf64_sparc -Y P,%R/usr/lib64 %{shared:-shared} \
+#define LINK_ARCH64_SPEC "-m elf64_sparc --hash-style=both -Y P,%R/usr/lib64 %{shared:-shared} \
%{!shared: \
%{!ibcs: \
%{!static: \
@@ -256,7 +256,7 @@
#else /* !SPARC_BI_ARCH */
#undef LINK_SPEC
-#define LINK_SPEC "-m elf64_sparc -Y P,%R/usr/lib64 %{shared:-shared} \
+#define LINK_SPEC "-m elf64_sparc --hash-style=both -Y P,%R/usr/lib64 %{shared:-shared} \
%{!shared: \
%{!ibcs: \
%{!static: \
--- gcc/config/i386/linux.h.orig 2007-08-04 08:56:07.000000000 +0200
+++ gcc/config/i386/linux.h 2007-09-01 15:47:26.605865578 +0200
@@ -108,7 +108,7 @@
{ "dynamic_linker", LINUX_DYNAMIC_LINKER }
#undef LINK_SPEC
-#define LINK_SPEC "-m %(link_emulation) %{shared:-shared} \
+#define LINK_SPEC "-m %(link_emulation) --hash-style=both %{shared:-shared} \
%{!shared: \
%{!ibcs: \
%{!static: \
--- gcc/config/i386/linux64.h.orig 2007-08-04 08:56:07.000000000 +0200
+++ gcc/config/i386/linux64.h 2007-09-01 15:48:27.336781690 +0200
@@ -65,7 +65,7 @@
#endif
#undef LINK_SPEC
-#define LINK_SPEC "%{" SPEC_64 ":-m elf_x86_64} %{" SPEC_32 ":-m elf_i386} \
+#define LINK_SPEC "%{" SPEC_64 ":-m elf_x86_64} %{" SPEC_32 ":-m elf_i386} --hash-style=both \
%{shared:-shared} \
%{!shared: \
%{!static: \
--- gcc/config/ia64/linux.h.orig 2006-12-12 18:59:53.000000000 +0100
+++ gcc/config/ia64/linux.h 2007-09-01 15:47:26.605865578 +0200
@@ -40,7 +40,7 @@
#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux-ia64.so.2"
#undef LINK_SPEC
-#define LINK_SPEC "\
+#define LINK_SPEC "--hash-style=both \
%{shared:-shared} \
%{!shared: \
%{!static: \
--- gcc/config/rs6000/sysv4.h.orig 2007-08-08 23:37:49.000000000 +0200
+++ gcc/config/rs6000/sysv4.h 2007-09-01 15:47:26.615865729 +0200
@@ -901,7 +901,7 @@
#define LINUX_DYNAMIC_LINKER \
CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER)
-#define LINK_OS_LINUX_SPEC "-m elf32ppclinux %{!shared: %{!static: \
+#define LINK_OS_LINUX_SPEC "-m elf32ppclinux --hash-style=both %{!shared: %{!static: \
%{rdynamic:-export-dynamic} \
%{!dynamic-linker:-dynamic-linker " LINUX_DYNAMIC_LINKER "}}}"
--- gcc/config/rs6000/linux64.h.orig 2007-08-04 08:56:12.000000000 +0200
+++ gcc/config/rs6000/linux64.h 2007-09-01 15:47:26.615865729 +0200
@@ -354,11 +354,11 @@
CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER64, UCLIBC_DYNAMIC_LINKER64)
-#define LINK_OS_LINUX_SPEC32 "-m elf32ppclinux %{!shared: %{!static: \
+#define LINK_OS_LINUX_SPEC32 "-m elf32ppclinux --hash-style=both %{!shared: %{!static: \
%{rdynamic:-export-dynamic} \
%{!dynamic-linker:-dynamic-linker " LINUX_DYNAMIC_LINKER32 "}}}"
-#define LINK_OS_LINUX_SPEC64 "-m elf64ppc %{!shared: %{!static: \
+#define LINK_OS_LINUX_SPEC64 "-m elf64ppc --hash-style=both %{!shared: %{!static: \
%{rdynamic:-export-dynamic} \
%{!dynamic-linker:-dynamic-linker " LINUX_DYNAMIC_LINKER64 "}}}"

View file

@ -0,0 +1,26 @@
diff -Naur gcc-4.2.0.orig/gcc/config/i386/linux64.h gcc-4.2.0/gcc/config/i386/linux64.h
--- gcc-4.2.0.orig/gcc/config/i386/linux64.h 2007-05-16 19:21:19.000000000 -0400
+++ gcc-4.2.0/gcc/config/i386/linux64.h 2007-05-18 17:04:05.000000000 -0400
@@ -49,8 +49,8 @@
When the -shared link option is used a final link is not being
done. */
-#define GLIBC_DYNAMIC_LINKER32 "/lib/ld-linux.so.2"
-#define GLIBC_DYNAMIC_LINKER64 "/lib64/ld-linux-x86-64.so.2"
+#define GLIBC_DYNAMIC_LINKER32 "/lib32/ld-linux.so.2"
+#define GLIBC_DYNAMIC_LINKER64 "/lib/ld-linux-x86-64.so.2"
#undef LINK_SPEC
#define LINK_SPEC "%{!m32:-m elf_x86_64} %{m32:-m elf_i386} \
diff -Naur gcc-4.2.0.orig/gcc/config/i386/t-linux64 gcc-4.2.0/gcc/config/i386/t-linux64
--- gcc-4.2.0.orig/gcc/config/i386/t-linux64 2007-05-16 19:21:19.000000000 -0400
+++ gcc-4.2.0/gcc/config/i386/t-linux64 2007-05-18 17:04:36.000000000 -0400
@@ -6,7 +6,7 @@
MULTILIB_OPTIONS = m64/m32
MULTILIB_DIRNAMES = 64 32
-MULTILIB_OSDIRNAMES = ../lib64 $(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib)
+MULTILIB_OSDIRNAMES = ../lib ../lib32
LIBGCC = stmp-multilib
INSTALL_LIBGCC = install-multilib

View file

@ -0,0 +1,163 @@
#! /bin/sh -e
# DP: Link using --hash-style=both (alpha, amd64, ia64, i386, powerpc, ppc64, s390, sparc)
dir=
if [ $# -eq 3 -a "$2" = '-d' ]; then
pdir="-d $3"
dir="$3/"
elif [ $# -ne 1 ]; then
echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
exit 1
fi
case "$1" in
-patch)
patch $pdir -f --no-backup-if-mismatch -p0 < $0
#cd ${dir}gcc && autoconf
;;
-unpatch)
patch $pdir -f --no-backup-if-mismatch -R -p0 < $0
#rm ${dir}gcc/configure
;;
*)
echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
exit 1
esac
exit 0
2006-07-11 Jakub Jelinek <jakub@redhat.com>
* config/i386/linux.h (LINK_SPEC): Add --hash-style=both.
* config/i386/linux64.h (LINK_SPEC): Likewise.
* config/rs6000/sysv4.h (LINK_OS_LINUX_SPEC): Likewise.
* config/rs6000/linux64.h (LINK_OS_LINUX_SPEC32,
LINK_OS_LINUX_SPEC64): Likewise.
* config/s390/linux.h (LINK_SPEC): Likewise.
* config/ia64/linux.h (LINK_SPEC): Likewise.
* config/sparc/linux.h (LINK_SPEC): Likewise.
* config/sparc/linux64.h (LINK_SPEC, LINK_ARCH32_SPEC,
LINK_ARCH64_SPEC): Likewise.
* config/alpha/linux-elf.h (LINK_SPEC): Likewise.
--- gcc/config/alpha/linux-elf.h.orig 2007-08-04 08:55:58.000000000 +0200
+++ gcc/config/alpha/linux-elf.h 2007-09-01 15:47:26.605865578 +0200
@@ -39,7 +39,7 @@
#define ELF_DYNAMIC_LINKER LINUX_DYNAMIC_LINKER
-#define LINK_SPEC "-m elf64alpha %{G*} %{relax:-relax} \
+#define LINK_SPEC "-m elf64alpha --hash-style=both %{G*} %{relax:-relax} \
%{O*:-O3} %{!O*:-O1} \
%{shared:-shared} \
%{!shared: \
--- gcc/config/s390/linux.h.orig 2007-08-04 08:55:59.000000000 +0200
+++ gcc/config/s390/linux.h 2007-09-01 15:47:26.605865578 +0200
@@ -77,7 +77,7 @@
#undef LINK_SPEC
#define LINK_SPEC \
- "%{m31:-m elf_s390}%{m64:-m elf64_s390} \
+ "%{m31:-m elf_s390}%{m64:-m elf64_s390} --hash-style=both \
%{shared:-shared} \
%{!shared: \
%{static:-static} \
--- gcc/config/sparc/linux.h.orig 2007-08-04 08:56:01.000000000 +0200
+++ gcc/config/sparc/linux.h 2007-09-01 15:47:26.605865578 +0200
@@ -132,7 +132,7 @@
#undef LINK_SPEC
-#define LINK_SPEC "-m elf32_sparc -Y P,/usr/lib %{shared:-shared} \
+#define LINK_SPEC "-m elf32_sparc --hash-style=both -Y P,/usr/lib %{shared:-shared} \
%{!mno-relax:%{!r:-relax}} \
%{!shared: \
%{!ibcs: \
--- gcc/config/sparc/linux64.h.orig 2007-08-04 08:56:01.000000000 +0200
+++ gcc/config/sparc/linux64.h 2007-09-01 15:47:26.605865578 +0200
@@ -166,7 +166,7 @@
{ "link_arch_default", LINK_ARCH_DEFAULT_SPEC }, \
{ "link_arch", LINK_ARCH_SPEC },
-#define LINK_ARCH32_SPEC "-m elf32_sparc -Y P,%R/usr/lib %{shared:-shared} \
+#define LINK_ARCH32_SPEC "-m elf32_sparc --hash-style=both -Y P,%R/usr/lib %{shared:-shared} \
%{!shared: \
%{!ibcs: \
%{!static: \
@@ -175,7 +175,7 @@
%{static:-static}}} \
"
-#define LINK_ARCH64_SPEC "-m elf64_sparc -Y P,%R/usr/lib64 %{shared:-shared} \
+#define LINK_ARCH64_SPEC "-m elf64_sparc --hash-style=both -Y P,%R/usr/lib64 %{shared:-shared} \
%{!shared: \
%{!ibcs: \
%{!static: \
@@ -256,7 +256,7 @@
#else /* !SPARC_BI_ARCH */
#undef LINK_SPEC
-#define LINK_SPEC "-m elf64_sparc -Y P,%R/usr/lib64 %{shared:-shared} \
+#define LINK_SPEC "-m elf64_sparc --hash-style=both -Y P,%R/usr/lib64 %{shared:-shared} \
%{!shared: \
%{!ibcs: \
%{!static: \
--- gcc/config/i386/linux.h.orig 2007-08-04 08:56:07.000000000 +0200
+++ gcc/config/i386/linux.h 2007-09-01 15:47:26.605865578 +0200
@@ -108,7 +108,7 @@
{ "dynamic_linker", LINUX_DYNAMIC_LINKER }
#undef LINK_SPEC
-#define LINK_SPEC "-m %(link_emulation) %{shared:-shared} \
+#define LINK_SPEC "-m %(link_emulation) --hash-style=both %{shared:-shared} \
%{!shared: \
%{!ibcs: \
%{!static: \
--- gcc/config/i386/linux64.h.orig 2007-08-04 08:56:07.000000000 +0200
+++ gcc/config/i386/linux64.h 2007-09-01 15:48:27.336781690 +0200
@@ -65,7 +65,7 @@
#endif
#undef LINK_SPEC
-#define LINK_SPEC "%{" SPEC_64 ":-m elf_x86_64} %{" SPEC_32 ":-m elf_i386} \
+#define LINK_SPEC "%{" SPEC_64 ":-m elf_x86_64} %{" SPEC_32 ":-m elf_i386} --hash-style=both \
%{shared:-shared} \
%{!shared: \
%{!static: \
--- gcc/config/ia64/linux.h.orig 2006-12-12 18:59:53.000000000 +0100
+++ gcc/config/ia64/linux.h 2007-09-01 15:47:26.605865578 +0200
@@ -40,7 +40,7 @@
#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux-ia64.so.2"
#undef LINK_SPEC
-#define LINK_SPEC "\
+#define LINK_SPEC "--hash-style=both \
%{shared:-shared} \
%{!shared: \
%{!static: \
--- gcc/config/rs6000/sysv4.h.orig 2007-08-08 23:37:49.000000000 +0200
+++ gcc/config/rs6000/sysv4.h 2007-09-01 15:47:26.615865729 +0200
@@ -901,7 +901,7 @@
#define LINUX_DYNAMIC_LINKER \
CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER)
-#define LINK_OS_LINUX_SPEC "-m elf32ppclinux %{!shared: %{!static: \
+#define LINK_OS_LINUX_SPEC "-m elf32ppclinux --hash-style=both %{!shared: %{!static: \
%{rdynamic:-export-dynamic} \
%{!dynamic-linker:-dynamic-linker " LINUX_DYNAMIC_LINKER "}}}"
--- gcc/config/rs6000/linux64.h.orig 2007-08-04 08:56:12.000000000 +0200
+++ gcc/config/rs6000/linux64.h 2007-09-01 15:47:26.615865729 +0200
@@ -354,11 +354,11 @@
CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER64, UCLIBC_DYNAMIC_LINKER64)
-#define LINK_OS_LINUX_SPEC32 "-m elf32ppclinux %{!shared: %{!static: \
+#define LINK_OS_LINUX_SPEC32 "-m elf32ppclinux --hash-style=both %{!shared: %{!static: \
%{rdynamic:-export-dynamic} \
%{!dynamic-linker:-dynamic-linker " LINUX_DYNAMIC_LINKER32 "}}}"
-#define LINK_OS_LINUX_SPEC64 "-m elf64ppc %{!shared: %{!static: \
+#define LINK_OS_LINUX_SPEC64 "-m elf64ppc --hash-style=both %{!shared: %{!static: \
%{rdynamic:-export-dynamic} \
%{!dynamic-linker:-dynamic-linker " LINUX_DYNAMIC_LINKER64 "}}}"

22
core/gcc/gcc.install Normal file
View file

@ -0,0 +1,22 @@
infodir=/usr/share/info
filelist=(cpp.info cppinternals.info gcc.info gccinstall.info gccint.info gfortran.info libgomp.info)
post_install() {
[ -x usr/bin/install-info ] || return 0
for file in ${filelist[@]}; do
install-info $infodir/$file.gz $infodir/dir 2> /dev/null
done
}
post_upgrade() {
post_install $1
}
pre_remove() {
[ -x usr/bin/install-info ] || return 0
for file in ${filelist[@]}; do
install-info --delete $infodir/$file.gz $infodir/dir 2> /dev/null
done
}
# vim:set ts=2 sw=2 et:

26
core/gcc/gcc_pure64.patch Normal file
View file

@ -0,0 +1,26 @@
diff -Naur gcc-4.2.0.orig/gcc/config/i386/linux64.h gcc-4.2.0/gcc/config/i386/linux64.h
--- gcc-4.2.0.orig/gcc/config/i386/linux64.h 2007-05-16 19:21:19.000000000 -0400
+++ gcc-4.2.0/gcc/config/i386/linux64.h 2007-05-18 17:04:05.000000000 -0400
@@ -49,8 +49,8 @@
When the -shared link option is used a final link is not being
done. */
-#define GLIBC_DYNAMIC_LINKER32 "/lib/ld-linux.so.2"
-#define GLIBC_DYNAMIC_LINKER64 "/lib64/ld-linux-x86-64.so.2"
+#define GLIBC_DYNAMIC_LINKER32 "/lib32/ld-linux.so.2"
+#define GLIBC_DYNAMIC_LINKER64 "/lib/ld-linux-x86-64.so.2"
#undef LINK_SPEC
#define LINK_SPEC "%{!m32:-m elf_x86_64} %{m32:-m elf_i386} \
diff -Naur gcc-4.2.0.orig/gcc/config/i386/t-linux64 gcc-4.2.0/gcc/config/i386/t-linux64
--- gcc-4.2.0.orig/gcc/config/i386/t-linux64 2007-05-16 19:21:19.000000000 -0400
+++ gcc-4.2.0/gcc/config/i386/t-linux64 2007-05-18 17:04:36.000000000 -0400
@@ -6,7 +6,7 @@
MULTILIB_OPTIONS = m64/m32
MULTILIB_DIRNAMES = 64 32
-MULTILIB_OSDIRNAMES = ../lib64 $(if $(wildcard $(shell echo $(SYSTEM_HEADER_DIR))/../../usr/lib32),../lib32,../lib)
+MULTILIB_OSDIRNAMES = ../lib ../lib32
LIBGCC = stmp-multilib
INSTALL_LIBGCC = install-multilib

21
core/gdbm/gdbm.install Normal file
View file

@ -0,0 +1,21 @@
infodir=/usr/share/info
filelist=(gdbm.info)
post_install() {
[ -x usr/bin/install-info ] || return 0
for file in ${filelist[@]}; do
usr/bin/install-info $infodir/$file $infodir/dir 2> /dev/null
done
}
post_upgrade() {
post_install $1
}
pre_remove() {
[ -x usr/bin/install-info ] || return 0
for file in ${filelist[@]}; do
usr/bin/install-info --delete $infodir/$file $infodir/dir 2> /dev/null
done
}

View file

@ -0,0 +1,22 @@
infodir=/usr/share/info
filelist=(gettext.info.gz autosprintf.info.gz)
post_install() {
[ -x usr/bin/install-info ] || return 0
for file in ${filelist[@]}; do
install-info $infodir/$file $infodir/dir 2> /dev/null
done
}
post_upgrade() {
post_install $1
}
pre_remove() {
[ -x usr/bin/install-info ] || return 0
for file in ${filelist[@]}; do
install-info --delete $infodir/$file $infodir/dir 2> /dev/null
done
}
# vim:set ts=2 sw=2 et:

62
core/glibc/ChangeLog Normal file
View file

@ -0,0 +1,62 @@
glibc-2.10.1-2
- readd bz4781 patch
glibc-2.10.1-1
- bump to 2.10 branch
- switch checkout to git
- remove patches for nss and gdb
glibc 2.9-7
- actually apply patch "applied" in 2.9-6...
glibc 2.9-6
- apply upstream patch to fix gdb issue
due to gcc optimization
glibc 2.9-5
- gcc-4.4 toolchain build
- new CVS checkout
- removed glibc-2.5-localedef_segfault-1.patch
- removed glibc-2.7-bz4781.patch
- compress info pages
- update handling
glibc 2.9-3
- remove texinfo dep
- only call install-info when needed
glibc 2.9-2
- apply Fedora10 changes to fix
name resolving issues
glibc 2.9-1
- bump to new 2.9 branch
glibc 2.8-2
- fix an old memory issue again
glibc 2.8-1
- no more tarballs
- we checkout the current release branch incl. libidn
- cleanup the patches
glibc 2.7-6
- fix broken locales with upstream changes
- disable the whole weekday patch, fixes #8530
glibc 2.7-5
- fix a regression: http://sourceware.org/bugzilla/show_bug.cgi?id=4781
mainly for x86_64 where using gcc-gcj eats all memory
glibc 2.7-4
- extract /etc/locale.gen from sources to have all new locales supported
- mask other broken locales / added a comment to post.install message
- apply changes from Debian 2.7-exp7 pkg
to fix some broken locales
glibc 2.7-3
- removed locale/check-unknown-symbols.diff
localedata/tailor-iso14651_t1.diff partly
to fix broken et_EE locale
- switch to compressed patches
- added ChangeLog

View file

@ -0,0 +1,42 @@
diff -Naur glibc-old/sysdeps/unix/sysv/linux/i386/clone.S glibc/sysdeps/unix/sysv/linux/i386/clone.S
--- glibc-old/sysdeps/unix/sysv/linux/i386/clone.S 2009-05-09 13:35:30.000000000 +1000
+++ glibc/sysdeps/unix/sysv/linux/i386/clone.S 2009-05-23 13:27:46.000000000 +1000
@@ -120,9 +120,6 @@
ret
L(thread_start):
- cfi_startproc;
- /* Clearing frame pointer is insufficient, use CFI. */
- cfi_undefined (eip);
/* Note: %esi is zero. */
movl %esi,%ebp /* terminate the stack frame */
#ifdef RESET_PID
@@ -155,7 +152,6 @@
jmp L(haspid)
.previous
#endif
- cfi_endproc;
cfi_startproc
PSEUDO_END (BP_SYM (__clone))
diff -Naur glibc-old/sysdeps/unix/sysv/linux/x86_64/clone.S glibc/sysdeps/unix/sysv/linux/x86_64/clone.S
--- glibc-old/sysdeps/unix/sysv/linux/x86_64/clone.S 2009-05-09 13:35:30.000000000 +1000
+++ glibc/sysdeps/unix/sysv/linux/x86_64/clone.S 2009-05-23 13:27:46.000000000 +1000
@@ -89,9 +89,6 @@
ret
L(thread_start):
- cfi_startproc;
- /* Clearing frame pointer is insufficient, use CFI. */
- cfi_undefined (rip);
/* Clear the frame pointer. The ABI suggests this be done, to mark
the outermost frame obviously. */
xorl %ebp, %ebp
@@ -116,7 +113,6 @@
/* Call exit with return value from function call. */
movq %rax, %rdi
call HIDDEN_JUMPTARGET (_exit)
- cfi_endproc;
cfi_startproc;
PSEUDO_END (BP_SYM (__clone))

View file

@ -0,0 +1,13 @@
timezone data has been split into the package sys-libs/timezone-data
--- glibc-2.4/Makeconfig
+++ glibc-2.4/Makeconfig
@@ -931,7 +931,7 @@
stdlib stdio-common libio malloc string wcsmbs time dirent \
grp pwd posix io termios resource misc socket sysvipc gmon \
gnulib iconv iconvdata wctype manual shadow gshadow po argp \
- crypt nss localedata timezone rt conform debug \
+ crypt nss localedata rt conform debug \
$(add-on-subdirs) $(dlfcn) $(binfmt-subdir)
ifndef avoid-generated

View file

@ -0,0 +1,106 @@
From: Ulrich Drepper <drepper@redhat.com>
Date: Sun, 26 Jul 2009 19:55:03 +0000 (-0700)
Subject: Compatibility of signalfd/eventfd with older kernels.
X-Git-Tag: fedora/glibc-2.10.90-9~1^2~4
X-Git-Url: http://repo.or.cz/w/glibc.git?a=commitdiff_plain;h=aa7492d2
Compatibility of signalfd/eventfd with older kernels.
---
diff --git a/sysdeps/unix/sysv/linux/eventfd.c b/sysdeps/unix/sysv/linux/eventfd.c
index 4cd5579..7f69ecd 100644
--- a/sysdeps/unix/sysv/linux/eventfd.c
+++ b/sysdeps/unix/sysv/linux/eventfd.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2007, 2008 Free Software Foundation, Inc.
+/* Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -19,14 +19,21 @@
#include <errno.h>
#include <sys/eventfd.h>
#include <sysdep.h>
+#include <kernel-features.h>
int
eventfd (int count, int flags)
{
#ifdef __NR_eventfd2
- return INLINE_SYSCALL (eventfd2, 2, count, flags);
-#else
+ int res = INLINE_SYSCALL (eventfd2, 2, count, flags);
+# ifndef __ASSUME_EVENTFD2
+ if (res != -1 || errno != ENOSYS)
+# endif
+ return res;
+#endif
+
+#ifndef __ASSUME_EVENTFD2
/* The old system call has no flag parameter which is bad. So we have
to wait until we have to support to pass additional values to the
kernel (sys_indirect) before implementing setting flags like
@@ -43,5 +50,7 @@ eventfd (int count, int flags)
__set_errno (ENOSYS);
return -1;
# endif
+#elif !defined __NR_eventfd2
+# error "__ASSUME_EVENTFD2 defined but not __NR_eventfd2"
#endif
}
diff --git a/sysdeps/unix/sysv/linux/kernel-features.h b/sysdeps/unix/sysv/linux/kernel-features.h
index 4562515..ff065ef 100644
--- a/sysdeps/unix/sysv/linux/kernel-features.h
+++ b/sysdeps/unix/sysv/linux/kernel-features.h
@@ -516,6 +516,8 @@
# define __ASSUME_SOCK_CLOEXEC 1
# define __ASSUME_IN_NONBLOCK 1
# define __ASSUME_PIPE2 1
+# define __ASSUME_EVENTFD2 1
+# define __ASSUME_SIGNALFD4 1
#endif
/* Support for the accept4 syscall was added in 2.6.28. */
diff --git a/sysdeps/unix/sysv/linux/signalfd.c b/sysdeps/unix/sysv/linux/signalfd.c
index 9898f29..c2d974a 100644
--- a/sysdeps/unix/sysv/linux/signalfd.c
+++ b/sysdeps/unix/sysv/linux/signalfd.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2007, 2008 Free Software Foundation, Inc.
+/* Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -20,14 +20,21 @@
#include <signal.h>
#include <sys/signalfd.h>
#include <sysdep.h>
+#include <kernel-features.h>
int
signalfd (int fd, const sigset_t *mask, int flags)
{
#ifdef __NR_signalfd4
- return INLINE_SYSCALL (signalfd4, 4, fd, mask, _NSIG / 8, flags);
-#else
+ int res = INLINE_SYSCALL (signalfd4, 4, fd, mask, _NSIG / 8, flags);
+# ifndef __ASSUME_SIGNALFD4
+ if (res != -1 || errno != ENOSYS)
+# endif
+ return res;
+#endif
+
+#ifndef __ASSUME_SIGNALFD4
/* The old system call has no flag parameter which is bad. So we have
to wait until we have to support to pass additional values to the
kernel (sys_indirect) before implementing setting flags like
@@ -44,5 +51,7 @@ signalfd (int fd, const sigset_t *mask, int flags)
__set_errno (ENOSYS);
return -1;
# endif
+#elif !defined __NR_signalfd4
+# error "__ASSUME_SIGNALFD4 defined but not __NR_signalfd4"
#endif
}

20
core/gmp/gmp.install Normal file
View file

@ -0,0 +1,20 @@
info_dir=/usr/share/info
info_files=(gmp.info gmp.info-1 gmp.info-2)
post_install() {
[ -x usr/bin/install-info ] || return 0
for f in ${info_files[@]}; do
install-info ${info_dir}/$f.gz ${info_dir}/dir 2> /dev/null
done
}
post_upgrade() {
post_install $1
}
pre_remove() {
[ -x usr/bin/install-info ] || return 0
for f in ${info_files[@]}; do
install-info --delete ${info_dir}/$f.gz ${info_dir}/dir 2> /dev/null
done
}

28
core/gpm/ChangeLog Normal file
View file

@ -0,0 +1,28 @@
2009-09-20 Eric Belanger <eric@archlinux.org>
* gpm 1.20.6-3
* Updated /dev/psaux to /dev/input/mice in stock config (close FS#16289)
2009-09-20 Eric Belanger <eric@archlinux.org>
* gpm 1.20.6-2
* Updated stock config and fixed rc.d script (close FS#16126)
* Removed array in install scriptlet
2009-02-09 Eric Belanger <eric@archlinux.org>
* gpm 1.20.6-1
* Upstream update
* Added info file support
2008-06-16 Eric Belanger <eric@archlinux.org>
* gpm 1.20.5-1
* Upstream update
* Added sanity checks
2008-04-17 Eric Belanger <eric@archlinux.org>
* gpm 1.20.3-1
* Upstream update
* Added missing /usr/lib/libgpm.so.1 symlink (close FS#9949)

35
core/gpm/PKGBUILD Normal file
View file

@ -0,0 +1,35 @@
# $Id: PKGBUILD 52495 2009-09-21 02:38:38Z eric $
# Maintainer: Eric Belanger <eric@archlinux.org>
# Contributor: Tom Newsom <Jeepster@gmx.co.uk>
pkgname=gpm
pkgver=1.20.6
pkgrel=3
pkgdesc="A mouse server for the console and xterm"
arch=('i686' 'x86_64')
url="http://unix.schottelius.org/gpm/"
license=('GPL')
depends=('ncurses' 'texinfo')
backup=('etc/conf.d/gpm')
options=('!makeflags')
install=gpm.install
source=(http://unix.schottelius.org/gpm/archives/${pkgname}-${pkgver}.tar.bz2 \
gpm gpm.conf.d)
md5sums=('6b534da16dc1b28ba828dea89e520f6f' '945ecde0836687e05c13ea837092ea6c'\
'63e599950946e5f5a649432510aacf4c')
sha1sums=('f3bb9272878b7934968381c8b25edab359114150' '19e1feb1493373512a77801699df012d186336ea'\
'e483f893b4e6b9e1221a208527d728ffefe5438e')
build() {
cd "${srcdir}/${pkgname}-${pkgver}"
./configure --prefix=/usr --sysconfdir=/etc || return 1
make || return 1
make DESTDIR="${pkgdir}" install || return 1
install -D -m755 ../gpm "${pkgdir}/etc/rc.d/gpm" || return 1
install -D -m644 ../gpm.conf.d "${pkgdir}/etc/conf.d/gpm" || return 1
# library fixes
cd "${pkgdir}/usr/lib/"
ln -s libgpm.so.2.* libgpm.so || return 1
chmod 755 "${pkgdir}"/usr/lib/libgpm.so.* || return 1
}

41
core/gpm/gpm Executable file
View file

@ -0,0 +1,41 @@
#!/bin/bash
# source application-specific settings
GPM_ARGS=
[ -f /etc/conf.d/gpm ] && . /etc/conf.d/gpm
. /etc/rc.conf
. /etc/rc.d/functions
PID=$(pidof -o %PPID /usr/sbin/gpm)
case "$1" in
start)
stat_busy "Starting GPM Daemon"
[ -z "$PID" ] && /usr/sbin/gpm ${GPM_ARGS}
PID=$(pidof -o %PPID /usr/sbin/gpm)
if [ -z "$PID" ]; then
stat_fail
else
add_daemon gpm
stat_done
fi
;;
stop)
stat_busy "Stopping GPM Daemon"
[ ! -z "$PID" ] && kill $PID &> /dev/null
if [ $? -gt 0 ]; then
stat_fail
else
rm_daemon gpm
stat_done
fi
;;
restart)
$0 stop
sleep 1
$0 start
;;
*)
echo "usage: $0 {start|stop|restart}"
esac
exit 0

4
core/gpm/gpm.conf.d Normal file
View file

@ -0,0 +1,4 @@
#
# Parameters to be passed to gpm
#
GPM_ARGS="-m /dev/input/mice"

14
core/gpm/gpm.install Normal file
View file

@ -0,0 +1,14 @@
infodir=/usr/share/info
file=gpm.info.gz
post_install() {
install-info $infodir/$file $infodir/dir 2> /dev/null
}
post_upgrade() {
post_install $1
}
pre_remove() {
install-info --delete $infodir/$file $infodir/dir 2> /dev/null
}

View file

@ -0,0 +1,75 @@
The DFA algorithm is slow with mutlibytes characters.
This patch disables the DFA algorithm, but it can be re-enabled by setting
the GREP_USE_DFA environment variable.
This patch requires 64-egf-speedup.patch
--- a/src/search.c.orig 2005-09-06 22:22:17.000000000 +0200
+++ b/src/search.c 2005-09-06 22:25:41.000000000 +0200
@@ -326,6 +326,8 @@
char eol = eolbyte;
int backref, start, len;
struct kwsmatch kwsm;
+ static int use_dfa;
+ static int use_dfa_checked = 0;
size_t i, ret_val;
#ifdef MBS_SUPPORT
int mb_cur_max = MB_CUR_MAX;
@@ -333,6 +335,26 @@
memset (&mbs, '\0', sizeof (mbstate_t));
#endif /* MBS_SUPPORT */
+ if (!use_dfa_checked)
+ {
+ char *grep_use_dfa = getenv ("GREP_USE_DFA");
+ if (!grep_use_dfa)
+ {
+#ifdef MBS_SUPPORT
+ /* Turn off DFA when processing multibyte input. */
+ use_dfa = (MB_CUR_MAX == 1);
+#else
+ use_dfa = 1;
+#endif /* MBS_SUPPORT */
+ }
+ else
+ {
+ use_dfa = atoi (grep_use_dfa);
+ }
+
+ use_dfa_checked = 1;
+ }
+
buflim = buf + size;
for (beg = end = buf; end < buflim; beg = end)
@@ -400,7 +422,8 @@
#endif /* MBS_SUPPORT */
(kwsm.index < kwset_exact_matches))
goto success;
- if (dfaexec (&dfa, beg, end - beg, &backref) == (size_t) -1)
+ if (use_dfa &&
+ dfaexec (&dfa, beg, end - beg, &backref) == (size_t) -1)
continue;
}
else
@@ -409,7 +432,9 @@
#ifdef MBS_SUPPORT
size_t bytes_left = 0;
#endif /* MBS_SUPPORT */
- size_t offset = dfaexec (&dfa, beg, buflim - beg, &backref);
+ size_t offset = 0;
+ if (use_dfa)
+ offset = dfaexec (&dfa, beg, buflim - beg, &backref);
if (offset == (size_t) -1)
break;
/* Narrow down to the line we've found. */
@@ -451,7 +476,7 @@
--beg;
}
/* Successful, no backreferences encountered! */
- if (!backref)
+ if (use_dfa && !backref)
goto success;
}
else

View file

@ -0,0 +1,41 @@
This fixes
echo Y | LC_ALL=en_US.UTF-8 grep -i '[y]'
The expected output is:
Y
Without this patch, it works on non UTF-8 environment, but fails on UTF-8
environment.
The definition of RE_ICASE comes from the glibc (/usr/include/regex.h)
Maybe lib/posix/regex.h should be removed to enforce the usage of the
glibc's regex.h
--- a/lib/posix/regex.h.orig 2004-01-05 12:09:12.984391131 +0000
+++ b/lib/posix/regex.h 2004-01-05 12:09:24.717990622 +0000
@@ -109,6 +109,10 @@
treated as 'a\{1'. */
#define RE_INVALID_INTERVAL_ORD (RE_DEBUG << 1)
+/* If this bit is set, then ignore case when matching.
+ If not set, then case is significant. */
+#define RE_ICASE (RE_INVALID_INTERVAL_ORD << 1)
+
/* This global variable defines the particular regexp syntax to use (for
some interfaces). When a regexp is compiled, the syntax used is
stored in the pattern buffer, so changing this does not affect
--- a/src/search.c 2009-02-11 17:15:24.000000000 +1100
+++ b/src/search.c 2009-02-11 17:23:48.000000000 +1100
@@ -172,10 +172,8 @@
char const *motif = pattern;
check_utf8 ();
-#if 0
if (match_icase)
syntax_bits |= RE_ICASE;
-#endif
re_set_syntax (syntax_bits);
dfasyntax (syntax_bits, match_icase, eolbyte);

119
core/grep/67-w.patch Normal file
View file

@ -0,0 +1,119 @@
--- a/src/search.c 2007-10-01 14:47:55.000000000 +0200
+++ b/src/search.c 2007-09-30 23:38:45.000000000 +0200
@@ -282,6 +282,7 @@
static int use_dfa_checked = 0;
size_t i, ret_val;
#ifdef MBS_SUPPORT
+ const char *last_char = NULL;
int mb_cur_max = MB_CUR_MAX;
mbstate_t mbs;
memset (&mbs, '\0', sizeof (mbstate_t));
@@ -338,6 +341,8 @@
while (bytes_left)
{
size_t mlen = mbrlen (beg, bytes_left, &mbs);
+
+ last_char = beg;
if (mlen == (size_t) -1 || mlen == 0)
{
/* Incomplete character: treat as single-byte. */
@@ -398,6 +403,8 @@
while (bytes_left)
{
size_t mlen = mbrlen (beg, bytes_left, &mbs);
+
+ last_char = beg;
if (mlen == (size_t) -1 || mlen == 0)
{
/* Incomplete character: treat as single-byte. */
@@ -475,10 +483,84 @@
if (match_words)
while (match <= best_match)
{
+ int lword_match = 0;
+ if (match == buf)
+ lword_match = 1;
+ else
+ {
+ assert (start > 0);
+#ifdef MBS_SUPPORT
+ if (mb_cur_max > 1)
+ {
+ const char *s;
+ int mr;
+ wchar_t pwc;
+ if (using_utf8)
+ {
+ s = match - 1;
+ while (s > buf
+ && (unsigned char) *s >= 0x80
+ && (unsigned char) *s <= 0xbf)
+ --s;
+ }
+ else
+ s = last_char;
+ mr = mbtowc (&pwc, s, match - s);
+ if (mr <= 0)
+ {
+ memset (&mbs, '\0', sizeof (mbstate_t));
+ lword_match = 1;
+ }
+ else if (!(iswalnum (pwc) || pwc == L'_')
+ && mr == (int) (match - s))
+ lword_match = 1;
+ }
+ else
+#endif /* MBS_SUPPORT */
+ if (!WCHAR ((unsigned char) match[-1]))
+ lword_match = 1;
+ }
+
+ if (lword_match)
+ {
+ int rword_match = 0;
+ if (start + len == end - beg - 1)
+ rword_match = 1;
+ else
+ {
+#ifdef MBS_SUPPORT
+ if (mb_cur_max > 1)
+ {
+ wchar_t nwc;
+ int mr;
+
+ mr = mbtowc (&nwc, buf + start + len,
+ end - buf - start - len - 1);
+ if (mr <= 0)
+ {
+ memset (&mbs, '\0', sizeof (mbstate_t));
+ rword_match = 1;
+ }
+ else if (!iswalnum (nwc) && nwc != L'_')
+ rword_match = 1;
+ }
+ else
+#endif /* MBS_SUPPORT */
+ if (!WCHAR ((unsigned char) match[len]))
+ rword_match = 1;
+ }
+
+ if (rword_match)
+ {
+ if (!start_ptr)
+ /* Returns the whole line. */
+ goto success;
+ else
+ {
+ goto assess_pattern_match;
+ }
+ }
+ }
- if ((match == buf || !WCHAR ((unsigned char) match[-1]))
- && (len == end - beg - 1
- || !WCHAR ((unsigned char) match[len])))
- goto assess_pattern_match;
if (len > 0)
{
/* Try a shorter length anchored at the same place. */

21
core/grep/grep.install Normal file
View file

@ -0,0 +1,21 @@
infodir=/usr/share/info
filelist=(grep.info)
post_install() {
[ -x usr/bin/install-info ] || return 0
for file in ${filelist[@]}; do
install-info $infodir/$file.gz $infodir/dir 2> /dev/null
done
}
post_upgrade() {
post_install $1
}
pre_remove() {
[ -x usr/bin/install-info ] || return 0
for file in ${filelist[@]}; do
install-info --delete $infodir/$file.gz $infodir/dir 2> /dev/null
done
}

40
core/groff/PKGBUILD Normal file
View file

@ -0,0 +1,40 @@
# $Id: PKGBUILD 53876 2009-10-03 18:11:12Z paul $
# Maintainer: judd <jvinet@zeroflux.org>
pkgname=groff
pkgver=1.20.1
pkgrel=3
pkgdesc="GNU troff text-formatting system"
arch=(i686 x86_64)
url="http://www.gnu.org/software/groff/groff.html"
license=('GPL')
groups=('base')
depends=('perl' 'gcc-libs' 'texinfo')
makedepends=('netpbm' 'psutils' 'ghostscript')
source=(ftp://ftp.gnu.org/gnu/groff/groff-$pkgver.tar.gz
site.tmac)
install=groff.install
md5sums=('48fa768dd6fdeb7968041dd5ae8e2b02'
'7b47109b2dd1797445c912574d8934a1')
build() {
cd $srcdir/$pkgname-$pkgver
./configure --prefix=/usr --without-x
mkdir -p $pkgdir/usr
make -j1 || return 1
make prefix=$pkgdir/usr install
cd $pkgdir/usr/bin
# needed for xman
ln -s eqn geqn
ln -s tbl gtbl
ln -s soelim zsoelim
rm -rf $pkgdir/usr/lib
# Fix some issues when encoding to utf8 man pages
# The output chars don't match keyboard chars...
cat $srcdir/site.tmac >> \
$pkgdir/usr/share/groff/site-tmac/man.local
cat $srcdir/site.tmac >> \
$pkgdir/usr/share/groff/site-tmac/mdoc.local
rm -f $pkgdir/usr/share/info/dir
}

20
core/groff/groff.install Normal file
View file

@ -0,0 +1,20 @@
infodir=/usr/share/info
filelist=(groff.info groff.info-1 groff.info-2 groff.info-3)
post_install() {
for file in ${filelist[@]}; do
install-info $infodir/$file $infodir/dir 2> /dev/null
done
}
post_upgrade() {
post_install $1
}
pre_remove() {
for file in ${filelist[@]}; do
install-info --delete $infodir/$file $infodir/dir 2> /dev/null
done
}
# vim:set ts=2 sw=2 et:

15
core/groff/site.tmac Normal file
View file

@ -0,0 +1,15 @@
.\" Character translations for non-keyboard
.\" characters - to make them searchable
.if '\*[.T]'utf8' \
. char \- \N'45'
. char - \N'45'
. char ' \N'39'
. char \' \N'39'
..
.\" Shut off SGR by default (groff colors)
.\" Require GROFF_SGR envvar defined to turn it on
.if '\V[GROFF_SGR]'' \
. output x X tty: sgr 0
..

View file

@ -0,0 +1,623 @@
Fix NX segfaulting on amd64.
Patch by Peter Jones.
http://lists.gnu.org/archive/html/bug-grub/2005-03/msg00011.html
--- grub-0.97/grub/asmstub.c
+++ grub-0.97/grub/asmstub.c
@@ -42,6 +42,7 @@
#include <sys/time.h>
#include <termios.h>
#include <signal.h>
+#include <sys/mman.h>
#ifdef __linux__
# include <sys/ioctl.h> /* ioctl */
@@ -79,7 +80,7 @@
struct apm_info apm_bios_info;
/* Emulation requirements. */
-char *grub_scratch_mem = 0;
+void *grub_scratch_mem = 0;
struct geometry *disks = 0;
@@ -103,14 +104,62 @@
static unsigned int serial_speed;
#endif /* SIMULATE_SLOWNESS_OF_SERIAL */
+/* This allocates page-aligned storage of the specified size, which must be
+ * a multiple of the page size as determined by calling sysconf(_SC_PAGESIZE)
+ */
+#ifdef __linux__
+static void *
+grub_mmap_alloc(size_t len)
+{
+ int mmap_flags = MAP_ANONYMOUS|MAP_PRIVATE|MAP_EXECUTABLE;
+
+#ifdef MAP_32BIT
+ mmap_flags |= MAP_32BIT;
+#endif
+ /* Mark the simulated stack executable, as GCC uses stack trampolines
+ * to implement nested functions. */
+ return mmap(NULL, len, PROT_READ|PROT_WRITE|PROT_EXEC, mmap_flags, -1, 0);
+}
+#else /* !defined(__linux__) */
+static void *
+grub_mmap_alloc(size_t len)
+{
+ int fd = 0, offset = 0, ret = 0;
+ void *pa = MAP_FAILED;
+ char template[] = "/tmp/grub_mmap_alloc_XXXXXX";
+ errno_t e;
+
+ fd = mkstemp(template);
+ if (fd < 0)
+ return pa;
+
+ unlink(template);
+
+ ret = ftruncate(fd, len);
+ if (ret < 0)
+ return pa;
+
+ /* Mark the simulated stack executable, as GCC uses stack trampolines
+ * to implement nested functions. */
+ pa = mmap(NULL, len, PROT_READ|PROT_WRITE|PROT_EXEC,
+ MAP_PRIVATE|MAP_EXECUTABLE, fd, offset);
+
+ e = errno;
+ close(fd);
+ errno = e;
+ return pa;
+}
+#endif /* defined(__linux__) */
+
/* The main entry point into this mess. */
int
grub_stage2 (void)
{
/* These need to be static, because they survive our stack transitions. */
static int status = 0;
- static char *realstack;
- char *scratch, *simstack;
+ static void *realstack;
+ void *simstack_alloc_base, *simstack;
+ size_t simstack_size, page_size;
int i;
/* We need a nested function so that we get a clean stack frame,
@@ -140,9 +189,35 @@
}
assert (grub_scratch_mem == 0);
- scratch = malloc (0x100000 + EXTENDED_MEMSIZE + 15);
- assert (scratch);
- grub_scratch_mem = (char *) ((((int) scratch) >> 4) << 4);
+
+ /* Allocate enough pages for 0x100000 + EXTENDED_SIZE + 15, and
+ * make sure the memory is aligned to a multiple of the system's
+ * page size */
+ page_size = sysconf (_SC_PAGESIZE);
+ simstack_size = ( 0x100000 + EXTENDED_MEMSIZE + 15);
+ if (simstack_size % page_size)
+ {
+ /* If we're not on a page_size boundary, round up to the next one */
+ simstack_size &= ~(page_size-1);
+ simstack_size += page_size;
+ }
+
+ /* Add one for a PROT_NONE boundary page at each end. */
+ simstack_size += 2 * page_size;
+
+ simstack_alloc_base = grub_mmap_alloc(simstack_size);
+ assert (simstack_alloc_base != MAP_FAILED);
+
+ /* mark pages above and below our simstack area as innaccessable.
+ * If the implementation we're using doesn't support that, then the
+ * new protection modes are undefined. It's safe to just ignore
+ * them, though. It'd be nice if we knew that we'd get a SEGV for
+ * touching the area, but that's all. it'd be nice to have. */
+ mprotect (simstack_alloc_base, page_size, PROT_NONE);
+ mprotect ((void *)((unsigned long)simstack_alloc_base +
+ simstack_size - page_size), page_size, PROT_NONE);
+
+ grub_scratch_mem = (void *)((unsigned long)simstack_alloc_base + page_size);
/* FIXME: simulate the memory holes using mprot, if available. */
@@ -215,7 +290,7 @@
device_map = 0;
free (disks);
disks = 0;
- free (scratch);
+ munmap(simstack_alloc_base, simstack_size);
grub_scratch_mem = 0;
if (serial_device)
--- grub-0.97/stage2/builtins.c
+++ grub-0.97/stage2/builtins.c
@@ -131,63 +131,98 @@
}
+/* blocklist_read_helper nee disk_read_blocklist_func was a nested
+ * function, to which pointers were taken and exposed globally. Even
+ * in the GNU-C nested functions extension, they have local linkage,
+ * and aren't guaranteed to be accessable *at all* outside of their
+ * containing scope.
+ *
+ * Above and beyond all of that, the variables within blocklist_func_context
+ * are originally local variables, with local (not even static) linkage,
+ * from within blocklist_func. These were each referenced by
+ * disk_read_blocklist_func, which is only called from other functions
+ * through a globally scoped pointer.
+ *
+ * The documentation in GCC actually uses the words "all hell will break
+ * loose" to describe this scenario.
+ *
+ * Also, "start_sector" was also used uninitialized, but gcc doesn't warn
+ * about it (possibly because of the scoping madness?)
+ */
+
+static struct {
+ int start_sector;
+ int num_sectors;
+ int num_entries;
+ int last_length;
+} blocklist_func_context = {
+ .start_sector = 0,
+ .num_sectors = 0,
+ .num_entries = 0,
+ .last_length = 0
+};
+
+/* Collect contiguous blocks into one entry as many as possible,
+ and print the blocklist notation on the screen. */
+static void
+blocklist_read_helper (int sector, int offset, int length)
+{
+ int *start_sector = &blocklist_func_context.start_sector;
+ int *num_sectors = &blocklist_func_context.num_sectors;
+ int *num_entries = &blocklist_func_context.num_entries;
+ int *last_length = &blocklist_func_context.last_length;
+
+ if (*num_sectors > 0)
+ {
+ if (*start_sector + *num_sectors == sector
+ && offset == 0 && *last_length == SECTOR_SIZE)
+ {
+ *num_sectors++;
+ *last_length = length;
+ return;
+ }
+ else
+ {
+ if (*last_length == SECTOR_SIZE)
+ grub_printf ("%s%d+%d", *num_entries ? "," : "",
+ *start_sector - part_start, *num_sectors);
+ else if (*num_sectors > 1)
+ grub_printf ("%s%d+%d,%d[0-%d]", *num_entries ? "," : "",
+ *start_sector - part_start, *num_sectors-1,
+ *start_sector + *num_sectors-1 - part_start,
+ *last_length);
+ else
+ grub_printf ("%s%d[0-%d]", *num_entries ? "," : "",
+ *start_sector - part_start, *last_length);
+ *num_entries++;
+ *num_sectors = 0;
+ }
+ }
+
+ if (offset > 0)
+ {
+ grub_printf("%s%d[%d-%d]", *num_entries ? "," : "",
+ sector-part_start, offset, offset+length);
+ *num_entries++;
+ }
+ else
+ {
+ *start_sector = sector;
+ *num_sectors = 1;
+ *last_length = length;
+ }
+}
+
/* blocklist */
static int
blocklist_func (char *arg, int flags)
{
char *dummy = (char *) RAW_ADDR (0x100000);
- int start_sector;
- int num_sectors = 0;
- int num_entries = 0;
- int last_length = 0;
-
- auto void disk_read_blocklist_func (int sector, int offset, int length);
-
- /* Collect contiguous blocks into one entry as many as possible,
- and print the blocklist notation on the screen. */
- auto void disk_read_blocklist_func (int sector, int offset, int length)
- {
- if (num_sectors > 0)
- {
- if (start_sector + num_sectors == sector
- && offset == 0 && last_length == SECTOR_SIZE)
- {
- num_sectors++;
- last_length = length;
- return;
- }
- else
- {
- if (last_length == SECTOR_SIZE)
- grub_printf ("%s%d+%d", num_entries ? "," : "",
- start_sector - part_start, num_sectors);
- else if (num_sectors > 1)
- grub_printf ("%s%d+%d,%d[0-%d]", num_entries ? "," : "",
- start_sector - part_start, num_sectors-1,
- start_sector + num_sectors-1 - part_start,
- last_length);
- else
- grub_printf ("%s%d[0-%d]", num_entries ? "," : "",
- start_sector - part_start, last_length);
- num_entries++;
- num_sectors = 0;
- }
- }
-
- if (offset > 0)
- {
- grub_printf("%s%d[%d-%d]", num_entries ? "," : "",
- sector-part_start, offset, offset+length);
- num_entries++;
- }
- else
- {
- start_sector = sector;
- num_sectors = 1;
- last_length = length;
- }
- }
+ int *start_sector = &blocklist_func_context.start_sector;
+ int *num_sectors = &blocklist_func_context.num_sectors;
+ int *num_entries = &blocklist_func_context.num_entries;
+
/* Open the file. */
if (! grub_open (arg))
return 1;
@@ -204,15 +241,15 @@
grub_printf (")");
/* Read in the whole file to DUMMY. */
- disk_read_hook = disk_read_blocklist_func;
+ disk_read_hook = blocklist_read_helper;
if (! grub_read (dummy, -1))
goto fail;
/* The last entry may not be printed yet. Don't check if it is a
* full sector, since it doesn't matter if we read too much. */
- if (num_sectors > 0)
- grub_printf ("%s%d+%d", num_entries ? "," : "",
- start_sector - part_start, num_sectors);
+ if (*num_sectors > 0)
+ grub_printf ("%s%d+%d", *num_entries ? "," : "",
+ *start_sector - part_start, *num_sectors);
grub_printf ("\n");
@@ -1868,6 +1905,77 @@
/* install */
+static struct {
+ int saved_sector;
+ int installaddr;
+ int installlist;
+ char *stage2_first_buffer;
+} install_func_context = {
+ .saved_sector = 0,
+ .installaddr = 0,
+ .installlist = 0,
+ .stage2_first_buffer = NULL,
+};
+
+/* Save the first sector of Stage2 in STAGE2_SECT. */
+/* Formerly disk_read_savesect_func with local scope inside install_func */
+static void
+install_savesect_helper(int sector, int offset, int length)
+{
+ if (debug)
+ printf ("[%d]", sector);
+
+ /* ReiserFS has files which sometimes contain data not aligned
+ on sector boundaries. Returning an error is better than
+ silently failing. */
+ if (offset != 0 || length != SECTOR_SIZE)
+ errnum = ERR_UNALIGNED;
+
+ install_func_context.saved_sector = sector;
+}
+
+/* Write SECTOR to INSTALLLIST, and update INSTALLADDR and INSTALLSECT. */
+/* Formerly disk_read_blocklist_func with local scope inside install_func */
+static void
+install_blocklist_helper (int sector, int offset, int length)
+{
+ int *installaddr = &install_func_context.installaddr;
+ int *installlist = &install_func_context.installlist;
+ char **stage2_first_buffer = &install_func_context.stage2_first_buffer;
+ /* Was the last sector full? */
+ static int last_length = SECTOR_SIZE;
+
+ if (debug)
+ printf("[%d]", sector);
+
+ if (offset != 0 || last_length != SECTOR_SIZE)
+ {
+ /* We found a non-sector-aligned data block. */
+ errnum = ERR_UNALIGNED;
+ return;
+ }
+
+ last_length = length;
+
+ if (*((unsigned long *) (*installlist - 4))
+ + *((unsigned short *) *installlist) != sector
+ || *installlist == (int) *stage2_first_buffer + SECTOR_SIZE + 4)
+ {
+ *installlist -= 8;
+
+ if (*((unsigned long *) (*installlist - 8)))
+ errnum = ERR_WONT_FIT;
+ else
+ {
+ *((unsigned short *) (*installlist + 2)) = (*installaddr >> 4);
+ *((unsigned long *) (*installlist - 4)) = sector;
+ }
+ }
+
+ *((unsigned short *) *installlist) += 1;
+ *installaddr += 512;
+}
+
static int
install_func (char *arg, int flags)
{
@@ -1875,8 +1983,12 @@
char *stage1_buffer = (char *) RAW_ADDR (0x100000);
char *stage2_buffer = stage1_buffer + SECTOR_SIZE;
char *old_sect = stage2_buffer + SECTOR_SIZE;
- char *stage2_first_buffer = old_sect + SECTOR_SIZE;
- char *stage2_second_buffer = stage2_first_buffer + SECTOR_SIZE;
+ /* stage2_first_buffer used to be defined as:
+ * char *stage2_first_buffer = old_sect + SECTOR_SIZE; */
+ char **stage2_first_buffer = &install_func_context.stage2_first_buffer;
+ /* and stage2_second_buffer was:
+ * char *stage2_second_buffer = stage2_first_buffer + SECTOR_SIZE; */
+ char *stage2_second_buffer = old_sect + SECTOR_SIZE + SECTOR_SIZE;
/* XXX: Probably SECTOR_SIZE is reasonable. */
char *config_filename = stage2_second_buffer + SECTOR_SIZE;
char *dummy = config_filename + SECTOR_SIZE;
@@ -1885,10 +1997,11 @@
int src_drive, src_partition, src_part_start;
int i;
struct geometry dest_geom, src_geom;
- int saved_sector;
+ int *saved_sector = &install_func_context.saved_sector;
int stage2_first_sector, stage2_second_sector;
char *ptr;
- int installaddr, installlist;
+ int *installaddr = &install_func_context.installaddr;
+ int *installlist = &install_func_context.installlist;
/* Point to the location of the name of a configuration file in Stage 2. */
char *config_file_location;
/* If FILE is a Stage 1.5? */
@@ -1897,67 +2010,13 @@
int is_open = 0;
/* If LBA is forced? */
int is_force_lba = 0;
- /* Was the last sector full? */
- int last_length = SECTOR_SIZE;
-
+
+ *stage2_first_buffer = old_sect + SECTOR_SIZE;
#ifdef GRUB_UTIL
/* If the Stage 2 is in a partition mounted by an OS, this will store
the filename under the OS. */
char *stage2_os_file = 0;
#endif /* GRUB_UTIL */
-
- auto void disk_read_savesect_func (int sector, int offset, int length);
- auto void disk_read_blocklist_func (int sector, int offset, int length);
-
- /* Save the first sector of Stage2 in STAGE2_SECT. */
- auto void disk_read_savesect_func (int sector, int offset, int length)
- {
- if (debug)
- printf ("[%d]", sector);
-
- /* ReiserFS has files which sometimes contain data not aligned
- on sector boundaries. Returning an error is better than
- silently failing. */
- if (offset != 0 || length != SECTOR_SIZE)
- errnum = ERR_UNALIGNED;
-
- saved_sector = sector;
- }
-
- /* Write SECTOR to INSTALLLIST, and update INSTALLADDR and
- INSTALLSECT. */
- auto void disk_read_blocklist_func (int sector, int offset, int length)
- {
- if (debug)
- printf("[%d]", sector);
-
- if (offset != 0 || last_length != SECTOR_SIZE)
- {
- /* We found a non-sector-aligned data block. */
- errnum = ERR_UNALIGNED;
- return;
- }
-
- last_length = length;
-
- if (*((unsigned long *) (installlist - 4))
- + *((unsigned short *) installlist) != sector
- || installlist == (int) stage2_first_buffer + SECTOR_SIZE + 4)
- {
- installlist -= 8;
-
- if (*((unsigned long *) (installlist - 8)))
- errnum = ERR_WONT_FIT;
- else
- {
- *((unsigned short *) (installlist + 2)) = (installaddr >> 4);
- *((unsigned long *) (installlist - 4)) = sector;
- }
- }
-
- *((unsigned short *) installlist) += 1;
- installaddr += 512;
- }
/* First, check the GNU-style long option. */
while (1)
@@ -1987,10 +2049,10 @@
addr = skip_to (0, file);
/* Get the installation address. */
- if (! safe_parse_maxint (&addr, &installaddr))
+ if (! safe_parse_maxint (&addr, installaddr))
{
/* ADDR is not specified. */
- installaddr = 0;
+ *installaddr = 0;
ptr = addr;
errnum = 0;
}
@@ -2084,17 +2146,17 @@
= (dest_drive & BIOS_FLAG_FIXED_DISK);
/* Read the first sector of Stage 2. */
- disk_read_hook = disk_read_savesect_func;
- if (grub_read (stage2_first_buffer, SECTOR_SIZE) != SECTOR_SIZE)
+ disk_read_hook = install_savesect_helper;
+ if (grub_read (*stage2_first_buffer, SECTOR_SIZE) != SECTOR_SIZE)
goto fail;
- stage2_first_sector = saved_sector;
+ stage2_first_sector = *saved_sector;
/* Read the second sector of Stage 2. */
if (grub_read (stage2_second_buffer, SECTOR_SIZE) != SECTOR_SIZE)
goto fail;
- stage2_second_sector = saved_sector;
+ stage2_second_sector = *saved_sector;
/* Check for the version of Stage 2. */
if (*((short *) (stage2_second_buffer + STAGE2_VER_MAJ_OFFS))
@@ -2110,27 +2172,27 @@
/* If INSTALLADDR is not specified explicitly in the command-line,
determine it by the Stage 2 id. */
- if (! installaddr)
+ if (! *installaddr)
{
if (! is_stage1_5)
/* Stage 2. */
- installaddr = 0x8000;
+ *installaddr = 0x8000;
else
/* Stage 1.5. */
- installaddr = 0x2000;
+ *installaddr = 0x2000;
}
*((unsigned long *) (stage1_buffer + STAGE1_STAGE2_SECTOR))
= stage2_first_sector;
*((unsigned short *) (stage1_buffer + STAGE1_STAGE2_ADDRESS))
- = installaddr;
+ = *installaddr;
*((unsigned short *) (stage1_buffer + STAGE1_STAGE2_SEGMENT))
- = installaddr >> 4;
+ = *installaddr >> 4;
- i = (int) stage2_first_buffer + SECTOR_SIZE - 4;
+ i = (int) *stage2_first_buffer + SECTOR_SIZE - 4;
while (*((unsigned long *) i))
{
- if (i < (int) stage2_first_buffer
+ if (i < (int) *stage2_first_buffer
|| (*((int *) (i - 4)) & 0x80000000)
|| *((unsigned short *) i) >= 0xA00
|| *((short *) (i + 2)) == 0)
@@ -2144,13 +2206,13 @@
i -= 8;
}
- installlist = (int) stage2_first_buffer + SECTOR_SIZE + 4;
- installaddr += SECTOR_SIZE;
+ *installlist = (int) *stage2_first_buffer + SECTOR_SIZE + 4;
+ *installaddr += SECTOR_SIZE;
/* Read the whole of Stage2 except for the first sector. */
grub_seek (SECTOR_SIZE);
- disk_read_hook = disk_read_blocklist_func;
+ disk_read_hook = install_blocklist_helper;
if (! grub_read (dummy, -1))
goto fail;
@@ -2233,7 +2295,7 @@
/* Skip the first sector. */
grub_seek (SECTOR_SIZE);
- disk_read_hook = disk_read_savesect_func;
+ disk_read_hook = install_savesect_helper;
if (grub_read (stage2_buffer, SECTOR_SIZE) != SECTOR_SIZE)
goto fail;
@@ -2303,7 +2365,7 @@
else
#endif /* GRUB_UTIL */
{
- if (! devwrite (saved_sector - part_start, 1, stage2_buffer))
+ if (! devwrite (*saved_sector - part_start, 1, stage2_buffer))
goto fail;
}
}
@@ -2325,7 +2387,7 @@
goto fail;
}
- if (fwrite (stage2_first_buffer, 1, SECTOR_SIZE, fp) != SECTOR_SIZE)
+ if (fwrite (*stage2_first_buffer, 1, SECTOR_SIZE, fp) != SECTOR_SIZE)
{
fclose (fp);
errnum = ERR_WRITE;
@@ -2352,7 +2414,7 @@
goto fail;
if (! devwrite (stage2_first_sector - src_part_start, 1,
- stage2_first_buffer))
+ *stage2_first_buffer))
goto fail;
if (! devwrite (stage2_second_sector - src_part_start, 1,
--- grub-0.97/stage2/shared.h
+++ grub-0.97/stage2/shared.h
@@ -36,8 +36,8 @@
/* Maybe redirect memory requests through grub_scratch_mem. */
#ifdef GRUB_UTIL
-extern char *grub_scratch_mem;
-# define RAW_ADDR(x) ((x) + (int) grub_scratch_mem)
+extern void *grub_scratch_mem;
+# define RAW_ADDR(x) ((x) + (unsigned long) grub_scratch_mem)
# define RAW_SEG(x) (RAW_ADDR ((x) << 4) >> 4)
#else
# define RAW_ADDR(x) (x)

View file

@ -0,0 +1,16 @@
--- grub-0.96/stage2/boot.c
+++ grub-0.96/stage2/boot.c
@@ -824,8 +824,11 @@
moveto = (mbi.mem_upper + 0x400) << 10;
moveto = (moveto - len) & 0xfffff000;
- max_addr = (lh->header == LINUX_MAGIC_SIGNATURE && lh->version >= 0x0203
- ? lh->initrd_addr_max : LINUX_INITRD_MAX_ADDRESS);
+ max_addr = LINUX_INITRD_MAX_ADDRESS;
+ if (lh->header == LINUX_MAGIC_SIGNATURE &&
+ lh->version >= 0x0203 &&
+ lh->initrd_addr_max < max_addr)
+ max_addr = lh->initrd_addr_max;
if (moveto + len >= max_addr)
moveto = (max_addr - len) & 0xfffff000;

86
core/grub/PKGBUILD Normal file
View file

@ -0,0 +1,86 @@
# $Id: PKGBUILD 47861 2009-07-28 10:32:47Z ronald $
# Maintainer: Ronald van Haren <ronald.archlinux.org>
pkgname=grub
pkgver=0.97
pkgrel=16
pkgdesc="A GNU multiboot boot loader"
arch=('i686' 'x86_64')
license=('GPL')
url="http://www.gnu.org/software/grub/"
groups=('base')
depends=('ncurses' 'diffutils' 'sed')
source=(ftp://alpha.gnu.org/gnu/grub/grub-$pkgver.tar.gz
menu.lst
install-grub
040_all_grub-0.96-nxstack.patch
05-grub-0.97-initrdaddr.diff
i2o.patch
special-devices.patch
more-raid.patch
intelmac.patch
grub-inode-size.patch
ext4.patch)
backup=('boot/grub/menu.lst')
install=grub.install
md5sums=('cd3f3eb54446be6003156158d51f4884'
'a2098dc41fc3cb13e53179de2979d088'
'3182c4ae4963a16930bc772bba89dacf'
'eb9d69c46af3a0667c1f651817d7f075'
'ccd2d757e79e3a03dc19ede7391ed328'
'826fdbf446067f9861baf9f6a69a4583'
'49f6d4bcced0bc8bbcff273f3254bbfa'
'f41f702014a064918d7afc6fc23baa6e'
'175dc6b9f4ab94e8056c3afb3e34460a'
'69c648d2b8d0965df70a74014424f31c'
'39e0f9a05b7e04aceb24fc7bc4893e3d')
build() {
cd $srcdir/$pkgname-$pkgver
#set destination architecture here
DESTARCH="i686"
#DESTARCH="x86_64"
# optimizations break the build -- disable them
# adding special devices to grub, patches are from fedora
patch -Np1 -i ../special-devices.patch || return 1
patch -Np1 -i ../i2o.patch || return 1
patch -Np1 -i ../more-raid.patch || return 1
patch -Np1 -i ../intelmac.patch || return 1
# Add support for bigger inode size to e2fs_stage1_5
patch -Np1 -i ../grub-inode-size.patch || return 1
# Add ext4 support
# http://www.mail-archive.com/bug-grub@gnu.org/msg11458.html
patch -Np1 -i ../ext4.patch || return 1
#arch64 fixes for static build
if [ "$CARCH" = "x86_64" ]; then
echo "this package has to be built on i686, won't compile on x86_64"
sleep 5
else
if [ "$DESTARCH" = "x86_64" ]; then
# patch from gentoo for fixing a segfault
patch -Np1 -i ../040_all_grub-0.96-nxstack.patch || return 1
# patch from frugalware to make it boot when more than 2GB ram installed
patch -Np1 -i ../05-grub-0.97-initrdaddr.diff || return 1
CFLAGS="-static" ./configure --prefix=/usr --bindir=/bin --sbindir=/sbin \
--mandir=/usr/share/man --infodir=/usr/share/info
else
CFLAGS= ./configure --prefix=/usr --bindir=/bin --sbindir=/sbin \
--mandir=/usr/share/man --infodir=/usr/share/info
fi
fi
CFLAGS= make || return 1
make DESTDIR=$pkgdir install || return 1
install -D -m644 ../menu.lst $startdir/pkg/boot/grub/menu.lst
install -D -m755 ../install-grub $startdir/pkg/sbin/install-grub
rm -f $pkgdir/usr/share/info/dir || return 1
gzip /$pkgdir/usr/share/info/*
if [ "$DESTARCH" = "x86_64" ]; then
# fool makepkg into building a x86_64 package
export CARCH="x86_64"
fi
}

263
core/grub/ext4.patch Normal file
View file

@ -0,0 +1,263 @@
diff -ruNp grub-0.97/stage2/fsys_ext2fs.c grub-0.97-patch/stage2/fsys_ext2fs.c
--- grub-0.97/stage2/fsys_ext2fs.c 2004-08-08 20:19:18.000000000 +0200
+++ grub-0.97-patch/stage2/fsys_ext2fs.c 2007-12-29 16:25:19.000000000
+0100
@@ -51,6 +51,9 @@ typedef unsigned int __u32;
#define EXT2_TIND_BLOCK (EXT2_DIND_BLOCK + 1)
#define EXT2_N_BLOCKS (EXT2_TIND_BLOCK + 1)
+/* Inode flags */
+#define EXT4_EXTENTS_FL 0x00080000 /* Inode uses extents */
+
/* include/linux/ext2_fs.h */
struct ext2_super_block
{
@@ -191,6 +194,42 @@ struct ext2_dir_entry
#define EXT2_DIR_REC_LEN(name_len) (((name_len) + 8 + EXT2_DIR_ROUND) & \
~EXT2_DIR_ROUND)
+/* linux/ext4_fs_extents.h */
+/*
+ * This is the extent on-disk structure.
+ * It's used at the bottom of the tree.
+ */
+struct ext4_extent {
+ __u32 ee_block; /* first logical block extent covers */
+ __u16 ee_len; /* number of blocks covered by extent */
+ __u16 ee_start_hi; /* high 16 bits of physical block */
+ __u32 ee_start; /* low 32 bits of physical block */
+};
+
+/*
+ * This is index on-disk structure.
+ * It's used at all the levels except the bottom.
+ */
+struct ext4_extent_idx {
+ __u32 ei_block; /* index covers logical blocks from 'block' */
+ __u32 ei_leaf; /* pointer to the physical block of the next *
+ * level. leaf or next index could be there */
+ __u16 ei_leaf_hi; /* high 16 bits of physical block */
+ __u16 ei_unused;
+};
+
+/*
+ * Each block (leaves and indexes), even inode-stored has header.
+ */
+struct ext4_extent_header {
+ __u16 eh_magic; /* probably will support different formats */
+ __u16 eh_entries; /* number of valid entries */
+ __u16 eh_max; /* capacity of store in entries */
+ __u16 eh_depth; /* has tree real underlying blocks? */
+ __u32 eh_generation; /* generation of the tree */
+};
+
+#define EXT4_EXT_MAGIC 0xf30a
/* ext2/super.c */
#define log2(n) ffz(~(n))
@@ -279,6 +318,26 @@ ext2_rdfsb (int fsblock, int buffer)
EXT2_BLOCK_SIZE (SUPERBLOCK), (char *) buffer);
}
+/* Walk through extents index tree to find the good leaf */
+static struct ext4_extent_header *
+ext4_recurse_extent_index(struct ext4_extent_header *extent_block, int logical_block)
+{
+ int i;
+ struct ext4_extent_idx *index = (struct ext4_extent_idx *) (extent_block + 1);
+ if (extent_block->eh_magic != EXT4_EXT_MAGIC)
+ return NULL;
+ if (extent_block->eh_depth == 0)
+ return extent_block;
+ for (i = 0; i < extent_block->eh_entries; i++)
+ {
+ if (logical_block < index[i].ei_block)
+ break;
+ }
+ if (i == 0 || !ext2_rdfsb(index[i-1].ei_leaf, DATABLOCK1))
+ return NULL;
+ return (ext4_recurse_extent_index((struct ext4_extent_header *) DATABLOCK1, logical_block));
+}
+
/* from
ext2/inode.c:ext2_bmap()
*/
--- grub-0.97/stage2/fsys_ext2fs.c~ 2008-12-28 20:19:00.000000000 +0100
+++ grub-0.97/stage2/fsys_ext2fs.c 2008-12-28 20:19:00.000000000 +0100
@@ -366,83 +366,106 @@
}
printf ("logical block %d\n", logical_block);
#endif /* E2DEBUG */
-
- /* if it is directly pointed to by the inode, return that physical addr */
- if (logical_block < EXT2_NDIR_BLOCKS)
- {
-#ifdef E2DEBUG
- printf ("returning %d\n", (unsigned char *) (INODE->i_block[logical_block]));
- printf ("returning %d\n", INODE->i_block[logical_block]);
-#endif /* E2DEBUG */
- return INODE->i_block[logical_block];
- }
- /* else */
- logical_block -= EXT2_NDIR_BLOCKS;
- /* try the indirect block */
- if (logical_block < EXT2_ADDR_PER_BLOCK (SUPERBLOCK))
+ /* standard ext2 inode */
+ if (!(INODE->i_flags & EXT4_EXTENTS_FL))
{
- if (mapblock1 != 1
- && !ext2_rdfsb (INODE->i_block[EXT2_IND_BLOCK], DATABLOCK1))
- {
- errnum = ERR_FSYS_CORRUPT;
- return -1;
- }
- mapblock1 = 1;
- return ((__u32 *) DATABLOCK1)[logical_block];
- }
- /* else */
- logical_block -= EXT2_ADDR_PER_BLOCK (SUPERBLOCK);
- /* now try the double indirect block */
- if (logical_block < (1 << (EXT2_ADDR_PER_BLOCK_BITS (SUPERBLOCK) * 2)))
- {
- int bnum;
- if (mapblock1 != 2
- && !ext2_rdfsb (INODE->i_block[EXT2_DIND_BLOCK], DATABLOCK1))
- {
- errnum = ERR_FSYS_CORRUPT;
- return -1;
- }
- mapblock1 = 2;
- if ((bnum = (((__u32 *) DATABLOCK1)
- [logical_block >> EXT2_ADDR_PER_BLOCK_BITS (SUPERBLOCK)]))
- != mapblock2
- && !ext2_rdfsb (bnum, DATABLOCK2))
- {
- errnum = ERR_FSYS_CORRUPT;
- return -1;
- }
- mapblock2 = bnum;
+ /* if it is directly pointed to by the inode, return that physical addr */
+ if (logical_block < EXT2_NDIR_BLOCKS)
+ {
+#ifdef E2DEBUG
+ printf ("returning %d\n", (unsigned char *) (INODE->i_block[logical_block]));
+ printf ("returning %d\n", INODE->i_block[logical_block]);
+#endif /* E2DEBUG */
+ return INODE->i_block[logical_block];
+ }
+ /* else */
+ logical_block -= EXT2_NDIR_BLOCKS;
+ /* try the indirect block */
+ if (logical_block < EXT2_ADDR_PER_BLOCK (SUPERBLOCK))
+ {
+ if (mapblock1 != 1
+ && !ext2_rdfsb (INODE->i_block[EXT2_IND_BLOCK], DATABLOCK1))
+ {
+ errnum = ERR_FSYS_CORRUPT;
+ return -1;
+ }
+ mapblock1 = 1;
+ return ((__u32 *) DATABLOCK1)[logical_block];
+ }
+ /* else */
+ logical_block -= EXT2_ADDR_PER_BLOCK (SUPERBLOCK);
+ /* now try the double indirect block */
+ if (logical_block < (1 << (EXT2_ADDR_PER_BLOCK_BITS (SUPERBLOCK) * 2)))
+ {
+ int bnum;
+ if (mapblock1 != 2
+ && !ext2_rdfsb (INODE->i_block[EXT2_DIND_BLOCK], DATABLOCK1))
+ {
+ errnum = ERR_FSYS_CORRUPT;
+ return -1;
+ }
+ mapblock1 = 2;
+ if ((bnum = (((__u32 *) DATABLOCK1)
+ [logical_block >> EXT2_ADDR_PER_BLOCK_BITS (SUPERBLOCK)]))
+ != mapblock2
+ && !ext2_rdfsb (bnum, DATABLOCK2))
+ {
+ errnum = ERR_FSYS_CORRUPT;
+ return -1;
+ }
+ mapblock2 = bnum;
+ return ((__u32 *) DATABLOCK2)
+ [logical_block & (EXT2_ADDR_PER_BLOCK (SUPERBLOCK) - 1)];
+ }
+ /* else */
+ mapblock2 = -1;
+ logical_block -= (1 << (EXT2_ADDR_PER_BLOCK_BITS (SUPERBLOCK) * 2));
+ if (mapblock1 != 3
+ && !ext2_rdfsb (INODE->i_block[EXT2_TIND_BLOCK], DATABLOCK1))
+ {
+ errnum = ERR_FSYS_CORRUPT;
+ return -1;
+ }
+ mapblock1 = 3;
+ if (!ext2_rdfsb (((__u32 *) DATABLOCK1)
+ [logical_block >> (EXT2_ADDR_PER_BLOCK_BITS (SUPERBLOCK)
+ * 2)],
+ DATABLOCK2))
+ {
+ errnum = ERR_FSYS_CORRUPT;
+ return -1;
+ }
+ if (!ext2_rdfsb (((__u32 *) DATABLOCK2)
+ [(logical_block >> EXT2_ADDR_PER_BLOCK_BITS (SUPERBLOCK))
+ & (EXT2_ADDR_PER_BLOCK (SUPERBLOCK) - 1)],
+ DATABLOCK2))
+ {
+ errnum = ERR_FSYS_CORRUPT;
+ return -1;
+ }
return ((__u32 *) DATABLOCK2)
- [logical_block & (EXT2_ADDR_PER_BLOCK (SUPERBLOCK) - 1)];
- }
- /* else */
- mapblock2 = -1;
- logical_block -= (1 << (EXT2_ADDR_PER_BLOCK_BITS (SUPERBLOCK) * 2));
- if (mapblock1 != 3
- && !ext2_rdfsb (INODE->i_block[EXT2_TIND_BLOCK], DATABLOCK1))
- {
- errnum = ERR_FSYS_CORRUPT;
- return -1;
+ [logical_block & (EXT2_ADDR_PER_BLOCK (SUPERBLOCK) - 1)];
}
- mapblock1 = 3;
- if (!ext2_rdfsb (((__u32 *) DATABLOCK1)
- [logical_block >> (EXT2_ADDR_PER_BLOCK_BITS (SUPERBLOCK)
- * 2)],
- DATABLOCK2))
- {
- errnum = ERR_FSYS_CORRUPT;
- return -1;
- }
- if (!ext2_rdfsb (((__u32 *) DATABLOCK2)
- [(logical_block >> EXT2_ADDR_PER_BLOCK_BITS (SUPERBLOCK))
- & (EXT2_ADDR_PER_BLOCK (SUPERBLOCK) - 1)],
- DATABLOCK2))
+ /* inode is in extents format */
+ else
{
+ int i;
+ struct ext4_extent_header *extent_hdr = ext4_recurse_extent_index((struct ext4_extent_header *) INODE->i_block, logical_block);
+ struct ext4_extent *extent = (struct ext4_extent *) (extent_hdr + 1);
+ if ( extent_hdr == NULL || extent_hdr->eh_magic != EXT4_EXT_MAGIC)
+ {
+ errnum = ERR_FSYS_CORRUPT;
+ return -1;
+ }
+ for (i = 0; i<extent_hdr->eh_entries; i++)
+ {
+ if (extent[i].ee_block <= logical_block && logical_block < extent[i].ee_block + extent[i].ee_len && !(extent[i].ee_len>>15))
+ return (logical_block - extent[i].ee_block + extent[i].ee_start);
+ }
+ /* We should not arrive here */
errnum = ERR_FSYS_CORRUPT;
return -1;
}
- return ((__u32 *) DATABLOCK2)
- [logical_block & (EXT2_ADDR_PER_BLOCK (SUPERBLOCK) - 1)];
}
/* preconditions: all preconds of ext2fs_block_map */

View file

@ -0,0 +1,315 @@
diff -ruBbd --unidirectional-new-file grub-0.96/stage2/builtins.c grub-0.96-patched/stage2/builtins.c
--- grub-0.96/stage2/builtins.c 2004-06-20 09:33:04.000000000 -0400
+++ grub-0.96-patched/stage2/builtins.c 2007-01-04 13:56:06.000000000 -0500
@@ -1229,14 +1229,15 @@
for (drive = 0x80; drive < 0x88; drive++)
{
unsigned long part = 0xFFFFFF;
- unsigned long start, len, offset, ext_offset;
- int type, entry;
+ unsigned long start, len, offset, ext_offset, gpt_offset;
+ int type, entry, gpt_count, gpt_size;
char buf[SECTOR_SIZE];
current_drive = drive;
while (next_partition (drive, 0xFFFFFF, &part, &type,
&start, &len, &offset, &entry,
- &ext_offset, buf))
+ &ext_offset, &gpt_offset,
+ &gpt_count, &gpt_size, buf))
{
if (type != PC_SLICE_TYPE_NONE
&& ! IS_PC_SLICE_TYPE_BSD (type)
@@ -2806,8 +2807,8 @@
{
int new_type;
unsigned long part = 0xFFFFFF;
- unsigned long start, len, offset, ext_offset;
- int entry, type;
+ unsigned long start, len, offset, ext_offset, gpt_offset;
+ int entry, type, gpt_count, gpt_size;
char mbr[512];
/* Get the drive and the partition. */
@@ -2844,7 +2845,14 @@
/* Look for the partition. */
while (next_partition (current_drive, 0xFFFFFF, &part, &type,
&start, &len, &offset, &entry,
- &ext_offset, mbr))
+ &ext_offset, &gpt_offset, &gpt_count, &gpt_size, mbr))
+ /* The partition may not be a GPT partition. */
+ if (gpt_offset != 0)
+ {
+ errnum = ERR_BAD_ARGUMENT;
+ return 1;
+ }
+
{
if (part == current_partition)
{
diff -ruBbd --unidirectional-new-file grub-0.96/stage2/disk_io.c grub-0.96-patched/stage2/disk_io.c
--- grub-0.96/stage2/disk_io.c 2004-05-23 12:35:24.000000000 -0400
+++ grub-0.96-patched/stage2/disk_io.c 2007-01-04 14:01:08.000000000 -0500
@@ -21,6 +21,7 @@
#include <shared.h>
#include <filesys.h>
+#include <gpt.h>
#ifdef SUPPORT_NETBOOT
# define GRUB 1
@@ -502,8 +503,8 @@
set_partition_hidden_flag (int hidden)
{
unsigned long part = 0xFFFFFF;
- unsigned long start, len, offset, ext_offset;
- int entry, type;
+ unsigned long start, len, offset, ext_offset, gpt_offset;
+ int entry, type, gpt_count, gpt_size;
char mbr[512];
/* The drive must be a hard disk. */
@@ -524,7 +525,14 @@
/* Look for the partition. */
while (next_partition (current_drive, 0xFFFFFF, &part, &type,
&start, &len, &offset, &entry,
- &ext_offset, mbr))
+ &ext_offset, &gpt_offset, &gpt_count, &gpt_size, mbr))
+ /* The partition may not be a GPT partition. */
+ if (gpt_offset != 0)
+ {
+ errnum = ERR_BAD_ARGUMENT;
+ return 1;
+ }
+
{
if (part == current_partition)
{
@@ -577,11 +585,14 @@
unsigned long *partition, int *type,
unsigned long *start, unsigned long *len,
unsigned long *offset, int *entry,
- unsigned long *ext_offset, char *buf)
+ unsigned long *ext_offset,
+ unsigned long *gpt_offset, int *gpt_count,
+ int *gpt_size, char *buf)
{
/* Forward declarations. */
auto int next_bsd_partition (void);
auto int next_pc_slice (void);
+ auto int next_gpt_slice(void);
/* Get next BSD partition in current PC slice. */
int next_bsd_partition (void)
@@ -666,6 +677,40 @@
return 0;
}
+ /* If this is a GPT partition table, read it as such. */
+ if (*entry == -1 && *offset == 0 && PC_SLICE_TYPE (buf, 0) == PC_SLICE_TYPE_GPT)
+ {
+ struct grub_gpt_header *hdr = (struct grub_gpt_header *) buf;
+
+ /* Read in the GPT Partition table header. */
+ if (! rawread (drive, 1, 0, SECTOR_SIZE, buf))
+ return 0;
+
+ if (hdr->magic == GPT_HEADER_MAGIC && hdr->version == 0x10000)
+ {
+ /* Let gpt_offset point to the first entry in the GPT
+ partition table. This can also be used by callers of
+ next_partition to determine if a entry comes from a
+ GPT partition table or not. */
+ *gpt_offset = hdr->partitions;
+ *gpt_count = hdr->maxpart;
+ *gpt_size = hdr->partentry_size;
+
+ return next_gpt_slice();
+ }
+ else
+ {
+ /* This is not a valid header for a GPT partition table.
+ Re-read the MBR or the boot sector of the extended
+ partition. */
+ if (! rawread (drive, *offset, 0, SECTOR_SIZE, buf))
+ return 0;
+ }
+ }
+
+ /* Not a GPT partition. */
+ *gpt_offset = 0;
+
/* Increase the entry number. */
(*entry)++;
@@ -710,6 +755,43 @@
return 1;
}
+ /* Get the next GPT slice. */
+ int next_gpt_slice (void)
+ {
+ struct grub_gpt_partentry *gptentry = (struct grub_gpt_partentry *) buf;
+ /* Make GPT partitions show up as PC slices. */
+ int pc_slice_no = (*partition & 0xFF0000) >> 16;
+
+ /* If this is the first time... */
+ if (pc_slice_no == 0xFF)
+ {
+ pc_slice_no = -1;
+ *entry = -1;
+ }
+
+ do {
+ (*entry)++;
+
+ if (*entry >= *gpt_count)
+ {
+ errnum = ERR_NO_PART;
+ return 0;
+ }
+ /* Read in the GPT Partition table entry. */
+ if (! rawread (drive, (*gpt_offset) + GPT_ENTRY_SECTOR (*gpt_size, *entry), GPT_ENTRY_INDEX (*gpt_size, *entry), *gpt_size, buf))
+ return 0;
+ } while (! (gptentry->type1 && gptentry->type2));
+
+ pc_slice_no++;
+ *start = gptentry->start;
+ *len = gptentry->end - gptentry->start + 1;
+ *type = PC_SLICE_TYPE_EXT2FS;
+ *entry = pc_slice_no;
+ *partition = (*entry << 16) | 0xFFFF;
+
+ return 1;
+ }
+
/* Start the body of this function. */
#ifndef STAGE1_5
@@ -717,6 +799,9 @@
return 0;
#endif
+ if (*partition != 0xFFFFFF && *gpt_offset != 0)
+ return next_gpt_slice ();
+
/* If previous partition is a BSD partition or a PC slice which
contains BSD partitions... */
if ((*partition != 0xFFFFFF && IS_PC_SLICE_TYPE_BSD (*type & 0xff))
@@ -755,6 +840,9 @@
unsigned long dest_partition = current_partition;
unsigned long part_offset;
unsigned long ext_offset;
+ unsigned long gpt_offset;
+ int gpt_count;
+ int gpt_size;
int entry;
char buf[SECTOR_SIZE];
int bsd_part, pc_slice;
@@ -766,7 +854,8 @@
int ret = next_partition (current_drive, dest_partition,
&current_partition, &current_slice,
&part_start, &part_length,
- &part_offset, &entry, &ext_offset, buf);
+ &part_offset, &entry, &ext_offset,
+ &gpt_offset, &gpt_count, &gpt_size, buf);
bsd_part = (current_partition >> 8) & 0xFF;
pc_slice = current_partition >> 16;
return ret;
diff -ruBbd --unidirectional-new-file grub-0.96/stage2/gpt.h grub-0.96-patched/stage2/gpt.h
--- grub-0.96/stage2/gpt.h 1969-12-31 19:00:00.000000000 -0500
+++ grub-0.96-patched/stage2/gpt.h 2007-01-04 13:52:14.000000000 -0500
@@ -0,0 +1,68 @@
+/*
+ * GRUB -- GRand Unified Bootloader
+ * Copyright (C) 2002,2005,2006 Free Software Foundation, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#ifndef _GPT_H
+#define _GPT_H
+
+typedef signed char grub_int8_t;
+typedef signed short grub_int16_t;
+typedef signed int grub_int32_t;
+typedef signed long long int grub_int64_t;
+typedef unsigned char grub_uint8_t;
+typedef unsigned short grub_uint16_t;
+typedef unsigned int grub_uint32_t;
+typedef unsigned long long int grub_uint64_t;
+
+struct grub_gpt_header
+{
+ grub_uint64_t magic;
+ grub_uint32_t version;
+ grub_uint32_t headersize;
+ grub_uint32_t crc32;
+ grub_uint32_t unused1;
+ grub_uint64_t primary;
+ grub_uint64_t backup;
+ grub_uint64_t start;
+ grub_uint64_t end;
+ grub_uint8_t guid[16];
+ grub_uint64_t partitions;
+ grub_uint32_t maxpart;
+ grub_uint32_t partentry_size;
+ grub_uint32_t partentry_crc32;
+} __attribute__ ((packed));
+
+struct grub_gpt_partentry
+{
+ grub_uint64_t type1;
+ grub_uint64_t type2;
+ grub_uint8_t guid[16];
+ grub_uint64_t start;
+ grub_uint64_t end;
+ grub_uint8_t attrib;
+ char name[72];
+} __attribute__ ((packed));
+
+#define GPT_HEADER_MAGIC 0x5452415020494645UL
+
+#define GPT_ENTRY_SECTOR(size,entry) \
+ ((((entry) * (size) + 1) & ~(SECTOR_SIZE - 1)) >> SECTOR_BITS)
+#define GPT_ENTRY_INDEX(size,entry) \
+ ((((entry) * (size) + 1) & (SECTOR_SIZE - 1)) - 1)
+
+#endif /* _GPT_H */
diff -ruBbd --unidirectional-new-file grub-0.96/stage2/pc_slice.h grub-0.96-patched/stage2/pc_slice.h
--- grub-0.96/stage2/pc_slice.h 2003-07-09 07:45:53.000000000 -0400
+++ grub-0.96-patched/stage2/pc_slice.h 2007-01-04 13:52:14.000000000 -0500
@@ -115,6 +115,7 @@
#define PC_SLICE_TYPE_LINUX_EXTENDED 0x85
#define PC_SLICE_TYPE_VSTAFS 0x9e
#define PC_SLICE_TYPE_DELL_UTIL 0xde
+#define PC_SLICE_TYPE_GPT 0xee
#define PC_SLICE_TYPE_LINUX_RAID 0xfd
diff -ruBbd --unidirectional-new-file grub-0.96/stage2/shared.h grub-0.96-patched/stage2/shared.h
--- grub-0.96/stage2/shared.h 2004-06-19 12:40:09.000000000 -0400
+++ grub-0.96-patched/stage2/shared.h 2007-01-04 13:52:15.000000000 -0500
@@ -934,7 +934,9 @@
unsigned long *partition, int *type,
unsigned long *start, unsigned long *len,
unsigned long *offset, int *entry,
- unsigned long *ext_offset, char *buf);
+ unsigned long *ext_offset,
+ unsigned long *gpt_offset, int *gpt_count,
+ int *gpt_size, char *buf);
/* Sets device to the one represented by the SAVED_* parameters. */
int make_saved_active (void);

View file

@ -0,0 +1,100 @@
diff -Naur grub-0.97-800/stage2/fsys_ext2fs.c grub-0.97-810/stage2/fsys_ext2fs.c
--- grub-0.97-800/stage2/fsys_ext2fs.c 2008-07-21 00:40:21.668879475 -0600
+++ grub-0.97-810/stage2/fsys_ext2fs.c 2008-07-21 01:01:11.063953773 -0600
@@ -79,7 +79,52 @@
__u32 s_rev_level; /* Revision level */
__u16 s_def_resuid; /* Default uid for reserved blocks */
__u16 s_def_resgid; /* Default gid for reserved blocks */
- __u32 s_reserved[235]; /* Padding to the end of the block */
+ /*
+ * These fields are for EXT2_DYNAMIC_REV superblocks only.
+ *
+ * Note: the difference between the compatible feature set and
+ * the incompatible feature set is that if there is a bit set
+ * in the incompatible feature set that the kernel doesn't
+ * know about, it should refuse to mount the filesystem.
+ *
+ * e2fsck's requirements are more strict; if it doesn't know
+ * about a feature in either the compatible or incompatible
+ * feature set, it must abort and not try to meddle with
+ * things it doesn't understand...
+ */
+ __u32 s_first_ino; /* First non-reserved inode */
+ __u16 s_inode_size; /* size of inode structure */
+ __u16 s_block_group_nr; /* block group # of this superblock */
+ __u32 s_feature_compat; /* compatible feature set */
+ __u32 s_feature_incompat; /* incompatible feature set */
+ __u32 s_feature_ro_compat; /* readonly-compatible feature set */
+ __u8 s_uuid[16]; /* 128-bit uuid for volume */
+ char s_volume_name[16]; /* volume name */
+ char s_last_mounted[64]; /* directory where last mounted */
+ __u32 s_algorithm_usage_bitmap; /* For compression */
+ /*
+ * Performance hints. Directory preallocation should only
+ * happen if the EXT2_FEATURE_COMPAT_DIR_PREALLOC flag is on.
+ */
+ __u8 s_prealloc_blocks; /* Nr of blocks to try to preallocate*/
+ __u8 s_prealloc_dir_blocks; /* Nr to preallocate for dirs */
+ __u16 s_reserved_gdt_blocks;/* Per group table for online growth */
+ /*
+ * Journaling support valid if EXT2_FEATURE_COMPAT_HAS_JOURNAL set.
+ */
+ __u8 s_journal_uuid[16]; /* uuid of journal superblock */
+ __u32 s_journal_inum; /* inode number of journal file */
+ __u32 s_journal_dev; /* device number of journal file */
+ __u32 s_last_orphan; /* start of list of inodes to delete */
+ __u32 s_hash_seed[4]; /* HTREE hash seed */
+ __u8 s_def_hash_version; /* Default hash version to use */
+ __u8 s_jnl_backup_type; /* Default type of journal backup */
+ __u16 s_reserved_word_pad;
+ __u32 s_default_mount_opts;
+ __u32 s_first_meta_bg; /* First metablock group */
+ __u32 s_mkfs_time; /* When the filesystem was created */
+ __u32 s_jnl_blocks[17]; /* Backup of the journal inode */
+ __u32 s_reserved[172]; /* Padding to the end of the block */
};
struct ext2_group_desc
@@ -218,6 +263,14 @@
#define EXT2_ADDR_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s) / sizeof (__u32))
#define EXT2_ADDR_PER_BLOCK_BITS(s) (log2(EXT2_ADDR_PER_BLOCK(s)))
+#define EXT2_GOOD_OLD_REV 0 /* The good old (original) format */
+#define EXT2_DYNAMIC_REV 1 /* V2 format w/ dynamic inode sizes */
+#define EXT2_GOOD_OLD_INODE_SIZE 128
+#define EXT2_INODE_SIZE(s) (((s)->s_rev_level == EXT2_GOOD_OLD_REV) ? \
+ EXT2_GOOD_OLD_INODE_SIZE : \
+ (s)->s_inode_size)
+#define EXT2_INODES_PER_BLOCK(s) (EXT2_BLOCK_SIZE(s)/EXT2_INODE_SIZE(s))
+
/* linux/ext2_fs.h */
#define EXT2_BLOCK_SIZE_BITS(s) ((s)->s_log_block_size + 10)
/* kind of from ext2/super.c */
@@ -553,7 +606,7 @@
gdp = GROUP_DESC;
ino_blk = gdp[desc].bg_inode_table +
(((current_ino - 1) % (SUPERBLOCK->s_inodes_per_group))
- >> log2 (EXT2_BLOCK_SIZE (SUPERBLOCK) / sizeof (struct ext2_inode)));
+ >> log2 (EXT2_INODES_PER_BLOCK (SUPERBLOCK)));
#ifdef E2DEBUG
printf ("inode table fsblock=%d\n", ino_blk);
#endif /* E2DEBUG */
@@ -565,13 +618,12 @@
/* reset indirect blocks! */
mapblock2 = mapblock1 = -1;
- raw_inode = INODE +
- ((current_ino - 1)
- & (EXT2_BLOCK_SIZE (SUPERBLOCK) / sizeof (struct ext2_inode) - 1));
+ raw_inode = (struct ext2_inode *)((char *)INODE +
+ ((current_ino - 1) & (EXT2_INODES_PER_BLOCK (SUPERBLOCK) - 1)) *
+ EXT2_INODE_SIZE (SUPERBLOCK));
#ifdef E2DEBUG
printf ("ipb=%d, sizeof(inode)=%d\n",
- (EXT2_BLOCK_SIZE (SUPERBLOCK) / sizeof (struct ext2_inode)),
- sizeof (struct ext2_inode));
+ EXT2_INODES_PER_BLOCK (SUPERBLOCK), EXT2_INODE_SIZE (SUPERBLOCK));
printf ("inode=%x, raw_inode=%x\n", INODE, raw_inode);
printf ("offset into inode table block=%d\n", (int) raw_inode - (int) INODE);
for (i = (unsigned char *) INODE; i <= (unsigned char *) raw_inode;

22
core/grub/grub.install Normal file
View file

@ -0,0 +1,22 @@
info_dir=/usr/share/info
info_files=(grub.info multiboot.info)
post_install() {
for f in ${info_files[@]}; do
install-info ${info_dir}/$f.gz ${info_dir}/dir 2> /dev/null
done
}
post_upgrade() {
post_install
}
pre_remove() {
for f in ${info_files[@]}; do
install-info --delete ${info_dir}/$f.gz ${info_dir}/dir 2> /dev/null
done
}

45
core/grub/i2o.patch Normal file
View file

@ -0,0 +1,45 @@
Only in grub-0.94/docs: grub.info
Only in grub-0.94/docs: multiboot.info
diff -ur grub-0.94/lib/device.c grub-0.94.new/lib/device.c
--- grub-0.94/lib/device.c 2004-05-07 04:50:36.375238696 +0200
+++ grub-0.94.new/lib/device.c 2004-05-07 04:48:57.611253104 +0200
@@ -419,6 +419,12 @@
{
sprintf (name, "/dev/rd/c%dd%d", controller, drive);
}
+
+static void
+get_i2o_disk_name (char *name, int unit)
+{
+ sprintf (name, "/dev/i2o/hd%c", unit + 'a');
+}
#endif
/* Check if DEVICE can be read. If an error occurs, return zero,
@@ -789,6 +795,26 @@
}
}
}
+
+ /* I2O disks. */
+ for (i = 0; i < 8; i++)
+ {
+ char name[16];
+
+ get_i2o_disk_name (name, i);
+ if (check_device (name))
+ {
+ (*map)[num_hd + 0x80] = strdup (name);
+ assert ((*map)[num_hd + 0x80]);
+
+ /* If the device map file is opened, write the map. */
+ if (fp)
+ fprintf (fp, "(hd%d)\t%s\n", num_hd, name);
+
+ num_hd++;
+ }
+ }
+
#endif /* __linux__ */
/* OK, close the device map file if opened. */

187
core/grub/install-grub Executable file
View file

@ -0,0 +1,187 @@
#!/bin/bash
#
# This is a little helper script that tries to convert linux-style device
# names to grub-style. It's not very smart, so it
# probably won't work for more complicated setups.
#
# If it doesn't work for you, try installing grub manually:
#
# # mkdir -p /boot/grub
# # cp /usr/lib/grub/i386-pc/* /boot/grub/
#
# Then start up the 'grub' shell and run something like the following:
#
# grub> root(hd0,0)
# grub> setup(hd0)
#
# The "root" line should point to the partition your kernel is located on,
# /boot if you have a separate boot partition, otherwise your root (/).
#
# The "setup" line tells grub which disc/partition to install the
# bootloader to. In the example above, it will install to the MBR of the
# primary master hard drive.
#
usage() {
echo "usage: install-grub <install_device> [boot_device]"
echo
echo "where <install_device> is the device where Grub will be installed"
echo "and [boot_device] is the partition that contains the /boot"
echo "directory (auto-detected if omitted)"
echo
echo "examples: install-grub /dev/hda"
echo " install-grub /dev/hda /dev/hda1"
echo
exit 0
}
## new install-grub, code was taken from setup script
ROOTDEV=$1
PART_ROOT=$2
VMLINUZ=vmlinuz26
if [ "$ROOTDEV" = "" ]; then
usage
fi
if [ "$PART_ROOT" = "" ]; then
PART_ROOT=$(mount | grep "on /boot type" | cut -d' ' -f 1)
fi
if [ "$PART_ROOT" = "" ]; then
PART_ROOT=$(mount | grep "on / type" | cut -d' ' -f 1)
fi
if [ "$PART_ROOT" = "" ]; then
echo "error: could not determine BOOT_DEVICE, please specify manually" >&2
exit 1
fi
get_grub_map() {
[ -e /tmp/dev.map ] && rm /tmp/dev.map
/sbin/grub --no-floppy --device-map /tmp/dev.map >/tmp/grub.log 2>&1 <<EOF
quit
EOF
}
mapdev() {
partition_flag=0
device_found=0
devs=$(cat /tmp/dev.map | grep -v fd | sed 's/ *\t/ /' | sed ':a;$!N;$!ba;s/\n/ /g')
linuxdevice=$(echo $1 | cut -b1-8)
if [ "$(echo $1 | egrep '[0-9]$')" ]; then
# /dev/hdXY
pnum=$(echo $1 | cut -b9-)
pnum=$(($pnum-1))
partition_flag=1
fi
for dev in $devs
do
if [ "(" = $(echo $dev | cut -b1) ]; then
grubdevice="$dev"
else
if [ "$dev" = "$linuxdevice" ]; then
device_found=1
break
fi
fi
done
if [ "$device_found" = "1" ]; then
if [ "$partition_flag" = "0" ]; then
echo "$grubdevice"
else
grubdevice_stringlen=${#grubdevice}
let grubdevice_stringlen--
grubdevice=$(echo $grubdevice | cut -b1-$grubdevice_stringlen)
echo "$grubdevice,$pnum)"
fi
else
echo " DEVICE NOT FOUND"
fi
}
dogrub() {
get_grub_map
if [ ! -f /boot/grub/menu.lst ]; then
echo "Error: Couldn't find /boot/grub/menu.lst. Is GRUB installed?"
exit 1
fi
# try to auto-configure GRUB...
if [ "$PART_ROOT" != "" -a "$S_GRUB" != "1" ]; then
grubdev=$(mapdev $PART_ROOT)
# look for a separately-mounted /boot partition
bootdev=$(mount | grep /boot | cut -d' ' -f 1)
if [ "$grubdev" != "" -o "$bootdev" != "" ]; then
cp /boot/grub/menu.lst /tmp/.menu.lst
# remove the default entries by truncating the file at our little tag (#-*)
head -n $(cat /tmp/.menu.lst | grep -n '#-\*' | cut -d: -f 1) /tmp/.menu.lst >/boot/grub/menu.lst
rm -f /tmp/.menu.lst
echo "" >>/boot/grub/menu.lst
echo "# (0) Arch Linux" >>/boot/grub/menu.lst
echo "title Arch Linux" >>/boot/grub/menu.lst
subdir=
if [ "$bootdev" != "" ]; then
grubdev=$(mapdev $bootdev)
else
subdir="/boot"
fi
echo "root $grubdev" >>/boot/grub/menu.lst
echo "kernel $subdir/$VMLINUZ root=$PART_ROOT ro" >>/boot/grub/menu.lst
if [ "$VMLINUZ" = "vmlinuz26" ]; then
echo "initrd $subdir/kernel26.img" >>/boot/grub/menu.lst
fi
echo "" >>/boot/grub/menu.lst
# adding fallback/full image
echo "# (1) Arch Linux" >>/boot/grub/menu.lst
echo "title Arch Linux Fallback" >>/boot/grub/menu.lst
echo "root $grubdev" >>/boot/grub/menu.lst
echo "kernel $subdir/$VMLINUZ root=$PART_ROOT ro" >>/boot/grub/menu.lst
if [ "$VMLINUZ" = "vmlinuz26" ]; then
echo "initrd $subdir/kernel26-fallback.img" >>/boot/grub/menu.lst
fi
echo "" >>/boot/grub/menu.lst
fi
fi
echo "Installing the GRUB bootloader..."
cp -a /usr/lib/grub/i386-pc/* /boot/grub/
sync
# freeze xfs filesystems to enable grub installation on xfs filesystems
if [ -x /usr/sbin/xfs_freeze ]; then
/usr/sbin/xfs_freeze -f /boot > /dev/null 2>&1
/usr/sbin/xfs_freeze -f / > /dev/null 2>&1
fi
# look for a separately-mounted /boot partition
bootpart=$(mount | grep /boot | cut -d' ' -f 1)
if [ "$bootpart" = "" ]; then
bootpart=$PART_ROOT
fi
bootpart=$(mapdev $bootpart)
bootdev=$(mapdev $ROOTDEV)
if [ "$bootpart" = "" ]; then
echo "Error: Missing/Invalid root device: $bootpart"
exit 1
fi
/sbin/grub --no-floppy --batch >/tmp/grub.log 2>&1 <<EOF
root $bootpart
setup $bootdev
quit
EOF
cat /tmp/grub.log
# unfreeze xfs filesystems
if [ -x /usr/sbin/xfs_freeze ]; then
/usr/sbin/xfs_freeze -u /boot > /dev/null 2>&1
/usr/sbin/xfs_freeze -u / > /dev/null 2>&1
fi
if grep "Error [0-9]*: " /tmp/grub.log >/dev/null; then
echo "Error installing GRUB. (see /tmp/grub.log for output)"
exit 1
fi
echo "GRUB was successfully installed."
rm -f /tmp/grub.log
exit 0
}
dogrub

67
core/grub/intelmac.patch Normal file
View file

@ -0,0 +1,67 @@
--- grub-0.97.orig/stage2/asm.S 2004-06-19 18:55:22.000000000 +0200
+++ grub-0.97/stage2/asm.S 2006-04-21 11:10:52.000000000 +0200
@@ -1651,7 +1651,29 @@
jnz 3f
ret
-3: /* use keyboard controller */
+3: /*
+ * try to switch gateA20 using PORT92, the "Fast A20 and Init"
+ * register
+ */
+ mov $0x92, %dx
+ inb %dx, %al
+ /* skip the port92 code if it's unimplemented (read returns 0xff) */
+ cmpb $0xff, %al
+ jz 6f
+
+ /* set or clear bit1, the ALT_A20_GATE bit */
+ movb 4(%esp), %ah
+ testb %ah, %ah
+ jz 4f
+ orb $2, %al
+ jmp 5f
+4: and $0xfd, %al
+
+ /* clear the INIT_NOW bit don't accidently reset the machine */
+5: and $0xfe, %al
+ outb %al, %dx
+
+6: /* use keyboard controller */
pushl %eax
call gloop1
@@ -1661,9 +1683,12 @@
gloopint1:
inb $K_STATUS
+ cmpb $0xff, %al
+ jz gloopint1_done
andb $K_IBUF_FUL, %al
jnz gloopint1
+gloopint1_done:
movb $KB_OUTPUT_MASK, %al
cmpb $0, 0x8(%esp)
jz gdoit
@@ -1684,6 +1709,8 @@
gloop1:
inb $K_STATUS
+ cmpb $0xff, %al
+ jz gloop2ret
andb $K_IBUF_FUL, %al
jnz gloop1
@@ -1991,6 +2018,11 @@
ENTRY(console_getkey)
push %ebp
+wait_for_key:
+ call EXT_C(console_checkkey)
+ incl %eax
+ jz wait_for_key
+
call EXT_C(prot_to_real)
.code16

48
core/grub/menu.lst Normal file
View file

@ -0,0 +1,48 @@
# Config file for GRUB - The GNU GRand Unified Bootloader
# /boot/grub/menu.lst
# DEVICE NAME CONVERSIONS
#
# Linux Grub
# -------------------------
# /dev/fd0 (fd0)
# /dev/sda (hd0)
# /dev/sdb2 (hd1,1)
# /dev/sda3 (hd0,2)
#
# FRAMEBUFFER RESOLUTION SETTINGS
# +-------------------------------------------------+
# | 640x480 800x600 1024x768 1280x1024
# ----+--------------------------------------------
# 256 | 0x301=769 0x303=771 0x305=773 0x307=775
# 32K | 0x310=784 0x313=787 0x316=790 0x319=793
# 64K | 0x311=785 0x314=788 0x317=791 0x31A=794
# 16M | 0x312=786 0x315=789 0x318=792 0x31B=795
# +-------------------------------------------------+
# for more details and different resolutions see
# http://wiki.archlinux.org/index.php/GRUB#Framebuffer_Resolution
# general configuration:
timeout 5
default 0
color light-blue/black light-cyan/blue
# boot sections follow
# each is implicitly numbered from 0 in the order of appearance below
#
# TIP: If you want a 1024x768 framebuffer, add "vga=773" to your kernel line.
#
#-*
# (0) Arch Linux
title Arch Linux [/boot/vmlinuz26]
root (hd0,0)
kernel /vmlinuz26 root=/dev/sda3 ro
initrd /kernel26.img
# (1) Windows
#title Windows
#rootnoverify (hd0,0)
#makeactive
#chainloader +1

100
core/grub/more-raid.patch Normal file
View file

@ -0,0 +1,100 @@
--- grub-0.95/lib/device.c.moreraid 2004-11-30 17:09:36.736099360 -0500
+++ grub-0.95/lib/device.c 2004-11-30 17:12:17.319686944 -0500
@@ -544,6 +544,17 @@
}
static void
+get_cciss_disk_name (char * name, int controller, int drive)
+{
+ sprintf (name, "/dev/cciss/c%dd%d", controller, drive);
+}
+
+static void
+get_cpqarray_disk_name (char * name, int controller, int drive)
+{
+ sprintf (name, "/dev/ida/c%dd%d", controller, drive);
+}
+static void
get_ataraid_disk_name (char *name, int unit)
{
sprintf (name, "/dev/ataraid/d%c", unit + '0');
@@ -920,7 +931,7 @@
for (controller = 0; controller < 8; controller++)
{
- for (drive = 0; drive < 15; drive++)
+ for (drive = 0; drive < 32; drive++)
{
char name[24];
@@ -940,6 +951,70 @@
}
}
#endif /* __linux__ */
+
+#ifdef __linux__
+ /* This is for cciss - we have
+ /dev/cciss/c<controller>d<logical drive>p<partition>.
+
+ cciss driver currently supports up to 8 controllers, 16 logical
+ drives, and 7 partitions. */
+ {
+ int controller, drive;
+
+ for (controller = 0; controller < 8; controller++)
+ {
+ for (drive = 0; drive < 16; drive++)
+ {
+ char name[24];
+
+ get_cciss_disk_name (name, controller, drive);
+ if (check_device (name))
+ {
+ (*map)[num_hd + 0x80] = strdup (name);
+ assert ((*map)[num_hd + 0x80]);
+
+ /* If the device map file is opened, write the map. */
+ if (fp)
+ fprintf (fp, "(hd%d)\t%s\n", num_hd, name);
+
+ num_hd++;
+ }
+ }
+ }
+ }
+#endif /* __linux__ */
+
+#ifdef __linux__
+ /* This is for cpqarray - we have
+ /dev/ida/c<controller>d<logical drive>p<partition>.
+
+ cpqarray driver currently supports up to 8 controllers, 16 logical
+ drives, and 15 partitions. */
+ {
+ int controller, drive;
+
+ for (controller = 0; controller < 8; controller++)
+ {
+ for (drive = 0; drive < 15; drive++)
+ {
+ char name[24];
+
+ get_cpqarray_disk_name (name, controller, drive);
+ if (check_device (name))
+ {
+ (*map)[num_hd + 0x80] = strdup (name);
+ assert ((*map)[num_hd + 0x80]);
+
+ /* If the device map file is opened, write the map. */
+ if (fp)
+ fprintf (fp, "(hd%d)\t%s\n", num_hd, name);
+
+ num_hd++;
+ }
+ }
+ }
+ }
+#endif /* __linux__ */
/* OK, close the device map file if opened. */
if (fp)

View file

@ -0,0 +1,18 @@
--- grub-0.93/lib/device.c.raid 2002-05-20 05:53:46.000000000 -0400
+++ grub-0.93/lib/device.c 2002-12-28 23:24:10.000000000 -0500
@@ -689,7 +689,14 @@
if (strcmp (dev + strlen(dev) - 5, "/disc") == 0)
strcpy (dev + strlen(dev) - 5, "/part");
}
- sprintf (dev + strlen(dev), "%d", ((partition >> 16) & 0xFF) + 1);
+
+ sprintf (dev + strlen(dev), "%s%d",
+ /* Compaq smart and others */
+ (strncmp(dev, "/dev/ida/", 9) == 0 ||
+ strncmp(dev, "/dev/ataraid/", 13) == 0 ||
+ strncmp(dev, "/dev/cciss/", 11) == 0 ||
+ strncmp(dev, "/dev/rd/", 8) == 0) ? "p" : "",
+ ((partition >> 16) & 0xFF) + 1);
/* Open the partition. */
fd = open (dev, O_RDWR);

View file

@ -0,0 +1,37 @@
diff -Naur gzip-1.2.4a-orig/Makefile.in gzip-1.2.4a/Makefile.in
--- gzip-1.2.4a-orig/Makefile.in 1993-08-17 10:12:40.000000000 -0700
+++ gzip-1.2.4a/Makefile.in 2005-04-21 11:45:27.000000000 -0700
@@ -348,27 +348,27 @@
rm -f _match.s
$(G)zdiff: zdiff.in
- sed -e "$(SEDCMD)" -e "s|BINDIR|$(bindir)|" $(srcdir)/zdiff.in > $@
+ sed -e "$(SEDCMD)" -e "s|BINDIR|/bin|" $(srcdir)/zdiff.in > $@
chmod 755 $@
$(G)zgrep: zgrep.in
- sed -e "$(SEDCMD)" -e "s|BINDIR|$(bindir)|" $(srcdir)/zgrep.in > $@
+ sed -e "$(SEDCMD)" -e "s|BINDIR|/bin|" $(srcdir)/zgrep.in > $@
chmod 755 $@
$(G)zmore: zmore.in
- sed -e "$(SEDCMD)" -e "s|BINDIR|$(bindir)|" $(srcdir)/zmore.in > $@
+ sed -e "$(SEDCMD)" -e "s|BINDIR|/bin|" $(srcdir)/zmore.in > $@
chmod 755 $@
$(G)znew: znew.in
- sed -e "$(SEDCMD)" -e "s|BINDIR|$(bindir)|" $(srcdir)/znew.in > $@
+ sed -e "$(SEDCMD)" -e "s|BINDIR|/bin|" $(srcdir)/znew.in > $@
chmod 755 $@
$(G)zforce: zforce.in
- sed -e "$(SEDCMD)" -e "s|BINDIR|$(bindir)|" $(srcdir)/zforce.in > $@
+ sed -e "$(SEDCMD)" -e "s|BINDIR|/bin|" $(srcdir)/zforce.in > $@
chmod 755 $@
gzexe: gzexe.in
- sed -e "$(SEDCMD)" -e "s|BINDIR|$(bindir)|" $(srcdir)/gzexe.in > $@
+ sed -e "$(SEDCMD)" -e "s|BINDIR|/bin|" $(srcdir)/gzexe.in > $@
chmod 755 $@
gzip.info: gzip.texi

Some files were not shown because too many files have changed in this diff Show more