Syncs with trunk

This commit is contained in:
Carles Pina i Estany 2009-11-19 21:18:38 +00:00
commit fbc5e89710
84 changed files with 39209 additions and 888 deletions

151
util/grub-mkrescue.in Normal file
View file

@ -0,0 +1,151 @@
#! /bin/sh -e
# Make GRUB rescue image
# Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009 Free Software Foundation, Inc.
#
# GRUB 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 3 of the License, or
# (at your option) any later version.
#
# GRUB 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 GRUB. If not, see <http://www.gnu.org/licenses/>.
# Initialize some variables.
transform="@program_transform_name@"
prefix=@prefix@
exec_prefix=@exec_prefix@
bindir=@bindir@
libdir=@libdir@
PACKAGE_NAME=@PACKAGE_NAME@
PACKAGE_TARNAME=@PACKAGE_TARNAME@
PACKAGE_VERSION=@PACKAGE_VERSION@
target_cpu=@target_cpu@
coreboot_dir=${libdir}/$(echo ${PACKAGE_TARNAME} | sed ${transform})/${target_cpu}-coreboot
pc_dir=${libdir}/$(echo ${PACKAGE_TARNAME} | sed ${transform})/${target_cpu}-pc
grub_mkisofs="grub-mkisofs"
# Usage: usage
# Print the usage.
usage () {
cat <<EOF
Usage: $0 [OPTION] SOURCE...
Make GRUB rescue image.
-h, --help print this message and exit
-v, --version print the version information and exit
--modules=MODULES pre-load specified modules MODULES
--output=FILE save output in FILE
$0 generates a bootable rescue image with specified source files or directories.
Report bugs to <bug-grub@gnu.org>.
EOF
}
# Check the arguments.
for option in "$@"; do
case "$option" in
-h | --help)
usage
exit 0 ;;
-v | --version)
echo "$0 (GNU GRUB ${PACKAGE_VERSION})"
exit 0 ;;
--modules=*)
modules=`echo "$option" | sed 's/--modules=//'` ;;
--output=*)
output_image=`echo "$option" | sed 's/--output=//'` ;;
-*)
echo "Unrecognized option \`$option'" 1>&2
usage
exit 1
;;
*)
source="${source} ${option}" ;;
esac
done
iso9660_dir=`mktemp -d`
mkdir -p ${iso9660_dir}/boot/grub
for platform in pc coreboot ; do
input_dir=${libdir}/$(echo ${PACKAGE_TARNAME} | sed ${transform})/${target_cpu}-${platform}
if test -e ${input_dir} ; then
mkdir -p ${iso9660_dir}/boot/grub/${target_cpu}-${platform}
for file in ${input_dir}/*.mod ${input_dir}/efiemu??.o \
${input_dir}/command.lst ${input_dir}/moddep.lst ${input_dir}/fs.lst \
${input_dir}/handler.lst ${input_dir}/parttool.lst; do
if test -f "$file"; then
cp -f "$file" ${iso9660_dir}/boot/grub/${target_cpu}-${platform}/
fi
done
fi
done
# build coreboot core.img
if test -e ${coreboot_dir} ; then
memdisk_img=`mktemp`
memdisk_dir=`mktemp -d`
mkdir -p ${memdisk_dir}/boot/grub
# obtain date-based UUID
iso_uuid=$(date +%Y-%m-%d-%H-%M-%S-00)
modules="$(cat ${coreboot_dir}/partmap.lst) ${modules}"
cat << EOF > ${memdisk_dir}/boot/grub/grub.cfg
search --fs-uuid --set ${iso_uuid}
set prefix=(\${root})/boot/grub/${target_cpu}-coreboot
EOF
(for i in ${modules} ; do
echo "insmod $i"
done ; \
echo "source /boot/grub/grub.cfg") \
> ${iso9660_dir}/boot/grub/i386-pc/grub.cfg
tar -C ${memdisk_dir} -cf ${memdisk_img} boot
rm -rf ${memdisk_dir}
grub-mkelfimage -d ${coreboot_dir}/ -m ${memdisk_img} -o ${iso9660_dir}/boot/multiboot.img \
memdisk tar search iso9660 configfile sh \
ata at_keyboard
rm -f ${memdisk_img}
grub_mkisofs="${grub_mkisofs} --modification-date=$(echo ${iso_uuid} | sed -e s/-//g)"
fi
if [ "${source}" != "" ] ; then
for d in ${source}; do
echo "Processing $d"
cp -dpRl "${d}" ${iso9660_dir}/
done
fi
# build eltorito core.img
if test -e ${pc_dir} ; then
core_img=`mktemp`
grub-mkimage -d ${pc_dir}/ -o ${core_img} --prefix=/boot/grub/i386-pc \
memdisk tar search iso9660 configfile sh \
biosdisk
cat ${pc_dir}/cdboot.img ${core_img} > ${iso9660_dir}/boot/grub/i386-pc/eltorito.img
rm -f ${core_img}
modules="$(cat ${pc_dir}/partmap.lst) ${modules}"
(for i in ${modules} ; do
echo "insmod $i"
done ; \
echo "source /boot/grub/grub.cfg") \
> ${iso9660_dir}/boot/grub/i386-pc/grub.cfg
grub_mkisofs="${grub_mkisofs} -b boot/grub/i386-pc/eltorito.img -boot-info-table"
fi
# build iso image
${grub_mkisofs} -o ${output_image} -r -J ${iso9660_dir}
rm -rf ${iso9660_dir}
exit 0

View file

@ -18,9 +18,14 @@
prefix=@prefix@
exec_prefix=@exec_prefix@
bindir=@bindir@
libdir=@libdir@
. ${libdir}/grub/grub-mkconfig_lib
. ${bindir}/gettext.sh
export TEXTDOMAIN=@PACKAGE@
export TEXTDOMAINDIR=@LOCALEDIR@
case "${GRUB_DISTRIBUTOR}" in
Debian) OS="${GRUB_DISTRIBUTOR} GNU/kFreeBSD" ;;
*) OS="FreeBSD" ;;
@ -28,9 +33,12 @@ esac
kfreebsd_entry ()
{
cat << EOF
menuentry "$1" {
EOF
os="$1"
version="$2"
recovery="$3" # not used yet
args="$4" # not used yet
title="$(gettext "%s, with kFreeBSD %s")"
printf "menuentry \"${title}\" {" ${os} ${version}
if [ -z "${prepare_boot_cache}" ]; then
prepare_boot_cache="$(prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} | sed -e "s/^/\t/")"
fi
@ -100,7 +108,7 @@ while [ "x$list" != "x" ] ; do
acpi_ko_rel_dirname=`make_system_path_relative_to_its_root $acpi_ko_dirname`
fi
kfreebsd_entry "${OS}, kFreeBSD ${version}"
kfreebsd_entry "${OS}" "${version}"
list=`echo $list | tr ' ' '\n' | grep -vx $kfreebsd | tr '\n' ' '`
done

View file

@ -18,9 +18,14 @@
prefix=@prefix@
exec_prefix=@exec_prefix@
bindir=@bindir@
libdir=@libdir@
. ${libdir}/grub/grub-mkconfig_lib
. ${bindir}/gettext.sh
export TEXTDOMAIN=@PACKAGE@
export TEXTDOMAINDIR=@LOCALEDIR@
if [ "x${GRUB_DISTRIBUTOR}" = "x" ] ; then
OS=GNU/Linux
else
@ -44,15 +49,22 @@ fi
linux_entry ()
{
cat << EOF
menuentry "$1" {
EOF
os="$1"
version="$2"
recovery="$3"
args="$4"
if ${recovery} ; then
title="$(gettext "%s, with Linux %s (recovery mode)")"
else
title="$(gettext "%s, with Linux %s")"
fi
printf "menuentry \"${title}\" {" ${os} ${version}
if [ -z "${prepare_boot_cache}" ]; then
prepare_boot_cache="$(prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} | sed -e "s/^/\t/")"
fi
printf '%s\n' "${prepare_boot_cache}"
cat << EOF
linux ${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro $2
linux ${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro ${args}
EOF
if test -n "${initrd}" ; then
cat << EOF
@ -95,11 +107,11 @@ while [ "x$list" != "x" ] ; do
linux_root_device_thisversion=${GRUB_DEVICE}
fi
linux_entry $eval_gettext ("${OS}, with Linux ${version}" \
"${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}")
linux_entry "${OS}" "${version}" false \
"${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}"
if [ "x${GRUB_DISABLE_LINUX_RECOVERY}" != "xtrue" ]; then
linux_entry $eval_gettext ("${OS}, with Linux ${version} (recovery mode)" \
"single ${GRUB_CMDLINE_LINUX}")
linux_entry "${OS}" "${version}" true \
"single ${GRUB_CMDLINE_LINUX}"
fi
list=`echo $list | tr ' ' '\n' | grep -vx $linux | tr '\n' ' '`

View file

@ -1,7 +1,7 @@
#! /bin/sh -e
# Make GRUB rescue image
# Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009 Free Software Foundation, Inc.
# Make GRUB rescue floppy
# Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006,2007,2008 Free Software Foundation, Inc.
#
# GRUB is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -30,26 +30,19 @@ target_cpu=@target_cpu@
platform=@platform@
pkglibdir=${libdir}/`echo ${PACKAGE_TARNAME}/${target_cpu}-${platform} | sed ${transform}`
grub_mkimage=${bindir}/`echo grub-mkelfimage | sed ${transform}`
grub_mkisofs=${bindir}/`echo grub-mkisofs | sed ${transform}`
# Usage: usage
# Print the usage.
usage () {
cat <<EOF
Usage: $0 [OPTION] output_image
Make GRUB rescue image.
Make GRUB rescue floppy.
-h, --help print this message and exit
-v, --version print the version information and exit
--modules=MODULES pre-load specified modules MODULES
--overlay=DIR overlay directory DIR in the memdisk image
(may be specified multiple times)
--pkglibdir=DIR use images from directory DIR instead of ${pkglibdir}
--grub-mkimage=FILE use FILE as grub-mkimage
--grub-mkisofs=FILE use FILE as grub-mkisofs
--output=FILE save output in FILE
$0 generates a bootable rescue image.
$0 generates a bootable rescue floppy.
Report bugs to <bug-grub@gnu.org>.
EOF
@ -68,14 +61,8 @@ for option in "$@"; do
exit 0 ;;
--modules=*)
modules=`echo "$option" | sed 's/--modules=//'` ;;
--overlay=*)
overlay=${overlay}${overlay:+ }`echo "$option" | sed 's/--overlay=//'` ;;
--pkglibdir=*)
input_dir=`echo "$option" | sed 's/--pkglibdir=//'` ;;
--grub-mkimage=*)
grub_mkimage=`echo "$option" | sed 's/--grub-mkimage=//'` ;;
--grub-mkisofs=*)
grub_mkisofs=`echo "$option" | sed 's/--grub-mkisofs=//'` ;;
--output=*)
output_image=`echo "$option" | sed 's/--output=//'` ;;
-*)
echo "Unrecognized option \`$option'" 1>&2
usage
@ -96,53 +83,34 @@ if test "x$output_image" = x; then
exit 1
fi
memdisk_dir=`mktemp -d`
iso9660_dir=`mktemp -d`
mkdir -p ${memdisk_dir}/boot/grub ${iso9660_dir}/boot/grub
aux_dir=`mktemp -d`
mkdir -p ${aux_dir}/boot/grub
for file in ${input_dir}/*.mod ${input_dir}/efiemu??.o \
${input_dir}/command.lst ${input_dir}/moddep.lst ${input_dir}/fs.lst \
${input_dir}/handler.lst ${input_dir}/parttool.lst; do
if test -f "$file"; then
cp -f "$file" ${iso9660_dir}/boot/grub/
cp -f "$file" ${aux_dir}/boot/grub/
fi
done
# obtain date-based UUID
iso_uuid=$(date +%Y-%m-%d-%H-%M-%S-00)
# first-stage grub.cfg
cat << EOF >> ${memdisk_dir}/boot/grub/grub.cfg
search --fs-uuid --set ${iso_uuid}
set prefix=(\${root})/boot/grub
source /boot/grub/grub.cfg
EOF
modules="$(cat ${input_dir}/partmap.lst) ${modules}"
for i in ${modules} ; do
echo "insmod $i"
done > ${aux_dir}/boot/grub/grub.cfg
# build memdisk
memdisk_img=`mktemp`
tar -C ${memdisk_dir} -cf ${memdisk_img} boot
rm -rf ${memdisk_dir}
tar -C ${aux_dir} -cf ${memdisk_img} boot
rm -rf ${aux_dir}
# build core.img
mkdir -p ${iso9660_dir}/boot/grub
${grub_mkimage} -d ${input_dir}/ -m ${memdisk_img} -o ${iso9660_dir}/boot/multiboot.img \
at_keyboard memdisk tar ata search iso9660 configfile sh
core_img=`mktemp`
grub-mkimage -d ${input_dir}/ -m ${memdisk_img} -o ${core_img} memdisk tar biosdisk
rm -f ${memdisk_img}
for d in ${overlay}; do
echo "Overlaying $d"
cp -dpR "${d}"/* "${iso9660_dir}"/
done
# second-stage grub.cfg
modules="`cat ${input_dir}/partmap.lst` ${modules}"
for i in ${modules} ; do
echo "insmod $i"
done > ${iso9660_dir}/boot/grub/grub.cfg
# build iso image
${grub_mkisofs} \
--modification-date=$(echo ${iso_uuid} | sed -e s/-//g) \
-o ${output_image} -r -J ${iso9660_dir}
# build floppy image
cat ${input_dir}/boot.img ${core_img} /dev/zero | dd bs=1024 count=1440 > ${output_image}
rm -f ${core_img}
exit 0

View file

@ -22,6 +22,7 @@
#include <grub/machine/boot.h>
#include <grub/machine/kernel.h>
#include <grub/machine/memory.h>
#include <grub/i18n.h>
#include <grub/kernel.h>
#include <grub/disk.h>
#include <grub/util/misc.h>
@ -36,6 +37,8 @@
#define _GNU_SOURCE 1
#include <getopt.h>
#include "progname.h"
#ifdef ENABLE_LZMA
#include <grub/lib/LzmaEnc.h>
@ -59,7 +62,7 @@ compress_kernel (char *kernel_img, size_t kernel_size,
props.numThreads = 1;
if (kernel_size < GRUB_KERNEL_MACHINE_RAW_SIZE)
grub_util_error ("the core image is too small");
grub_util_error (_("the core image is too small"));
*core_img = xmalloc (kernel_size);
memcpy (*core_img, kernel_img, GRUB_KERNEL_MACHINE_RAW_SIZE);
@ -71,7 +74,7 @@ compress_kernel (char *kernel_img, size_t kernel_size,
kernel_size - GRUB_KERNEL_MACHINE_RAW_SIZE,
&props, out_props, &out_props_size,
0, NULL, &g_Alloc, &g_Alloc) != SZ_OK)
grub_util_error ("cannot compress the kernel image");
grub_util_error (_("cannot compress the kernel image"));
*core_size += GRUB_KERNEL_MACHINE_RAW_SIZE;
}
@ -111,14 +114,14 @@ generate_image (const char *dir, char *prefix, FILE *out, char *mods[],
if (memdisk_path)
{
memdisk_size = ALIGN_UP(grub_util_get_image_size (memdisk_path), 512);
grub_util_info ("the size of memory disk is 0x%x", memdisk_size);
grub_util_info (_("the size of memory disk is 0x%x"), memdisk_size);
total_module_size += memdisk_size + sizeof (struct grub_module_header);
}
if (config_path)
{
config_size = grub_util_get_image_size (config_path) + 1;
grub_util_info ("the size of config file is 0x%x", config_size);
grub_util_info (_("the size of config file is 0x%x"), config_size);
total_module_size += config_size + sizeof (struct grub_module_header);
}
@ -126,13 +129,13 @@ generate_image (const char *dir, char *prefix, FILE *out, char *mods[],
total_module_size += (grub_util_get_image_size (p->name)
+ sizeof (struct grub_module_header));
grub_util_info ("the total module size is 0x%x", total_module_size);
grub_util_info (_("the total module size is 0x%x"), total_module_size);
kernel_img = xmalloc (kernel_size + total_module_size);
grub_util_load_image (kernel_path, kernel_img);
if (GRUB_KERNEL_MACHINE_PREFIX + strlen (prefix) + 1 > GRUB_KERNEL_MACHINE_DATA_END)
grub_util_error ("prefix too long");
grub_util_error (_("prefix is too long"));
strcpy (kernel_img + GRUB_KERNEL_MACHINE_PREFIX, prefix);
/* Fill in the grub_module_info structure. */
@ -193,19 +196,19 @@ generate_image (const char *dir, char *prefix, FILE *out, char *mods[],
compress_kernel (kernel_img, kernel_size + total_module_size,
&core_img, &core_size);
grub_util_info ("the core size is 0x%x", core_size);
grub_util_info (_("the core size is 0x%x"), core_size);
#if defined(GRUB_MACHINE_PCBIOS)
{
unsigned num;
num = ((core_size + GRUB_DISK_SECTOR_SIZE - 1) >> GRUB_DISK_SECTOR_BITS);
if (num > 0xffff)
grub_util_error ("the core image is too big");
grub_util_error (_("the core image is too big"));
boot_path = grub_util_get_path (dir, "diskboot.img");
boot_size = grub_util_get_image_size (boot_path);
if (boot_size != GRUB_DISK_SECTOR_SIZE)
grub_util_error ("diskboot.img is not one sector size");
grub_util_error (_("diskboot.img size must be %u bytes"), GRUB_DISK_SECTOR_SIZE);
boot_img = grub_util_read_image (boot_path);
@ -278,7 +281,7 @@ generate_image (const char *dir, char *prefix, FILE *out, char *mods[],
#ifdef GRUB_MACHINE_PCBIOS
if (GRUB_KERNEL_MACHINE_LINK_ADDR + core_size > GRUB_MEMORY_MACHINE_UPPER)
grub_util_error ("Core image is too big (%p > %p)\n",
grub_util_error (_("Core image is too big (%p > %p)\n"),
GRUB_KERNEL_MACHINE_LINK_ADDR + core_size, GRUB_MEMORY_MACHINE_UPPER);
#endif
@ -315,9 +318,9 @@ static void
usage (int status)
{
if (status)
fprintf (stderr, "Try ``grub-mkimage --help'' for more information.\n");
fprintf (stderr, _("Try ``%s --help'' for more information.\n"), program_name);
else
printf ("\
printf (_("\
Usage: grub-mkimage [OPTION]... [MODULES]\n\
\n\
Make a bootable image of GRUB.\n\
@ -332,7 +335,7 @@ Make a bootable image of GRUB.\n\
-v, --verbose print verbose messages\n\
\n\
Report bugs to <%s>.\n\
", GRUB_LIBDIR, DEFAULT_DIRECTORY, PACKAGE_BUGREPORT);
"), GRUB_LIBDIR, DEFAULT_DIRECTORY, PACKAGE_BUGREPORT);
exit (status);
}
@ -347,7 +350,10 @@ main (int argc, char *argv[])
char *config = NULL;
FILE *fp = stdout;
progname = "grub-mkimage";
set_program_name (argv[0]);
setlocale (LC_ALL, "");
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
while (1)
{
@ -420,7 +426,7 @@ main (int argc, char *argv[])
{
fp = fopen (output, "wb");
if (! fp)
grub_util_error ("cannot open %s", output);
grub_util_error (_("cannot open %s"), output);
free (output);
}

View file

@ -1,180 +0,0 @@
#! /bin/sh -e
# Make GRUB rescue image
# Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006,2007,2008 Free Software Foundation, Inc.
#
# GRUB 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 3 of the License, or
# (at your option) any later version.
#
# GRUB 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 GRUB. If not, see <http://www.gnu.org/licenses/>.
# Initialize some variables.
transform="@program_transform_name@"
prefix=@prefix@
exec_prefix=@exec_prefix@
bindir=@bindir@
libdir=@libdir@
PACKAGE_NAME=@PACKAGE_NAME@
PACKAGE_TARNAME=@PACKAGE_TARNAME@
PACKAGE_VERSION=@PACKAGE_VERSION@
target_cpu=@target_cpu@
platform=@platform@
pkglibdir=${libdir}/`echo ${PACKAGE_TARNAME}/${target_cpu}-${platform} | sed ${transform}`
grub_mkimage=${bindir}/`echo grub-mkimage | sed ${transform}`
# Usage: usage
# Print the usage.
usage () {
cat <<EOF
Usage: $0 [OPTION] output_image
Make GRUB rescue image.
-h, --help print this message and exit
-v, --version print the version information and exit
--modules=MODULES pre-load specified modules MODULES
--overlay=DIR overlay directory DIR in the memdisk image
(may be specified multiple times)
--pkglibdir=DIR use images from directory DIR instead of ${pkglibdir}
--grub-mkimage=FILE use FILE as grub-mkimage
--image-type=TYPE select floppy or cdrom (default)
--emulation=TYPE select El Torito boot emulation type floppy
or none (default) (cdrom only)
$0 generates a bootable rescue image of the specified type.
Report bugs to <bug-grub@gnu.org>.
EOF
}
image_type=cdrom
input_dir=${pkglibdir}
emulation=none
# Check the arguments.
for option in "$@"; do
case "$option" in
-h | --help)
usage
exit 0 ;;
-v | --version)
echo "$0 (GNU GRUB ${PACKAGE_VERSION})"
exit 0 ;;
--modules=*)
modules=`echo "$option" | sed 's/--modules=//'` ;;
--overlay=*)
overlay=${overlay}${overlay:+ }`echo "$option" | sed 's/--overlay=//'` ;;
--pkglibdir=*)
input_dir=`echo "$option" | sed 's/--pkglibdir=//'` ;;
--grub-mkimage=*)
grub_mkimage=`echo "$option" | sed 's/--grub-mkimage=//'` ;;
--image-type=*)
image_type=`echo "$option" | sed 's/--image-type=//'`
case "$image_type" in
floppy|cdrom) ;;
*)
echo "Unknown image type \`$image_type'" 1>&2
exit 1 ;;
esac ;;
--emulation=*)
emulation=`echo "$option" | sed 's/--emulation=//'`
case "$emulation" in
floppy|none) ;;
*)
echo "Unknown emulation type \`$emulation'" 1>&2
exit 1 ;;
esac ;;
-*)
echo "Unrecognized option \`$option'" 1>&2
usage
exit 1
;;
*)
if test "x$output_image" != x; then
echo "Unrecognized option \`$option'" 1>&2
usage
exit 1
fi
output_image="${option}" ;;
esac
done
if test "x$output_image" = x; then
usage
exit 1
fi
aux_dir=`mktemp -d`
mkdir -p ${aux_dir}/boot/grub
for file in ${input_dir}/*.mod ${input_dir}/efiemu??.o \
${input_dir}/command.lst ${input_dir}/moddep.lst ${input_dir}/fs.lst \
${input_dir}/handler.lst ${input_dir}/parttool.lst; do
if test -f "$file"; then
cp -f "$file" ${aux_dir}/boot/grub/
fi
done
modules="biosdisk `cat ${input_dir}/partmap.lst` ${modules}"
for i in ${modules} ; do
echo "insmod $i"
done > ${aux_dir}/boot/grub/grub.cfg
for d in ${overlay}; do
echo "Overlaying $d"
cp -dpR "${d}"/* "${aux_dir}"/
done
if [ "x${image_type}" = xfloppy -o "x${emulation}" = xfloppy ] ; then
# build memdisk
memdisk_img=`mktemp`
tar -C ${aux_dir} -cf ${memdisk_img} boot
rm -rf ${aux_dir}
# build core.img
core_img=`mktemp`
${grub_mkimage} -d ${input_dir}/ -m ${memdisk_img} -o ${core_img} memdisk tar
rm -f ${memdisk_img}
# build floppy image
if [ "x${image_type}" = xcdrom ] ; then
floppy_dir=`mktemp -d`
floppy_img=${floppy_dir}/grub_floppy.img
else
floppy_img=${output_image}
fi
cat ${input_dir}/boot.img ${core_img} /dev/zero | dd bs=1024 count=1440 > ${floppy_img}
rm -f ${core_img}
if [ "x${image_type}" = xcdrom ] ; then
# build iso image
genisoimage -b grub_floppy.img \
-o ${output_image} -r -J ${floppy_dir}
rm -rf ${floppy_dir}
fi
else
# build core.img
core_img=`mktemp`
${grub_mkimage} -d ${input_dir}/ -o ${core_img} biosdisk iso9660
# build grub_eltorito image
cat ${input_dir}/cdboot.img ${core_img} > ${aux_dir}/boot/grub/grub_eltorito
rm -f ${core_img}
# build iso image
genisoimage -b boot/grub/grub_eltorito \
-no-emul-boot -boot-load-size 4 -boot-info-table \
-o ${output_image} -r -J ${aux_dir}
rm -rf ${aux_dir}
fi
exit 0

View file

@ -1,7 +1,7 @@
/* grub-setup.c - make GRUB usable */
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006,2007,2008 Free Software Foundation, Inc.
* Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -32,8 +32,10 @@
#include <grub/machine/boot.h>
#include <grub/machine/kernel.h>
#include <grub/term.h>
#include <grub/i18n.h>
#include <grub/util/raid.h>
#include <grub/util/lvm.h>
#include <grub/util/getroot.h>
static const grub_gpt_part_type_t grub_gpt_partition_type_bios_boot = GRUB_GPT_PARTITION_TYPE_BIOS_BOOT;
@ -46,7 +48,7 @@ static const grub_gpt_part_type_t grub_gpt_partition_type_bios_boot = GRUB_GPT_P
#include <sys/types.h>
#include <sys/stat.h>
#include <dirent.h>
#include <grub/util/getroot.h>
#include "progname.h"
#define _GNU_SOURCE 1
#include <getopt.h>
@ -157,11 +159,11 @@ setup (const char *dir,
void NESTED_FUNC_ATTR save_first_sector (grub_disk_addr_t sector, unsigned offset,
unsigned length)
{
grub_util_info ("the first sector is <%llu,%u,%u>",
grub_util_info (_("the first sector is <%llu,%u,%u>"),
sector, offset, length);
if (offset != 0 || length != GRUB_DISK_SECTOR_SIZE)
grub_util_error ("The first sector of the core file is not sector-aligned");
grub_util_error (_("The first sector of the core file is not sector-aligned"));
first_sector = sector;
}
@ -171,11 +173,11 @@ setup (const char *dir,
{
struct boot_blocklist *prev = block + 1;
grub_util_info ("saving <%llu,%u,%u> with the segment 0x%x",
grub_util_info (_("saving <%llu,%u,%u> with the segment 0x%x"),
sector, offset, length, (unsigned) current_segment);
if (offset != 0 || last_length != GRUB_DISK_SECTOR_SIZE)
grub_util_error ("Non-sector-aligned data is found in the core file");
grub_util_error (_("Non-sector-aligned data is found in the core file"));
if (block != first_block
&& (grub_le_to_cpu64 (prev->start)
@ -189,7 +191,7 @@ setup (const char *dir,
block--;
if (block->len)
grub_util_error ("The sectors of the core file are too fragmented");
grub_util_error (_("The sectors of the core file are too fragmented"));
}
last_length = length;
@ -200,7 +202,7 @@ setup (const char *dir,
boot_path = grub_util_get_path (dir, boot_file);
boot_size = grub_util_get_image_size (boot_path);
if (boot_size != GRUB_DISK_SECTOR_SIZE)
grub_util_error ("The size of `%s' is not %d",
grub_util_error (_("The size of `%s' is not %u"),
boot_path, GRUB_DISK_SECTOR_SIZE);
boot_img = grub_util_read_image (boot_path);
free (boot_path);
@ -217,9 +219,9 @@ setup (const char *dir,
core_sectors = ((core_size + GRUB_DISK_SECTOR_SIZE - 1)
>> GRUB_DISK_SECTOR_BITS);
if (core_size < GRUB_DISK_SECTOR_SIZE)
grub_util_error ("The size of `%s' is too small", core_path);
grub_util_error (_("The size of `%s' is too small"), core_path);
else if (core_size > 0xFFFF * GRUB_DISK_SECTOR_SIZE)
grub_util_error ("The size of `%s' is too large", core_path);
grub_util_error (_("The size of `%s' is too large"), core_path);
core_img = grub_util_read_image (core_path);
@ -242,7 +244,7 @@ setup (const char *dir,
if (! dest_dev)
grub_util_error ("%s", grub_errmsg);
grub_util_info ("setting the root device to `%s'", root);
grub_util_info (_("setting the root device to `%s'"), root);
if (grub_env_set ("root", root) != GRUB_ERR_NONE)
grub_util_error ("%s", grub_errmsg);
@ -256,15 +258,15 @@ setup (const char *dir,
grub_fs_t fs;
fs = grub_fs_probe (dest_dev);
if (! fs)
grub_util_error ("Unable to identify a filesystem in %s; safety check can't be performed.",
grub_util_error (_("Unable to identify a filesystem in %s; safety check can't be performed"),
dest_dev->disk->name);
if (! fs->reserved_first_sector)
grub_util_error ("%s appears to contain a %s filesystem which isn't known to "
"reserve space for DOS-style boot. Installing GRUB there could "
"result in FILESYSTEM DESTRUCTION if valuable data is overwritten "
"by grub-setup (--skip-fs-probe disables this "
"check, use at your own risk).", dest_dev->disk->name, fs->name);
grub_util_error (_("%s appears to contain a %s filesystem which isn't known to "
"reserve space for DOS-style boot. Installing GRUB there could "
"result in FILESYSTEM DESTRUCTION if valuable data is overwritten "
"by grub-setup (--skip-fs-probe disables this "
"check, use at your own risk)"), dest_dev->disk->name, fs->name);
}
/* Copy the possible DOS BPB. */
@ -309,7 +311,7 @@ setup (const char *dir,
bsd_part = -1;
}
else
grub_util_error ("No PC style partitions found");
grub_util_error (_("No DOS-style partitions found"));
}
else
dos_part = bsd_part = -1;
@ -320,18 +322,18 @@ setup (const char *dir,
bsd_part = grub_le_to_cpu32 (*install_bsd_part);
}
grub_util_info ("dos partition is %d, bsd partition is %d",
grub_util_info (_("dos partition is %d, bsd partition is %d"),
dos_part, bsd_part);
if (! dest_dev->disk->has_partitions)
{
grub_util_warn ("Attempting to install GRUB to a partitionless disk. This is a BAD idea.");
grub_util_warn (_("Attempting to install GRUB to a partitionless disk. This is a BAD idea."));
goto unable_to_embed;
}
if (dest_dev->disk->partition)
{
grub_util_warn ("Attempting to install GRUB to a partition instead of the MBR. This is a BAD idea.");
grub_util_warn (_("Attempting to install GRUB to a partition instead of the MBR. This is a BAD idea."));
goto unable_to_embed;
}
@ -350,7 +352,7 @@ setup (const char *dir,
if (! dest_partmap)
{
grub_util_warn ("Attempting to install GRUB to a partitionless disk. This is a BAD idea.");
grub_util_warn (_("Attempting to install GRUB to a partitionless disk. This is a BAD idea."));
goto unable_to_embed;
}
@ -360,25 +362,23 @@ setup (const char *dir,
if (embed_region.end == embed_region.start)
{
if (! strcmp (dest_partmap, "part_msdos"))
grub_util_warn ("This msdos-style partition label has no post-MBR gap; embedding won't be possible!");
grub_util_warn (_("This msdos-style partition label has no post-MBR gap; embedding won't be possible!"));
else
grub_util_warn ("This GPT partition label has no BIOS Boot Partition; embedding won't be possible!");
grub_util_warn (_("This GPT partition label has no BIOS Boot Partition; embedding won't be possible!"));
goto unable_to_embed;
}
if ((unsigned long) core_sectors > embed_region.end - embed_region.start)
{
if (core_sectors > 62)
grub_util_warn ("Your core.img is unusually large. It won't fit in the embedding area.");
else if (embed_region.end - embed_region.start < 62)
grub_util_warn ("Your embedding area is unusually small. core.img won't fit in it.");
else
grub_util_warn ("Embedding area is too small for core.img.");
grub_util_warn (_("Your core.img is unusually large. It won't fit in the embedding area."));
else /* embed_region.end - embed_region.start < 62 */
grub_util_warn (_("Your embedding area is unusually small. core.img won't fit in it."));
goto unable_to_embed;
}
grub_util_info ("will embed the core image at sector 0x%llx", embed_region.start);
grub_util_info (_("the core image will be embedded at sector 0x%llx"), embed_region.start);
*install_dos_part = grub_cpu_to_le32 (dos_part);
*install_bsd_part = grub_cpu_to_le32 (bsd_part);
@ -415,14 +415,14 @@ setup (const char *dir,
unable_to_embed:
if (must_embed)
grub_util_error ("Embedding is not possible, but this is required when "
"the root device is on a RAID array or LVM volume.");
grub_util_error (_("Embedding is not possible, but this is required when "
"the root device is on a RAID array or LVM volume."));
grub_util_warn ("Embedding is not possible. GRUB can only be installed in this "
"setup by using blocklists. However, blocklists are UNRELIABLE and "
"its use is discouraged.");
grub_util_warn (_("Embedding is not possible. GRUB can only be installed in this "
"setup by using blocklists. However, blocklists are UNRELIABLE and "
"its use is discouraged."));
if (! force)
grub_util_error ("If you really want blocklists, use --force.");
grub_util_error (_("If you really want blocklists, use --force."));
/* Make sure that GRUB reads the identical image as the OS. */
tmp_img = xmalloc (core_size);
@ -436,8 +436,9 @@ unable_to_embed:
for (i = 0; i < MAX_TRIES; i++)
{
grub_util_info ("attempting to read the core image `%s' from GRUB%s",
core_path_dev, (i == 0) ? "" : " again");
grub_util_info ((i == 0) ? _("attempting to read the core image `%s' from GRUB")
: _("attempting to read the core image `%s' from GRUB again"),
core_path_dev);
grub_disk_cache_invalidate_all ();
@ -445,11 +446,11 @@ unable_to_embed:
if (file)
{
if (grub_file_size (file) != core_size)
grub_util_info ("succeeded in opening the core image but the size is different (%d != %d)",
grub_util_info (_("succeeded in opening the core image but the size is different (%d != %d)"),
(int) grub_file_size (file), (int) core_size);
else if (grub_file_read (file, tmp_img, core_size)
!= (grub_ssize_t) core_size)
grub_util_info ("succeeded in opening the core image but cannot read %d bytes",
grub_util_info (_("succeeded in opening the core image but cannot read %d bytes"),
(int) core_size);
else if (memcmp (core_img, tmp_img, core_size) != 0)
{
@ -472,7 +473,7 @@ unable_to_embed:
}
#endif
grub_util_info ("succeeded in opening the core image but the data is different");
grub_util_info (_("succeeded in opening the core image but the data is different"));
}
else
{
@ -483,10 +484,10 @@ unable_to_embed:
grub_file_close (file);
}
else
grub_util_info ("couldn't open the core image");
grub_util_info (_("couldn't open the core image"));
if (grub_errno)
grub_util_info ("error message = %s", grub_errmsg);
grub_util_info (_("error message = %s"), grub_errmsg);
grub_errno = GRUB_ERR_NONE;
sync ();
@ -494,7 +495,7 @@ unable_to_embed:
}
if (i == MAX_TRIES)
grub_util_error ("Cannot read `%s' correctly", core_path_dev);
grub_util_error (_("Cannot read `%s' correctly"), core_path_dev);
/* Clean out the blocklists. */
block = first_block;
@ -507,7 +508,7 @@ unable_to_embed:
block--;
if ((char *) block <= core_img)
grub_util_error ("No terminator in the core image");
grub_util_error (_("No terminator in the core image"));
}
/* Now read the core image to determine where the sectors are. */
@ -518,13 +519,13 @@ unable_to_embed:
file->read_hook = save_first_sector;
if (grub_file_read (file, tmp_img, GRUB_DISK_SECTOR_SIZE)
!= GRUB_DISK_SECTOR_SIZE)
grub_util_error ("Failed to read the first sector of the core image");
grub_util_error (_("Failed to read the first sector of the core image"));
block = first_block;
file->read_hook = save_blocklists;
if (grub_file_read (file, tmp_img, core_size - GRUB_DISK_SECTOR_SIZE)
!= (grub_ssize_t) core_size - GRUB_DISK_SECTOR_SIZE)
grub_util_error ("Failed to read the rest sectors of the core image");
grub_util_error (_("Failed to read the rest sectors of the core image"));
grub_file_close (file);
@ -540,10 +541,10 @@ unable_to_embed:
*install_bsd_part = grub_cpu_to_le32 (bsd_part);
/* Write the first two sectors of the core image onto the disk. */
grub_util_info ("opening the core image `%s'", core_path);
grub_util_info (_("opening the core image `%s'"), core_path);
fp = fopen (core_path, "r+b");
if (! fp)
grub_util_error ("Cannot open `%s'", core_path);
grub_util_error (_("Cannot open `%s'"), core_path);
grub_util_write_image (core_img, GRUB_DISK_SECTOR_SIZE * 2, fp);
fclose (fp);
@ -583,9 +584,9 @@ static void
usage (int status)
{
if (status)
fprintf (stderr, "Try ``grub-setup --help'' for more information.\n");
fprintf (stderr, _("Try ``%s --help'' for more information.\n"), program_name);
else
printf ("\
printf (_("\
Usage: grub-setup [OPTION]... DEVICE\n\
\n\
Set up images to boot from DEVICE.\n\
@ -603,7 +604,7 @@ DEVICE must be a GRUB device (e.g. ``(hd0,1)'').\n\
-v, --verbose print verbose messages\n\
\n\
Report bugs to <%s>.\n\
",
"),
DEFAULT_BOOT_FILE, DEFAULT_CORE_FILE, DEFAULT_DIRECTORY,
DEFAULT_DEVICE_MAP, PACKAGE_BUGREPORT);
@ -633,7 +634,10 @@ main (int argc, char *argv[])
char *dest_dev;
int must_embed = 0, force = 0, fs_probe = 1;
progname = "grub-setup";
set_program_name (argv[0]);
setlocale (LC_ALL, "");
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
/* Check for options. */
while (1)
@ -712,13 +716,13 @@ main (int argc, char *argv[])
/* Obtain DEST_DEV. */
if (optind >= argc)
{
fprintf (stderr, "No device is specified.\n");
fprintf (stderr, _("No device is specified.\n"));
usage (1);
}
if (optind + 1 != argc)
{
fprintf (stderr, "Unknown extra argument `%s'.\n", argv[optind + 1]);
fprintf (stderr, _("Unknown extra argument `%s'.\n"), argv[optind + 1]);
usage (1);
}
@ -735,7 +739,7 @@ main (int argc, char *argv[])
dest_dev = grub_util_get_grub_dev (argv[optind]);
if (! dest_dev)
{
fprintf (stderr, "Invalid device `%s'.\n", argv[optind]);
fprintf (stderr, _("Invalid device `%s'.\n"), argv[optind]);
usage (1);
}
}
@ -748,7 +752,7 @@ main (int argc, char *argv[])
char *tmp = get_device_name (root_dev);
if (! tmp)
grub_util_error ("Invalid root device `%s'", root_dev);
grub_util_error (_("Invalid root device `%s'"), root_dev);
tmp = xstrdup (tmp);
free (root_dev);
@ -759,9 +763,9 @@ main (int argc, char *argv[])
root_dev = grub_util_get_grub_dev (grub_guess_root_device (dir ? : DEFAULT_DIRECTORY));
if (! root_dev)
{
grub_util_info ("guessing the root device failed, because of `%s'",
grub_util_info (_("guessing the root device failed, because of `%s'"),
grub_errmsg);
grub_util_error ("Cannot guess the root device. Specify the option ``--root-device''.");
grub_util_error (_("Cannot guess the root device. Specify the option ``--root-device''."));
}
}

286
util/import_gcry.py Normal file
View file

@ -0,0 +1,286 @@
#*
#* GRUB -- GRand Unified Bootloader
#* Copyright (C) 2009 Free Software Foundation, Inc.
#*
#* GRUB 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 3 of the License, or
#* (at your option) any later version.
#*
#* GRUB 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 GRUB. If not, see <http://www.gnu.org/licenses/>.
#*
import re
import sys
import os
import datetime
if len (sys.argv) < 3:
print ("Usage: %s SOURCE DESTINATION" % sys.argv[0])
exit (0)
indir = sys.argv[1]
outdir = sys.argv[2]
basedir = os.path.join (outdir, "lib/libgcrypt-grub")
try:
os.makedirs (basedir)
except:
print ("WARNING: %s already exists" % basedir)
cipher_dir_in = os.path.join (indir, "cipher")
cipher_dir_out = os.path.join (basedir, "cipher")
try:
os.makedirs (cipher_dir_out)
except:
print ("WARNING: %s already exists" % cipher_dir_out)
cipher_files = os.listdir (cipher_dir_in)
conf = open (os.path.join (outdir, "conf", "gcry.rmk"), "w")
conf.write ("# -*- makefile -*-\n\n")
chlog = ""
# Strictly speaking CRC32/CRC24 work on bytes so this value should be 1
# But libgcrypt uses 64. Let's keep the value for compatibility. Since
# noone uses CRC24/CRC32 for HMAC this is no problem
mdblocksizes = {"_gcry_digest_spec_crc32" : 64,
"_gcry_digest_spec_crc32_rfc1510" : 64,
"_gcry_digest_spec_crc24_rfc2440" : 64,
"_gcry_digest_spec_md4" : 64,
"_gcry_digest_spec_md5" : 64,
"_gcry_digest_spec_rmd160" : 64,
"_gcry_digest_spec_sha1" : 64,
"_gcry_digest_spec_sha224" : 64,
"_gcry_digest_spec_sha256" : 64,
"_gcry_digest_spec_sha384" : 128,
"_gcry_digest_spec_sha512" : 128,
"_gcry_digest_spec_tiger" : 64,
"_gcry_digest_spec_whirlpool" : 64}
for cipher_file in cipher_files:
infile = os.path.join (cipher_dir_in, cipher_file)
outfile = os.path.join (cipher_dir_out, cipher_file)
if cipher_file == "ChangeLog":
continue
chlognew = " * %s" % cipher_file
nch = False
if re.match (".*\.[ch]$", cipher_file):
isc = re.match (".*\.c$", cipher_file)
f = open (infile, "r")
fw = open (outfile, "w")
fw.write ("/* This file was automatically imported with \n")
fw.write (" import_gcry.py. Please don't modify it */\n");
ciphernames = []
mdnames = []
hold = False
skip = False
skip2 = False
ismd = False
iscomma = False
for line in f:
if skip:
if line[0] == "}":
skip = False
continue
if skip2:
if not re.search (" *};", line) is None:
skip2 = False
continue
if ismd:
if not re.search (" *};", line) is None:
if not mdblocksizes.has_key (mdname):
print ("ERROR: Unknown digest blocksize: %s\n" % mdname)
exit (1)
if not iscomma:
fw.write (" ,\n")
fw.write (" .blocksize = %s\n" % mdblocksizes [mdname])
ismd = False
iscomma = not re.search (",$", line) is None
if hold:
hold = False
# We're optimising for size.
if not re.match ("(run_selftests|selftest|_gcry_aes_c.._..c|_gcry_[a-z0-9]*_hash_buffer)", line) is None:
skip = True
fname = re.match ("[a-zA-Z0-9_]*", line).group ()
chmsg = "(%s): Removed." % fname
if nch:
chlognew = "%s\n %s" % (chlognew, chmsg)
else:
chlognew = "%s %s" % (chlognew, chmsg)
nch = True
continue
else:
fw.write (holdline)
m = re.match ("#include <.*>", line)
if not m is None:
chmsg = "Removed including of %s" % \
m.group () [len ("#include <"):len (m.group ()) - 1]
if nch:
chlognew = "%s\n %s" % (chlognew, chmsg)
else:
chlognew = "%s: %s" % (chlognew, chmsg)
nch = True
continue
m = re.match ("gcry_cipher_spec_t", line)
if isc and not m is None:
ciphername = line [len ("gcry_cipher_spec_t"):].strip ()
ciphername = re.match("[a-zA-Z0-9_]*",ciphername).group ()
ciphernames.append (ciphername)
m = re.match ("gcry_md_spec_t", line)
if isc and not m is None:
assert (not ismd)
mdname = line [len ("gcry_md_spec_t"):].strip ()
mdname = re.match("[a-zA-Z0-9_]*",mdname).group ()
mdnames.append (mdname)
ismd = True
m = re.match ("static const char \*selftest.*;$", line)
if not m is None:
fname = line[len ("static const char \*"):]
fname = re.match ("[a-zA-Z0-9_]*", fname).group ()
chmsg = "(%s): Removed declaration." % fname
if nch:
chlognew = "%s\n %s" % (chlognew, chmsg)
else:
chlognew = "%s %s" % (chlognew, chmsg)
nch = True
continue
m = re.match ("(static const char( |)\*|static gpg_err_code_t|void)$", line)
if not m is None:
hold = True
holdline = line
continue
m = re.match ("cipher_extra_spec_t", line)
if isc and not m is None:
skip2 = True
fname = line[len ("cipher_extra_spec_t "):]
fname = re.match ("[a-zA-Z0-9_]*", fname).group ()
chmsg = "(%s): Removed." % fname
if nch:
chlognew = "%s\n %s" % (chlognew, chmsg)
else:
chlognew = "%s %s" % (chlognew, chmsg)
nch = True
continue
m = re.match ("md_extra_spec_t", line)
if isc and not m is None:
skip2 = True
fname = line[len ("md_extra_spec_t "):]
fname = re.match ("[a-zA-Z0-9_]*", fname).group ()
chmsg = "(%s): Removed." % fname
if nch:
chlognew = "%s\n %s" % (chlognew, chmsg)
else:
chlognew = "%s %s" % (chlognew, chmsg)
nch = True
continue
fw.write (line)
if len (ciphernames) > 0 or len (mdnames) > 0:
modname = cipher_file [0:len(cipher_file) - 2]
if re.match (".*-glue$", modname):
modfiles = "libgcrypt-grub/cipher/%s libgcrypt-grub/cipher/%s" \
% (cipher_file, cipher_file.replace ("-glue.c", ".c"))
modname = modname.replace ("-glue", "")
else:
modfiles = "libgcrypt-grub/cipher/%s" % cipher_file
modname = "gcry_%s" % modname
chmsg = "(GRUB_MOD_INIT(%s)): New function\n" % modname
if nch:
chlognew = "%s\n %s" % (chlognew, chmsg)
else:
chlognew = "%s%s" % (chlognew, chmsg)
nch = True
fw.write ("\n\nGRUB_MOD_INIT(%s)\n" % modname)
fw.write ("{\n")
for ciphername in ciphernames:
chmsg = "Register cipher %s" % ciphername
chlognew = "%s\n %s" % (chlognew, chmsg)
fw.write (" grub_cipher_register (&%s);\n" % ciphername)
for mdname in mdnames:
chmsg = "Register digest %s" % mdname
chlognew = "%s\n %s" % (chlognew, chmsg)
fw.write (" grub_md_register (&%s);\n" % mdname)
fw.write ("}")
chmsg = "(GRUB_MOD_FINI(%s)): New function\n" % modname
chlognew = "%s\n %s" % (chlognew, chmsg)
fw.write ("\n\nGRUB_MOD_FINI(%s)\n" % modname)
fw.write ("{\n")
for ciphername in ciphernames:
chmsg = "Unregister cipher %s" % ciphername
chlognew = "%s\n %s" % (chlognew, chmsg)
fw.write (" grub_cipher_unregister (&%s);\n" % ciphername)
for mdname in mdnames:
chmsg = "Unregister MD %s" % mdname
chlognew = "%s\n %s" % (chlognew, chmsg)
fw.write (" grub_md_unregister (&%s);\n" % mdname)
fw.write ("}\n")
conf.write ("pkglib_MODULES += %s.mod\n" % modname)
conf.write ("%s_mod_SOURCES = %s\n" %\
(modname, modfiles))
conf.write ("%s_mod_CFLAGS = $(COMMON_CFLAGS) -Wno-missing-field-initializers -Wno-error\n" % modname)
conf.write ("%s_mod_LDFLAGS = $(COMMON_LDFLAGS)\n\n" % modname)
elif isc and cipher_file != "camellia.c":
print ("WARNING: C file isn't a module: %s" % cipher_file)
f.close ()
fw.close ()
if nch:
chlog = "%s%s\n" % (chlog, chlognew)
continue
if re.match ("(Manifest|Makefile\.am)$", cipher_file):
chlog = "%s%sRemoved\n" % (chlog, chlognew)
continue
# Autogenerated files. Not even worth mentionning in ChangeLog
if re.match ("Makefile\.in$", cipher_file):
chlog = "%s%sRemoved\n" % (chlog, chlognew)
continue
chlog = "%s%sSkipped unknown file\n" % (chlog, chlognew)
print ("WARNING: unknown file %s" % cipher_file)
outfile = os.path.join (cipher_dir_out, "types.h")
fw=open (outfile, "w")
fw.write ("#include <grub/types.h>\n")
fw.write ("#include <grub/cipher_wrap.h>\n")
chlog = "%s * types.h: New file.\n" % chlog
fw.close ()
outfile = os.path.join (cipher_dir_out, "memory.h")
fw=open (outfile, "w")
fw.write ("#include <grub/cipher_wrap.h>\n")
chlog = "%s * memory.h: New file.\n" % chlog
fw.close ()
outfile = os.path.join (cipher_dir_out, "cipher.h")
fw=open (outfile, "w")
fw.write ("#include <grub/crypto.h>\n")
fw.write ("#include <grub/cipher_wrap.h>\n")
chlog = "%s * cipher.h: Likewise.\n" % chlog
fw.close ()
outfile = os.path.join (cipher_dir_out, "g10lib.h")
fw=open (outfile, "w")
fw.write ("#include <grub/cipher_wrap.h>\n")
chlog = "%s * g10lib.h: Likewise.\n" % chlog
fw.close ()
infile = os.path.join (cipher_dir_in, "ChangeLog")
outfile = os.path.join (cipher_dir_out, "ChangeLog")
f=open (infile, "r")
fw=open (outfile, "w")
dt = datetime.date.today ()
fw.write ("%04d-%02d-%02d Automatic import tool\n" % \
(dt.year,dt.month, dt.day))
fw.write ("\n")
fw.write (" Imported ciphers to GRUB\n")
fw.write ("\n")
fw.write (chlog)
fw.write ("\n")
for line in f:
fw.write (line)
f.close ()
fw.close ()

View file

@ -23,11 +23,9 @@
You should have received a copy of the GNU General Public License
along with this program; if not, see <http://www.gnu.org/licenses/>.
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
*/
static char rcsid[] ="$Id: eltorito.c,v 1.13 1999/03/02 03:41:25 eric Exp $";
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
@ -95,11 +93,11 @@ void FDECL1(init_boot_catalog, const char *, path)
}
else
{
fprintf(stderr, "A boot catalog exists and appears corrupted.\n");
fprintf(stderr, "Please check the following file: %s.\n",bootpath);
fprintf(stderr, "This file must be removed before a bootable CD can be done.\n");
free(bootpath);
exit(1);
fprintf (stderr, _("A boot catalog exists and appears corrupted.\n"));
fprintf (stderr, _("Please check the following file: %s.\n"), bootpath);
fprintf (stderr, _("This file must be removed before a bootable CD can be done.\n"));
free (bootpath);
exit (1);
}
}
@ -109,11 +107,11 @@ void FDECL1(init_boot_catalog, const char *, path)
*/
bcat = fopen (bootpath, "wb");
if (bcat == NULL)
error (1, errno, "Error creating boot catalog (%s)", bootpath);
error (1, errno, _("Error creating boot catalog (%s)"), bootpath);
buf = (char *) e_malloc( 2048 );
if (fwrite (buf, 1, 2048, bcat) != 2048)
error (1, errno, "Error writing to boot catalog (%s)", bootpath);
error (1, errno, _("Error writing to boot catalog (%s)"), bootpath);
fclose (bcat);
chmod (bootpath, S_IROTH | S_IRGRP | S_IRWXU);
@ -143,8 +141,8 @@ void FDECL1(get_torito_desc, struct eltorito_boot_descriptor *, boot_desc)
de2 = search_tree_file(root, boot_catalog);
if (!de2)
{
fprintf(stderr,"Uh oh, I cant find the boot catalog!\n");
exit(1);
fprintf (stderr, _("Boot catalog cannot be found!\n"));
exit (1);
}
set_731(boot_desc->bootcat_ptr,
@ -157,8 +155,8 @@ void FDECL1(get_torito_desc, struct eltorito_boot_descriptor *, boot_desc)
de=search_tree_file(root, boot_image);
if (!de)
{
fprintf(stderr,"Uh oh, I cant find the boot image!\n");
exit(1);
fprintf (stderr, _("Boot image cannot be found!\n"));
exit (1);
}
/*
@ -220,12 +218,13 @@ void FDECL1(get_torito_desc, struct eltorito_boot_descriptor *, boot_desc)
* assume 512 bytes/sector on a bootable floppy
*/
nsectors = ((de->size + 511) & ~(511))/512;
fprintf(stderr, "\nSize of boot image is %d sectors -> ", nsectors);
fprintf (stderr, _("\nSize of boot image is %d sectors"), nsectors);
fprintf (stderr, " -> ");
if (! use_eltorito_emul_floppy)
{
default_desc.boot_media[0] = EL_TORITO_MEDIA_NOEMUL;
fprintf (stderr, "No emulation\n");
fprintf (stderr, _("No emulation\n"));
}
else if (nsectors == 2880 )
/*
@ -233,22 +232,22 @@ void FDECL1(get_torito_desc, struct eltorito_boot_descriptor *, boot_desc)
*/
{
default_desc.boot_media[0] = EL_TORITO_MEDIA_144FLOP;
fprintf(stderr, "Emulating a 1.44 meg floppy\n");
fprintf (stderr, _("Emulating a 1.44 meg floppy\n"));
}
else if (nsectors == 5760 )
{
default_desc.boot_media[0] = EL_TORITO_MEDIA_288FLOP;
fprintf(stderr,"Emulating a 2.88 meg floppy\n");
fprintf (stderr, _("Emulating a 2.88 meg floppy\n"));
}
else if (nsectors == 2400 )
{
default_desc.boot_media[0] = EL_TORITO_MEDIA_12FLOP;
fprintf(stderr,"Emulating a 1.2 meg floppy\n");
fprintf (stderr, _("Emulating a 1.2 meg floppy\n"));
}
else
{
fprintf(stderr,"\nError - boot image is not the an allowable size.\n");
exit(1);
fprintf (stderr, _("\nError - boot image is not the an allowable size.\n"));
exit (1);
}
/*
@ -267,15 +266,15 @@ void FDECL1(get_torito_desc, struct eltorito_boot_descriptor *, boot_desc)
*/
bootcat = fopen (de2->whole_name, "r+b");
if (bootcat == NULL)
error (1, errno, "Error opening boot catalog for update");
error (1, errno, _("Error opening boot catalog for update"));
/*
* write out
*/
if (fwrite (&valid_desc, 1, 32, bootcat) != 32)
error (1, errno, "Error writing to boot catalog");
error (1, errno, _("Error writing to boot catalog"));
if (fwrite (&default_desc, 1, 32, bootcat) != 32)
error (1, errno, "Error writing to boot catalog");
error (1, errno, _("Error writing to boot catalog"));
fclose (bootcat);
/* If the user has asked for it, patch the boot image */
@ -289,7 +288,7 @@ void FDECL1(get_torito_desc, struct eltorito_boot_descriptor *, boot_desc)
struct eltorito_boot_info bi_table;
bootimage = fopen (de->whole_name, "r+b");
if (bootimage == NULL)
error (1, errno, "Error opening boot image file '%s' for update",
error (1, errno, _("Error opening boot image file '%s' for update"),
de->whole_name);
/* Compute checksum of boot image, sans 64 bytes */
total_len = 0;
@ -297,7 +296,7 @@ void FDECL1(get_torito_desc, struct eltorito_boot_descriptor *, boot_desc)
while ((len = fread (csum_buffer, 1, SECTOR_SIZE, bootimage)) > 0)
{
if (total_len & 3)
error (1, 0, "Odd alignment at non-end-of-file in boot image '%s'",
error (1, 0, _("Odd alignment at non-end-of-file in boot image '%s'"),
de->whole_name);
if (total_len < 64)
memset (csum_buffer, 0, 64 - total_len);
@ -309,7 +308,7 @@ void FDECL1(get_torito_desc, struct eltorito_boot_descriptor *, boot_desc)
}
if (total_len != de->size)
error (1, 0, "Boot image file '%s' changed underneath us",
error (1, 0, _("Boot image file '%s' changed unexpectedly"),
de->whole_name);
/* End of file, set position to byte 8 */
fseeko (bootimage, (off_t) 8, SEEK_SET);
@ -321,7 +320,7 @@ void FDECL1(get_torito_desc, struct eltorito_boot_descriptor *, boot_desc)
set_731 (bi_table.file_checksum, bi_checksum);
if (fwrite (&bi_table, 1, sizeof (bi_table), bootimage) != sizeof (bi_table))
error (1, errno, "Error writing to boot image (%s)", bootimage);
error (1, errno, _("Error writing to boot image (%s)"), bootimage);
fclose (bootimage);
}

View file

@ -19,8 +19,6 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
static char rcsid[] ="$Id: hash.c,v 1.4 1997/12/06 21:05:04 eric Exp $";
#include <stdlib.h>
#include "config.h"
#include "mkisofs.h"

View file

@ -20,7 +20,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, see <http://www.gnu.org/licenses/>.
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
*/
/*
* $Id: iso9660.h,v 1.2 1997/05/17 15:46:44 eric Exp $

View file

@ -17,10 +17,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, see <http://www.gnu.org/licenses/>.
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
static char rcsid[] ="$Id: joliet.c,v 1.14 1999/03/07 17:41:19 eric Exp $";
*/
/*
* Joliet extensions for ISO9660. These are spottily documented by
@ -359,9 +356,9 @@ static int generate_joliet_path_tables()
if( next_jpath_index > 0xffff )
{
fprintf(stderr, "Unable to generate sane path tables - too many directories (%d)\n",
next_jpath_index);
exit(1);
fprintf (stderr, _("Unable to generate sane path tables - too many directories (%d)\n"),
next_jpath_index);
exit (1);
}
/*
* Now start filling in the path tables. Start with root directory
@ -398,8 +395,8 @@ static int generate_joliet_path_tables()
dpnt = jpathlist[j];
if(!dpnt)
{
fprintf(stderr,"Entry %d not in path tables\n", j);
exit(1);
fprintf (stderr, _("Entry %d not in path tables\n"), j);
exit (1);
}
npnt = dpnt->de_name;
@ -412,8 +409,8 @@ static int generate_joliet_path_tables()
de = dpnt->self;
if(!de)
{
fprintf(stderr,"Fatal goof - directory has amnesia\n");
exit(1);
fprintf (stderr, _("Fatal goof - directory has amnesia\n"));
exit (1);
}
namelen = joliet_strlen(de->name);
@ -478,7 +475,7 @@ static int generate_joliet_path_tables()
free(jpathlist);
if(jpath_table_index != jpath_table_size)
{
fprintf(stderr,"Joliet path table lengths do not match %d %d\n",
fprintf(stderr, _("Joliet path table lengths do not match %d %d\n"),
jpath_table_index,
jpath_table_size);
}
@ -530,8 +527,8 @@ static void FDECL2(generate_one_joliet_directory, struct directory *, dpnt, FILE
/*
* We got trouble.
*/
fprintf(stderr, "Unable to locate relocated directory\n");
exit(1);
fprintf (stderr, _("Unable to locate relocated directory\n"));
exit (1);
}
}
else
@ -605,7 +602,8 @@ static void FDECL2(generate_one_joliet_directory, struct directory *, dpnt, FILE
finddir = finddir->next;
if(!finddir)
{
fprintf(stderr,"Fatal goof - unable to find directory location\n"); exit(1);
fprintf (stderr, _("Fatal goof - unable to find directory location\n"));
exit (1);
}
}
set_733((char *) jrec.extent, finddir->jextent);
@ -653,8 +651,8 @@ static void FDECL2(generate_one_joliet_directory, struct directory *, dpnt, FILE
if(dpnt->jsize != dir_index)
{
fprintf(stderr,"Unexpected joliet directory length %d %d %s\n",dpnt->jsize,
dir_index, dpnt->de_name);
fprintf (stderr, _("Unexpected joliet directory length %d %d %s\n"),
dpnt->jsize, dir_index, dpnt->de_name);
}
xfwrite(directory_buffer, 1, total_size, outfile);

View file

@ -1,147 +1,76 @@
/*
* 27-Mar-96: Jan-Piet Mens <jpm@mens.de>
* added 'match' option (-m) to specify regular expressions NOT to be included
* in the CD image.
* Copyright (C) 2009 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 3 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, see <http://www.gnu.org/licenses/>.
*/
static char rcsid[] ="$Id: match.c,v 1.3 1999/03/02 03:41:25 eric Exp $";
#include "config.h"
#include <prototyp.h>
#include <stdio.h>
#ifndef VMS
#ifdef HAVE_MALLOC_H
#include <malloc.h>
#else
#include <stdlib.h>
#endif
#endif
#include <string.h>
#include "fnmatch.h"
#include "match.h"
#define MAXMATCH 1000
static char *mat[MAXMATCH];
void add_match(fn)
char * fn;
struct pattern
{
register int i;
char *str;
struct pattern *next;
};
for (i=0; mat[i] && i<MAXMATCH; i++);
if (i == MAXMATCH) {
fprintf(stderr,"Can't exclude RE '%s' - too many entries in table\n",fn);
return;
}
static struct pattern *patlist = NULL;
static struct pattern *i_patlist = NULL; /* ISO9660/RR */
static struct pattern *j_patlist = NULL; /* Joliet */
mat[i] = (char *) malloc(strlen(fn)+1);
if (! mat[i]) {
fprintf(stderr,"Can't allocate memory for excluded filename\n");
return;
}
strcpy(mat[i],fn);
#define DECL_ADD_MATCH(function, list) \
void \
function (char *pattern) \
{ \
struct pattern *new; \
new = malloc (sizeof (*new)); \
new->str = strdup (pattern); \
new->next = list; \
list = new; \
}
int matches(fn)
char * fn;
{
/* very dumb search method ... */
register int i;
DECL_ADD_MATCH (add_match, patlist)
DECL_ADD_MATCH (i_add_match, i_patlist)
DECL_ADD_MATCH (j_add_match, j_patlist)
for (i=0; mat[i] && i<MAXMATCH; i++) {
if (fnmatch(mat[i], fn, FNM_FILE_NAME) != FNM_NOMATCH) {
return 1; /* found -> excluded filenmae */
}
}
return 0; /* not found -> not excluded */
#define DECL_MATCHES(function, list) \
int \
function (char *str) \
{ \
struct pattern *i; \
for (i = list; i != NULL; i = i->next) \
if (fnmatch (i->str, str, FNM_FILE_NAME) != FNM_NOMATCH) \
return 1; \
return 0; \
}
/* ISO9660/RR hide */
DECL_MATCHES (matches, patlist)
DECL_MATCHES (i_matches, i_patlist)
DECL_MATCHES (j_matches, j_patlist)
static char *i_mat[MAXMATCH];
void i_add_match(fn)
char * fn;
int
i_ishidden()
{
register int i;
for (i=0; i_mat[i] && i<MAXMATCH; i++);
if (i == MAXMATCH) {
fprintf(stderr,"Can't exclude RE '%s' - too many entries in table\n",fn);
return;
}
i_mat[i] = (char *) malloc(strlen(fn)+1);
if (! i_mat[i]) {
fprintf(stderr,"Can't allocate memory for excluded filename\n");
return;
}
strcpy(i_mat[i],fn);
return (i_patlist != NULL);
}
int i_matches(fn)
char * fn;
{
/* very dumb search method ... */
register int i;
for (i=0; i_mat[i] && i<MAXMATCH; i++) {
if (fnmatch(i_mat[i], fn, FNM_FILE_NAME) != FNM_NOMATCH) {
return 1; /* found -> excluded filenmae */
}
}
return 0; /* not found -> not excluded */
}
int i_ishidden()
{
return (i_mat[0] != NULL);
}
/* Joliet hide */
static char *j_mat[MAXMATCH];
void j_add_match(fn)
char * fn;
{
register int i;
for (i=0; j_mat[i] && i<MAXMATCH; i++);
if (i == MAXMATCH) {
fprintf(stderr,"Can't exclude RE '%s' - too many entries in table\n",fn);
return;
}
j_mat[i] = (char *) malloc(strlen(fn)+1);
if (! j_mat[i]) {
fprintf(stderr,"Can't allocate memory for excluded filename\n");
return;
}
strcpy(j_mat[i],fn);
}
int j_matches(fn)
char * fn;
{
/* very dumb search method ... */
register int i;
for (i=0; j_mat[i] && i<MAXMATCH; i++) {
if (fnmatch(j_mat[i], fn, FNM_FILE_NAME) != FNM_NOMATCH) {
return 1; /* found -> excluded filenmae */
}
}
return 0; /* not found -> not excluded */
}
int j_ishidden()
{
return (j_mat[0] != NULL);
return (j_patlist != NULL);
}

View file

@ -1,22 +1,29 @@
/*
* 27th March 1996. Added by Jan-Piet Mens for matching regular expressions
* in paths.
*
* Copyright (C) 2009 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 3 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, see <http://www.gnu.org/licenses/>.
*/
/*
* $Id: match.h,v 1.2 1999/03/02 03:41:25 eric Exp $
*/
#include "config.h"
#include "fnmatch.h"
extern void add_match (char *);
extern void i_add_match (char *);
extern void j_add_match (char *);
void add_match __PR((char *fn));
int matches __PR((char *fn));
extern int matches (char *);
extern int i_matches (char *);
extern int j_matches (char *);
void i_add_match __PR((char *fn));
int i_matches __PR((char *fn));
int i_ishidden __PR((void));
void j_add_match __PR((char *fn));
int j_matches __PR((char *fn));
int j_ishidden __PR((void));
extern int i_ishidden ();
extern int j_ishidden ();

View file

@ -20,9 +20,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, see <http://www.gnu.org/licenses/>.
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
static char rcsid[] ="$Id: mkisofs.c,v 1.32 1999/03/07 21:48:49 eric Exp $";
*/
#include <errno.h>
#include "config.h"
@ -66,6 +64,8 @@ struct directory * root = NULL;
static char version_string[] = "mkisofs 1.12b5";
#include "progname.h"
char * outfile;
FILE * discimage;
uint64_t next_extent = 0;
@ -195,6 +195,8 @@ struct ld_option
#define OPTION_NO_EMUL_BOOT 171
#define OPTION_ELTORITO_EMUL_FLOPPY 172
#define OPTION_VERSION 173
static const struct ld_option ld_options[] =
{
{ {"all-files", no_argument, NULL, 'a'},
@ -227,6 +229,10 @@ static const struct ld_option ld_options[] =
'f', NULL, "Follow symbolic links", ONE_DASH },
{ {"help", no_argument, NULL, OPTION_HELP},
'\0', NULL, "Print option help", ONE_DASH },
{ {"help", no_argument, NULL, OPTION_HELP},
'\0', NULL, "Print option help", TWO_DASHES },
{ {"version", no_argument, NULL, OPTION_VERSION},
'\0', NULL, "Print version information and exit", TWO_DASHES },
{ {"hide", required_argument, NULL, OPTION_I_HIDE},
'\0', "GLOBFILE", "Hide ISO9660/RR file" , ONE_DASH },
{ {"hide-joliet", required_argument, NULL, OPTION_J_HIDE},
@ -364,7 +370,7 @@ void FDECL1(read_rcfile, char *, appname)
return;
if ( verbose > 0 )
{
fprintf(stderr, "Using \"%s\"\n", filename);
fprintf (stderr, _("Using \"%s\"\n"), filename);
}
/* OK, we got it. Now read in the lines and parse them */
@ -392,7 +398,7 @@ void FDECL1(read_rcfile, char *, appname)
}
if (name == pnt)
{
fprintf(stderr, "%s:%d: name required\n", filename, linum);
fprintf(stderr, _("%s:%d: name required\n"), filename, linum);
continue;
}
name_end = pnt;
@ -402,7 +408,7 @@ void FDECL1(read_rcfile, char *, appname)
/* silently ignore errors in the rc file. */
if (*pnt != '=')
{
fprintf(stderr, "%s:%d: equals sign required\n", filename, linum);
fprintf (stderr, _("%s:%d: equals sign required\n"), filename, linum);
continue;
}
/* Skip pas the = sign, and any white space following it */
@ -436,8 +442,8 @@ void FDECL1(read_rcfile, char *, appname)
}
if (rco->tag == NULL)
{
fprintf(stderr, "%s:%d: field name \"%s\" unknown\n", filename, linum,
name);
fprintf (stderr, _("%s:%d: field name \"%s\" unknown\n"), filename, linum,
name);
}
}
if (ferror(rcfile))
@ -462,23 +468,12 @@ int goof = 0;
#endif
void usage(){
const char * program_name = "mkisofs";
#if 0
fprintf(stderr,"Usage:\n");
fprintf(stderr,
"mkisofs [-o outfile] [-R] [-V volid] [-v] [-a] \
[-T]\n [-l] [-d] [-V] [-D] [-L] [-p preparer]"
"[-P publisher] [ -A app_id ] [-z] \n \
[-b boot_image_name] [-c boot_catalog-name] \
[-x path -x path ...] path\n");
#endif
unsigned int i;
/* const char **targets, **pp;*/
fprintf (stderr, "Usage: %s [options] file...\n", program_name);
printf (_("Usage: %s [options] file...\n"), program_name);
fprintf (stderr, "Options:\n");
printf (_("Options:\n"));
for (i = 0; i < OPTION_COUNT; i++)
{
if (ld_options[i].doc != NULL)
@ -487,7 +482,7 @@ void usage(){
int len;
unsigned int j;
fprintf (stderr, " ");
printf (" ");
comma = FALSE;
len = 2;
@ -498,16 +493,16 @@ void usage(){
if (ld_options[j].shortopt != '\0'
&& ld_options[j].control != NO_HELP)
{
fprintf (stderr, "%s-%c", comma ? ", " : "", ld_options[j].shortopt);
printf ("%s-%c", comma ? ", " : "", ld_options[j].shortopt);
len += (comma ? 2 : 0) + 2;
if (ld_options[j].arg != NULL)
{
if (ld_options[j].opt.has_arg != optional_argument)
{
fprintf (stderr, " ");
putchar (' ');
++len;
}
fprintf (stderr, "%s", ld_options[j].arg);
printf ("%s", ld_options[j].arg);
len += strlen (ld_options[j].arg);
}
comma = TRUE;
@ -522,7 +517,7 @@ void usage(){
if (ld_options[j].opt.name != NULL
&& ld_options[j].control != NO_HELP)
{
fprintf (stderr, "%s-%s%s",
printf ("%s-%s%s",
comma ? ", " : "",
ld_options[j].control == TWO_DASHES ? "-" : "",
ld_options[j].opt.name);
@ -532,7 +527,7 @@ void usage(){
+ strlen (ld_options[j].opt.name));
if (ld_options[j].arg != NULL)
{
fprintf (stderr, " %s", ld_options[j].arg);
printf (" %s", ld_options[j].arg);
len += 1 + strlen (ld_options[j].arg);
}
comma = TRUE;
@ -543,14 +538,14 @@ void usage(){
if (len >= 30)
{
fprintf (stderr, "\n");
printf ("\n");
len = 0;
}
for (; len < 30; len++)
fputc (' ', stderr);
putchar (' ');
fprintf (stderr, "%s\n", ld_options[i].doc);
printf ("%s\n", ld_options[i].doc);
}
}
exit(1);
@ -637,6 +632,11 @@ int FDECL2(main, int, argc, char **, argv){
int c;
char *log_file = 0;
set_program_name (argv[0]);
setlocale (LC_ALL, "");
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
if (argc < 2)
usage();
@ -703,7 +703,7 @@ int FDECL2(main, int, argc, char **, argv){
cdwrite_data = optarg;
break;
case 'i':
fprintf(stderr, "-i option no longer supported.\n");
fprintf (stderr, _("-i option no longer supported.\n"));
exit(1);
break;
case 'J':
@ -715,55 +715,61 @@ int FDECL2(main, int, argc, char **, argv){
case 'b':
use_eltorito++;
boot_image = optarg; /* pathname of the boot image on cd */
if (boot_image == NULL) {
fprintf(stderr,"Required boot image pathname missing\n");
exit(1);
}
if (boot_image == NULL)
{
fprintf (stderr, _("Required boot image pathname missing\n"));
exit (1);
}
break;
case 'c':
use_eltorito++;
boot_catalog = optarg; /* pathname of the boot image on cd */
if (boot_catalog == NULL) {
fprintf(stderr,"Required boot catalog pathname missing\n");
exit(1);
}
if (boot_catalog == NULL)
{
fprintf (stderr, _("Required boot catalog pathname missing\n"));
exit (1);
}
break;
case OPTION_BOOT_INFO_TABLE:
use_boot_info_table = 1;
break;
case OPTION_NO_EMUL_BOOT:
fprintf (stderr, "Ignoring -no-emul-boot (no-emulation is the default behaviour)\n");
fprintf (stderr, _("Ignoring -no-emul-boot (no-emulation is the default behaviour)\n"));
break;
case OPTION_ELTORITO_EMUL_FLOPPY:
use_eltorito_emul_floppy = 1;
break;
case OPTION_ABSTRACT:
abstract = optarg;
if(strlen(abstract) > 37) {
fprintf(stderr,"Abstract filename string too long\n");
exit(1);
};
if(strlen(abstract) > 37)
{
fprintf (stderr, _("Abstract filename string too long\n"));
exit (1);
};
break;
case 'A':
appid = optarg;
if(strlen(appid) > 128) {
fprintf(stderr,"Application-id string too long\n");
exit(1);
};
if(strlen(appid) > 128)
{
fprintf (stderr, _("Application-id string too long\n"));
exit (1);
};
break;
case OPTION_BIBLIO:
biblio = optarg;
if(strlen(biblio) > 37) {
fprintf(stderr,"Bibliographic filename string too long\n");
exit(1);
};
if(strlen(biblio) > 37)
{
fprintf (stderr, _("Bibliographic filename string too long\n"));
exit (1);
};
break;
case OPTION_COPYRIGHT:
copyright = optarg;
if(strlen(copyright) > 37) {
fprintf(stderr,"Copyright filename string too long\n");
exit(1);
};
if(strlen(copyright) > 37)
{
fprintf (stderr, _("Copyright filename string too long\n"));
exit (1);
};
break;
case 'd':
omit_period++;
@ -794,20 +800,22 @@ int FDECL2(main, int, argc, char **, argv){
break;
case 'p':
preparer = optarg;
if(strlen(preparer) > 128) {
fprintf(stderr,"Preparer string too long\n");
exit(1);
};
if(strlen(preparer) > 128)
{
fprintf (stderr, _("Preparer string too long\n"));
exit (1);
};
break;
case OPTION_PRINT_SIZE:
print_size++;
break;
case 'P':
publisher = optarg;
if(strlen(publisher) > 128) {
fprintf(stderr,"Publisher string too long\n");
exit(1);
};
if(strlen(publisher) > 128)
{
fprintf (stderr, _("Publisher string too long\n"));
exit (1);
};
break;
case OPTION_QUIET:
verbose = 0;
@ -824,48 +832,47 @@ int FDECL2(main, int, argc, char **, argv){
break;
case OPTION_SYSID:
system_id = optarg;
if(strlen(system_id) > 32) {
fprintf(stderr,"System ID string too long\n");
exit(1);
};
if(strlen(system_id) > 32)
{
fprintf (stderr, _("System ID string too long\n"));
exit (1);
};
break;
case 'T':
generate_tables++;
break;
case 'V':
volume_id = optarg;
if(strlen(volume_id) > 32) {
fprintf(stderr,"Volume ID string too long\n");
exit(1);
};
if(strlen(volume_id) > 32)
{
fprintf (stderr, _("Volume ID string too long\n"));
exit (1);
};
break;
case OPTION_VOLSET:
volset_id = optarg;
if(strlen(volset_id) > 128) {
fprintf(stderr,"Volume set ID string too long\n");
exit(1);
};
if(strlen(volset_id) > 128)
{
fprintf (stderr, _("Volume set ID string too long\n"));
exit (1);
};
break;
case OPTION_VOLSET_SIZE:
volume_set_size = atoi(optarg);
break;
case OPTION_VOLSET_SEQ_NUM:
volume_sequence_number = atoi(optarg);
if (volume_sequence_number > volume_set_size) {
fprintf(stderr,"Volume set sequence number too big\n");
exit(1);
}
if (volume_sequence_number > volume_set_size)
{
fprintf (stderr, _("Volume set sequence number too big\n"));
exit (1);
}
break;
case 'v':
verbose++;
break;
case 'z':
#ifdef VMS
fprintf(stderr,"Transparent compression not supported with VMS\n");
exit(1);
#else
transparent_compression++;
#endif
break;
case 'x':
case 'm':
@ -886,6 +893,10 @@ int FDECL2(main, int, argc, char **, argv){
usage ();
exit (0);
break;
case OPTION_VERSION:
printf ("%s (%s %s)\n", program_name, PACKAGE_NAME, PACKAGE_VERSION);
exit (0);
break;
case OPTION_NOSPLIT_SL_COMPONENT:
split_SL_component = 0;
break;
@ -893,37 +904,41 @@ int FDECL2(main, int, argc, char **, argv){
split_SL_field = 0;
break;
case OPTION_CREAT_DATE:
if (strlen (optarg) != 16) {
fprintf (stderr, "date string must be 16 characters.\n");
exit (1);
}
if (strlen (optarg) != 16)
{
fprintf (stderr, _("date string must be 16 characters.\n"));
exit (1);
}
if (creation_date)
free(creation_date);
creation_date = strdup(optarg);
break;
case OPTION_MODIF_DATE:
if (strlen (optarg) != 16) {
fprintf (stderr, "date string must be 16 characters.\n");
exit (1);
}
if (strlen (optarg) != 16)
{
fprintf (stderr, _("date string must be 16 characters.\n"));
exit (1);
}
if (modification_date)
free(modification_date);
modification_date = strdup(optarg);
break;
case OPTION_EXPIR_DATE:
if (strlen (optarg) != 16) {
fprintf (stderr, "date string must be 16 characters.\n");
exit (1);
}
if (strlen (optarg) != 16)
{
fprintf (stderr, _("date string must be 16 characters.\n"));
exit (1);
}
if (expiration_date)
free(expiration_date);
expiration_date = strdup(optarg);
break;
case OPTION_EFFEC_DATE:
if (strlen (optarg) != 16) {
fprintf (stderr, "date string must be 16 characters.\n");
exit (1);
}
if (strlen (optarg) != 16)
{
fprintf (stderr, _("date string must be 16 characters.\n"));
exit (1);
}
if (effective_date)
free(effective_date);
effective_date = strdup(optarg);
@ -940,11 +955,11 @@ parse_input_files:
int resource;
struct rlimit rlp;
if (getrlimit(RLIMIT_DATA,&rlp) == -1)
perror("Warning: getrlimit");
perror (_("Warning: getrlimit"));
else {
rlp.rlim_cur=33554432;
if (setrlimit(RLIMIT_DATA,&rlp) == -1)
perror("Warning: setrlimit");
perror (_("Warning: setrlimit"));
}
}
#endif
@ -960,13 +975,13 @@ parse_input_files:
if(cdwrite_data == NULL && merge_image != NULL)
{
fprintf(stderr,"Multisession usage bug: Must specify -C if -M is used.\n");
exit(0);
fprintf (stderr, _("Multisession usage bug: Must specify -C if -M is used.\n"));
exit (0);
}
if(cdwrite_data != NULL && merge_image == NULL)
{
fprintf(stderr,"Warning: -C specified without -M: old session data will not be merged.\n");
fprintf (stderr, _("Warning: -C specified without -M: old session data will not be merged.\n"));
}
/* The first step is to scan the directory tree, and take some notes */
@ -1004,21 +1019,17 @@ parse_input_files:
int i;
/* open log file - test that we can open OK */
if ((lfp = fopen(log_file, "w")) == NULL) {
fprintf(stderr,"can't open logfile: %s\n", log_file);
exit (1);
}
if ((lfp = fopen(log_file, "w")) == NULL)
error (1, errno, _("can't open logfile: %s"), log_file);
fclose(lfp);
/* redirect all stderr message to log_file */
fprintf(stderr, "re-directing all messages to %s\n", log_file);
fprintf (stderr, _("re-directing all messages to %s\n"), log_file);
fflush(stderr);
/* associate stderr with the log file */
if (freopen(log_file, "w", stderr) == NULL) {
fprintf(stderr,"can't open logfile: %s\n", log_file);
exit (1);
}
if (freopen(log_file, "w", stderr) == NULL)
error (1, errno, _("can't open logfile: %s\n"), log_file);
if(verbose > 1) {
for (i=0;i<argc;i++)
fprintf(stderr,"%s ", argv[i]);
@ -1059,9 +1070,8 @@ parse_input_files:
/*
* Complain and die.
*/
fprintf(stderr,"Unable to open previous session image %s\n",
merge_image);
exit(1);
error (1, 0, _("Unable to open previous session image %s\n"),
merge_image);
}
memcpy(&de.isorec.extent, mrootp->extent, 8);
@ -1171,8 +1181,7 @@ parse_input_files:
* This is a fatal error - the user won't be getting what
* they want if we were to proceed.
*/
fprintf(stderr, "Invalid node - %s\n", node);
exit(1);
error (1, 0, _("Invalid node - %s\n"), node);
}
else
{
@ -1234,10 +1243,7 @@ parse_input_files:
}
if (goof)
{
fprintf(stderr, "Joliet tree sort failed.\n");
exit(1);
}
error (1, 0, _("Joliet tree sort failed.\n"));
/*
* Fix a couple of things in the root directory so that everything
@ -1251,17 +1257,12 @@ parse_input_files:
*/
if (print_size){
discimage = fopen("/dev/null", "wb");
if (!discimage){
fprintf(stderr,"Unable to open /dev/null\n");
exit(1);
}
if (!discimage)
error (1, errno, _("Unable to open /dev/null\n"));
} else if (outfile){
discimage = fopen(outfile, "wb");
if (!discimage){
fprintf(stderr,"Unable to open disc image file\n");
exit(1);
};
if (!discimage)
error (1, errno, _("Unable to open disc image file\n"));
} else {
discimage = stdout;
@ -1383,10 +1384,10 @@ parse_input_files:
if( verbose > 0 )
{
#ifdef HAVE_SBRK
fprintf(stderr,"Max brk space used %x\n",
(unsigned int)(((unsigned long)sbrk(0)) - mem_start));
fprintf (stderr, _("Max brk space used %x\n"),
(unsigned int)(((unsigned long)sbrk(0)) - mem_start));
#endif
fprintf (stderr, "%llu extents written (%llu MiB)\n", last_extent, last_extent >> 9);
fprintf (stderr, _("%llu extents written (%llu MiB)\n"), last_extent, last_extent >> 9);
}
#ifdef VMS
@ -1399,10 +1400,8 @@ parse_input_files:
void *
FDECL1(e_malloc, size_t, size)
{
void* pt = 0;
if( (size > 0) && ((pt=malloc(size))==NULL) ) {
fprintf(stderr, "Not enough memory\n");
exit (1);
}
void* pt = 0;
if( (size > 0) && ((pt = malloc (size)) == NULL))
error (1, errno, "malloc");
return pt;
}

View file

@ -19,7 +19,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, see <http://www.gnu.org/licenses/>.
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
*/
/*
* $Id: mkisofs.h,v 1.20 1999/03/02 04:16:41 eric Exp $
@ -30,6 +30,10 @@
#include <prototyp.h>
#include <sys/stat.h>
#include <locale.h>
#include <libintl.h>
#define _(str) gettext(str)
/* This symbol is used to indicate that we do not have things like
symlinks, devices, and so forth available. Just files and dirs */

View file

@ -4,9 +4,11 @@
*
* Written by Eric Youngdale (1996).
*
* Copyright (C) 2009 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, or (at your option)
* the Free Software Foundation; either version 3, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
@ -15,12 +17,9 @@
* 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.
* along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
static char rcsid[] ="$Id: multi.c,v 1.14 1999/03/02 04:16:41 eric Exp $";
#include <stdlib.h>
#include <string.h>
#include <time.h>
@ -158,10 +157,8 @@ readsecs(startsecno, buffer, sectorcount)
{
int f = fileno(in_image);
if (lseek(f, (off_t)startsecno * SECTOR_SIZE, 0) == (off_t)-1) {
fprintf(stderr," Seek error on old image\n");
exit(10);
}
if (lseek(f, (off_t)startsecno * SECTOR_SIZE, 0) == (off_t)-1)
error (10, errno, _("Seek error on old image\n"));
return (read(f, buffer, sectorcount * SECTOR_SIZE));
}
#endif
@ -179,7 +176,7 @@ FDECL3(parse_rr, unsigned char *, pnt, int, len, struct directory_entry *,dpnt)
while(len >= 4){
if(pnt[3] != 1) {
fprintf(stderr,"**BAD RRVERSION");
fprintf (stderr, _("**Bad RR version attribute"));
return -1;
};
if(strncmp((char *) pnt, "NM", 2) == 0) {
@ -250,7 +247,7 @@ FDECL4(check_rr_dates, struct directory_entry *, dpnt,
*/
while(len >= 4){
if(pnt[3] != 1) {
fprintf(stderr,"**BAD RRVERSION");
fprintf (stderr, _("**Bad RR version attribute"));
return -1;
};
@ -546,9 +543,9 @@ FDECL2(read_merging_directory, struct iso_directory_record *, mrootp,
* Warn the user that iso (8.3) names were used because neither
* Rock Ridge (-R) nor TRANS.TBL (-T) name translations were found.
*/
fprintf(stderr,"Warning: Neither Rock Ridge (-R) nor TRANS.TBL (-T) \n");
fprintf(stderr,"name translations were found on previous session.\n");
fprintf(stderr,"ISO (8.3) file names have been used instead.\n");
fprintf (stderr, _("Warning: Neither Rock Ridge (-R) nor TRANS.TBL (-T) "
"name translations were found on previous session. "
"ISO (8.3) file names have been used instead.\n"));
warning_given = 1;
}
@ -764,10 +761,7 @@ struct iso_directory_record * FDECL1(merge_isofs, char *, path)
{
if (readsecs(file_addr/SECTOR_SIZE, &buffer,
sizeof(buffer)/SECTOR_SIZE) != sizeof(buffer))
{
fprintf(stderr," Read error on old image %s\n", path);
exit(10);
}
error (10, errno, _("Read error on old image %s\n"), path);
vdp = (struct iso_volume_descriptor *)buffer;
@ -928,7 +922,7 @@ void FDECL3(merge_remaining_entries, struct directory *, this_dir,
{
if( strcmp(s_entry->name, "<translation table>") == 0)
{
fprintf(stderr,"Should never get here\n");
fprintf (stderr, "Should never get here\n");
set_733(s_entry->isorec.extent, ttbl_extent);
return;
}
@ -1087,20 +1081,14 @@ FDECL1(get_session_start, int *, file_addr)
#else
if( cdwrite_data == NULL )
{
fprintf(stderr,"Special parameters for cdwrite not specified with -C\n");
exit(1);
}
error (1, 0, _("Special parameters for cdwrite not specified with -C\n"));
/*
* Next try and find the ',' in there which delimits the two numbers.
*/
pnt = strchr(cdwrite_data, ',');
if( pnt == NULL )
{
fprintf(stderr, "Malformed cdwrite parameters\n");
exit(1);
}
error (1, 0, _("Malformed cdwrite parameters\n"));
*pnt = '\0';
if (file_addr != NULL) {

View file

@ -21,8 +21,6 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
static char rcsid[] ="$Id: name.c,v 1.11 1999/03/02 03:41:26 eric Exp $";
#include "config.h"
#include "mkisofs.h"
@ -213,7 +211,7 @@ int FDECL3(iso9660_file_length,
}
if(current_length < 30)
{
if( *pnt < 0 )
if( !isascii (*pnt))
{
*result++ = '_';
}
@ -281,7 +279,7 @@ int FDECL3(iso9660_file_length,
switch (*pnt)
{
default:
if( *pnt < 0 )
if( !isascii (*pnt) )
{
*result++ = '_';
}

View file

@ -19,9 +19,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, see <http://www.gnu.org/licenses/>.
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
static char rcsid[] ="$Id: rock.c,v 1.8 1999/03/02 03:41:26 eric Exp $";
*/
#include <stdlib.h>
@ -308,7 +306,7 @@ int deep_opt;
* the symbolic link won't fit into one SL System Use Field
* print an error message and continue with splited one
*/
fprintf(stderr,"symbolic link ``%s'' to long for one SL System Use Field, splitting", cpnt);
fprintf(stderr, _("symbolic link ``%s'' to long for one SL System Use Field, splitting"), cpnt);
}
if(MAYBE_ADD_CE_ENTRY(SL_SIZE + sl_bytes)) add_CE_entry();
}
@ -516,7 +514,7 @@ int deep_opt;
zipfile = fopen(checkname, "rb");
if(zipfile) {
OK_flag = 0;
fprintf(stderr,"Unable to insert transparent compressed file - name conflict\n");
fprintf (stderr, _("Unable to insert transparent compressed file - name conflict\n"));
fclose(zipfile);
}
@ -589,10 +587,8 @@ char * FDECL4(generate_rr_extension_record, char *, id, char *, descriptor,
memcpy(Rock + lipnt, source, len_src);
lipnt += len_src;
if(lipnt > SECTOR_SIZE) {
fprintf(stderr,"Extension record too long\n");
exit(1);
};
if(lipnt > SECTOR_SIZE)
error (1, 0, _("Extension record too long\n"));
pnt = (char *) e_malloc(SECTOR_SIZE);
memset(pnt, 0, SECTOR_SIZE);
memcpy(pnt, Rock, lipnt);

View file

@ -20,9 +20,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, see <http://www.gnu.org/licenses/>.
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
static char rcsid[] ="$Id: tree.c,v 1.29 1999/03/07 17:41:19 eric Exp $";
*/
/* ADD_FILES changes made by Ross Biro biro@yggdrasil.com 2/23/95 */
@ -225,10 +223,7 @@ static int FDECL1(sort_n_finish, struct directory *, this_dir)
}
if(s_entry1 == s_entry)
{
fprintf(stderr,"Fatal goof\n");
exit(1);
}
error (1, 0, _("Fatal goof\n"));
/*
* OK, handle the conflicts. Try substitute names until we come
@ -286,8 +281,7 @@ static int FDECL1(sort_n_finish, struct directory *, this_dir)
/*
* If we fell off the bottom here, we were in real trouble.
*/
fprintf(stderr,"Unable to generate unique name for file %s\n", s_entry->name);
exit(1);
error (1, 0, _("Unable to generate unique name for file %s\n"), s_entry->name);
got_valid_name:
/*
@ -298,9 +292,9 @@ got_valid_name:
{
if( verbose > 0 )
{
fprintf(stderr,"Using %s for %s%s%s (%s)\n", newname,
this_dir->whole_name, SPATH_SEPARATOR,
s_entry->name, s_entry1->name);
fprintf (stderr, _("Using %s for %s%s%s (%s)\n"), newname,
this_dir->whole_name, SPATH_SEPARATOR,
s_entry->name, s_entry1->name);
}
s_entry->isorec.name_len[0] = strlen(newname);
new_reclen = sizeof(struct iso_directory_record) -
@ -320,7 +314,7 @@ got_valid_name:
delete_file_hash(s_entry1);
if( verbose > 0 )
{
fprintf(stderr,"Using %s for %s%s%s (%s)\n", newname,
fprintf(stderr, _("Using %s for %s%s%s (%s)\n"), newname,
this_dir->whole_name, SPATH_SEPARATOR,
s_entry1->name, s_entry->name);
}
@ -444,19 +438,16 @@ got_valid_name:
if (new_reclen & 1) new_reclen++;
if(new_reclen > 0xff)
{
fprintf(stderr,"Fatal error - RR overflow for file %s\n",
s_entry->name);
exit(1);
}
error (1, 0, _("Fatal error - RR overflow for file %s\n"),
s_entry->name);
s_entry->isorec.length[0] = new_reclen;
}
status = sort_directory(&this_dir->contents);
if( status > 0 )
{
fprintf(stderr, "Unable to sort directory %s\n",
this_dir->whole_name);
fprintf (stderr, _("Unable to sort directory %s\n"),
this_dir->whole_name);
}
/*
@ -485,12 +476,9 @@ got_valid_name:
s_entry->table = NULL;
}
if(count != tablesize)
{
fprintf(stderr,"Translation table size mismatch %d %d\n",
count, tablesize);
exit(1);
}
if(count != tablesize)
error (1, 0, _("Translation table size mismatch %d %d\n"),
count, tablesize);
}
/*
@ -754,10 +742,8 @@ void finish_cl_pl_entries(){
if(d_entry->self == s_entry) break;
d_entry = d_entry->next;
};
if(!d_entry){
fprintf(stderr,"Unable to locate directory parent\n");
exit(1);
};
if(!d_entry)
error (1, 0, _("Unable to locate directory parent\n"));
/* First fix the PL pointer in the directory in the rr_reloc dir */
s_entry1 = d_entry->contents->next;
@ -807,7 +793,7 @@ FDECL3(scan_directory_tree,struct directory *, this_dir,
if (verbose > 1)
{
fprintf(stderr, "Scanning %s\n", path);
fprintf (stderr, _("Scanning %s\n"), path);
}
current_dir = opendir(path);
@ -822,7 +808,7 @@ FDECL3(scan_directory_tree,struct directory *, this_dir,
if(!current_dir || !d_entry)
{
fprintf(stderr,"Unable to open directory %s\n", path);
fprintf (stderr, _("Unable to open directory %s\n"), path);
de->isorec.flags[0] &= ~2; /* Mark as not a directory */
if(current_dir) closedir(current_dir);
return 0;
@ -867,16 +853,14 @@ FDECL3(scan_directory_tree,struct directory *, this_dir,
{
if( verbose > 0 )
{
fprintf(stderr, "Ignoring file %s\n", d_entry->d_name);
fprintf (stderr, _("Ignoring file %s\n"), d_entry->d_name);
}
continue;
}
}
if(strlen(path)+strlen(d_entry->d_name) + 2 > sizeof(whole_path)){
fprintf(stderr, "Overflow of stat buffer\n");
exit(1);
};
if(strlen(path)+strlen(d_entry->d_name) + 2 > sizeof(whole_path))
error (1, 0, _("Overflow of stat buffer\n"));
/* Generate the complete ASCII path for this file */
strcpy(whole_path, path);
@ -889,7 +873,7 @@ FDECL3(scan_directory_tree,struct directory *, this_dir,
/** Should we exclude this file ? */
if (matches(d_entry->d_name) || matches(whole_path)) {
if (verbose > 1) {
fprintf(stderr, "Excluded by match: %s\n", whole_path);
fprintf (stderr, _("Excluded by match: %s\n"), whole_path);
}
continue;
}
@ -904,7 +888,7 @@ FDECL3(scan_directory_tree,struct directory *, this_dir,
*/
if (verbose > 1)
{
fprintf(stderr, "Excluded: %s\n",whole_path);
fprintf (stderr, _("Excluded: %s\n"), whole_path);
}
continue;
}
@ -974,7 +958,7 @@ FDECL3(insert_file_entry,struct directory *, this_dir,
* This means that the file doesn't exist, or isn't accessible.
* Sometimes this is because of NFS permissions problems.
*/
fprintf(stderr, "Non-existant or inaccessible: %s\n",whole_path);
fprintf (stderr, _("Non-existant or inaccessible: %s\n"),whole_path);
return 0;
}
@ -1009,15 +993,15 @@ FDECL3(insert_file_entry,struct directory *, this_dir,
} else {
if(follow_links)
{
fprintf(stderr,
"Unable to stat file %s - ignoring and continuing.\n",
whole_path);
fprintf (stderr,
_("Unable to stat file %s - ignoring and continuing.\n"),
whole_path);
}
else
{
fprintf(stderr,
"Symlink %s ignored - continuing.\n",
whole_path);
fprintf (stderr,
_("Symlink %s ignored - continuing.\n"),
whole_path);
return 0; /* Non Rock Ridge discs - ignore all symlinks */
}
}
@ -1041,8 +1025,8 @@ FDECL3(insert_file_entry,struct directory *, this_dir,
{
if(!use_RockRidge)
{
fprintf(stderr, "Already cached directory seen (%s)\n",
whole_path);
fprintf (stderr, _("Already cached directory seen (%s)\n"),
whole_path);
return 0;
}
statbuf.st_size = 0;
@ -1080,19 +1064,11 @@ FDECL3(insert_file_entry,struct directory *, this_dir,
{
add_directory_hash(statbuf.st_dev, STAT_INODE(statbuf));
}
#ifdef VMS
if(!S_ISDIR(lstatbuf.st_mode) && (statbuf.st_fab_rfm != FAB$C_FIX &&
statbuf.st_fab_rfm != FAB$C_STMLF)) {
fprintf(stderr,"Warning - file %s has an unsupported VMS record"
" format (%d)\n",
whole_path, statbuf.st_fab_rfm);
}
#endif
if(S_ISREG(lstatbuf.st_mode) && (status = access(whole_path, R_OK)))
{
fprintf(stderr, "File %s is not readable (errno = %d) - ignoring\n",
whole_path, errno);
fprintf (stderr, _("File %s is not readable (%s) - ignoring\n"),
whole_path, strerror (errno));
return 0;
}
@ -1103,12 +1079,10 @@ FDECL3(insert_file_entry,struct directory *, this_dir,
&& strcmp(short_name, ".")
&& strcmp(short_name, "..") )
{
if(find_directory_hash(statbuf.st_dev, STAT_INODE(statbuf))) {
fprintf(stderr,"Directory loop - fatal goof (%s %lx %lu).\n",
whole_path, (unsigned long) statbuf.st_dev,
(unsigned long) STAT_INODE(statbuf));
exit(1);
}
if(find_directory_hash(statbuf.st_dev, STAT_INODE(statbuf)))
error (1, 0, _("Directory loop - fatal goof (%s %lx %lu).\n"),
whole_path, (unsigned long) statbuf.st_dev,
(unsigned long) STAT_INODE(statbuf));
add_directory_hash(statbuf.st_dev, STAT_INODE(statbuf));
}
@ -1116,8 +1090,8 @@ FDECL3(insert_file_entry,struct directory *, this_dir,
!S_ISFIFO(lstatbuf.st_mode) && !S_ISSOCK(lstatbuf.st_mode)
&& !S_ISLNK(lstatbuf.st_mode) && !S_ISREG(lstatbuf.st_mode) &&
!S_ISDIR(lstatbuf.st_mode)) {
fprintf(stderr,"Unknown file type %s - ignoring and continuing.\n",
whole_path);
fprintf (stderr, _("Unknown file type %s - ignoring and continuing.\n"),
whole_path);
return 0;
}
@ -1125,9 +1099,9 @@ FDECL3(insert_file_entry,struct directory *, this_dir,
if(status)
{
fprintf(stderr,
"Unable to stat file %s - ignoring and continuing.\n",
whole_path);
fprintf (stderr,
_("Unable to stat file %s - ignoring and continuing.\n"),
whole_path);
return 0;
}
@ -1202,7 +1176,7 @@ FDECL3(insert_file_entry,struct directory *, this_dir,
else if (strcmp(short_name,".") && strcmp(short_name,"..")) {
if (i_matches(short_name) || i_matches(whole_path)) {
if (verbose > 1) {
fprintf(stderr, "Hidden from ISO9660 tree: %s\n", whole_path);
fprintf (stderr, _("Hidden from ISO9660 tree: %s\n"), whole_path);
}
s_entry->de_flags |= INHIBIT_ISO9660_ENTRY;
}
@ -1214,7 +1188,7 @@ FDECL3(insert_file_entry,struct directory *, this_dir,
else if (strcmp(short_name,".") && strcmp(short_name,"..")) {
if (j_matches(short_name) || j_matches(whole_path)) {
if (verbose > 1) {
fprintf(stderr, "Hidden from Joliet tree: %s\n", whole_path);
fprintf (stderr, _("Hidden from Joliet tree: %s\n"), whole_path);
}
s_entry->de_flags |= INHIBIT_JOLIET_ENTRY;
}
@ -1623,10 +1597,7 @@ struct directory * FDECL4(find_or_create_directory, struct directory *, parent,
fprintf(stderr,"%s(%d) ", path, dpnt->depth);
#endif
if(parent->depth > RR_relocation_depth)
{
fprintf(stderr,"Directories too deep %s\n", path);
exit(1);
}
error (1, 0, _("Directories too deep %s\n"), path);
dpnt->parent = parent;
dpnt->depth = parent->depth + 1;
@ -1658,10 +1629,7 @@ static void FDECL2(delete_directory, struct directory *, parent, struct director
struct directory * tdir;
if( child->contents != NULL )
{
fprintf(stderr, "Unable to delete non-empty directory\n");
exit(1);
}
error (1, 0, _("Unable to delete non-empty directory\n"));
free(child->whole_name);
child->whole_name = NULL;
@ -1684,10 +1652,7 @@ static void FDECL2(delete_directory, struct directory *, parent, struct director
}
}
if( tdir == NULL )
{
fprintf(stderr, "Unable to locate child directory in parent list\n");
exit(1);
}
error (1, 0, _("Unable to locate child directory in parent list\n"));
}
free(child);
return;
@ -1804,8 +1769,8 @@ struct directory_entry * FDECL2(search_tree_file, struct directory *,
if( (p1=strchr(subdir, '/')) == subdir )
{
fprintf(stderr,"call to search_tree_file with an absolute path, stripping\n");
fprintf(stderr,"initial path separator. Hope this was intended...\n");
fprintf (stderr, _("call to search_tree_file with an absolute path, stripping\n"));
fprintf (stderr, _("initial path separator. Hope this was intended...\n"));
memmove(subdir, subdir+1, strlen(subdir)-1);
p1 = strchr(subdir, '/');
}
@ -1873,7 +1838,7 @@ struct directory_entry * FDECL2(search_tree_file, struct directory *,
*/
return (NULL);
}
fprintf(stderr,"We cant get here in search_tree_file :-/ \n");
fprintf (stderr, "We cant get here in search_tree_file :-/ \n");
}
void init_fstatbuf()

View file

@ -19,9 +19,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, see <http://www.gnu.org/licenses/>.
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
static char rcsid[] ="$Id: write.c,v 1.21 1999/03/07 17:41:19 eric Exp $";
*/
#include <string.h>
#include <stdlib.h>
@ -156,10 +154,8 @@ void FDECL4(xfwrite, void *, buffer, uint64_t, count, uint64_t, size, FILE *, fi
unlink(outfile);
sprintf(nbuf, "%s_%02d", outfile, idx++);
file = freopen(nbuf, "wb", file);
if (file == NULL) {
fprintf(stderr, "Cannot open '%s'.\n", nbuf);
exit(1);
}
if (file == NULL)
error (1, errno, _("Cannot open '%s'"), nbuf);
}
while(count)
@ -167,10 +163,7 @@ void FDECL4(xfwrite, void *, buffer, uint64_t, count, uint64_t, size, FILE *, fi
size_t got = fwrite (buffer, size, count, file);
if (got != count)
{
fprintf(stderr,"cannot fwrite %llu*%llu\n",size,count);
exit(1);
}
error (1, errno, _("cannot fwrite %llu*%llu\n"), size, count);
count-=got,*(char**)&buffer+=size*got;
}
}
@ -252,14 +245,7 @@ static void FDECL3(write_one_file, char *, filename,
if ((infile = fopen(filename, "rb")) == NULL)
{
#if defined(sun) || defined(_AUX_SOURCE)
fprintf(stderr, "cannot open %s: (%d)\n", filename, errno);
#else
fprintf(stderr, "cannot open %s: %s\n", filename, strerror(errno));
#endif
exit(1);
}
error (1, errno, _("cannot open %s\n"), filename);
remain = size;
while(remain > 0)
@ -268,7 +254,7 @@ static void FDECL3(write_one_file, char *, filename,
use = ROUND_UP(use); /* Round up to nearest sector boundary */
memset(buffer, 0, use);
if (fread(buffer, 1, use, infile) == 0)
error (1, errno, "cannot read %llu bytes from %s", use, filename);
error (1, errno, _("cannot read %llu bytes from %s"), use, filename);
xfwrite(buffer, 1, use, outfile);
last_extent_written += use/SECTOR_SIZE;
#if 0
@ -286,8 +272,8 @@ static void FDECL3(write_one_file, char *, filename,
time(&now);
frac = last_extent_written / (double)last_extent;
the_end = begun + (now - begun) / frac;
fprintf(stderr, "%6.2f%% done, estimate finish %s",
frac * 100., ctime(&the_end));
fprintf (stderr, _("%6.2f%% done, estimate finish %s"),
frac * 100., ctime(&the_end));
}
#endif
remain -= use;
@ -553,8 +539,8 @@ static void FDECL1(assign_file_addresses, struct directory *, dpnt)
{
if(verbose > 2)
{
fprintf(stderr, "Cache hit for %s%s%s\n",s_entry->filedir->de_name,
SPATH_SEPARATOR, s_entry->name);
fprintf (stderr, _("Cache hit for %s%s%s\n"), s_entry->filedir->de_name,
SPATH_SEPARATOR, s_entry->name);
}
set_733((char *) s_entry->isorec.extent, s_hash->starting_block);
set_733((char *) s_entry->isorec.size, s_hash->size);
@ -575,10 +561,8 @@ static void FDECL1(assign_file_addresses, struct directory *, dpnt)
{
if(finddir->self == s_entry) break;
finddir = finddir->next;
if(!finddir)
{
fprintf(stderr,"Fatal goof\n"); exit(1);
}
if (!finddir)
error (1, 0, _("Fatal goof\n"));
}
set_733((char *) s_entry->isorec.extent, finddir->extent);
s_entry->starting_block = finddir->extent;
@ -682,9 +666,9 @@ static void FDECL1(assign_file_addresses, struct directory *, dpnt)
#ifdef DBG_ISO
if((ROUND_UP(s_entry->size) >> 11) > 500)
{
fprintf(stderr,"Warning: large file %s\n", whole_path);
fprintf(stderr,"Starting block is %d\n", s_entry->starting_block);
fprintf(stderr,"Reported file size is %d extents\n", s_entry->size);
fprintf (stderr, "Warning: large file %s\n", whole_path);
fprintf (stderr, "Starting block is %d\n", s_entry->starting_block);
fprintf (stderr, "Reported file size is %d extents\n", s_entry->size);
}
#endif
@ -909,8 +893,8 @@ void FDECL2(generate_one_directory, struct directory *, dpnt, FILE *, outfile)
if(dpnt->size != dir_index)
{
fprintf(stderr,"Unexpected directory length %d %d %s\n",dpnt->size,
dir_index, dpnt->de_name);
fprintf (stderr, _("Unexpected directory length %d %d %s\n"), dpnt->size,
dir_index, dpnt->de_name);
}
xfwrite(directory_buffer, 1, total_size, outfile);
@ -921,8 +905,8 @@ void FDECL2(generate_one_directory, struct directory *, dpnt, FILE *, outfile)
{
if(ce_index != dpnt->ce_bytes)
{
fprintf(stderr,"Continuation entry record length mismatch (%d %d).\n",
ce_index, dpnt->ce_bytes);
fprintf (stderr, _("Continuation entry record length mismatch (%d %d).\n"),
ce_index, dpnt->ce_bytes);
}
xfwrite(ce_buffer, 1, ce_size, outfile);
last_extent_written += ce_size >> 11;
@ -994,9 +978,8 @@ static int generate_path_tables()
*/
if( next_path_index > 0xffff )
{
fprintf(stderr, "Unable to generate sane path tables - too many directories (%d)\n",
next_path_index);
exit(1);
error (1, 0, _("Unable to generate sane path tables - too many directories (%d)\n"),
next_path_index);
}
path_table_index = 0;
@ -1031,8 +1014,7 @@ static int generate_path_tables()
dpnt = pathlist[j];
if(!dpnt)
{
fprintf(stderr,"Entry %d not in path tables\n", j);
exit(1);
error (1, 0, _("Entry %d not in path tables\n"), j);
}
npnt = dpnt->de_name;
@ -1052,8 +1034,7 @@ static int generate_path_tables()
de = dpnt->self;
if(!de)
{
fprintf(stderr,"Fatal goof\n");
exit(1);
error (1, 0, _("Fatal goof\n"));
}
@ -1088,9 +1069,9 @@ static int generate_path_tables()
free(pathlist);
if(path_table_index != path_table_size)
{
fprintf(stderr,"Path table lengths do not match %d %d\n",
path_table_index,
path_table_size);
fprintf (stderr, _("Path table lengths do not match %d %d\n"),
path_table_index,
path_table_size);
}
return 0;
} /* generate_path_tables(... */
@ -1134,9 +1115,9 @@ static int FDECL1(file_write, FILE *, outfile)
if( print_size > 0 )
{
fprintf(stderr,"Total extents scheduled to be written = %llu\n",
last_extent - session_start);
exit(0);
fprintf (stderr, _("Total extents scheduled to be written = %llu\n"),
last_extent - session_start);
exit (0);
}
if( verbose > 2 )
{
@ -1144,8 +1125,8 @@ static int FDECL1(file_write, FILE *, outfile)
fprintf(stderr,"Total directory extents being written = %llu\n", last_extent);
#endif
fprintf(stderr,"Total extents scheduled to be written = %llu\n",
last_extent - session_start);
fprintf (stderr, _("Total extents scheduled to be written = %llu\n"),
last_extent - session_start);
}
/*
@ -1161,8 +1142,8 @@ static int FDECL1(file_write, FILE *, outfile)
return 0;
}
fprintf(stderr,"Total extents actually written = %llu\n",
last_extent_written - session_start);
fprintf (stderr, _("Total extents actually written = %llu\n"),
last_extent_written - session_start);
/*
* Hard links throw us off here
@ -1170,14 +1151,14 @@ static int FDECL1(file_write, FILE *, outfile)
assert (last_extent > session_start);
if(should_write + session_start != last_extent)
{
fprintf(stderr,"Number of extents written not what was predicted. Please fix.\n");
fprintf(stderr,"Predicted = %d, written = %llu\n", should_write, last_extent);
fprintf (stderr, _("Number of extents written different than what was predicted. Please fix.\n"));
fprintf (stderr, _("Predicted = %d, written = %llu\n"), should_write, last_extent);
}
fprintf(stderr,"Total translation table size: %d\n", table_size);
fprintf(stderr,"Total rockridge attributes bytes: %d\n", rockridge_size);
fprintf(stderr,"Total directory bytes: %d\n", total_dir_size);
fprintf(stderr,"Path table size(bytes): %d\n", path_table_size);
fprintf (stderr, _("Total translation table size: %d\n"), table_size);
fprintf (stderr, _("Total rockridge attributes bytes: %d\n"), rockridge_size);
fprintf (stderr, _("Total directory bytes: %d\n"), total_dir_size);
fprintf (stderr, _("Path table size(bytes): %d\n"), path_table_size);
#ifdef DEBUG
fprintf(stderr, "next extent, last_extent, last_extent_written %d %d %d\n",