Merge remote-tracking branch 'origin/seventeen' into kernel-test-next

This commit is contained in:
Arne Fitzenreiter
2014-10-31 17:32:58 +01:00
26 changed files with 3249 additions and 220 deletions

View File

@@ -17,26 +17,8 @@
. ${rc_functions}
eval $(/usr/local/bin/readhash /var/ipfire/main/settings)
# English is default
FONT="lat0-16"
FONT="LatArCyrHeb-16"
KEYMAP_CORRECTIONS="euro2"
case "${LANGUAGE}" in
# German
de)
LEGACY_CHARSET="iso-8859-15"
FONT="lat0-16 -m 8859-15"
;;
# Polish
pl)
FONT="lat2-16"
;;
# Russish/Turkish
ru|tr)
FONT="LatArCyrHeb-16"
;;
esac
UNICODE="1"
BROKEN_COMPOSE="0"

View File

@@ -34,6 +34,7 @@ bin_PROGRAMS = \
bin_SCRIPTS = \
downloadsource.sh \
execute-postinstall.sh \
start-networking.sh
#- installer -------------------------------------------------------------------
@@ -44,6 +45,7 @@ installer_SOURCES = \
main.c
installer_CFLAGS = \
$(AM_CFLAGS) \
$(BLKID_CFLAGS) \
$(LIBSMOOTH_CFLAGS) \
$(PCI_CFLAGS) \

View File

