summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--initramfs/distro-specs/suse/functions-default11
-rw-r--r--initramfs/distro-specs/ubuntu/functions-default15
-rw-r--r--initramfs/initrd-stuff/etc/functions37
3 files changed, 48 insertions, 15 deletions
diff --git a/initramfs/distro-specs/suse/functions-default b/initramfs/distro-specs/suse/functions-default
index c9301e75..931cb711 100644
--- a/initramfs/distro-specs/suse/functions-default
+++ b/initramfs/distro-specs/suse/functions-default
@@ -96,14 +96,9 @@ fi
config_syslog () {
if [ "x$start_syslog" != "xno" ] ; then
if [ -f /mnt/etc/${D_INITDIR}/syslog ] ; then
- # how to configure remote log server?
- # logging servers might be specified in $log_servers (from e.g. dhcp)
- echo -e "# File modified by $0 within InitRamFS" \
- > /etc/syslog-ng.conf
- sed -e "s,.*dhcp/dev.*,,;s,.*named/dev.*,," \
- /mnt/etc/syslog-ng/syslog-ng.conf >> /etc/syslog-ng.conf
- cp /etc/syslog-ng.conf /mnt/etc/syslog-ng/syslog-ng.conf
- rllinker syslog "02" "20"
+ # logoutput depending on $start_syslog definitions
+ sysngwriter /mnt/etc/syslog-ng/syslog-ng.conf
+ rllinker syslog "02" "20"
else
error "$df_errsysl" nonfatal
fi
diff --git a/initramfs/distro-specs/ubuntu/functions-default b/initramfs/distro-specs/ubuntu/functions-default
index 0310d1c7..13eb7f14 100644
--- a/initramfs/distro-specs/ubuntu/functions-default
+++ b/initramfs/distro-specs/ubuntu/functions-default
@@ -138,19 +138,22 @@ fi
# syslog service
config_syslog () {
-if [ "x$start_syslog" = "xyes" ] ; then
+if [ "x$start_syslog" != "xno" ] ; then
+# fixme, welcher Syslog wird verwendet?
+#if syslog
testmkd /mnt/var/log/news
echo -e "# /etc/syslog.conf - file generated by $0" >/mnt/etc/syslogd.conf
- echo "kern.warn;*.err;authpriv.none\t/dev/tty10\n\
-#kern.warn;*.err;authpriv.none\t|/dev/xconsole\n\
-#*.emerg\n\n*.=warn;*.=err\t\t\t-/var/log/warn\n\
-#*.crit\t\t\t\t/var/log/warn\n*.*;mail.none;news.none\t\t\
-#-/var/log/messages" >> /mnt/etc/syslogd.conf
# test -n "$log_servers" && \
# for logserver in $log_servers; do
# echo -e "*.*;*.*;*.*;*kern.!*\t@$logserver" >>/mnt/etc/syslog.conf
# done
+#else syslog-ng
+# if [ -f /mnt/etc/${D_INITDIR}/syslog ] ; then
+# # logoutput depending on $start_syslog definitions
+# sysngwriter /mnt/etc/syslog-ng/syslog-ng.conf
rllinker "sysklogd" "02" "18"
+#else keiner installiert
+# error "$df_errsysl" nonfatal
fi
}
diff --git a/initramfs/initrd-stuff/etc/functions b/initramfs/initrd-stuff/etc/functions
index 17bb1053..4cb18574 100644
--- a/initramfs/initrd-stuff/etc/functions
+++ b/initramfs/initrd-stuff/etc/functions
@@ -2,7 +2,7 @@
# (included by init, hwautocfg, servconfig, ... within OpenSLX initial
# ramfs)
#
-# Dirk von Suchodoletz <dvs@OpenSLX.com>, 13-10-2006
+# Dirk von Suchodoletz <dvs@OpenSLX.com>, 31-10-2006
# Felix Endres, 30-04-2006
# <mj0@uni-freiburg.de> (xenbr), 27-09-2006
# Tobias Maier
@@ -484,6 +484,41 @@ testmkd () {
}
#############################################################################
+# function for writing a syslog-ng.conf file. First parameter is absolute
+# destination (incl. /mnt prefix)
+# sysngwriter $dest $start_syslog
+sysngwriter () {
+syslogngcfg=$1
+# logging servers might be specified in $log_servers (from e.g. dhcp)
+# fixme!? only first logserver from dhcp variable is used
+[ -n "$log_servers" ] && start_syslog="syslog://${log_servers% *}:514/udp"
+echo -e "# File written by $0 within InitRamFS\n\
+source src {\n\tfile(\"/proc/kmsg\") log_prefix(\"kernel: \");\n\
+\tunix-stream(\"/dev/log\");\n\tinternal();\n};\ndestination console_all {\
+file(\"/dev/tty10\"); };" >$syslogngcfg
+case "$start_syslog" in
+ yes|Yes|YES)
+ : # already defined
+ ;;
+ file)
+ echo -e "destination allmessages { file(\"/var/log/allmessages\"); };\n\
+log { source(src); destination(allmessages); };" \
+ >>$syslogngcfg
+ ;;
+ *)
+ syslogsrv=$(uri_token $start_syslog server)
+ syslogport=$(uri_token $start_syslog port)
+ syslogprot=$(uri_token $start_syslog path)
+ [ -z ${syslogport} ] && syslogport=514
+ [ -z ${syslogprot} ] && syslogprot=udp
+ echo -e "destination loghost {\n\t${syslogprot}(\"${syslogsrv}\" \
+port(${syslogport}));\n};\nlog {\n\tsource(src); destination(loghost);\n};" \
+ >>$syslogngcfg
+ ;;
+esac
+}
+
+#############################################################################
# simple basename replacement
basename () {
local b=${1##*/}