@@ -39,6 +39,16 @@ AC_PROG_CC
AC_PROG_CC_C99
AC_PROG_CC_C_O
CC_CHECK_FLAGS_APPEND([with_cflags], [CFLAGS], [\
"-Wformat=2 -Wformat-security -Wformat-nonliteral" \
-Werror=overflow \
-fno-strict-aliasing \
-fstack-protector \
-fstack-protector-strong \
-fPIE \
--param=ssp-buffer-size=4])
AC_SUBST([OUR_CFLAGS], "$with_cflags")
AC_PATH_PROG([M4], [m4])
# Gettext
@@ -84,6 +94,11 @@ AC_ARG_WITH([config-root],
AC_DEFINE_UNQUOTED([CONFIG_ROOT], "$withval", [The config-root]),
AC_MSG_ERROR([*** you need to set CONFIG_ROOT with --with-config-root=]))
AC_ARG_WITH([download-url],
AS_HELP_STRING([--with-download-url] [The default download URL]),
AC_DEFINE_UNQUOTED([DOWNLOAD_URL], "$withval", [The default download URL]),
AC_MSG_ERROR([*** you need to set DOWNLOAD_URL with --with-download-url=]))
AC_CONFIG_FILES([
Makefile
po/Makefile.in

View File

@@ -19,29 +19,39 @@
# #
###############################################################################
#lfs change the url while build!
IPFireISO=ipfire.iso
#
function download() {
wget -U "IPFire-NetInstall/2.x" "$@"
}
#Get user defined download from boot cmdline
grep "netinstall=" /proc/cmdline > /dev/null && CMDLINE=1
if ( [ "$CMDLINE" == "1" ]); then
read CMDLINE < /proc/cmdline
POS=${CMDLINE%%netinstall*}
POS=${#POS}
IPFireISO=`echo ${CMDLINE:POS} | cut -d"=" -f2 | cut -d" " -f1`
if [ $# -lt 2 ]; then
echo "$0: Insufficient number of arguments" >&2
exit 2
fi
echo "Download with wget..."
wget $IPFireISO -O /tmp/download.iso -t3 -U IPFire_NetInstall/2.x
wget $IPFireISO.md5 -O /tmp/download.iso.md5 -t3 -U IPFire_NetInstall/2.x
echo
echo "Checking download..."
md5_file=`md5sum /tmp/download.iso | cut -d" " -f1`
md5_down=`cat /tmp/download.iso.md5 | cut -d" " -f1`
if [ "$md5_file" == "$md5_down" ]; then
echo -n "/tmp/download.iso" > /tmp/source_device
exit 0
OUTPUT="${1}"
URL="${2}"
echo "Downloading ${URL}..."
if ! download -O "${OUTPUT}" "${URL}"; then
echo "Download failed" >&2
rm -f "${OUTPUT}"
exit 1
fi
echo "Error - SKIP"
exit 10
# Download went well. Checking for MD5 sum
if download -O "${OUTPUT}.md5" "${URL}.md5" &>/dev/null; then
# Read downloaded checksum
read -r md5sum rest < "${OUTPUT}.md5"
rm -f "${OUTPUT}.md5"
# Compute checkum of downloaded image file
read -r md5sum_image rest <<< "$(md5sum "${OUTPUT}")"
if [ "${md5sum}" != "${md5sum_image}" ]; then
echo "MD5 sum mismatch: ${md5sum} != ${md5sum_image}" >&2
exit 2
fi
fi
exit 0

View File

@@ -12,21 +12,45 @@
#
########################################################################
dhcpcd_up()
{
LEASE_FILE="/var/ipfire/dhcpc/dhcpcd-${interface}.info"
export_lease() {
set | grep "^new_" | sed "s|^new_||g" | \
sed "s|'||g" | \
sort > /var/ipfire/dhcpc/dhcpcd-$interface.info
DNS=`grep "domain_name_servers" /var/ipfire/dhcpc/dhcpcd-$interface.info | cut -d"=" -f2`
DNS1=`echo $DNS | cut -d" " -f1`
DNS2=`echo $DNS | cut -d" " -f2`
echo "nameserver $DNS1" > /etc/resolv.conf
echo "nameserver $DNS2" >> /etc/resolv.conf
sed "s|'||g" | sort > ${LEASE_FILE}
}
case "$reason" in
BOUND|INFORM|REBIND|REBOOT|RENEW|TIMEOUT|STATIC) dhcpcd_up;;
make_resolvconf() {
local DNS="$(grep 'domain_name_servers' ${LEASE_FILE} | cut -d'=' -f2)"
local DNS1="$(echo ${DNS} | cut -d' ' -f1)"
local DNS2="$(echo ${DNS} | cut -d' ' -f2)"
(
echo "nameserver ${DNS1}"
echo "nameserver ${DNS2}"
) > /etc/resolv.conf
}
case "${reason}" in
PREINIT)
# Configure MTU
if [ -n "${new_interface_mtu}" ] && [ ${new_interface_mtu} -gt 576 ]; then
echo "Setting MTU to ${new_interface_mtu}"
ip link set "${interface}" mtu "${new_interface_mtu}"
fi
;;
BOUND|INFORM|REBIND|REBOOT|RENEW|TIMEOUT|STATIC)
# Export all information about the newly received lease
# to file
export_lease
# Create system configuration files
make_resolvconf
;;
EXPIRE|FAIL|IPV4LL|NAK|NOCARRIER|RELEASE|STOP)
rm -f "${LEASE_FILE}"
;;
esac
exit 0

View File

@@ -18,6 +18,7 @@ install() {
inst /etc/system-release
inst /usr/bin/installer
inst /usr/bin/downloadsource.sh
inst /usr/bin/execute-postinstall.sh
inst /usr/local/bin/iowrap
# Kernel drivers
@@ -35,28 +36,28 @@ install() {
inst_multiple tar gzip lzma xz
# Networking
inst_multiple dhcpcd ethtool hostname ip ping wget
inst_multiple dhcpcd ethtool hostname ip ping sort wget
inst /usr/bin/start-networking.sh
inst /var/ipfire/dhcpc/dhcpcd-run-hooks
inst /var/ipfire/dhcpc/dhcpcd.conf
for file in /var/ipfire/dhcpc/dhcpcd-hooks/*; do
inst "${file}"
done
inst /var/ipfire/dhcpc/dhcpcd-run-hooks
inst "$moddir/70-dhcpcd.exe" "/var/ipfire/dhcpc/dhcpcd-hooks/70-dhcpcd.exe"
inst /etc/host.conf /etc/hosts /etc/protocols
inst /etc/nsswitch.conf /etc/resolv.conf
inst_libdir_file "libnss_dns.so.*"
# Misc. tools
inst_multiple cut grep eject killall md5sum touch
inst_multiple chmod cut grep eject id killall md5sum touch
inst_multiple -o fdisk cfdisk df ps top
# Hardware IDs
inst /usr/share/hwdata/pci.ids /usr/share/hwdata/usb.ids
# Locales
for locale in de en es fr nl pl ru tr; do
for file in $(find /usr/lib/locale/${locale}*); do
inst "${file}"
done
done
mkdir -p "${initdir}/usr/lib/locale"
localedef --quiet --prefix="${initdir}" --add-to-archive /usr/lib/locale/en_US
localedef --quiet --prefix="${initdir}" --add-to-archive /usr/lib/locale/en_US.utf8
for file in /usr/share/locale/*/LC_MESSAGES/installer.mo; do
inst "${file}"
done

View File

@@ -3,6 +3,12 @@
# IPFire Installer RC
#
# Enable Unicode
echo -en '\033%G' && kbd_mode -u
# Load default console font
setfont LatArCyrHeb-16
# Silence the kernel
echo >/proc/sys/kernel/printk "1 4 1 7"
echo -n -e "\033[9;0]"

View File

@@ -0,0 +1,65 @@
#!/bin/sh
###############################################################################
# #
# IPFire.org - A linux based firewall #
# Copyright (C) 2014 IPFire Team <info@ipfire.org> #
# #
# 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/>. #
# #
###############################################################################
function download() {
wget -U "IPFire-NetInstall/2.x" "$@"
}
if [ $# -lt 2 ]; then
echo "$0: Insufficient number of arguments" >&2
exit 2
fi
DESTINATION="${1}"
DOWNLOAD_URL="${2}"
DOWNLOAD_TARGET="/tmp/post-install.exe"
if download -O "${DESTINATION}${DOWNLOAD_TARGET}" "${DOWNLOAD_URL}"; then
echo "Downloading post-install script from ${DOWNLOAD_URL}..."
# Make it executable
chmod a+x "${DESTINATION}${DOWNLOAD_TARGET}"
# Replace /etc/resolv.conf so that we will have
cp -fb /etc/resolv.conf ${DESTINATION}/etc/resolv.conf
for i in /dev /proc /sys; do
mount --bind "${i}" "${DESTINATION}${i}"
done
# Execute the downloaded script
chroot "${DESTINATION}" sh --login -c "${DOWNLOAD_TARGET}"
retval=$?
# Cleanup the environment
mv -f ${DESTINATION}/etc/resolv.conf{~,}
for i in /dev /proc /sys; do
umount "${DESTINATION}${i}"
done
rm -f "${DESTINATION}${DOWNLOAD_TARGET}"
exit ${retval}
# In case the download failed
else
echo "Could not download the post-install script" >&2
exit 1
fi

View File

@@ -26,12 +26,14 @@
#include <blkid/blkid.h>
#include <fcntl.h>
#include <libudev.h>
#include <linux/loop.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/ioctl.h>
#include <sys/mount.h>
#include <sys/stat.h>
#include <sys/swap.h>
#include <sys/sysinfo.h>
#include <unistd.h>
@@ -82,11 +84,56 @@ static int strstartswith(const char* a, const char* b) {
return (strncmp(a, b, strlen(b)) == 0);
}
static char loop_device[STRING_SIZE];
static int setup_loop_device(const char* source, const char* device) {
int file_fd = open(source, O_RDWR);
if (file_fd < 0)
goto ERROR;
int device_fd = -1;
if ((device_fd = open(device, O_RDWR)) < 0)
goto ERROR;
if (ioctl(device_fd, LOOP_SET_FD, file_fd) < 0)
goto ERROR;
close(file_fd);
close(device_fd);
return 0;
ERROR:
if (file_fd >= 0)
close(file_fd);
if (device_fd >= 0) {
ioctl(device_fd, LOOP_CLR_FD, 0);
close(device_fd);
}
return -1;
}
int hw_mount(const char* source, const char* target, const char* fs, int flags) {
const char* loop_device = "/dev/loop0";
// Create target if it does not exist
if (access(target, X_OK) != 0)
mkdir(target, S_IRWXU|S_IRWXG|S_IRWXO);
struct stat st;
stat(source, &st);
if (S_ISREG(st.st_mode)) {
int r = setup_loop_device(source, loop_device);
if (r == 0) {
source = loop_device;
} else {
return -1;
}
}
return mount(source, target, fs, flags, NULL);
}
@@ -293,7 +340,7 @@ void hw_free_disks(struct hw_disk** disks) {
free(disks);
}
unsigned int hw_count_disks(struct hw_disk** disks) {
unsigned int hw_count_disks(const struct hw_disk** disks) {
unsigned int ret = 0;
while (*disks++)
@@ -306,7 +353,7 @@ struct hw_disk** hw_select_disks(struct hw_disk** disks, int* selection) {
struct hw_disk** ret = hw_create_disks();
struct hw_disk** selected_disks = ret;
unsigned int num_disks = hw_count_disks(disks);
unsigned int num_disks = hw_count_disks((const struct hw_disk**)disks);
for (unsigned int i = 0; i < num_disks; i++) {
if (!selection || selection[i]) {
@@ -393,7 +440,7 @@ static int hw_device_has_p_suffix(const struct hw_destination* dest) {
return 0;
}
static int hw_calculate_partition_table(struct hw_destination* dest) {
static int hw_calculate_partition_table(struct hw_destination* dest, int disable_swap) {
char path[DEV_SIZE];
int part_idx = 1;
@@ -446,9 +493,14 @@ static int hw_calculate_partition_table(struct hw_destination* dest) {
}
dest->size_boot = hw_boot_size(dest);
dest->size_swap = hw_swap_size(dest);
dest->size_root = hw_root_size(dest);
// Should we use swap?
if (disable_swap)
dest->size_swap = 0;
else
dest->size_swap = hw_swap_size(dest);
// Determine the size of the data partition.
unsigned long long used_space = dest->size_bootldr + dest->size_boot
+ dest->size_swap + dest->size_root;
@@ -493,7 +545,7 @@ static int hw_calculate_partition_table(struct hw_destination* dest) {
return 0;
}
struct hw_destination* hw_make_destination(int part_type, struct hw_disk** disks) {
struct hw_destination* hw_make_destination(int part_type, struct hw_disk** disks, int disable_swap) {
struct hw_destination* dest = malloc(sizeof(*dest));
if (part_type == HW_PART_TYPE_NORMAL) {
@@ -513,7 +565,7 @@ struct hw_destination* hw_make_destination(int part_type, struct hw_disk** disks
// Is this a RAID device?
dest->is_raid = (part_type > HW_PART_TYPE_NORMAL);
int r = hw_calculate_partition_table(dest);
int r = hw_calculate_partition_table(dest, disable_swap);
if (r)
return NULL;
@@ -982,12 +1034,13 @@ static char* hw_get_uuid(const char* dev) {
return uuid;
}
#define FSTAB_FMT "UUID=%s %-8s %-4s %-10s %d %d\n"
int hw_write_fstab(struct hw_destination* dest) {
FILE* f = fopen(DESTINATION_MOUNT_PATH "/etc/fstab", "w");
if (!f)
return -1;
const char* fmt = "UUID=%s %-8s %-4s %-10s %d %d\n";
char* uuid = NULL;
// boot
@@ -995,7 +1048,7 @@ int hw_write_fstab(struct hw_destination* dest) {
uuid = hw_get_uuid(dest->part_boot);
if (uuid) {
fprintf(f, fmt, uuid, "/boot", "auto", "defaults", 1, 2);
fprintf(f, FSTAB_FMT, uuid, "/boot", "auto", "defaults", 1, 2);
free(uuid);
}
}
@@ -1005,7 +1058,7 @@ int hw_write_fstab(struct hw_destination* dest) {
uuid = hw_get_uuid(dest->part_swap);
if (uuid) {
fprintf(f, fmt, uuid, "swap", "swap", "defaults,pri=1", 0, 0);
fprintf(f, FSTAB_FMT, uuid, "swap", "swap", "defaults,pri=1", 0, 0);
free(uuid);
}
}
@@ -1013,7 +1066,7 @@ int hw_write_fstab(struct hw_destination* dest) {
// root
uuid = hw_get_uuid(dest->part_root);
if (uuid) {
fprintf(f, fmt, uuid, "/", "auto", "defaults", 1, 1);
fprintf(f, FSTAB_FMT, uuid, "/", "auto", "defaults", 1, 1);
free(uuid);
}
@@ -1022,7 +1075,7 @@ int hw_write_fstab(struct hw_destination* dest) {
uuid = hw_get_uuid(dest->part_data);
if (uuid) {
fprintf(f, fmt, uuid, "/var", "auto", "defaults", 1, 1);
fprintf(f, FSTAB_FMT, uuid, "/var", "auto", "defaults", 1, 1);
free(uuid);
}
}

View File

@@ -107,11 +107,12 @@ char* hw_find_source_medium(struct hw* hw);
struct hw_disk** hw_find_disks(struct hw* hw, const char* sourcedrive);
void hw_free_disks(struct hw_disk** disks);
unsigned int hw_count_disks(struct hw_disk** disks);
unsigned int hw_count_disks(const struct hw_disk** disks);
struct hw_disk** hw_select_disks(struct hw_disk** disks, int* selection);
struct hw_disk** hw_select_first_disk(const struct hw_disk** disks);
struct hw_destination* hw_make_destination(int part_type, struct hw_disk** disks);
struct hw_destination* hw_make_destination(int part_type, struct hw_disk** disks,
int disable_swap);
unsigned long long hw_memory();
@@ -131,6 +132,8 @@ int hw_write_fstab(struct hw_destination* dest);
char* hw_find_backup_file(const char* output, const char* search_path);
int hw_restore_backup(const char* output, const char* backup_path, const char* destination);
int hw_start_networking(const char* output);
void hw_sync();
#endif /* HEADER_HW_H */

View File

@@ -7,6 +7,7 @@
* Contains main entry point, and misc functions.6
*
*/
#define _GNU_SOURCE
#include <assert.h>
#include <errno.h>
@@ -23,7 +24,6 @@
#define _(x) dgettext("installer", x)
#define INST_FILECOUNT 21000
#define UNATTENDED_CONF "/cdrom/boot/unattended.conf"
#define LICENSE_FILE "/cdrom/COPYING"
#define SOURCE_TEMPFILE "/tmp/downloaded-image.iso"
@@ -163,7 +163,7 @@ static int newtLicenseBox(const char* title, const char* text, int width, int he
return ret;
}
int write_lang_configs(const char *lang) {
int write_lang_configs(char* lang) {
struct keyvalue *kv = initkeyvalues();
/* default stuff for main/settings. */
@@ -207,7 +207,7 @@ static char* center_string(const char* str, int width) {
}
#define DEFAULT_LANG "English"
#define NUM_LANGS 8
#define NUM_LANGS 10
static struct lang {
const char* code;
@@ -226,6 +226,80 @@ static struct lang {
{ NULL, NULL },
};
static struct config {
int unattended;
int serial_console;
int require_networking;
int perform_download;
int disable_swap;
char download_url[STRING_SIZE];
char postinstall[STRING_SIZE];
} config = {
.unattended = 0,
.serial_console = 0,
.require_networking = 0,
.perform_download = 0,
.disable_swap = 0,
.download_url = DOWNLOAD_URL,
.postinstall = "\0",
};
static void parse_command_line(struct config* c) {
char buffer[STRING_SIZE];
char cmdline[STRING_SIZE];
FILE* f = fopen("/proc/cmdline", "r");
if (!f)
return;
int r = fread(&cmdline, 1, sizeof(cmdline) - 1, f);
if (r > 0) {
char* token = strtok(cmdline, " ");
while (token) {
strncpy(buffer, token, sizeof(buffer));
char* val = buffer;
char* key = strsep(&val, "=");
// serial console
if (strcmp(token, "console=ttyS0") == 0)
c->serial_console = 1;
// enable networking?
else if (strcmp(token, "installer.net") == 0)
c->require_networking = 1;
// unattended mode
else if (strcmp(token, "installer.unattended") == 0)
c->unattended = 1;
// disable swap
else if (strcmp(token, "installer.disable-swap") == 0)
c->disable_swap = 1;
// download url
else if (strcmp(key, "installer.download-url") == 0) {
strncpy(c->download_url, val, sizeof(c->download_url));
c->perform_download = 1;
// Require networking for the download
c->require_networking = 1;
// postinstall script
} else if (strcmp(key, "installer.postinstall") == 0) {
strncpy(c->postinstall, val, sizeof(c->postinstall));
// Require networking for the download
c->require_networking = 1;
}
token = strtok(NULL, " ");
}
}
fclose(f);
}
int main(int argc, char *argv[]) {
struct hw* hw = hw_init();
const char* logfile = NULL;
@@ -243,17 +317,10 @@ int main(int argc, char *argv[]) {
char message[STRING_SIZE];
char title[STRING_SIZE];
int allok = 0;
FILE *handle, *cmdfile, *copying;
char line[STRING_SIZE];
int unattended = 0;
int serialconsole = 0;
int require_networking = 0;
struct keyvalue *unattendedkv = initkeyvalues();
char restore_file[STRING_SIZE] = "";
FILE *copying;
setlocale (LC_ALL, "");
sethostname( SNAME , 10);
setlocale(LC_ALL, "");
sethostname(SNAME, 10);
/* Log file/terminal stuff. */
FILE* flog = NULL;
@@ -283,33 +350,18 @@ int main(int argc, char *argv[]) {
snprintf(title, sizeof(title), "%s - %s", NAME, SLOGAN);
if (! (cmdfile = fopen("/proc/cmdline", "r"))) {
fprintf(flog, "Couldn't open commandline: /proc/cmdline\n");
} else {
fgets(line, STRING_SIZE, cmdfile);
// Parse parameters from the kernel command line
parse_command_line(&config);
// check if we have to make an unattended install
if (strstr(line, "installer.unattended") != NULL) {
splashWindow(title, _("Warning: Unattended installation will start in 10 seconds..."), 10);
unattended = 1;
}
// check if the installer should start networking
if (strstr(line, "installer.net") != NULL) {
require_networking = 1;
}
// check if we have to patch for serial console
if (strstr (line, "console=ttyS0") != NULL) {
serialconsole = 1;
}
if (config.unattended) {
splashWindow(title, _("Warning: Unattended installation will start in 10 seconds..."), 10);
}
// Load common modules
mysystem(logfile, "/sbin/modprobe vfat"); // USB key
hw_stop_all_raid_arrays(logfile);
if (!unattended) {
if (!config.unattended) {
// Language selection
char* langnames[NUM_LANGS + 1];
@@ -327,7 +379,7 @@ int main(int argc, char *argv[]) {
assert(choice <= NUM_LANGS);
fprintf(flog, "Selected language: %s (%s)\n", languages[choice].name, languages[choice].code);
snprintf(language, sizeof(language), languages[choice].code);
snprintf(language, sizeof(language), "%s", languages[choice].code);
setenv("LANGUAGE", language, 1);
setlocale(LC_ALL, language);
@@ -336,7 +388,7 @@ int main(int argc, char *argv[]) {
char* helpline = center_string(_("<Tab>/<Alt-Tab> between elements | <Space> selects | <F12> next screen"), screen_cols);
newtPushHelpLine(helpline);
if (!unattended) {
if (!config.unattended) {
snprintf(message, sizeof(message),
_("Welcome to the %s installation program.\n\n"
"Selecting Cancel on any of the following screens will reboot the computer."), NAME);
@@ -345,16 +397,21 @@ int main(int argc, char *argv[]) {
/* Search for a source drive that holds the right
* version of the image we are going to install. */
sourcedrive = hw_find_source_medium(hw);
fprintf(flog, "Source drive: %s\n", sourcedrive);
if (!config.perform_download) {
sourcedrive = hw_find_source_medium(hw);
fprintf(flog, "Source drive: %s\n", sourcedrive);
}
/* If we could not find a source drive, we will try
* downloading the install image */
if (!sourcedrive) {
if (!unattended) {
if (!sourcedrive)
config.perform_download = 1;
if (config.perform_download) {
if (!config.unattended) {
// Show the right message to the user
char reason[STRING_SIZE];
if (require_networking) {
if (config.perform_download) {
snprintf(reason, sizeof(reason),
_("The installer will now try downloading the installation image."));
} else {
@@ -373,11 +430,12 @@ int main(int argc, char *argv[]) {
goto EXIT;
}
require_networking = 1;
// Make sure that we enable networking before download
config.require_networking = 1;
}
// Try starting the networking if we require it
if (require_networking) {
if (config.require_networking) {
while (1) {
statuswindow(60, 4, title, _("Trying to start networking (DHCP)..."));
@@ -401,20 +459,31 @@ int main(int argc, char *argv[]) {
}
// Download the image if required
while (!sourcedrive) {
snprintf(commandstring, sizeof(commandstring), "/usr/bin/downloadsource.sh %s", SOURCE_TEMPFILE);
runcommandwithstatus(commandstring, title, _("Downloading installation image..."), logfile);
if (config.perform_download) {
fprintf(flog, "Download URL: %s\n", config.download_url);
snprintf(commandstring, sizeof(commandstring), "/usr/bin/downloadsource.sh %s %s",
SOURCE_TEMPFILE, config.download_url);
FILE* f = fopen(SOURCE_TEMPFILE, "r");
if (f) {
sourcedrive = SOURCE_TEMPFILE;
fclose(f);
} else {
rc = newtWinOkCancel(title, _("The installation image could not be downloaded."),
60, 8, _("Retry"), _("Cancel"));
while (!sourcedrive) {
rc = runcommandwithstatus(commandstring, title, _("Downloading installation image..."), logfile);
if (rc)
goto EXIT;
FILE* f = fopen(SOURCE_TEMPFILE, "r");
if (f) {
sourcedrive = SOURCE_TEMPFILE;
fclose(f);
} else {
char reason[STRING_SIZE] = "-";
if (rc == 2)
snprintf(reason, sizeof(STRING_SIZE), _("MD5 checksum mismatch"));
snprintf(message, sizeof(message),
_("The installation image could not be downloaded.\n Reason: %s\n\n%s"),
reason, config.download_url);
rc = newtWinOkCancel(title, message, 75, 12, _("Retry"), _("Cancel"));
if (rc)
goto EXIT;
}
}
}
}
@@ -423,24 +492,17 @@ int main(int argc, char *argv[]) {
int r = hw_mount(sourcedrive, SOURCE_MOUNT_PATH, "iso9660", MS_RDONLY);
if (r) {
fprintf(flog, "Could not mount %s to %s\n", sourcedrive, SOURCE_MOUNT_PATH);
fprintf(flog, strerror(errno));
exit(1);
snprintf(message, sizeof(message), _("Could not mount %s to %s:\n %s\n"),
sourcedrive, SOURCE_MOUNT_PATH, strerror(errno));
errorbox(message);
goto EXIT;
}
/* load unattended configuration */
if (unattended) {
fprintf(flog, "unattended: Reading unattended.conf\n");
(void) readkeyvalues(unattendedkv, UNATTENDED_CONF);
findkey(unattendedkv, "RESTORE_FILE", restore_file);
}
if (!unattended) {
if (!config.unattended) {
// Read the license file.
if (!(copying = fopen(LICENSE_FILE, "r"))) {
sprintf(discl_msg, "Could not open license file: %s\n", LICENSE_FILE);
fprintf(flog, discl_msg);
fprintf(flog, "%s", discl_msg);
} else {
fread(discl_msg, 1, 40000, copying);
fclose(copying);
@@ -463,7 +525,7 @@ int main(int argc, char *argv[]) {
// Check how many disks have been found and what
// we can do with them.
unsigned int num_disks = hw_count_disks(disks);
unsigned int num_disks = hw_count_disks((const struct hw_disk**)disks);
while (1) {
// no harddisks found
@@ -474,8 +536,8 @@ int main(int argc, char *argv[]) {
// exactly one disk has been found
// or if we are running in unattended mode, we will select
// the first disk and go with that one
} else if ((num_disks == 1) || (unattended && num_disks >= 1)) {
selected_disks = hw_select_first_disk(disks);
} else if ((num_disks == 1) || (config.unattended && num_disks >= 1)) {
selected_disks = hw_select_first_disk((const struct hw_disk**)disks);
// more than one usable disk has been found and
// the user needs to choose what to do with them
@@ -484,7 +546,7 @@ int main(int argc, char *argv[]) {
int disk_selection[num_disks];
for (unsigned int i = 0; i < num_disks; i++) {
disk_names[i] = &disks[i]->description;
disk_names[i] = disks[i]->description;
disk_selection[i] = 0;
}
@@ -512,10 +574,10 @@ int main(int argc, char *argv[]) {
// Don't print the auto-selected harddisk setup in
// unattended mode.
if (unattended)
if (config.unattended)
break;
num_selected_disks = hw_count_disks(selected_disks);
num_selected_disks = hw_count_disks((const struct hw_disk**)selected_disks);
if (num_selected_disks == 1) {
snprintf(message, sizeof(message),
@@ -554,7 +616,7 @@ int main(int argc, char *argv[]) {
hw_free_disks(disks);
struct hw_destination* destination = hw_make_destination(part_type, selected_disks);
struct hw_destination* destination = hw_make_destination(part_type, selected_disks, config.disable_swap);
if (!destination) {
errorbox(_("Your harddisk is too small."));
@@ -570,19 +632,21 @@ int main(int argc, char *argv[]) {
fprintf(flog, "Memory : %lluMB\n", BYTES2MB(hw_memory()));
// Warn the user if there is not enough space to create a swap partition
if (!unattended && !*destination->part_swap) {
rc = newtWinChoice(title, _("OK"), _("Cancel"),
_("Your harddisk is very small, but you can continue without a swap partition."));
if (!config.unattended) {
if (!config.disable_swap && !*destination->part_swap) {
rc = newtWinChoice(title, _("OK"), _("Cancel"),
_("Your harddisk is very small, but you can continue without a swap partition."));
if (rc != 1)
goto EXIT;
if (rc != 1)
goto EXIT;
}
}
// Filesystem selection
if (!unattended) {
if (!config.unattended) {
struct filesystems {
int fstype;
const char* description;
char* description;
} filesystems[] = {
{ HW_FS_EXT4, _("ext4 Filesystem") },
{ HW_FS_EXT4_WO_JOURNAL, _("ext4 Filesystem without journal") },
@@ -686,7 +750,7 @@ int main(int argc, char *argv[]) {
statuswindow(60, 4, title, _("Installing the bootloader..."));
/* Serial console ? */
if (serialconsole) {
if (config.serial_console) {
/* grub */
FILE* f = fopen(DESTINATION_MOUNT_PATH "/etc/default/grub", "a");
if (!f) {
@@ -725,7 +789,7 @@ int main(int argc, char *argv[]) {
char* backup_file = hw_find_backup_file(logfile, SOURCE_MOUNT_PATH);
if (backup_file) {
rc = 0;
if (!unattended) {
if (!config.unattended) {
rc = newtWinOkCancel(title, _("A backup file has been found on the installation image.\n\n"
"Do you want to restore the backup?"), 50, 10, _("Yes"), _("No"));
}
@@ -752,10 +816,21 @@ int main(int argc, char *argv[]) {
// Umount source drive and eject
hw_umount(SOURCE_MOUNT_PATH);
// Download and execute the postinstall script
if (*config.postinstall) {
snprintf(commandstring, sizeof(commandstring),
"/usr/bin/execute-postinstall.sh %s %s", DESTINATION_MOUNT_PATH, config.postinstall);
if (runcommandwithstatus(commandstring, title, _("Running post-install script..."), logfile)) {
errorbox(_("Post-install script failed."));
goto EXIT;
}
}
snprintf(commandstring, STRING_SIZE, "/usr/bin/eject %s", sourcedrive);
mysystem(logfile, commandstring);
if (!unattended) {
if (!config.unattended) {
snprintf(message, sizeof(message), _(
"%s was successfully installed!\n\n"
"Please remove any installation mediums from this system and hit the reboot button. "

View File

@@ -56,6 +56,10 @@ function main() {
fi
echo "Successfully started on ${interface}"
# Wait until everything is settled
sleep 15
return 0
done

View File

@@ -0,0 +1,13 @@
--- squidclamav-5.11/src/pattern.c~ 2014-10-29 13:08:05.658143495 +0000
+++ squidclamav-5.11/src/pattern.c 2014-10-29 13:08:20.964642365 +0000
@@ -151,10 +151,6 @@
return 1;
}
- /* extract source ipaddress and source fqdn */
- if (parseSourceAddress(in_buff.src_address, "/") != 0) {
- }
-
if (debug != 0)
logit(log_file, "DEBUG Parsed request: %s %s/%s %s %s\n", in_buff.url, in_buff.ipaddress, in_buff.fqdn, in_buff.ident, in_buff.method);