Merge remote-tracking branch 'origin/next'

This commit is contained in:
Arne Fitzenreiter
2014-06-02 18:22:35 +02:00
48 changed files with 12126 additions and 637 deletions

View File

@@ -0,0 +1 @@
/etc/icinga

View File

@@ -1,11 +1,16 @@
Listen 1009
<VirtualHost *:1009>
DocumentRoot /usr/share/cacti
Include /etc/httpd/conf/conf.d/php*.conf
Alias /cacti /usr/share/cacti
<Directory /usr/share/cacti>
Options FollowSymLinks
AllowOverride None
</Directory>
RewriteEngine on
RewriteRule ^/$ /cacti/ [R]
</VirtualHost>

View File

@@ -0,0 +1,6 @@
/var/log/cacti/cacti.log {
missingok
monthly
notifempty
compress
}

BIN
config/cacti/d.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

BIN
config/cacti/d.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

BIN
config/cacti/throbber.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

37
config/icinga/icinga.conf Normal file
View File

@@ -0,0 +1,37 @@
Listen 1010
<VirtualHost *:1010>
ScriptAlias /icinga/cgi-bin /usr/share/icinga/cgi-bin
Alias /icinga /usr/share/icinga/
RewriteEngine on
RewriteRule ^/$ /icinga/ [R]
<Directory /usr/share/icinga/cgi-bin>
Options ExecCGI
AllowOverride None
AuthName "Icinga Access"
AuthType Basic
AuthUserFile /etc/icinga/htpasswd.users
Order allow,deny
Allow from all
Require valid-user
</Directory>
<Directory /usr/share/icinga/>
Options None
AllowOverride All
AuthName "Icinga Access"
AuthType Basic
AuthUserFile /etc/icinga/htpasswd.users
Order allow,deny
Allow from all
Require valid-user
</Directory>
</VirtualHost>

View File

@@ -34,7 +34,6 @@ etc/rc.d/init.d/functions
#etc/rc.d/init.d/gnump3d
etc/rc.d/init.d/halt
#etc/rc.d/init.d/hostapd
#etc/rc.d/init.d/icecream
#etc/rc.d/init.d/imspector
etc/rc.d/init.d/ipsec
#etc/rc.d/init.d/keepalived

View File

@@ -36,7 +36,6 @@ etc/rc.d/init.d/functions
#etc/rc.d/init.d/gnump3d
etc/rc.d/init.d/halt
#etc/rc.d/init.d/hostapd
#etc/rc.d/init.d/icecream
#etc/rc.d/init.d/imspector
etc/rc.d/init.d/ipsec
#etc/rc.d/init.d/keepalived

View File

@@ -1,38 +0,0 @@
bin/ping
#usr/bin/ftp
#usr/bin/rcp
#usr/bin/rlogin
#usr/bin/rsh
#usr/bin/talk
#usr/bin/tftp
#usr/sbin/ftpd
#usr/sbin/inetd
#usr/sbin/rexecd
#usr/sbin/rlogind
#usr/sbin/rshd
#usr/sbin/talkd
#usr/sbin/tftpd
#usr/sbin/uucpd
#usr/share/info/inetutils.info
#usr/share/info/inetutils.info-1
#usr/share/info/inetutils.info-2
#usr/share/info/inetutils.info-3
#usr/share/man/man1/ftp.1
#usr/share/man/man1/logger.1
#usr/share/man/man1/rcp.1
#usr/share/man/man1/rlogin.1
#usr/share/man/man1/rsh.1
#usr/share/man/man1/talk.1
#usr/share/man/man1/telnet.1
#usr/share/man/man1/tftp.1
#usr/share/man/man5/syslog.conf.5
#usr/share/man/man8/ftpd.8
#usr/share/man/man8/inetd.8
#usr/share/man/man8/ping.8
#usr/share/man/man8/rexecd.8
#usr/share/man/man8/rlogind.8
#usr/share/man/man8/rshd.8
#usr/share/man/man8/syslogd.8
#usr/share/man/man8/talkd.8
#usr/share/man/man8/telnetd.8
#usr/share/man/man8/tftpd.8

View File

@@ -1 +1,2 @@
bin/ping
usr/bin/ping

View File

@@ -9,6 +9,9 @@ srv/web/ipfire/cgi-bin/modem-status.cgi
srv/web/ipfire/cgi-bin/ovpnmain.cgi
srv/web/ipfire/cgi-bin/proxy.cgi
srv/web/ipfire/html/themes/ipfire/include/functions.pl
usr/bin/squidGuard
usr/sbin/redirect_wrapper
usr/sbin/updxlrator
usr/local/bin/setddns.pl
var/ipfire/langs
var/ipfire/menu.d/20-status.menu

View File

@@ -165,6 +165,10 @@ if [ $BOOTSPACE -lt 1000 ]; then
esac
fi
# Update ping
rm -f /bin/ping
ln -sf ../usr/bin/ping /bin/ping
chmod 4755 /usr/bin/ping
# Update Language cache
perl -e "require '/var/ipfire/lang.pl'; &Lang::BuildCacheLang"

View File

@@ -1,5 +1,7 @@
etc/fcron.cyclic/cacti.cron
etc/httpd/conf/vhosts.d/cacti.conf
#etc/logrotate.d
etc/logrotate.d/cacti
#usr/share/cacti
#usr/share/cacti/LICENSE
#usr/share/cacti/README
@@ -27,6 +29,7 @@ usr/share/cacti/cli/poller_graphs_reapply_names.php
usr/share/cacti/cli/poller_output_empty.php
usr/share/cacti/cli/poller_reindex_hosts.php
usr/share/cacti/cli/rebuild_poller_cache.php
usr/share/cacti/cli/reorder_data_query.php
usr/share/cacti/cli/repair_database.php
usr/share/cacti/cli/repair_templates.php
usr/share/cacti/cli/structure_rra_paths.php
@@ -191,12 +194,17 @@ usr/share/cacti/images/cacti_logo.gif
usr/share/cacti/images/calendar.gif
usr/share/cacti/images/delete_icon.gif
usr/share/cacti/images/delete_icon_large.gif
usr/share/cacti/images/disable_icon.png
usr/share/cacti/images/enable_icon.png
usr/share/cacti/images/enable_icon_disabled.png
usr/share/cacti/images/favicon.ico
usr/share/cacti/images/graph_page_top.gif
usr/share/cacti/images/graph_properties.gif
usr/share/cacti/images/graph_query.png
usr/share/cacti/images/graph_zoom.gif
usr/share/cacti/images/hide.gif
usr/share/cacti/images/install_icon.png
usr/share/cacti/images/install_icon_disabled.png
usr/share/cacti/images/left_border.gif
usr/share/cacti/images/menu_line.gif
usr/share/cacti/images/menuarrow.gif
@@ -222,6 +230,8 @@ usr/share/cacti/images/tab_mode_tree_down.gif
usr/share/cacti/images/tab_settings.gif
usr/share/cacti/images/tab_settings_down.gif
usr/share/cacti/images/transparent_line.gif
usr/share/cacti/images/uninstall_icon.gif
usr/share/cacti/images/view_none.gif
#usr/share/cacti/include
usr/share/cacti/include/auth.php
usr/share/cacti/include/bottom_footer.php
@@ -231,10 +241,28 @@ usr/share/cacti/include/global_arrays.php
usr/share/cacti/include/global_constants.php
usr/share/cacti/include/global_form.php
usr/share/cacti/include/global_settings.php
#usr/share/cacti/include/jscalendar
usr/share/cacti/include/js
usr/share/cacti/include/js/jquery
usr/share/cacti/include/js/jquery/colorpicker.js
usr/share/cacti/include/js/jquery/jquery-ui.js
usr/share/cacti/include/js/jquery/jquery.cookie.js
usr/share/cacti/include/js/jquery/jquery.dd.js
usr/share/cacti/include/js/jquery/jquery.dropdown.js
usr/share/cacti/include/js/jquery/jquery.js
usr/share/cacti/include/js/jquery/jquery.jstree.js
usr/share/cacti/include/js/jquery/jquery.tablednd.js
usr/share/cacti/include/js/jquery/jquery.timepicker.js
usr/share/cacti/include/js/jquery/jquery.zoom.js
usr/share/cacti/include/js/jquery/themes
usr/share/cacti/include/js/jquery/themes/default
usr/share/cacti/include/js/jquery/themes/default/d.gif
usr/share/cacti/include/js/jquery/themes/default/d.png
usr/share/cacti/include/js/jquery/themes/default/style.css
usr/share/cacti/include/js/jquery/themes/default/throbber.gif
usr/share/cacti/include/jscalendar
usr/share/cacti/include/jscalendar/calendar-setup.js
usr/share/cacti/include/jscalendar/calendar.js
#usr/share/cacti/include/jscalendar/lang
usr/share/cacti/include/jscalendar/lang
usr/share/cacti/include/jscalendar/lang/calendar-af.js
usr/share/cacti/include/jscalendar/lang/calendar-al.js
usr/share/cacti/include/jscalendar/lang/calendar-bg.js
@@ -280,20 +308,9 @@ usr/share/cacti/include/jscalendar/lang/calendar-zh.js
usr/share/cacti/include/jscalendar/lang/cn_utf8.js
usr/share/cacti/include/layout.js
usr/share/cacti/include/main.css
usr/share/cacti/include/plugins.php
usr/share/cacti/include/top_graph_header.php
usr/share/cacti/include/top_header.php
#usr/share/cacti/include/treeview
usr/share/cacti/include/treeview/ftiens4.js
usr/share/cacti/include/treeview/ftiens4_export.js
usr/share/cacti/include/treeview/ftv2blank.gif
usr/share/cacti/include/treeview/ftv2lastnode.gif
usr/share/cacti/include/treeview/ftv2mlastnode.gif
usr/share/cacti/include/treeview/ftv2mnode.gif
usr/share/cacti/include/treeview/ftv2node.gif
usr/share/cacti/include/treeview/ftv2plastnode.gif
usr/share/cacti/include/treeview/ftv2pnode.gif
usr/share/cacti/include/treeview/ftv2vertline.gif
usr/share/cacti/include/treeview/ua.js
usr/share/cacti/include/zoom.js
usr/share/cacti/index.php
#usr/share/cacti/install
@@ -318,6 +335,10 @@ usr/share/cacti/install/0_8_7d_to_0_8_7e.php
usr/share/cacti/install/0_8_7e_to_0_8_7f.php
usr/share/cacti/install/0_8_7f_to_0_8_7g.php
usr/share/cacti/install/0_8_7g_to_0_8_7h.php
usr/share/cacti/install/0_8_7h_to_0_8_7i.php
usr/share/cacti/install/0_8_7i_to_0_8_8.php
usr/share/cacti/install/0_8_8_to_0_8_8a.php
usr/share/cacti/install/0_8_8_to_0_8_8b.php
usr/share/cacti/install/0_8_to_0_8_1.php
usr/share/cacti/install/index.php
usr/share/cacti/install/install_finish.gif
@@ -338,7 +359,7 @@ usr/share/cacti/lib/adodb/adodb-php4.inc.php
usr/share/cacti/lib/adodb/adodb-time.inc.php
usr/share/cacti/lib/adodb/adodb-xmlschema.inc.php
usr/share/cacti/lib/adodb/adodb.inc.php
#usr/share/cacti/lib/adodb/datadict
usr/share/cacti/lib/adodb/datadict
usr/share/cacti/lib/adodb/datadict/datadict-access.inc.php
usr/share/cacti/lib/adodb/datadict/datadict-db2.inc.php
usr/share/cacti/lib/adodb/datadict/datadict-firebird.inc.php
@@ -351,7 +372,7 @@ usr/share/cacti/lib/adodb/datadict/datadict-oci8.inc.php
usr/share/cacti/lib/adodb/datadict/datadict-postgres.inc.php
usr/share/cacti/lib/adodb/datadict/datadict-sapdb.inc.php
usr/share/cacti/lib/adodb/datadict/datadict-sybase.inc.php
#usr/share/cacti/lib/adodb/drivers
usr/share/cacti/lib/adodb/drivers
usr/share/cacti/lib/adodb/drivers/adodb-access.inc.php
usr/share/cacti/lib/adodb/drivers/adodb-ado.inc.php
usr/share/cacti/lib/adodb/drivers/adodb-ado5.inc.php
@@ -392,7 +413,7 @@ usr/share/cacti/lib/adodb/drivers/adodb-sqlite.inc.php
usr/share/cacti/lib/adodb/drivers/adodb-sqlitepo.inc.php
usr/share/cacti/lib/adodb/drivers/adodb-sybase.inc.php
usr/share/cacti/lib/adodb/drivers/adodb-vfp.inc.php
#usr/share/cacti/lib/adodb/lang
usr/share/cacti/lib/adodb/lang
usr/share/cacti/lib/adodb/lang/adodb-ar.inc.php
usr/share/cacti/lib/adodb/lang/adodb-bg.inc.php
usr/share/cacti/lib/adodb/lang/adodb-bgutf8.inc.php
@@ -437,6 +458,7 @@ usr/share/cacti/lib/html_validate.php
usr/share/cacti/lib/import.php
usr/share/cacti/lib/ldap.php
usr/share/cacti/lib/ping.php
usr/share/cacti/lib/plugins.php
usr/share/cacti/lib/poller.php
usr/share/cacti/lib/rrd.php
usr/share/cacti/lib/snmp.php
@@ -450,6 +472,9 @@ usr/share/cacti/lib/variables.php
usr/share/cacti/lib/xml.php
usr/share/cacti/log
usr/share/cacti/logout.php
usr/share/cacti/plugins
usr/share/cacti/plugins.php
usr/share/cacti/plugins/index.php
usr/share/cacti/poller.php
usr/share/cacti/poller_commands.php
usr/share/cacti/poller_export.php

View File

@@ -1,23 +0,0 @@
#opt/icecream
#opt/icecream/bin
#opt/icecream/bin/c++
#opt/icecream/bin/cc
#opt/icecream/bin/g++
#opt/icecream/bin/gcc
#opt/icecream/bin/icecc
#opt/icecream/bin/icerun
#opt/icecream/include
#opt/icecream/include/icecc
#opt/icecream/include/icecc/comm.h
#opt/icecream/include/icecc/job.h
#opt/icecream/lib
#opt/icecream/lib/icecc
#opt/icecream/lib/icecc/icecc-create-env
#opt/icecream/lib/libicecc.a
#opt/icecream/lib/libicecc.la
#opt/icecream/lib/pkgconfig
#opt/icecream/lib/pkgconfig/icecc.pc
#opt/icecream/sbin
opt/icecream/sbin/icecc-scheduler
opt/icecream/sbin/iceccd
etc/rc.d/init.d/icecream

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,4 @@
etc/sysconfig/vdr-plugins.d/vnsiserver5.conf
etc/vdr/plugins/vnsiserver5
etc/vdr/plugins/vnsiserver5/allowed_hosts.conf
usr/lib/vdr/libvdr-vnsiserver5.so.2.0.0

View File

@@ -70,7 +70,7 @@ while (<>) {
$username = $tmp[2]; if ($username eq '') { $username='-'; };
$method = $tmp[3];
$xlrator_url = $source_url;
$xlrator_url = "";
if (($method eq 'GET') || ($method eq 'HEAD'))
{
@@ -212,9 +212,11 @@ while (<>) {
# ----------- ADD NEW SOURCES BEFORE THIS LINE !!! ------------------
}
$request="$xlrator_url $hostaddr $username $method\n";
print $request;
if ($xlrator_url) {
print "OK rewrite-url=\"$xlrator_url\"\n";
} else {
print "ERR\n";
}
}
# -------------------------------------------------------------------

View File

@@ -100,7 +100,7 @@ while($line = <>) {
}
# break if redirector changes data
if($return ne "\n" and $return ne $line ){
if($return ne "ERR\n" and $return ne $line ){
if ( $redirectors->[$i] ne "/usr/sbin/updxlrator"){
if ($debug){
writetolog($redirectors->[$i]." is stopping querry because block was found.");

View File

@@ -0,0 +1,5 @@
# Configuration snippet for vdr-vnsiserver5 -*- sh -*-
#
# Add command line options to pass to the vnsiserver5 plugin to PLUGIN_OPTIONS.
PLUGIN_OPTIONS=""

View File

@@ -13,3 +13,11 @@ Maintainer / advanced commands
toolchain : Create our own toolchain package to save 20% of build time.
shell : Enter a shell inside the chroot, used to tune lfs script
and / or during kernel upgrade to rebuild a new .config
Options:
--target=[armv5tel|i586] : Cross-compile for this target architecture.
Uses the QEMU emulator if needed to virtualise
the desired target architecture.
Can be permanently set with TARGET_ARCH= in
.config.

View File

@@ -57,8 +57,6 @@ DIR_CONF = $(LFS_BASEDIR)/config
DIR_INFO = $(LFS_BASEDIR)/log
DIR_TMP = /tmp
KGCC = gcc
###############################################################################
# Common Macro Definitions
###############################################################################

View File

@@ -24,7 +24,7 @@
include Config
VER = 0.8.7h
VER = 0.8.8b
THISAPP = cacti-$(VER)
DL_FILE = $(THISAPP).tar.gz
@@ -32,7 +32,7 @@ DL_FROM = $(URL_IPFIRE)
DIR_APP = $(DIR_SRC)/$(THISAPP)
TARGET = $(DIR_INFO)/$(THISAPP)
PROG = cacti
PAK_VER = 4
PAK_VER = 5
DEPS = "netsnmpd mysql"
@@ -44,7 +44,7 @@ objects = $(DL_FILE)
$(DL_FILE) = $(DL_FROM)/$(DL_FILE)
$(DL_FILE)_MD5 = 58c9371341f49a190ae11a85118e598d
$(DL_FILE)_MD5 = acb40deae073ca22e5c01a8e3ba389fb
install : $(TARGET)
@@ -54,7 +54,6 @@ download :$(patsubst %,$(DIR_DL)/%,$(objects))
md5 : $(subst %,%_MD5,$(objects))
dist:
@$(PAK)
@@ -78,6 +77,21 @@ $(subst %,%_MD5,$(objects)) :
$(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
@$(PREBUILD)
@rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar zxf $(DIR_DL)/$(DL_FILE)
cd $(DIR_APP) && patch -p1 -i $(DIR_SRC)/src/patches/cacti/cacti-0.8.8a-legal.patch
cd $(DIR_APP) && patch -p1 -i $(DIR_SRC)/src/patches/cacti/cacti-0.8.8a-replace_treeview_by_jquery.jstree.patch
cd $(DIR_APP) && patch -p2 -i $(DIR_SRC)/src/patches/cacti/cacti-0.8.8b-html-injection.patch
cd $(DIR_APP) && patch -p2 -i $(DIR_SRC)/src/patches/cacti/cacti-0.8.8b-remote-command-execution.patch
cd $(DIR_APP) && patch -p2 -i $(DIR_SRC)/src/patches/cacti/cacti-0.8.8b-rra-comments.patch
cd $(DIR_APP) && patch -p2 -i $(DIR_SRC)/src/patches/cacti/cacti-0.8.8b-sanitize-variables.patch
cd $(DIR_APP) && patch -p2 -i $(DIR_SRC)/src/patches/cacti/cacti-0.8.8b-sql-injection-shell-escaping.patch
cp -vf \
$(DIR_SRC)/config/cacti/d.gif \
$(DIR_SRC)/config/cacti/d.png \
$(DIR_SRC)/config/cacti/throbber.gif \
$(DIR_APP)/include/js/jquery/themes/default/
cd $(DIR_APP) && rm -rf include/treeview
@rm -rf /var/cacti /usr/share/cacti
mkdir -pv /var/cacti /usr/share/cacti
@@ -92,6 +106,9 @@ $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
ln -s /var/cacti/log /usr/share/cacti/log
ln -s /var/cacti/rra /usr/share/cacti/rra
-mkdir -pv /etc/logrotate.d
install -v -m 644 $(DIR_SRC)/config/cacti/cacti.logrotate /etc/logrotate.d/cacti
chown -R nobody:nobody /var/cacti/rra /var/cacti/log
@rm -rf $(DIR_APP)
@$(POSTBUILD)

View File

@@ -1,7 +1,7 @@
###############################################################################
# #
# IPFire.org - A linux based firewall #
# Copyright (C) 2009 Michael Tremer & Christian Schmidt #
# Copyright (C) 2007-2012 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 #
@@ -24,27 +24,33 @@
include Config
VER = 0.9.7
VER = 1.11.4
PLUGIN_VER = 2.0.2
THISAPP = icecc-$(VER)
DL_FILE = $(THISAPP).tar.bz2
THISAPP = icinga-$(VER)
DL_FILE = $(THISAPP).tar.gz
DL_FROM = $(URL_IPFIRE)
DIR_APP = $(DIR_SRC)/$(THISAPP)
TARGET = $(DIR_INFO)/$(THISAPP)
PROG = icecc
PAK_VER = 3
PROG = icinga
PAK_VER = 1
DEPS = ""
CFLAGS += -fno-strict-aliasing
###############################################################################
# Top-level Rules
###############################################################################
objects = $(DL_FILE)
objects = $(DL_FILE) nagios-plugins-$(PLUGIN_VER).tar.gz
$(DL_FILE) = $(DL_FROM)/$(DL_FILE)
nagios-plugins-$(PLUGIN_VER).tar.gz = \
$(DL_FROM)/nagios-plugins-$(PLUGIN_VER).tar.gz
$(DL_FILE)_MD5 = c06900c2f4011428d0d48826a04f74fb
$(DL_FILE)_MD5 = cfe64b91ec84f5431e53959e31ff07b5
nagios-plugins-$(PLUGIN_VER).tar.gz_MD5 = 2f6d9c43adcf9f024175e48a44d099d4
install : $(TARGET)
@@ -76,12 +82,56 @@ $(subst %,%_MD5,$(objects)) :
$(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
@$(PREBUILD)
@rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar jxf $(DIR_DL)/$(DL_FILE)
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/icecream-rename-scheduler.patch
cd $(DIR_APP) && patch -Np0 < $(DIR_SRC)/src/patches/icecream-0.9.7-platform-arm.patch
cd $(DIR_APP) && ./configure \
--prefix=/opt/icecream
cd $(DIR_APP) && make $(MAKETUNING) $(EXTRA_MAKE)
cd $(DIR_APP) && make install
@rm -rf $(DIR_APP)
@rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar zxf $(DIR_DL)/$(DL_FILE)
@rm -rf $(DIR_SRC)/nagios-plugins-$(PLUGIN_VER) && cd $(DIR_SRC) && \
tar axf $(DIR_DL)/nagios-plugins-$(PLUGIN_VER).tar.gz
# Compile core
cd $(DIR_APP) && \
./configure \
--prefix=/usr \
--sysconfdir=/etc/icinga \
--datadir=/usr/share/icinga \
--datarootdir=/usr/share/icinga \
--sbindir=/usr/share/icinga/cgi-bin \
--localstatedir=/var/icinga \
--libdir=/usr/lib/icinga \
--libexecdir=/usr/lib/icinga/plugins \
--with-lockfile=/var/run/icinga.pid \
--with-httpd-conf=/etc/httpd/conf/conf.d \
--with-icinga-user=nobody \
--with-icinga-group=nobody \
--enable-event-broker \
--enable-embedded-perl \
--disable-idoutils
cd $(DIR_APP) && make all $(MAKETUNING)
# Compile plugins
cd $(DIR_SRC)/nagios-plugins-$(PLUGIN_VER) && \
./configure \
--prefix=/usr \
--libexecdir=/usr/lib/icinga/plugins \
--with-nagios-user=nobody \
--with-nagios-group=nobody
cd $(DIR_SRC)/nagios-plugins-$(PLUGIN_VER) && make $(MAKETUNING)
# Install core
cd $(DIR_APP) && make \
install install-init install-commandmode install-config \
install-webconf install-eventhandlers
rm -vf /etc/httpd/conf/conf.d/icinga.conf
install -v -m 644 $(DIR_SRC)/config/icinga/icinga.conf \
/etc/httpd/conf/vhosts.d/icinga.conf
# Install plugins
cd $(DIR_SRC)/nagios-plugins-$(PLUGIN_VER) && make install
ln -svf /etc/rc.d/init.d/icinga /etc/rc.d/rc3.d/S67icinga
ln -svf /etc/rc.d/init.d/icinga /etc/rc.d/rc0.d/K33icinga
ln -svf /etc/rc.d/init.d/icinga /etc/rc.d/rc6.d/K33icinga
install -v -m 644 $(DIR_SRC)/config/backup/includes/icinga \
/var/ipfire/backup/addons/includes/icinga
@rm -rf $(DIR_APP) $(DIR_SRC)/nagios-plugins-$(PLUGIN_VER)
@$(POSTBUILD)

View File

@@ -74,6 +74,10 @@ $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
cd $(DIR_APP) && patch -Np1 -i $(DIR_SRC)/src/patches/iputils-20020927-rh.patch
cd $(DIR_APP) && patch -Np1 -i $(DIR_SRC)/src/patches/iputils-glibckernheaders.patch
cd $(DIR_APP) && make ping
cd $(DIR_APP) && install -m 0755 ping /usr/bin
cd $(DIR_APP) && install -m 4755 ping /usr/bin
# Some scripts expect ping in /bin/ping.
ln -svf ../usr/bin/ping /bin/ping
@rm -rf $(DIR_APP)
@$(POSTBUILD)

View File

@@ -24,10 +24,10 @@
include Config
VER = 3.10.40
VER = 3.10.41
RPI_PATCHES = linux-3.10.38-grsec-1b49b45
GRS_PATCHES = grsecurity-2.9.1-3.10.40-ipfire1.patch.xz
GRS_PATCHES = grsecurity-2.9.1-3.10.41-ipfire1.patch.xz
THISAPP = linux-$(VER)
DL_FILE = linux-$(VER).tar.xz
@@ -36,7 +36,7 @@ DIR_APP = $(DIR_SRC)/$(THISAPP)
CFLAGS =
CXXFLAGS =
PAK_VER = 45
PAK_VER = 46
DEPS = ""
VERSUFIX=ipfire$(KCFG)
@@ -74,9 +74,9 @@ $(DL_FILE) = $(URL_IPFIRE)/$(DL_FILE)
rpi-patches-$(RPI_PATCHES).patch.xz = $(URL_IPFIRE)/rpi-patches-$(RPI_PATCHES).patch.xz
$(GRS_PATCHES) = $(URL_IPFIRE)/$(GRS_PATCHES)
$(DL_FILE)_MD5 = c1dca08f0f1a60f29b7caa9ff45582a8
$(DL_FILE)_MD5 = 08631db3e6b4328b0315f59ef3fa7b0a
rpi-patches-$(RPI_PATCHES).patch.xz_MD5 = a7408e8bad57b4b2cb677dd5a0bfb7ff
$(GRS_PATCHES)_MD5 = f46506dd67e459fc41d60d0641323668
$(GRS_PATCHES)_MD5 = de48891a35952a3c6de5beea694f7557
install : $(TARGET)
@@ -253,26 +253,26 @@ else
# Cleanup kernel source
cp $(DIR_SRC)/config/kernel/kernel.config.$(MACHINE)-$(VERSUFIX) $(DIR_APP)/.config
cd $(DIR_APP) && make CC="$(KGCC)" oldconfig
cd $(DIR_APP) && make CC="$(KGCC)" clean
cd $(DIR_APP) && make oldconfig
cd $(DIR_APP) && make clean
cd $(DIR_APP) && sed -i -e 's/EXTRAVERSION\ =.*/EXTRAVERSION\ =\ -$(VERSUFIX)/' Makefile
ifeq "$(KCFG)" "-kirkwood"
cd $(DIR_APP) && make $(MAKETUNING) CC="$(KGCC)" uImage modules
cd $(DIR_APP) && make $(MAKETUNING) uImage modules
cd $(DIR_APP) && cp -v arch/arm/boot/uImage /boot/vmlinuz-$(VER)-$(VERSUFIX)
cd $(DIR_APP) && cp -v arch/arm/boot/uImage /boot/uImage-$(VERSUFIX)
else
ifeq "$(KCFG)" "-multi"
cd $(DIR_APP) && make $(MAKETUNING) CC="$(KGCC)" zImage modules
cd $(DIR_APP) && make $(MAKETUNING) zImage modules
cd $(DIR_APP) && cp -v arch/arm/boot/zImage /boot/vmlinuz-$(VER)-$(VERSUFIX)
cd $(DIR_APP) && cp -v arch/arm/boot/zImage /boot/zImage-$(VERSUFIX)
else
ifeq "$(KCFG)" "-rpi"
cd $(DIR_APP) && make $(MAKETUNING) CC="$(KGCC)" zImage modules
cd $(DIR_APP) && make $(MAKETUNING) zImage modules
cd $(DIR_APP) && cp -v arch/arm/boot/zImage /boot/vmlinuz-$(VER)-$(VERSUFIX)
cd $(DIR_APP) && cp -v arch/arm/boot/zImage /boot/kernel.img
else
cd $(DIR_APP) && make $(MAKETUNING) CC="$(KGCC)" bzImage modules
cd $(DIR_APP) && make $(MAKETUNING) bzImage modules
cd $(DIR_APP) && cp -v arch/i386/boot/bzImage /boot/vmlinuz-$(VER)-$(VERSUFIX)
ln -sf vmlinuz-$(VER)-$(VERSUFIX) /boot/vmlinuz-$(VERSUFIX)
endif
@@ -281,11 +281,11 @@ endif
cd $(DIR_APP) && cp -v System.map /boot/System.map-$(VER)-$(VERSUFIX)
cd $(DIR_APP) && cp -v .config /boot/config-$(VER)-$(VERSUFIX)
ln -sf System.map-$(VER)-$(VERSUFIX) /boot/System.map-$(VERSUFIX)
cd $(DIR_APP) && make CC="$(KGCC)" $(MAKETUNING) modules_install
cd $(DIR_APP) && make CC="$(KGCC)" $(MAKETUNING) firmware_install
cd $(DIR_APP) && make $(MAKETUNING) modules_install
cd $(DIR_APP) && make $(MAKETUNING) firmware_install
ifeq "$(MACHINE_TYPE)" "arm"
cd $(DIR_APP) && make CC="$(KGCC)" $(MAKETUNING) dtbs
cd $(DIR_APP) && make $(MAKETUNING) dtbs
cd $(DIR_APP) && for f in $$(find arch/arm/boot/dts/ -name *.dtb); do \
mkdir -p /boot/dtb-$(VER)-$(VERSUFIX) ; \
install -m 644 $$f /boot/dtb-$(VER)-$(VERSUFIX)/ ; \

View File

@@ -32,7 +32,7 @@ DL_FROM = $(URL_IPFIRE)
DIR_APP = $(DIR_SRC)/$(THISAPP)
TARGET = $(DIR_INFO)/$(THISAPP)
PROG = squidclamav
PAK_VER = 17
PAK_VER = 18
DEPS = "clamav"
@@ -78,6 +78,7 @@ $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
@$(PREBUILD)
@rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar zxf $(DIR_DL)/$(DL_FILE)
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/squidclamav-5.11-dont_use_ipv6.patch
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/squidclamav-5.11-squid-helper-protocol.patch
cd $(DIR_APP) && ./configure --prefix=/usr
cd $(DIR_APP) && make install
install -v -m 664 $(DIR_CONF)/squidclamav/squidclamav.conf /etc/squidclamav.conf

View File

@@ -70,6 +70,7 @@ $(subst %,%_MD5,$(objects)) :
$(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
@$(PREBUILD)
@rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar zxf $(DIR_DL)/$(DL_FILE)
cd $(DIR_APP) && patch -Np1 -i $(DIR_SRC)/src/patches/squidguard-1.4-squid-helper-protocol.patch
cd $(DIR_APP) && ./configure --prefix=/usr --datadir=/usr/share \
--sysconfdir=/etc --localstatedir=/var --infodir=/usr/info --mandir=/usr/man \
--with-sg-config=/var/ipfire/urlfilter/squidGuard.conf \

View File

@@ -1,7 +1,7 @@
###############################################################################
# #
# IPFire.org - A linux based firewall #
# Copyright (C) 2007 Michael Tremer & Christian Schmidt #
# Copyright (C) 2007-2013 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 #
@@ -24,13 +24,23 @@
include Config
VER = 1.4.2
THISAPP = inetutils-$(VER)
VER = 1.0.0
THISAPP = vdr-vnsiserver5-$(VER)
DL_FILE = $(THISAPP).tar.gz
DL_FROM = $(URL_IPFIRE)
DIR_APP = $(DIR_SRC)/$(THISAPP)
TARGET = $(DIR_INFO)/$(THISAPP)
PROG = vdr_vnsiserver5
PAK_VER = 1
DEPS = "vdr"
VDRPLUGVER = 2.0.0
EXTRA_FLAGS= -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
CFLAGS += $(EXTRA_FLAGS)
CXXFLAGS += $(EXTRA_FLAGS)
###############################################################################
# Top-level Rules
@@ -38,18 +48,21 @@ TARGET = $(DIR_INFO)/$(THISAPP)
objects = $(DL_FILE)
$(DL_FILE) = $(DL_FROM)/$(DL_FILE)
$(DL_FILE) = $(DL_FROM)/$(DL_FILE)
$(DL_FILE)_MD5 = df0909a586ddac2b7a0d62795eea4206
$(DL_FILE)_MD5 = 3d1a0b21d11187e43a56f9e4cf7cb1c9
install : $(TARGET)
check : $(patsubst %,$(DIR_CHK)/%,$(objects))
download :$(patsubst %,$(DIR_DL)/%,$(objects))
download : $(patsubst %,$(DIR_DL)/%,$(objects))
md5 : $(subst %,%_MD5,$(objects))
dist:
@$(PAK)
###############################################################################
# Downloading, checking, md5sum
###############################################################################
@@ -70,19 +83,17 @@ $(subst %,%_MD5,$(objects)) :
$(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
@$(PREBUILD)
@rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar zxf $(DIR_DL)/$(DL_FILE)
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/$(THISAPP)-gcc4_fixes-3.patch
cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/$(THISAPP)-daemon_fixes-1.patch
cd $(DIR_APP) && sed -i '/#include/a #include <stdlib.h>' libicmp/icmp_timestamp.c
cd $(DIR_APP) && ./configure --prefix=/usr --libexecdir=/usr/sbin \
--sysconfdir=/etc --localstatedir=/var \
--mandir=/usr/share/man --infodir=/usr/share/info \
--disable-logger --disable-syslogd --disable-telnet --disable-telnetd
cd $(DIR_APP) && make $(MAKETUNING)
cd $(DIR_APP) && make install
mv -v /usr/bin/ping /bin
# Don't use whois command from here.
rm -vf /usr/bin/whois
cd $(DIR_APP) && make $(MAKE_TUNING) LIBDIR=. VDRDIR=/usr/lib/vdr \
CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" \
LOCALEDIR=$$(pwd)/locale all
-mkdir -pv /etc/vdr/plugins/vnsiserver5
cd $(DIR_APP) && install -m 755 libvdr-vnsiserver5.so \
/usr/lib/vdr/libvdr-vnsiserver5.so.$(VDRPLUGVER)
ln -svf ../../svdrphosts.conf /etc/vdr/plugins/vnsiserver5/allowed_hosts.conf
install -m 644 $(DIR_SRC)/config/vdr/plugins.d/vnsiserver5.conf \
/etc/sysconfig/vdr-plugins.d
@rm -rf $(DIR_APP)
@$(POSTBUILD)

142
make.sh
View File

@@ -34,16 +34,13 @@ NICE=10 # Nice level
MAX_RETRIES=1 # prefetch/check loop
BUILD_IMAGES=1 # Flash and Xen Downloader
KVER=`grep --max-count=1 VER lfs/linux | awk '{ print $3 }'`
MACHINE=`uname -m`
GIT_TAG=$(git tag | tail -1) # Git Tag
GIT_LASTCOMMIT=$(git log | head -n1 | cut -d" " -f2 |head -c8) # Last commit
TOOLCHAINVER=7
BUILDMACHINE=$MACHINE
if [ "$MACHINE" = "x86_64" ]; then
BUILDMACHINE="i686";
fi
# New architecture variables
BUILD_ARCH="$(uname -m)"
BUILDMACHINE="${BUILD_ARCH}"
# Debian specific settings
if [ ! -e /etc/debian_version ]; then
@@ -72,6 +69,12 @@ if [ -f .config ]; then
. .config
fi
if [ -n "${TARGET_ARCH}" ]; then
configure_target "${TARGET_ARCH}"
else
configure_target "default"
fi
if [ -z $EDITOR ]; then
for i in nano emacs vi; do
EDITOR=$(which $i 2>/dev/null)
@@ -241,7 +244,7 @@ prepareenv() {
buildtoolchain() {
local error=false
case "${MACHINE}:$(uname -m)" in
case "${TARGET_ARCH}:${BUILD_ARCH}" in
# x86
i586:i586|i586:i686|i586:x86_64)
# These are working.
@@ -352,7 +355,6 @@ buildbase() {
lfsmake2 groff
lfsmake2 gperf
lfsmake2 gzip
lfsmake2 inetutils
lfsmake2 iproute2
lfsmake2 jwhois
lfsmake2 kbd
@@ -399,61 +401,62 @@ buildipfire() {
ipfiremake bc
ipfiremake u-boot
if [ "${MACHINE_TYPE}" != "arm" ]; then
case "${TARGET_ARCH}" in
i586)
# x86-pae (Native and new XEN) kernel build
ipfiremake linux KCFG="-pae"
# ipfiremake kvm-kmod KCFG="-pae"
# ipfiremake v4l-dvb KCFG="-pae"
# ipfiremake mISDN KCFG="-pae"
ipfiremake cryptodev KCFG="-pae"
# ipfiremake compat-drivers KCFG="-pae"
# ipfiremake r8169 KCFG="-pae"
# ipfiremake r8168 KCFG="-pae"
# ipfiremake r8101 KCFG="-pae"
ipfiremake e1000e KCFG="-pae"
ipfiremake igb KCFG="-pae"
# x86-pae (Native and new XEN) kernel build
ipfiremake linux KCFG="-pae"
# ipfiremake kvm-kmod KCFG="-pae"
# ipfiremake v4l-dvb KCFG="-pae"
# ipfiremake mISDN KCFG="-pae"
ipfiremake cryptodev KCFG="-pae"
# ipfiremake compat-drivers KCFG="-pae"
# ipfiremake r8169 KCFG="-pae"
# ipfiremake r8168 KCFG="-pae"
# ipfiremake r8101 KCFG="-pae"
ipfiremake e1000e KCFG="-pae"
ipfiremake igb KCFG="-pae"
# x86 kernel build
ipfiremake linux KCFG=""
# ipfiremake kvm-kmod KCFG=""
# ipfiremake v4l-dvb KCFG=""
# ipfiremake mISDN KCFG=""
ipfiremake cryptodev KCFG=""
# ipfiremake compat-drivers KCFG=""
# ipfiremake r8169 KCFG=""
# ipfiremake r8168 KCFG=""
# ipfiremake r8101 KCFG=""
ipfiremake e1000e KCFG=""
ipfiremake igb KCFG=""
;;
# x86 kernel build
ipfiremake linux KCFG=""
# ipfiremake kvm-kmod KCFG=""
# ipfiremake v4l-dvb KCFG=""
# ipfiremake mISDN KCFG=""
ipfiremake cryptodev KCFG=""
# ipfiremake compat-drivers KCFG=""
# ipfiremake r8169 KCFG=""
# ipfiremake r8168 KCFG=""
# ipfiremake r8101 KCFG=""
ipfiremake e1000e KCFG=""
ipfiremake igb KCFG=""
armv5tel)
# arm-rpi (Raspberry Pi) kernel build
ipfiremake linux KCFG="-rpi"
# ipfiremake v4l-dvb KCFG="-rpi"
# ipfiremake mISDN KCFG="-rpi" NOPCI=1
ipfiremake cryptodev KCFG="-rpi"
# ipfiremake compat-drivers KCFG="-rpi"
else
# arm-rpi (Raspberry Pi) kernel build
ipfiremake linux KCFG="-rpi"
# ipfiremake v4l-dvb KCFG="-rpi"
# ipfiremake mISDN KCFG="-rpi" NOPCI=1
ipfiremake cryptodev KCFG="-rpi"
# ipfiremake compat-drivers KCFG="-rpi"
# arm multi platform (Panda, Wandboard ...) kernel build
ipfiremake linux KCFG="-multi"
ipfiremake cryptodev KCFG="-multi"
ipfiremake e1000e KCFG="-multi"
ipfiremake igb KCFG="-multi"
# arm multi platform (Panda, Wandboard ...) kernel build
ipfiremake linux KCFG="-multi"
ipfiremake cryptodev KCFG="-multi"
ipfiremake e1000e KCFG="-multi"
ipfiremake igb KCFG="-multi"
# arm-kirkwood (Dreamplug, ICY-Box ...) kernel build
ipfiremake linux KCFG="-kirkwood"
# ipfiremake v4l-dvb KCFG="-kirkwood"
# ipfiremake mISDN KCFG="-kirkwood"
ipfiremake cryptodev KCFG="-kirkwood"
# ipfiremake compat-drivers KCFG="-kirkwood"
# ipfiremake r8169 KCFG="-kirkwood"
# ipfiremake r8168 KCFG="-kirkwood"
# ipfiremake r8101 KCFG="-kirkwood"
# ipfiremake e1000e KCFG="-kirkwood"
ipfiremake igb KCFG="-kirkwood"
fi
# arm-kirkwood (Dreamplug, ICY-Box ...) kernel build
ipfiremake linux KCFG="-kirkwood"
# ipfiremake v4l-dvb KCFG="-kirkwood"
# ipfiremake mISDN KCFG="-kirkwood"
ipfiremake cryptodev KCFG="-kirkwood"
# ipfiremake compat-drivers KCFG="-kirkwood"
# ipfiremake r8169 KCFG="-kirkwood"
# ipfiremake r8168 KCFG="-kirkwood"
# ipfiremake r8101 KCFG="-kirkwood"
# ipfiremake e1000e KCFG="-kirkwood"
ipfiremake igb KCFG="-kirkwood"
;;
esac
ipfiremake pkg-config
ipfiremake linux-atm
ipfiremake cpio
@@ -669,8 +672,10 @@ buildipfire() {
ipfiremake netpbm
ipfiremake phpSANE
ipfiremake tunctl
ipfiremake netsnmpd
ipfiremake nagios
ipfiremake nagios_nrpe
ipfiremake icinga
ipfiremake ebtables
ipfiremake directfb
ipfiremake dfb++
@@ -678,6 +683,7 @@ buildipfire() {
ipfiremake ffmpeg
ipfiremake vdr
ipfiremake vdr_streamdev
ipfiremake vdr_vnsiserver5
ipfiremake vdr_vnsiserver3
ipfiremake vdr_epgsearch
ipfiremake vdr_dvbapi
@@ -715,13 +721,11 @@ buildipfire() {
ipfiremake perl-Sort-Naturally
ipfiremake vdradmin
ipfiremake miau
ipfiremake netsnmpd
ipfiremake perl-DBI
ipfiremake perl-DBD-mysql
ipfiremake perl-DBD-SQLite
ipfiremake perl-File-ReadBackwards
ipfiremake cacti
ipfiremake icecc
ipfiremake openvmtools
ipfiremake nagiosql
ipfiremake iftop
@@ -897,6 +901,22 @@ ipfirepackages() {
rm -rf $BASEDIR/build/install/packages/*
}
while [ $# -gt 0 ]; do
case "${1}" in
--target=*)
configure_target "${1#--target=}"
;;
-*)
exiterror "Unknown configuration option: ${1}"
;;
*)
# Found a command, so exit options parsing.
break
;;
esac
shift
done
# See what we're supposed to do
case "$1" in
build)

View File

@@ -1,62 +0,0 @@
#!/bin/sh
########################################################################
# Begin $rc_base/init.d/icecream
#
# Description : This is a script that starts the icecream daemon.
#
# Authors : Michael Tremer (mitch@ipfire.org)
#
# Version : 01.00
#
# Notes :
#
########################################################################
. /etc/sysconfig/rc
. ${rc_functions}
#SCHEDULER=minerva.ipfire.org
ENABLE_SCHEDULER=on
JOBS=8
case "${1}" in
start)
boot_mesg "Starting Icecream Daemon..."
ARGS="-d -m ${JOBS}"
if [ -n "${SCHEDULER}" ]; then
ARGS="${ARGS} -s ${SCHEDULER}"
fi
/opt/icecream/sbin/iceccd ${ARGS}
evaluate_retval
if [ "${ENABLE_SCHEDULER}" = "on" ]; then
/opt/icecream/sbin/icecc-scheduler -d
fi
;;
stop)
boot_mesg "Stopping Icecream Daemon..."
killproc /opt/icecream/sbin/iceccd
if [ "${ENABLE_SCHEDULER}" = "on" ]; then
killproc /opt/icecream/sbin/icecc-scheduler
fi
;;
restart)
${0} stop
sleep 1
${0} start
;;
status)
statusproc /opt/icecream/sbin/iceccd
;;
*)
echo "Usage: ${0} {start|stop|reload|restart|status}"
exit 1
;;
esac
# End $rc_base/init.d/icecream

View File

@@ -23,7 +23,4 @@
#
. /opt/pakfire/lib/functions.sh
extract_files
mysqladmin --user=root -pmysqlfire create cacti
mysql --user=root -pmysqlfire cacti < /usr/share/cacti/cacti.sql
mysql --user=root -pmysqlfire -e "GRANT ALL ON cacti.* TO cactiuser@localhost IDENTIFIED BY 'cactiuser';" mysql
/etc/init.d/apache restart

View File

@@ -22,5 +22,6 @@
############################################################################
#
. /opt/pakfire/lib/functions.sh
stop_service vdr
extract_files
start_service --delay 90 --background icecream
start_service --background vdr

View File

@@ -22,5 +22,6 @@
############################################################################
#
. /opt/pakfire/lib/functions.sh
stop_service icecream
stop_service vdr
remove_files
start_service vdr --background

View File

@@ -22,5 +22,5 @@
############################################################################
#
. /opt/pakfire/lib/functions.sh
/etc/init.d/icecream stop
./uninstall.sh
./install.sh

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,607 @@
Description: treeview has a license issue, cacti upstream is going to replace it
with functionality from jquery.jstree.
.
This patch implements the changes needed for an upstream layout where the
necessary code is in cacti/include/js/jquery/ but the code in that path is
not included in this patch.
.
The necessary jquery scripts and theme info can come from cacti upstream and from
debian packages (libjs-jquery and libjs-jquery-cookie) The version used when
creating this patch can be found here:
http://svn.cacti.net/viewvc/cacti/branches/0.8.9/include/js/jquery/jquery.js?pathrev=7324
http://svn.cacti.net/viewvc/cacti/branches/0.8.9/include/js/jquery/jquery.jstree.js?pathrev=7324
http://svn.cacti.net/viewvc/cacti/branches/main/include/js/jquery/themes/default/?pathrev=7324
http://anonscm.debian.org/gitweb/?p=pkg-javascript/jquery-goodies.git;a=blob;f=cookie/jquery.cookie.js;hb=c50e1a2d599cb48893e8d77470e71e83e44dfdb5
.
This patch does NOT implement the changes needed for the Debian package of
cacti.
.
This patch was updated with the patch from Jan Zalesak <zalesak@jaw.cz> in
http://bugs.debian.org/702690 which was further improved to also cover
lib/graph_export.php and to keep tag alignment consistent.
Bug: http://bugs.cacti.net/view.php?id=2228
Bug-Debian: http://bugs.debian.org/679980
Author: Paul Gevers <elbrus@debian.org>
Date: Sun, 31 Mar 2013 11:59:05 +0200
--- a/include/top_graph_header.php
+++ b/include/top_graph_header.php
@@ -84,8 +84,9 @@
<link href="<?php echo $config['url_path']; ?>include/main.css" type="text/css" rel="stylesheet">
<link href="<?php echo $config['url_path']; ?>images/favicon.ico" rel="shortcut icon"/>
<script type="text/javascript" src="<?php echo $config['url_path']; ?>include/layout.js"></script>
- <script type="text/javascript" src="<?php echo $config['url_path']; ?>include/treeview/ua.js"></script>
- <script type="text/javascript" src="<?php echo $config['url_path']; ?>include/treeview/ftiens4.js"></script>
+ <script type="text/javascript" src="<?php echo $config['url_path']; ?>include/js/jquery/jquery.js" language="javascript"></script>
+ <script type="text/javascript" src="<?php echo $config['url_path']; ?>include/js/jquery/jquery.cookie.js" language="javascript"></script>
+ <script type="text/javascript" src="<?php echo $config['url_path']; ?>include/js/jquery/jquery.jstree.js"></script>
<script type="text/javascript" src="<?php echo $config['url_path']; ?>include/jscalendar/calendar.js"></script>
<script type="text/javascript" src="<?php echo $config['url_path']; ?>include/jscalendar/lang/calendar-en.js"></script>
<script type="text/javascript" src="<?php echo $config['url_path']; ?>include/jscalendar/calendar-setup.js"></script>
@@ -178,7 +179,6 @@
<td valign="top" style="padding: 5px; border-right: #aaaaaa 1px solid;background-repeat:repeat-y;background-color:#efefef;" bgcolor='#efefef' width='<?php print htmlspecialchars(read_graph_config_option("default_dual_pane_width"));?>' class='noprint'>
<table border=0 cellpadding=0 cellspacing=0><tr><td><a style="font-size:7pt;text-decoration:none;color:silver" href="http://www.treemenu.net/" target=_blank></a></td></tr></table>
<?php grow_dhtml_trees(); ?>
- <script type="text/javascript">initializeDocument();</script>
<?php if (isset($_GET["select_first"])) { ?>
<script type="text/javascript">
--- a/lib/graph_export.php
+++ b/lib/graph_export.php
@@ -1365,15 +1365,6 @@
/* create the treeview representation for the html data */
grow_dhtml_trees_export($fp,$tree_id);
- fwrite($fp,"<script type='text/javascript'>initializeDocument();</script>\n");
- fwrite($fp,"<script type='text/javascript'>\n");
- fwrite($fp,"var obj;\n");
- fwrite($fp,"obj = findObj(1);\n");
- fwrite($fp,"if (!obj.isOpen) {\n");
- fwrite($fp,"clickOnNode(1);\n");
- fwrite($fp,"}\n");
- fwrite($fp,"clickOnLink(2,'','main');\n");
- fwrite($fp,"</script>\n");
fwrite($fp,"</td>\n");
fwrite($fp,"<td valign='top'>\n");
}
@@ -1383,16 +1374,7 @@
include_once($config["library_path"] . "/tree.php");
include_once($config["library_path"] . "/data_query.php");
- fwrite($fp, "<script type='text/javascript'>\n");
- fwrite($fp, "<!--
- USETEXTLINKS = 1
- STARTALLOPEN = 0
- USEFRAMES = 0
- USEICONS = 0
- WRAPTEXT = 1
- ICONPATH = 'treeview/'
- PERSERVESTATE = 1
- HIGHLIGHT = 1\n");
+ fwrite($fp, "<div id=\"jtree\">\n");
if (read_config_option("export_tree_isolation") == "off") {
$dhtml_tree_base = 0;
@@ -1413,9 +1395,34 @@
}
}
- fwrite($fp,"foldersTree.treeID = \"t2\"
- //-->\n
- </script>\n");
+ fwrite($fp, "</div>\n");
+ fwrite($fp, "<script type=\"text/javascript\">\n");
+ fwrite($fp, "$(function () {
+ $(\"#jtree\")
+ .jstree({
+ \"plugins\" : [\"ui\",\"themes\",\"html_data\",\"cookies\"],
+ \"themes\" : {\"icons\" : false,
+ \"url\" : \"./js/style.css\"},
+ \"cookies\" : {
+ \"save_opened\" : \"Cacti_jstree_open\",
+ \"save_selected\" : \"Cacti_jstree_select\"
+ }
+
+ })
+
+ // Make sure that the nodes are actually used as links
+ // We need reselect to prevent endless loops
+ // https://groups.google.com/d/topic/jstree/j6XNq9hQdeA/discussion
+ .bind(\"reselect.jstree\", function (e, data) {
+ data.inst.get_container().bind(\"select_node.jstree\", function (e, data) {
+ // data.rstl.obj is the object that was selected.
+ document.location.href = data.rslt.obj.children(\"a\").attr(\"href\");
+ });
+ });
+
+});\n");
+ fwrite($fp, "</script>\n");
+
}
/* get_graph_tree_array_export - returns a list of graph trees taking permissions into account if
@@ -1478,8 +1485,7 @@
$dhtml_tree = array();
$dhtml_tree[0] = $start;
$dhtml_tree[1] = read_graph_config_option("expand_hosts");
- $dhtml_tree[2] = "foldersTree = gFld(\"\", \"\")\n";
- $i = 2;
+ $i = 1;
$tree_list = get_graph_tree_array_export();
@@ -1499,7 +1505,6 @@
if (((read_config_option("export_tree_isolation") == "on") && ($tree_id == $tree["id"])) ||
(read_config_option("export_tree_isolation") == "off")) {
- $i++;
$hier_sql = "SELECT DISTINCT
graph_tree_items.id,
@@ -1522,19 +1527,53 @@
$dhtml_tree_id = 0;
if (sizeof($hierarchy) > 0) {
+ $last_tier = 1;
+ $openli = false;
+ $lasthost = false;
+ $opentree = false;
foreach ($hierarchy as $leaf) {
if ($dhtml_tree_id <> $tree["id"]) {
- $dhtml_tree[$i] = "ou0 = insFld(foldersTree, gFld(\"" . get_tree_name($tree["id"]) . "\", \"" . clean_up_export_name(get_tree_name($tree["id"])) . "_leaf.html\"))\n";
+ if ($opentree) {
+ $i++;
+ $dhtml_tree[$i] = "\t\t\t</ul>\n\t\t</li>\n\t</ul>\n";
+ }
+ $i++;
+ $clean_id = clean_up_export_name(get_tree_name($tree["id"]));
+ $dhtml_tree[$i] = "\t<ul>\n\t\t<li id=\"" . $clean_id . "\"><a href=\"" . $clean_id . "_leaf.html\">" . get_tree_name($tree["id"]) . "</a>\n\t\t\t<ul>\n";
+ $opentree = true;
}
$dhtml_tree_id = $tree["id"];
- $i++;
$tier = tree_tier($leaf["order_key"]);
if ($leaf["host_id"] > 0) { //It's a host
- $dhtml_tree[$i] = "ou" . ($tier) . " = insFld(ou" . ($tier-1) . ", gFld(\"Host: " . $leaf["hostname"] . "\", \"" . clean_up_export_name($leaf["hostname"] . "_" . $leaf["id"]) . ".html\"))\n";
+ if ($tier > $last_tier) {
+ $i++;
+ $dhtml_tree[$i] = "\t\t\t<ul>\n";
+ } elseif ($tier < $last_tier) {
+ if (!$lasthost) {
+ $i++;
+ $dhtml_tree[$i] = "\t\t\t\t</li>\n";
+ }
+ for ($x = $tier; $x < $last_tier; $x++) {
+ $i++;
+ $dhtml_tree[$i] = "\t\t\t</ul>\n\t\t\t\t</li>\n";
+ $openli = false;
+ }
+ } elseif ($openli && !$lasthost) {
+ $i++;
+ $dhtml_tree[$i] = "\t\t\t\t</li>\n";
+ $openli = false;
+ }
+ $last_tier = $tier;
+ $lasthost = true;
+ $i++;
+ $clean_id = clean_up_export_name($leaf["hostname"] . "_" . $leaf["id"]);
+ $dhtml_tree[$i] = "\t\t\t\t<li id=\"" . $clean_id . "\"><a href=\"" . $clean_id . ".html\">Host: " . htmlspecialchars($leaf["hostname"]) . "</a>\n";
if (read_config_option("export_tree_expand_hosts") == "on") {
+ $i++;
+ $dhtml_tree[$i] = "\t\t\t\t\t<ul>\n";
if ($leaf["host_grouping_type"] == HOST_GROUPING_GRAPH_TEMPLATE) {
$graph_templates = db_fetch_assoc("SELECT
graph_templates.id,
@@ -1552,7 +1591,8 @@
if (sizeof($graph_templates) > 0) {
foreach ($graph_templates as $graph_template) {
$i++;
- $dhtml_tree[$i] = "ou" . ($tier+1) . " = insFld(ou" . ($tier) . ", gFld(\" " . $graph_template["name"] . "\", \"" . clean_up_export_name($leaf["hostname"] . "_gt_" . $leaf["id"]) . "_" . $graph_template["id"] . ".html\"))\n";
+ $clean_id = clean_up_export_name($leaf["hostname"] . "_gt_" . $leaf["id"] . "_" . $graph_template["id"]);
+ $dhtml_tree[$i] = "\t\t\t\t\t\t<li id=\"" . $clean_id . "\"><a href=\"" . $clean_id . ".html\">" . htmlspecialchars($graph_template["name"]) . "</a></li>\n";
}
}
}else if ($leaf["host_grouping_type"] == HOST_GROUPING_DATA_QUERY_INDEX) {
@@ -1567,36 +1607,77 @@
array_push($data_queries, array(
"id" => "0",
- "name" => "Graph Template Based"
+ "name" => "Non Query Based"
));
if (sizeof($data_queries) > 0) {
- foreach ($data_queries as $data_query) {
- $i++;
-
- $dhtml_tree[$i] = "ou" . ($tier+1) . " = insFld(ou" . ($tier) . ", gFld(\" " . $data_query["name"] . "\", \"" . clean_up_export_name($leaf["hostname"] . "_dq_" . $leaf["title"] . "_" . $leaf["id"]) . "_" . $data_query["id"] . ".html\"))\n";
+ foreach ($data_queries as $data_query) {
+ $i++;
+ $clean_id = clean_up_export_name($leaf["hostname"] . "_dq_" . $leaf["title"] . "_" . $leaf["id"] . "_" . $data_query["id"]);
+ $dhtml_tree[$i] = "\t\t\t\t\t\t<li id=\"" . $clean_id . "\"><a href=\"" . $clean_id . ".html\">" . htmlspecialchars($data_query["name"]) . "</a>\n";
- /* fetch a list of field names that are sorted by the preferred sort field */
- $sort_field_data = get_formatted_data_query_indexes($leaf["host_id"], $data_query["id"]);
+ /* fetch a list of field names that are sorted by the preferred sort field */
+ $sort_field_data = get_formatted_data_query_indexes($leaf["host_id"], $data_query["id"]);
- if ($data_query["id"] > 0) {
- while (list($snmp_index, $sort_field_value) = each($sort_field_data)) {
+ if ($data_query["id"] > 0) {
+ $i++;
+ $dhtml_tree[$i] = "\t\t\t\t\t\t\t<ul>\n";
+ while (list($snmp_index, $sort_field_value) = each($sort_field_data)) {
+ $i++;
+ $clean_id = clean_up_export_name($leaf["hostname"] . "_dqi_" . $leaf["id"] . "_" . $data_query["id"] . "_" . $snmp_index);
+ $dhtml_tree[$i] = "\t\t\t\t\t\t\t\t<li id=\"" . $clean_id . "\"><a href=\"" . $clean_id . ".html\">" . htmlspecialchars($sort_field_value) . "</a></li>\n";
+ }
$i++;
- $dhtml_tree[$i] = "ou" . ($tier+2) . " = insFld(ou" . ($tier+1) . ", gFld(\" " . $sort_field_value . "\", \"" . clean_up_export_name($leaf["hostname"] . "_dqi_" . $leaf["title"] . "_" . $leaf["id"]) . "_" . $data_query["id"] . "_" . $snmp_index . ".html\"))\n";
+ $dhtml_tree[$i] = "\t\t\t\t\t\t\t</ul>\n";
}
+ $i++;
+ $dhtml_tree[$i] = "\t\t\t\t\t\t</li>\n";
}
}
- }
}
+ $i++;
+ $dhtml_tree[$i] = "\t\t\t\t\t</ul>\n";
}
- }else {
- $dhtml_tree[$i] = "ou" . ($tier) . " = insFld(ou" . ($tier-1) . ", gFld(\"" . $leaf["title"] . "\", \"" . clean_up_export_name(get_tree_name($tree["id"]) . "_" . $leaf["title"] . "_" . $leaf["id"]) . "_leaf.html\"))\n";
+ $i++;
+ $dhtml_tree[$i] = "\t\t\t\t</li>\n";
+ }else { //It's not a host
+ if ($tier > $last_tier) {
+ $i++;
+ $dhtml_tree[$i] = "\t\t\t<ul>\n";
+ } elseif ($tier < $last_tier) {
+ if (!$lasthost) {
+ $i++;
+ $dhtml_tree[$i] = "</li>\n";
+ }
+ for ($x = $tier; $x < $last_tier; $x++) {
+ $i++;
+ $dhtml_tree[$i] = "\t\t\t\t</ul>\n\t\t\t\t</li>\n";
+ $openli = false;
+ }
+ } elseif ($openli && !$lasthost) {
+ $i++;
+ $dhtml_tree[$i] = "</li>\n";
+ $openli = false;
+ }
+ $last_tier = $tier;
+ $i++;
+ $clean_id = clean_up_export_name(get_tree_name($tree["id"]) . "_" . $leaf["title"] . "_" . $leaf["id"]);
+ $dhtml_tree[$i] = "\t\t\t\t<li id=\"" . $clean_id . "\"><a href=\"" . $clean_id . "_leaf.html\">" . htmlspecialchars($leaf["title"]) . "</a>\n";
+ $openli = true;
+ $lasthost = false;
}
}
+ for ($x = $last_tier; $x > 1; $x--) {
+ $i++;
+ $dhtml_tree[$i] = "\t\t\t\t\t</ul>\n\t\t\t\t</li>\n";
+ }
+ $i++;
+ $dhtml_tree[$i] = "\t\t\t</ul>\n\t\t</li>\n\t</ul>\n";
}else{
if ($dhtml_tree_id <> $tree["id"]) {
- $dhtml_tree[$i] = "ou0 = insFld(foldersTree, gFld(\"" . get_tree_name($tree["id"]) . "\", \"" . clean_up_export_name(get_tree_name($tree["id"])) . "_leaf.html\"))\n";
$i++;
+ $clean_id = clean_up_export_name(get_tree_name($tree["id"]));
+ $dhtml_tree[$i] = "\t<ul>\n\t\t<li id=\"" . $clean_id . "_leaf\"><a href=\"" . $clean_id . "_leaf.html\">" . get_tree_name($tree["id"]) . "</a></li>\n\t</ul>";
}
}
}
@@ -1612,10 +1693,10 @@
$dir - the export directory where graphs will either be staged or located.
*/
function create_export_directory_structure($cacti_root_path, $dir) {
- /* create the treeview sub-directory */
- if (!is_dir("$dir/treeview")) {
- if (!mkdir("$dir/treeview", 0755)) {
- export_fatal("Create directory '" . $dir . "/treeview' failed. Can not continue");
+ /* create the jquery sub-directory */
+ if (!is_dir("$dir/js")) {
+ if (!mkdir("$dir/js", 0755)) {
+ export_fatal("Create directory '" . $dir . "/js' failed. Can not continue");
}
}
@@ -1626,8 +1707,6 @@
}
}
- $treeview_dir = $dir . "/treeview";
-
/* css */
copy("$cacti_root_path/include/main.css", "$dir/main.css");
@@ -1639,18 +1718,15 @@
copy("$cacti_root_path/images/shadow_gray.gif", "$dir/shadow_gray.gif");
/* java scripts for the tree */
- copy("$cacti_root_path/include/treeview/ftiens4_export.js", "$treeview_dir/ftiens4.js");
- copy("$cacti_root_path/include/treeview/ua.js", "$treeview_dir/ua.js");
-
- /* images for the tree */
- copy("$cacti_root_path/include/treeview/ftv2blank.gif", "$treeview_dir/ftv2blank.gif");
- copy("$cacti_root_path/include/treeview/ftv2lastnode.gif", "$treeview_dir/ftv2lastnode.gif");
- copy("$cacti_root_path/include/treeview/ftv2mlastnode.gif", "$treeview_dir/ftv2mlastnode.gif");
- copy("$cacti_root_path/include/treeview/ftv2mnode.gif", "$treeview_dir/ftv2mnode.gif");
- copy("$cacti_root_path/include/treeview/ftv2node.gif", "$treeview_dir/ftv2node.gif");
- copy("$cacti_root_path/include/treeview/ftv2plastnode.gif", "$treeview_dir/ftv2plastnode.gif");
- copy("$cacti_root_path/include/treeview/ftv2pnode.gif", "$treeview_dir/ftv2pnode.gif");
- copy("$cacti_root_path/include/treeview/ftv2vertline.gif", "$treeview_dir/ftv2vertline.gif");
+ copy("$cacti_root_path/include/js/jquery/jquery.js", "$dir/js/jquery.js");
+ copy("$cacti_root_path/include/js/jquery/jquery.jstree.js", "$dir/js/jquery.jstree.js");
+ copy("$cacti_root_path/include/js/jquery/jquery.cookie.js", "$dir/js/jquery.cookie.js");
+
+ /* theme info for java scripts */
+ copy("$cacti_root_path/include/js/jquery/themes/default/style.css", "$dir/js/style.css");
+ copy("$cacti_root_path/include/js/jquery/themes/default/d.png", "$dir/js/d.png");
+ copy("$cacti_root_path/include/js/jquery/themes/default/d.gif", "$dir/js/d.gif");
+ copy("$cacti_root_path/include/js/jquery/themes/default/throbber.gif", "$dir/js/throbber.gif");
}
function get_host_description($host_id) {
@@ -1738,8 +1814,9 @@
<meta http-equiv=refresh content='300'; url='index.html'>
<meta http-equiv=Pragma content=no-cache>
<meta http-equiv=cache-control content=no-cache>
- <script type=\"text/javascript\" src=\"./treeview/ua.js\"></script>
- <script type=\"text/javascript\" src=\"./treeview/ftiens4.js\"></script>
+ <script type=\"text/javascript\" src=\"./js/jquery.js\" language=\"javascript\"></script>
+ <script type=\"text/javascript\" src=\"./js/jquery.cookie.js\" language=\"javascript\"></script>
+ <script type=\"text/javascript\" src=\"./js/jquery.jstree.js\" language=\"javascript\"></script>
</head>
<body>
<table style='width:100%;height:100%;' cellspacing='0' cellpadding='0'>
--- a/lib/html_tree.php
+++ b/lib/html_tree.php
@@ -495,17 +495,9 @@
include_once($config["library_path"] . "/data_query.php");
?>
- <script type="text/javascript">
- <!--
- USETEXTLINKS = 1
- STARTALLOPEN = 0
- USEFRAMES = 0
- USEICONS = 0
- WRAPTEXT = 1
- PERSERVESTATE = 1
- HIGHLIGHT = 1
<?php
/* get current time */
+/* Probably not needed anymore as jstree uses jquery.cookies
list($micro,$seconds) = explode(" ", microtime());
$current_time = $seconds + $micro;
$expand_hosts = read_graph_config_option("expand_hosts");
@@ -522,6 +514,8 @@
$dhtml_tree = $_SESSION['dhtml_tree'];
}
}
+*/
+ $dhtml_tree = create_dhtml_tree();
$total_tree_items = sizeof($dhtml_tree) - 1;
@@ -529,8 +523,31 @@
print $dhtml_tree[$i];
}
?>
- //-->
- </script>
+<script type="text/javascript">
+$(function () {
+ $("#jtree")
+ .jstree({
+ "plugins" : ["ui","themes","html_data","cookies"],
+ "themes" : {"icons" : false,
+ "url" : "<?php echo $config['url_path']; ?>include/js/jquery/themes/default/style.css"},
+ "cookies" : {
+ "save_opened" : "Cacti_jstree_open",
+ "save_selected" : "Cacti_jstree_select"
+ }
+ })
+
+ // Make sure that the nodes are actually used as links
+ // We need reselect to prevent endless loops
+ // https://groups.google.com/d/topic/jstree/j6XNq9hQdeA/discussion
+ .bind("reselect.jstree", function (e, data) {
+ data.inst.get_container().bind("select_node.jstree", function (e, data) {
+ // data.rstl.obj is the object that was selected.
+ document.location.href = data.rslt.obj.children("a").attr("href");
+ });
+ });
+
+});
+</script>
<?php
}
@@ -543,9 +560,8 @@
$dhtml_tree[0] = $start;
$dhtml_tree[1] = read_graph_config_option("expand_hosts");
- $dhtml_tree[2] = "foldersTree = gFld(\"\", \"\")\n";
- $dhtml_tree[3] = "foldersTree.xID = \"root\"\n";
- $i = 3;
+ $dhtml_tree[2] = "\n<div id=\"jtree\">\n";
+ $i = 2;
$tree_list = get_graph_tree_array();
@@ -567,7 +583,6 @@
if (sizeof($tree_list) > 0) {
foreach ($tree_list as $tree) {
- $i++;
$hierarchy = db_fetch_assoc("select
graph_tree_items.id,
graph_tree_items.title,
@@ -583,21 +598,45 @@
and graph_tree_items.local_graph_id = 0
order by graph_tree_items.order_key");
- $dhtml_tree[$i] = "ou0 = insFld(foldersTree, gFld(\"" . htmlspecialchars($tree["name"]) . "\", \"" . htmlspecialchars("graph_view.php?action=tree&tree_id=" . $tree["id"]) . "\"))\n";
$i++;
- $dhtml_tree[$i] = "ou0.xID = \"tree_" . $tree["id"] . "\"\n";
+ $dhtml_tree[$i] = "\t<ul>\n\t\t<li id=\"" . htmlspecialchars("tree_" . $tree["id"]) . "\"><a href=\"" . htmlspecialchars("graph_view.php?action=tree&tree_id=" . $tree["id"]) . "\">" . htmlspecialchars($tree["name"]) . "</a>\n";
if (sizeof($hierarchy) > 0) {
+ $i++;
+ $dhtml_tree[$i] = "\t\t\t<ul>\n";
+ $last_tier = 1;
+ $openli = false;
+ $lasthost = false;
foreach ($hierarchy as $leaf) {
- $i++;
$tier = tree_tier($leaf["order_key"]);
- if ($leaf["host_id"] > 0) {
- $dhtml_tree[$i] = "ou" . ($tier) . " = insFld(ou" . abs(($tier-1)) . ", gFld(\"" . "Host: " . htmlspecialchars($leaf["hostname"]) . "\", \"" . htmlspecialchars("graph_view.php?action=tree&tree_id=" . $tree["id"] . "&leaf_id=" . $leaf["id"]) . "\"))\n";
+ if ($leaf["host_id"] > 0) { //It's a host
+ if ($tier > $last_tier) {
+ $i++;
+ $dhtml_tree[$i] = "\t\t\t<ul>\n";
+ } elseif ($tier < $last_tier) {
+ if (!$lasthost) {
+ $i++;
+ $dhtml_tree[$i] = "\t\t\t\t</li>\n";
+ }
+ for ($x = $tier; $x < $last_tier; $x++) {
+ $i++;
+ $dhtml_tree[$i] = "\t\t\t</ul>\n\t\t\t\t</li>\n";
+ $openli = false;
+ }
+ } elseif ($openli && !$lasthost) {
+ $i++;
+ $dhtml_tree[$i] = "\t\t\t\t</li>\n";
+ $openli = false;
+ }
+ $last_tier = $tier;
+ $lasthost = true;
$i++;
- $dhtml_tree[$i] = "ou" . ($tier) . ".xID = \"tree_" . $tree["id"] . "_leaf_" . $leaf["id"] . "\"\n";
+ $dhtml_tree[$i] = "\t\t\t\t<li id=\"" . htmlspecialchars("tree_" . $tree["id"] . "_leaf_" . $leaf["id"]) . "\"><a href=\"" . htmlspecialchars("graph_view.php?action=tree&tree_id=" . $tree["id"] . "&leaf_id=" . $leaf["id"]) . "\">Host: " . htmlspecialchars($leaf["hostname"]) . "</a>\n";
if (read_graph_config_option("expand_hosts") == "on") {
+ $i++;
+ $dhtml_tree[$i] = "\t\t\t\t\t<ul>\n";
if ($leaf["host_grouping_type"] == HOST_GROUPING_GRAPH_TEMPLATE) {
$graph_templates = db_fetch_assoc("select
graph_templates.id,
@@ -612,9 +651,7 @@
if (sizeof($graph_templates) > 0) {
foreach ($graph_templates as $graph_template) {
$i++;
- $dhtml_tree[$i] = "ou" . ($tier+1) . " = insFld(ou" . ($tier) . ", gFld(\" " . htmlspecialchars($graph_template["name"]) . "\", \"graph_view.php?action=tree&tree_id=" . $tree["id"] . "&leaf_id=" . $leaf["id"] . "&host_group_data=graph_template:" . $graph_template["id"] . "\"))\n";
- $i++;
- $dhtml_tree[$i] = "ou" . ($tier+1) . ".xID = \"tree_" . $tree["id"] . "_leaf_" . $leaf["id"] . "_hgd_gt_" . $graph_template["id"] . "\"\n";
+ $dhtml_tree[$i] = "\t\t\t\t\t\t<li id=\"" . htmlspecialchars("tree_" . $tree["id"] . "_leaf_" . $leaf["id"] . "_hgd_gt_" . $graph_template["id"]) . "\"><a href=\"" . htmlspecialchars("graph_view.php?action=tree&tree_id=" . $tree["id"] . "&leaf_id=" . $leaf["id"] . "&host_group_data=graph_template:" . $graph_template["id"]) . "\">" . htmlspecialchars($graph_template["name"]) . "</a></li>\n";
}
}
}else if ($leaf["host_grouping_type"] == HOST_GROUPING_DATA_QUERY_INDEX) {
@@ -645,33 +682,71 @@
if ((($data_query["id"] == 0) && ($non_template_graphs > 0)) ||
(($data_query["id"] > 0) && (sizeof($sort_field_data) > 0))) {
$i++;
- $dhtml_tree[$i] = "ou" . ($tier+1) . " = insFld(ou" . ($tier) . ", gFld(\" " . htmlspecialchars($data_query["name"]) . "\", \"" . htmlspecialchars("graph_view.php?action=tree&tree_id=" . $tree["id"] . "&leaf_id=" . $leaf["id"] . "&host_group_data=data_query:" . $data_query["id"]) . "\"))\n";
- $i++;
- $dhtml_tree[$i] = "ou" . ($tier+1) . ".xID = \"tree_" . $tree["id"] . "_leaf_" . $leaf["id"] . "_hgd_dq_" . $data_query["id"] . "\"\n";
-
+ $dhtml_tree[$i] = "\t\t\t\t\t\t<li id=\"" . htmlspecialchars("tree_" . $tree["id"] . "_leaf_" . $leaf["id"] . "_hgd_dq_" . $data_query["id"]) . "\"><a href=\"" . htmlspecialchars("graph_view.php?action=tree&tree_id=" . $tree["id"] . "&leaf_id=" . $leaf["id"] . "&host_group_data=data_query:" . $data_query["id"]) . "\">" . htmlspecialchars($data_query["name"]) . "</a>\n";
if ($data_query["id"] > 0) {
+ $i++;
+ $dhtml_tree[$i] = "\t\t\t\t\t\t\t<ul>\n";
while (list($snmp_index, $sort_field_value) = each($sort_field_data)) {
$i++;
- $dhtml_tree[$i] = "ou" . ($tier+2) . " = insFld(ou" . ($tier+1) . ", gFld(\" " . htmlspecialchars($sort_field_value) . "\", \"" . htmlspecialchars("graph_view.php?action=tree&tree_id=" . $tree["id"] . "&leaf_id=" . $leaf["id"] . "&host_group_data=data_query_index:" . $data_query["id"] . ":" . urlencode($snmp_index)) . "\"))\n";
- $i++;
- $dhtml_tree[$i] = "ou" . ($tier+2) . ".xID = \"tree_" . $tree["id"] . "_leaf_" . $leaf["id"] . "_hgd_dqi" . $data_query["id"] . "_" . urlencode($snmp_index) . "\"\n";
+ $dhtml_tree[$i] = "\t\t\t\t\t\t\t\t<li id=\"" . htmlspecialchars("tree_" . $tree["id"] . "_leaf_" . $leaf["id"] . "_hgd_dqi" . $data_query["id"]) . "_" . urlencode($snmp_index) . "\"><a href=\"" . htmlspecialchars("graph_view.php?action=tree&tree_id=" . $tree["id"] . "&leaf_id=" . $leaf["id"] . "&host_group_data=data_query_index:" . $data_query["id"] . ":" . urlencode($snmp_index)) . "\">" . htmlspecialchars($sort_field_value) . "</a></li>\n";
}
+ $i++;
+ $dhtml_tree[$i] = "\t\t\t\t\t\t\t</ul>\n";
+ $i++;
+ $dhtml_tree[$i] = "\t\t\t\t\t\t</li>\n";
}
}
}
}
+ $i++;
+ $dhtml_tree[$i] = "\t\t\t\t\t\t</li>\n";
+ }
+ $i++;
+ $dhtml_tree[$i] = "\t\t\t\t\t</ul>\n";
+ }
+ $i++;
+ $dhtml_tree[$i] = "\t\t\t\t</li>\n";
+ }else{ //It's not a host
+ if ($tier > $last_tier) {
+ $i++;
+ $dhtml_tree[$i] = "\t\t\t<ul>\n";
+ } elseif ($tier < $last_tier) {
+ if (!$lasthost) {
+ $i++;
+ $dhtml_tree[$i] = "</li>\n";
}
+ for ($x = $tier; $x < $last_tier; $x++) {
+ $i++;
+ $dhtml_tree[$i] = "\t\t\t\t</ul>\n\t\t\t\t</li>\n";
+ $openli = false;
+ }
+ } elseif ($openli && !$lasthost) {
+ $i++;
+ $dhtml_tree[$i] = "</li>\n";
+ $openli = false;
}
- }else{
- $dhtml_tree[$i] = "ou" . ($tier) . " = insFld(ou" . abs(($tier-1)) . ", gFld(\"" . htmlspecialchars($leaf["title"]) . "\", \"" . htmlspecialchars("graph_view.php?action=tree&tree_id=" . $tree["id"] . "&leaf_id=" . $leaf["id"]) . "\"))\n";
+ $last_tier = $tier;
$i++;
- $dhtml_tree[$i] = "ou" . ($tier) . ".xID = \"tree_" . $tree["id"] . "_leaf_" . $leaf["id"] . "\"\n";
+ $dhtml_tree[$i] = "\t\t\t\t<li id=\"" . htmlspecialchars("tree_" . $tree["id"] . "_leaf_" . $leaf["id"]) . "\"><a href=\"" . htmlspecialchars("graph_view.php?action=tree&tree_id=" . $tree["id"] . "&leaf_id=" . $leaf["id"]) . "\">" . htmlspecialchars($leaf["title"]) . "</a>\n";
+ $openli = true;
+ $lasthost = false;
}
}
+ for ($x = $last_tier; $x > 1; $x--) {
+ $i++;
+ $dhtml_tree[$i] = "\t\t\t\t\t</ul>\n\t\t\t\t</li>\n";
+ }
+ $i++;
+ $dhtml_tree[$i] = "\t\t\t</ul>\n";
}
+ $i++;
+ $dhtml_tree[$i] = "\t\t</li>\n\t</ul>\n";
}
}
+ $i++;
+ $dhtml_tree[$i] = "</div>\n";
+
return $dhtml_tree;
}
@@ -758,14 +833,6 @@
}
}
- print "<script type=\"text/javascript\">\n";
- print "<!--\n";
- print "myNode = findObj(\"$nodeid\")\n";
- print "myNode.forceOpeningOfAncestorFolders();\n";
- print "highlightObjLink(myNode)\n";
- print "//-->\n";
- print "</script>";
-
/* ================= input validation ================= */
input_validate_input_number(get_request_var_post("graphs"));
input_validate_input_number(get_request_var_post("page"));

View File

@@ -0,0 +1,19 @@
------------------------------------------------------------------------
r7443 | rony | 2014-03-30 18:43:28 -0500 (Sun, 30 Mar 2014) | 2 lines
bug#0002431: CVE-2014-2326 Unspecified HTML Injection Vulnerability
------------------------------------------------------------------------
Index: branches/0.8.8/cdef.php
===================================================================
--- branches/0.8.8/cdef.php (revision 7442)
+++ branches/0.8.8/cdef.php (revision 7443)
@@ -431,7 +431,7 @@
<a class="linkEditMain" href="<?php print htmlspecialchars("cdef.php?action=item_edit&id=" . $cdef_item["id"] . "&cdef_id=" . $cdef["id"]);?>">Item #<?php print htmlspecialchars($i);?></a>
</td>
<td>
- <em><?php $cdef_item_type = $cdef_item["type"]; print $cdef_item_types[$cdef_item_type];?></em>: <strong><?php print get_cdef_item_name($cdef_item["id"]);?></strong>
+ <em><?php $cdef_item_type = $cdef_item["type"]; print $cdef_item_types[$cdef_item_type];?></em>: <strong><?php print htmlspecialchars(get_cdef_item_name($cdef_item["id"]));?></strong>
</td>
<td>
<a href="<?php print htmlspecialchars("cdef.php?action=item_movedown&id=" . $cdef_item["id"] . "&cdef_id=" . $cdef["id"]);?>"><img src="images/move_down.gif" border="0" alt="Move Down"></a>

View File

@@ -0,0 +1,28 @@
------------------------------------------------------------------------
r7442 | rony | 2014-03-30 18:41:56 -0500 (Sun, 30 Mar 2014) | 2 lines
bug#0002433: CVE-2014-2328 Unspecified Remote Command Execution Vulnerability
------------------------------------------------------------------------
Index: branches/0.8.8/lib/graph_export.php
===================================================================
--- branches/0.8.8/lib/graph_export.php (revision 7441)
+++ branches/0.8.8/lib/graph_export.php (revision 7442)
@@ -339,7 +339,7 @@
chdir($stExportDir);
/* set the initial command structure */
- $stExecute = 'ncftpput -R -V -r 1 -u '.$aFtpExport['username'].' -p '.$aFtpExport['password'];
+ $stExecute = 'ncftpput -R -V -r 1 -u ' . cacti_escapeshellarg($aFtpExport['username']) . ' -p ' . cacti_escapeshellarg($aFtpExport['password']);
/* if the user requested passive mode, use it */
if ($aFtpExport['passive']) {
@@ -347,7 +347,7 @@
}
/* setup the port, server, remote directory and all files */
- $stExecute .= ' -P ' . $aFtpExport['port'] . ' ' . $aFtpExport['server'] . ' ' . $aFtpExport['remotedir'] . ".";
+ $stExecute .= ' -P ' . cacti_escapeshellarg($aFtpExport['port']) . ' ' . cacti_escapeshellarg($aFtpExport['server']) . ' ' . cacti_escapeshellarg($aFtpExport['remotedir']) . ".";
/* run the command */
$iExecuteReturns = 0;

View File

@@ -0,0 +1,42 @@
------------------------------------------------------------------------
r7418 | gandalf | 2013-08-13 13:32:49 -0600 (Tue, 13 Aug 2013) | 1 line
fix COMMENT handling, even in case COMMENT is empty, with or without HR and with variable substitution
------------------------------------------------------------------------
Index: branches/0.8.8/lib/rrd.php
===================================================================
--- branches/0.8.8/lib/rrd.php (revision 7417)
+++ branches/0.8.8/lib/rrd.php (revision 7418)
@@ -1343,20 +1343,20 @@
$need_rrd_nl = TRUE;
if ($graph_item_types{$graph_item["graph_type_id"]} == "COMMENT") {
+ # perform variable substitution first (in case this will yield an empty results or brings command injection problems)
+ $comment_arg = rrd_substitute_host_query_data($graph_variables["text_format"][$graph_item_id], $graph, $graph_item);
+ # next, compute the argument of the COMMENT statement and perform injection counter measures
+ if (trim($comment_arg) == '') { # an empty COMMENT must be treated with care
+ $comment_arg = cacti_escapeshellarg(' ' . $hardreturn[$graph_item_id]);
+ } else {
+ $comment_arg = cacti_escapeshellarg($comment_arg . $hardreturn[$graph_item_id]);
+ }
+
+ # create rrdtool specific command line
if (read_config_option("rrdtool_version") != "rrd-1.0.x") {
- $comment_string = $graph_item_types{$graph_item["graph_type_id"]} . ":" . str_replace(":", "\:", cacti_escapeshellarg($graph_variables["text_format"][$graph_item_id] . $hardreturn[$graph_item_id])) . " ";
- if (trim($comment_string) == 'COMMENT:"\n"') {
- $txt_graph_items .= 'COMMENT:" \n"'; # rrdtool will skip a COMMENT that holds a NL only; so add a blank to make NL work
- } else if (trim($comment_string) != "COMMENT:\"\"") {
- $txt_graph_items .= rrd_substitute_host_query_data($comment_string, $graph, $graph_item);
- }
+ $txt_graph_items .= $graph_item_types{$graph_item["graph_type_id"]} . ":" . str_replace(":", "\:", $comment_arg) . " ";
}else {
- $comment_string = $graph_item_types{$graph_item["graph_type_id"]} . ":" . cacti_escapeshellarg($graph_variables["text_format"][$graph_item_id] . $hardreturn[$graph_item_id]) . " ";
- if (trim($comment_string) == 'COMMENT:"\n"') {
- $txt_graph_items .= 'COMMENT:" \n"'; # rrdtool will skip a COMMENT that holds a NL only; so add a blank to make NL work
- } else if (trim($comment_string) != "COMMENT:\"\"") {
- $txt_graph_items .= rrd_substitute_host_query_data($comment_string, $graph, $graph_item);
- }
+ $txt_graph_items .= $graph_item_types{$graph_item["graph_type_id"]} . ":" . $comment_arg . " ";
}
}elseif (($graph_item_types{$graph_item["graph_type_id"]} == "GPRINT") && (!isset($graph_data_array["graph_nolegend"]))) {
$graph_variables["text_format"][$graph_item_id] = str_replace(":", "\:", $graph_variables["text_format"][$graph_item_id]); /* escape colons */

View File

@@ -0,0 +1,155 @@
------------------------------------------------------------------------
r7420 | cigamit | 2013-08-17 21:41:24 -0600 (Sat, 17 Aug 2013) | 1 line
Bug #0002383 : Sanitize the step and id variables
------------------------------------------------------------------------
Index: branches/0.8.8/host.php
===================================================================
--- branches/0.8.8/host.php (revision 7419)
+++ branches/0.8.8/host.php (revision 7420)
@@ -149,6 +149,9 @@
if ($_POST["snmp_version"] == 3 && ($_POST["snmp_password"] != $_POST["snmp_password_confirm"])) {
raise_message(4);
}else{
+ input_validate_input_number(get_request_var_post("id"));
+ input_validate_input_number(get_request_var_post("host_template_id"));
+
$host_id = api_device_save($_POST["id"], $_POST["host_template_id"], $_POST["description"],
trim($_POST["hostname"]), $_POST["snmp_community"], $_POST["snmp_version"],
$_POST["snmp_username"], $_POST["snmp_password"],
Index: branches/0.8.8/lib/api_device.php
===================================================================
--- branches/0.8.8/lib/api_device.php (revision 7419)
+++ branches/0.8.8/lib/api_device.php (revision 7420)
@@ -107,7 +107,7 @@
$_host_template_id = db_fetch_cell("select host_template_id from host where id=$id");
}
- $save["id"] = $id;
+ $save["id"] = form_input_validate($id, "id", "^[0-9]+$", false, 3);
$save["host_template_id"] = form_input_validate($host_template_id, "host_template_id", "^[0-9]+$", false, 3);
$save["description"] = form_input_validate($description, "description", "", false, 3);
$save["hostname"] = form_input_validate(trim($hostname), "hostname", "", false, 3);
Index: branches/0.8.8/install/index.php
===================================================================
--- branches/0.8.8/install/index.php (revision 7419)
+++ branches/0.8.8/install/index.php (revision 7420)
@@ -310,27 +310,28 @@
}
/* pre-processing that needs to be done for each step */
-if (empty($_REQUEST["step"])) {
- $_REQUEST["step"] = 1;
-}else{
- if ($_REQUEST["step"] == "1") {
- $_REQUEST["step"] = "2";
- }elseif (($_REQUEST["step"] == "2") && ($_REQUEST["install_type"] == "1")) {
- $_REQUEST["step"] = "3";
- }elseif (($_REQUEST["step"] == "2") && ($_REQUEST["install_type"] == "3")) {
- $_REQUEST["step"] = "8";
- }elseif (($_REQUEST["step"] == "8") && ($old_version_index <= array_search("0.8.5a", $cacti_versions))) {
- $_REQUEST["step"] = "9";
- }elseif ($_REQUEST["step"] == "8") {
- $_REQUEST["step"] = "3";
- }elseif ($_REQUEST["step"] == "9") {
- $_REQUEST["step"] = "3";
- }elseif ($_REQUEST["step"] == "3") {
- $_REQUEST["step"] = "4";
+if (isset($_REQUEST["step"]) && $_REQUEST["step"] > 0) {
+ $step = intval($_REQUEST["step"]);
+ if ($step == "1") {
+ $step = "2";
+ } elseif (($step == "2") && ($_REQUEST["install_type"] == "1")) {
+ $step = "3";
+ } elseif (($step == "2") && ($_REQUEST["install_type"] == "3")) {
+ $step = "8";
+ } elseif (($step == "8") && ($old_version_index <= array_search("0.8.5a", $cacti_versions))) {
+ $step = "9";
+ } elseif ($step == "8") {
+ $step = "3";
+ } elseif ($step == "9") {
+ $step = "3";
+ } elseif ($step == "3") {
+ $step = "4";
}
+} else {
+ $step = 1;
}
-if ($_REQUEST["step"] == "4") {
+if ($step == "4") {
include_once("../lib/data_query.php");
include_once("../lib/utility.php");
@@ -366,7 +367,7 @@
header ("Location: ../index.php");
exit;
-}elseif (($_REQUEST["step"] == "8") && ($_REQUEST["install_type"] == "3")) {
+}elseif (($step == "8") && ($_REQUEST["install_type"] == "3")) {
/* if the version is not found, die */
if (!is_int($old_version_index)) {
print " <p style='font-family: Verdana, Arial; font-size: 16px; font-weight: bold; color: red;'>Error</p>
@@ -505,7 +506,7 @@
</tr>
<tr>
<td width="100%" style="font-size: 12px;">
- <?php if ($_REQUEST["step"] == "1") { ?>
+ <?php if ($step == "1") { ?>
<p>Thanks for taking the time to download and install cacti, the complete graphing
solution for your network. Before you can start making cool graphs, there are a few
@@ -530,7 +531,7 @@
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.</p>
- <?php }elseif ($_REQUEST["step"] == "2") { ?>
+ <?php }elseif ($step == "2") { ?>
<p>Please select the type of installation</p>
@@ -551,7 +552,7 @@
print "Server Operating System Type: " . $config["cacti_server_os"] . "<br>"; ?>
</p>
- <?php }elseif ($_REQUEST["step"] == "3") { ?>
+ <?php }elseif ($step == "3") { ?>
<p>Make sure all of these values are correct before continuing.</p>
<?php
@@ -609,7 +610,7 @@
is an upgrade. You can change any of the settings on this screen at a later
time by going to "Cacti Settings" from within Cacti.</p>
- <?php }elseif ($_REQUEST["step"] == "8") { ?>
+ <?php }elseif ($step == "8") { ?>
<p>Upgrade results:</p>
@@ -659,7 +660,7 @@
print $upgrade_results;
?>
- <?php }elseif ($_REQUEST["step"] == "9") { ?>
+ <?php }elseif ($step == "9") { ?>
<p style='font-size: 16px; font-weight: bold; color: red;'>Important Upgrade Notice</p>
@@ -673,7 +674,7 @@
<?php }?>
- <p align="right"><input type="image" src="install_<?php if ($_REQUEST["step"] == "3") {?>finish<?php }else{?>next<?php }?>.gif" alt="<?php if ($_REQUEST["step"] == "3"){?>Finish<?php }else{?>Next<?php }?>"></p>
+ <p align="right"><input type="image" src="install_<?php if ($step == "3") {?>finish<?php }else{?>next<?php }?>.gif" alt="<?php if ($step == "3"){?>Finish<?php }else{?>Next<?php }?>"></p>
</td>
</tr>
</table>
@@ -681,7 +682,7 @@
</tr>
</table>
-<input type="hidden" name="step" value="<?php print $_REQUEST["step"];?>">
+<input type="hidden" name="step" value="<?php print $step;?>">
</form>

View File

@@ -0,0 +1,117 @@
------------------------------------------------------------------------
r7439 | rony | 2014-03-30 17:52:10 -0500 (Sun, 30 Mar 2014) | 5 lines
bug#0002405: SQL injection in graph_xport.php
- Fixed form input validation problems
- Fixed rrd export and graph shell escape issues
------------------------------------------------------------------------
Index: branches/0.8.8/graph_xport.php
===================================================================
--- branches/0.8.8/graph_xport.php (revision 7438)
+++ branches/0.8.8/graph_xport.php (revision 7439)
@@ -47,43 +47,48 @@
$graph_data_array = array();
+/* ================= input validation ================= */
+input_validate_input_number(get_request_var("local_graph_id"));
+input_validate_input_number(get_request_var("rra_id"));
+/* ==================================================== */
+
/* override: graph start time (unix time) */
-if (!empty($_GET["graph_start"]) && $_GET["graph_start"] < 1600000000) {
- $graph_data_array["graph_start"] = $_GET["graph_start"];
+if (!empty($_GET["graph_start"]) && is_numeric($_GET["graph_start"] && $_GET["graph_start"] < 1600000000)) {
+ $graph_data_array["graph_start"] = get_request_var("graph_start");
}
/* override: graph end time (unix time) */
-if (!empty($_GET["graph_end"]) && $_GET["graph_end"] < 1600000000) {
- $graph_data_array["graph_end"] = $_GET["graph_end"];
+if (!empty($_GET["graph_end"]) && is_numeric($_GET["graph_end"]) && $_GET["graph_end"] < 1600000000) {
+ $graph_data_array["graph_end"] = get_request_var("graph_end");
}
/* override: graph height (in pixels) */
-if (!empty($_GET["graph_height"]) && $_GET["graph_height"] < 3000) {
- $graph_data_array["graph_height"] = $_GET["graph_height"];
+if (!empty($_GET["graph_height"]) && is_numeric($_GET["graph_height"]) && $_GET["graph_height"] < 3000) {
+ $graph_data_array["graph_height"] = get_request_var("graph_height");
}
/* override: graph width (in pixels) */
-if (!empty($_GET["graph_width"]) && $_GET["graph_width"] < 3000) {
- $graph_data_array["graph_width"] = $_GET["graph_width"];
+if (!empty($_GET["graph_width"]) && is_numeric($_GET["graph_width"]) && $_GET["graph_width"] < 3000) {
+ $graph_data_array["graph_width"] = get_request_var("graph_width");
}
/* override: skip drawing the legend? */
if (!empty($_GET["graph_nolegend"])) {
- $graph_data_array["graph_nolegend"] = $_GET["graph_nolegend"];
+ $graph_data_array["graph_nolegend"] = get_request_var("graph_nolegend");
}
/* print RRDTool graph source? */
if (!empty($_GET["show_source"])) {
- $graph_data_array["print_source"] = $_GET["show_source"];
+ $graph_data_array["print_source"] = get_request_var("show_source");
}
-$graph_info = db_fetch_row("SELECT * FROM graph_templates_graph WHERE local_graph_id='" . $_REQUEST["local_graph_id"] . "'");
+$graph_info = db_fetch_row("SELECT * FROM graph_templates_graph WHERE local_graph_id='" . get_request_var("local_graph_id") . "'");
/* for bandwidth, NThPercentile */
$xport_meta = array();
/* Get graph export */
-$xport_array = @rrdtool_function_xport($_GET["local_graph_id"], $_GET["rra_id"], $graph_data_array, $xport_meta);
+$xport_array = @rrdtool_function_xport($_GET["local_graph_id"], get_request_var("rra_id"), $graph_data_array, $xport_meta);
/* Make graph title the suggested file name */
if (is_array($xport_array["meta"])) {
Index: branches/0.8.8/lib/rrd.php
===================================================================
--- branches/0.8.8/lib/rrd.php (revision 7438)
+++ branches/0.8.8/lib/rrd.php (revision 7439)
@@ -865,13 +865,13 @@
/* basic graph options */
$graph_opts .=
"--imgformat=" . $image_types{$graph["image_format_id"]} . RRD_NL .
- "--start=$graph_start" . RRD_NL .
- "--end=$graph_end" . RRD_NL .
+ "--start=" . cacti_escapeshellarg($graph_start) . RRD_NL .
+ "--end=" . cacti_escapeshellarg($graph_end) . RRD_NL .
"--title=" . cacti_escapeshellarg($graph["title_cache"]) . RRD_NL .
"$rigid" .
- "--base=" . $graph["base_value"] . RRD_NL .
- "--height=$graph_height" . RRD_NL .
- "--width=$graph_width" . RRD_NL .
+ "--base=" . cacti_escapeshellarg($graph["base_value"]) . RRD_NL .
+ "--height=" . cacti_escapeshellarg($graph_height) . RRD_NL .
+ "--width=" . cacti_escapeshellarg($graph_width) . RRD_NL .
"$scale" .
"$unit_value" .
"$unit_exponent_value" .
@@ -1606,8 +1606,8 @@
/* basic export options */
$xport_opts =
- "--start=$xport_start" . RRD_NL .
- "--end=$xport_end" . RRD_NL .
+ "--start=" . cacti_escapeshellarg($xport_start) . RRD_NL .
+ "--end=" . cacti_escapeshellarg($xport_end) . RRD_NL .
"--maxrows=10000" . RRD_NL;
$xport_defs = "";
@@ -1997,7 +1997,7 @@
$stacked_columns["col" . $j] = ($graph_item_types{$xport_item["graph_type_id"]} == "STACK") ? 1 : 0;
$j++;
- $txt_xport_items .= "XPORT:" . $data_source_name . ":" . str_replace(":", "", cacti_escapeshellarg($legend_name)) ;
+ $txt_xport_items .= "XPORT:" . cacti_escapeshellarg($data_source_name) . ":" . str_replace(":", "", cacti_escapeshellarg($legend_name)) ;
}else{
$need_rrd_nl = FALSE;
}

View File

@@ -1,22 +0,0 @@
Index: services/scheduler.cpp
===================================================================
--- services/scheduler.cpp (revision 1310078)
+++ services/scheduler.cpp (working copy)
@@ -52,7 +52,7 @@
#include "config.h"
#include "bench.h"
-#define DEBUG_SCHEDULER 0
+#define DEBUG_SCHEDULER 1
/* TODO:
* leak check
@@ -613,6 +613,8 @@
platform_map.insert( make_pair( string( "ppc" ), string( "ppc64" ) ) );
platform_map.insert( make_pair( string( "s390" ), string( "s390x" ) ) );
+
+ platform_map.insert( make_pair( string( "armv5tel"), string( "armv7l" ) ) );
}
multimap<string, string>::const_iterator end = platform_map.upper_bound( target );

View File

@@ -1,107 +0,0 @@
Index: icecc-0.9.6/doc/man-scheduler.1.docbook
===================================================================
--- icecc-0.9.6.orig/doc/man-scheduler.1.docbook
+++ icecc-0.9.6/doc/man-scheduler.1.docbook
@@ -23,13 +23,13 @@
</refmeta>
<refnamediv>
- <refname>scheduler</refname>
+ <refname>icecc-scheduler</refname>
<refpurpose>Icecream scheduler</refpurpose>
</refnamediv>
<refsynopsisdiv>
<cmdsynopsis>
-<command>scheduler</command>
+<command>icecc-scheduler</command>
<group>
<arg choice="opt">
<option>-n</option>
@@ -151,7 +151,7 @@ need to run the scheduler with root righ
<refsect1>
<title>See Also</title>
-<para>icecream, scheduler, iceccd, icemon</para>
+<para>icecream, icecc-scheduler, iceccd, icemon</para>
</refsect1>
<refsect1>
Index: icecc-0.9.6/services/Makefile.am
===================================================================
--- icecc-0.9.6.orig/services/Makefile.am
+++ icecc-0.9.6/services/Makefile.am
@@ -11,9 +11,9 @@ ice_HEADERS = job.h comm.h
noinst_HEADERS = bench.h exitcode.h getifaddrs.h logging.h tempfile.h platform.h
icedir = $(includedir)/icecc
-sbin_PROGRAMS = scheduler
-scheduler_SOURCES = scheduler.cpp
-scheduler_LDADD = libicecc.la
+sbin_PROGRAMS = icecc-scheduler
+icecc_scheduler_SOURCES = scheduler.cpp
+icecc_scheduler_LDADD = libicecc.la
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = icecc.pc
Index: icecc-0.9.6/services/Makefile.in
===================================================================
--- icecc-0.9.6.orig/services/Makefile.in
+++ icecc-0.9.6/services/Makefile.in
@@ -37,7 +37,7 @@ PRE_UNINSTALL = :
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
-sbin_PROGRAMS = scheduler$(EXEEXT)
+sbin_PROGRAMS = icecc-scheduler$(EXEEXT)
subdir = services
DIST_COMMON = $(ice_HEADERS) $(noinst_HEADERS) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in $(srcdir)/icecc.pc.in
@@ -82,9 +82,9 @@ libicecc_la_LINK = $(LIBTOOL) --tag=CXX
$(LIBTOOLFLAGS) --mode=link $(CXXLD) $(libicecc_la_CXXFLAGS) \
$(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
PROGRAMS = $(sbin_PROGRAMS)
-am_scheduler_OBJECTS = scheduler.$(OBJEXT)
-scheduler_OBJECTS = $(am_scheduler_OBJECTS)
-scheduler_DEPENDENCIES = libicecc.la
+am_icecc_scheduler_OBJECTS = scheduler.$(OBJEXT)
+icecc_scheduler_OBJECTS = $(am_icecc_scheduler_OBJECTS)
+icecc_scheduler_DEPENDENCIES = libicecc.la
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
@@ -107,8 +107,8 @@ CXXLD = $(CXX)
CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \
$(LDFLAGS) -o $@
-SOURCES = $(libicecc_la_SOURCES) $(scheduler_SOURCES)
-DIST_SOURCES = $(libicecc_la_SOURCES) $(scheduler_SOURCES)
+SOURCES = $(libicecc_la_SOURCES) $(icecc_scheduler_SOURCES)
+DIST_SOURCES = $(libicecc_la_SOURCES) $(icecc_scheduler_SOURCES)
DATA = $(pkgconfig_DATA)
HEADERS = $(ice_HEADERS) $(noinst_HEADERS)
ETAGS = etags
@@ -242,8 +242,8 @@ libicecc_la_CXXFLAGS = -fPIC -DPIC
ice_HEADERS = job.h comm.h
noinst_HEADERS = bench.h exitcode.h getifaddrs.h logging.h tempfile.h platform.h
icedir = $(includedir)/icecc
-scheduler_SOURCES = scheduler.cpp
-scheduler_LDADD = libicecc.la
+icecc_scheduler_SOURCES = scheduler.cpp
+icecc_scheduler_LDADD = libicecc.la
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = icecc.pc
all: all-am
@@ -358,9 +358,9 @@ clean-sbinPROGRAMS:
list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
echo " rm -f" $$list; \
rm -f $$list
-scheduler$(EXEEXT): $(scheduler_OBJECTS) $(scheduler_DEPENDENCIES)
- @rm -f scheduler$(EXEEXT)
- $(CXXLINK) $(scheduler_OBJECTS) $(scheduler_LDADD) $(LIBS)
+icecc-scheduler$(EXEEXT): $(icecc_scheduler_OBJECTS) $(icecc_scheduler_DEPENDENCIES)
+ @rm -f icecc-scheduler$(EXEEXT)
+ $(CXXLINK) $(icecc_scheduler_OBJECTS) $(icecc_scheduler_LDADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)

View File

@@ -1,166 +0,0 @@
Submitted By: Randy McMurchy <randy_at_linuxfromscratch_dot_org>
Date: 2005-03-23
Initial Package Version: 1.4.2
Upstream Status: Not sure
Origin: Internet (URL's are now lost)
Description: Fix the rexecd daemon so that it understands shadow
passwords. Fix the rshd daemon so that it properly
resolves hostnames.
diff -Naur inetutils-1.4.2-orig/rexecd/rexecd.c inetutils-1.4.2/rexecd/rexecd.c
--- inetutils-1.4.2-orig/rexecd/rexecd.c 2002-12-11 12:38:00.000000000 +0000
+++ inetutils-1.4.2/rexecd/rexecd.c 2005-02-22 19:53:44.146962264 +0000
@@ -79,6 +79,10 @@
#include <varargs.h>
#endif
+#ifdef HAVE_SHADOW_H
+#include <shadow.h>
+#endif
+
void error __P ((const char *fmt, ...));
/*
* remote execute server:
@@ -127,6 +131,10 @@
char *cmdbuf, *cp, *namep;
char *user, *pass;
struct passwd *pwd;
+#ifdef HAVE_SHADOW_H
+ struct spwd *spwd;
+ char *pw_field;
+#endif
int s;
u_short port;
int pv[2], pid, cc;
@@ -186,6 +194,24 @@
exit(1);
}
endpwent();
+
+#ifdef HAVE_SHADOW_H
+ // Get encrypted password from /etc/shadow if possible,
+ // else from /etc/passwd.
+ spwd = getspnam(user);
+ if (spwd) {
+ pw_field = spwd->sp_pwdp;
+ } else {
+ pw_field = pwd->pw_passwd;
+ }
+ if (*pw_field != '\0') {
+ namep = CRYPT (pass, pw_field);
+ if (strcmp(namep, pw_field)) {
+ error("Password incorrect.\n");
+ exit(1);
+ }
+ }
+#else
if (*pwd->pw_passwd != '\0') {
namep = CRYPT (pass, pwd->pw_passwd);
if (strcmp(namep, pwd->pw_passwd)) {
@@ -193,6 +219,7 @@
exit(1);
}
}
+#endif
write(STDERR_FILENO, "\0", 1);
if (port) {
pipe(pv);
diff -Naur inetutils-1.4.2-orig/rshd/rshd.c inetutils-1.4.2/rshd/rshd.c
--- inetutils-1.4.2-orig/rshd/rshd.c 2002-12-11 12:38:00.000000000 +0000
+++ inetutils-1.4.2/rshd/rshd.c 2005-02-22 19:54:33.162510768 +0000
@@ -443,7 +443,7 @@
dup2 (sockfd, STDERR_FILENO);
}
- /* Get the "name" of the clent form its Internet address.
+ /* Get the "name" of the client form its Internet address.
* This is used for the autentication below
*/
errorstr = NULL;
@@ -457,52 +457,49 @@
* in a remote net; look up the name and check that this
* address corresponds to the name.
*/
- hostname = strdup (hp->h_name);
+ const char *remotehost = strdup(hp->h_name);
#ifdef KERBEROS
if (!use_kerberos)
#endif
- if (check_all || local_domain (hp->h_name))
+ if (! remotehost)
+ errorstr = "Out of memory\n";
+ else if (check_all || local_domain (remotehost))
{
- char *remotehost = (char *) alloca (strlen (hp->h_name) + 1);
- if (! remotehost)
- errorstr = "Out of memory\n";
- else
+ errorhost = remotehost;
+ hp = gethostbyname (remotehost);
+ if (hp == NULL)
{
- strcpy (remotehost, hp->h_name);
- errorhost = remotehost;
- hp = gethostbyname (remotehost);
- if (hp == NULL)
+ syslog (LOG_INFO,
+ "Couldn't look up address for %s", remotehost);
+ errorstr = "Couldn't look up address for your host (%s)\n";
+ hostname = strdup(inet_ntoa(fromp->sin_addr));
+ }
+ else
+ {
+ for (; ; hp->h_addr_list++)
{
- syslog (LOG_INFO,
- "Couldn't look up address for %s", remotehost);
- errorstr = "Couldn't look up address for your host (%s)\n";
- hostname = inet_ntoa (fromp->sin_addr);
+ if (hp->h_addr_list[0] == NULL)
+ {
+ syslog (LOG_NOTICE,
+ "Host addr %s not listed for host %s",
+ inet_ntoa (fromp->sin_addr), hp->h_name);
+ errorstr = "Host address mismatch for %s\n";
+ hostname = strdup(inet_ntoa(fromp->sin_addr));
+ break;
+ }
+ if (!memcmp (hp->h_addr_list[0],
+ (caddr_t)&fromp->sin_addr,
+ sizeof fromp->sin_addr))
+ {
+ hostname = strdup(hp->h_name);
+ break; /* equal, OK */
+ }
}
- else
- for (; ; hp->h_addr_list++)
- {
- if (hp->h_addr_list[0] == NULL)
- {
- syslog (LOG_NOTICE,
- "Host addr %s not listed for host %s",
- inet_ntoa (fromp->sin_addr), hp->h_name);
- errorstr = "Host address mismatch for %s\n";
- hostname = inet_ntoa (fromp->sin_addr);
- break;
- }
- if (!memcmp (hp->h_addr_list[0],
- (caddr_t)&fromp->sin_addr,
- sizeof fromp->sin_addr))
- {
- hostname = hp->h_name;
- break; /* equal, OK */
- }
- }
- }
+ }
}
}
else
- errorhost = hostname = inet_ntoa (fromp->sin_addr);
+ errorhost = hostname = strdup(inet_ntoa(fromp->sin_addr));
#ifdef KERBEROS
if (use_kerberos)

View File

@@ -1,37 +0,0 @@
Submitted By: Matthew Burgess <matthew@linuxfromscratch.org>
Date: 2005-08-30
Initial Package Version: 1.4.2
Upstream Status: From upstream
Origin: Greg Schafer <gschafer@zip.com.au> (http://www.diy-linux.org/downloads/patches/GCC4/inetutils-1.4.2-gcc4-fixes-1.patch)
Description: Fix compilation issues with gcc4
diff -Naur inetutils-1.4.2.orig/ftp/ftp_var.h inetutils-1.4.2/ftp/ftp_var.h
--- inetutils-1.4.2.orig/ftp/ftp_var.h 2000-07-08 01:00:53.000000000 +0000
+++ inetutils-1.4.2/ftp/ftp_var.h 2005-08-30 20:25:27.205932304 +0000
@@ -36,8 +36,6 @@
#include <sys/param.h>
#include <setjmp.h>
-#include "extern.h"
-
#ifndef FTP_EXTERN
#define FTP_EXTERN extern
#endif
@@ -129,3 +127,5 @@
FTP_EXTERN int macnum; /* number of defined macros */
FTP_EXTERN struct macel macros[16];
FTP_EXTERN char macbuf[4096];
+
+#include "extern.h"
diff -Naur inetutils-1.4.2.orig/libinetutils/ttymsg.c inetutils-1.4.2/libinetutils/ttymsg.c
--- inetutils-1.4.2.orig/libinetutils/ttymsg.c 2001-11-01 15:52:19.000000000 +0000
+++ inetutils-1.4.2/libinetutils/ttymsg.c 2005-08-30 20:24:27.168059448 +0000
@@ -132,7 +132,7 @@
}
if (wret)
{
- (char *)iov->iov_base += wret;
+ iov->iov_base = (char *)iov->iov_base + wret;
iov->iov_len -= wret;
}
continue;

View File

@@ -0,0 +1,75 @@
http://bugs.squid-cache.org/show_bug.cgi?id=3978
--- squidGuard-1.4.orig/src/main.c 2013-12-11 17:42:15.000000000 +1300
+++ squidGuard-1.4.orig/src/main.c 2013-12-11 19:04:09.000000000 +1300
@@ -175,7 +175,7 @@
sgReloadConfig();
}
if(failsafe_mode) {
- puts("");
+ puts("ERR message=\"squidGuard failsafe mode\"");
fflush(stdout);
if(sig_hup){
sgReloadConfig();
@@ -184,7 +184,7 @@
}
if(parseLine(buf,&squidInfo) != 1){
sgLogError("Error parsing squid line: %s",buf);
- puts("");
+ puts("BH message=\"squidGuard error parsing squid line\"");
}
else {
src = Source;
@@ -196,14 +196,14 @@
acl = sgAclCheckSource(src);
if((redirect = sgAclAccess(src,acl,&squidInfo)) == NULL){
if(src == NULL || src->cont_search == 0){
- puts("");
+ puts("ERR");
break;
} else
if(src->next != NULL){
src = src->next;
continue;
} else {
- puts("");
+ puts("ERR");
break;
}
} else {
@@ -215,9 +215,10 @@
squidInfo.ident[0] = '-';
squidInfo.ident[1] = '\0';
}
- fprintf(stdout,"%s %s/%s %s %s\n",redirect,squidInfo.src,
- squidInfo.srcDomain,squidInfo.ident,
- squidInfo.method);
+ if (isdigit(redirect[0]) && isdigit(redirect[1]) && isdigit(redirect[2]) && redirect[3]==':') {
+ fprintf(stdout,"OK status=%c%c%c url=\"%s\"\n", redirect[0], redirect[1], redirect[2], &redirect[4]);
+ } else
+ fprintf(stdout,"OK rewrite-url=\"%s\"\n",redirect);
/* sgLogError("%s %s/%s %s %s\n",redirect,squidInfo.src,squidInfo.srcDomain,squidInfo.ident,squidInfo.method); */
break;
}
--- squidGuard-1.4.orig/src/sgDiv.c 2013-12-11 17:42:15.000000000 +1300
+++ squidGuard-1.4.orig/src/sgDiv.c 2013-12-11 18:58:33.000000000 +1300
@@ -771,7 +771,7 @@
}
sgLogError("Going into emergency mode");
while(fgets(buf, MAX_BUF, stdin) != NULL){
- puts("");
+ puts("ERR");
fflush(stdout);
}
sgLogError("ending emergency mode, stdin empty");
--- squidGuard-1.4.orig/src/sgDiv.c.in 2013-12-11 17:42:15.000000000 +1300
+++ squidGuard-1.4.orig/src/sgDiv.c.in 2013-12-11 18:58:40.000000000 +1300
@@ -782,7 +782,7 @@
}
sgLogError("Going into emergency mode");
while(fgets(buf, MAX_BUF, stdin) != NULL){
- puts("");
+ puts("ERR");
fflush(stdout);
}
sgLogError("ending emergency mode, stdin empty");

View File

@@ -60,6 +60,67 @@ WARN="\\033[1;35m"
FAIL="\\033[1;31m"
NORMAL="\\033[0;39m"
configure_target() {
local target_arch="${1}"
if [ "${target_arch}" = "default" ]; then
target_arch="$(configure_target_guess)"
fi
case "${target_arch}" in
i586)
BUILDTARGET="${target_arch}-pc-linux-gnu"
CROSSTARGET="${BUILD_ARCH}-cross-linux-gnu"
CFLAGS_ARCH="-march=i586 -fomit-frame-pointer"
;;
armv5tel)
BUILDTARGET="${target_arch}-unknown-linux-gnueabi"
CROSSTARGET="${BUILD_ARCH}-cross-linux-gnueabi"
CFLAGS_ARCH="-march=armv5te -mfloat-abi=soft -fomit-frame-pointer"
MACHINE_TYPE="arm"
;;
*)
exiterror "Cannot build for architure ${target_arch}"
;;
esac
# Check if the QEMU helper is available if needed.
if qemu_is_required "${target_arch}"; then
local qemu_target_helper="$(qemu_find_target_helper_name "${target_arch}")"
if [ -n "${qemu_target_helper}" ]; then
QEMU_TARGET_HELPER="${qemu_target_helper}"
else
exiterror "Could not find a binfmt_misc helper entry for ${target_arch}"
fi
fi
TARGET_ARCH="${target_arch}"
# Old variable names
MACHINE="${TARGET_ARCH}"
CFLAGS="-O2 -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fPIC"
CFLAGS="${CFLAGS} -fstack-protector-all --param=ssp-buffer-size=4 ${CFLAGS_ARCH}"
CXXFLAGS="${CFLAGS}"
}
configure_target_guess() {
case "${BUILD_ARCH}" in
x86_64|i686|i586)
echo "i586"
;;
armv7*|armv6*|armv5*)
echo "armv5tel"
;;
*)
exiterror "Cannot guess target architecture"
;;
esac
}
evaluate() {
if [ "$?" -eq "0" ]; then
beautify message DONE
@@ -217,30 +278,6 @@ get_pkg_ver()
echo "$PKG_VER"
} # End of get_pkg_ver()
if [ 'x86_64' = $MACHINE -o 'i686' = $MACHINE -o 'i586' = $MACHINE ]; then
echo "`date -u '+%b %e %T'`: Machine is iX86 (or equivalent)" >> $LOGFILE
MACHINE=i586
CROSSTARGET=${MACHINE}-cross-linux-gnu
BUILDTARGET=i586-pc-linux-gnu
CFLAGS_ARCH="${GLOBAL_CFLAGS} -march=i586 -fomit-frame-pointer"
elif [ 'armv5tejl' = $MACHINE -o 'armv5tel' = $MACHINE -o 'armv6l' = $MACHINE -o 'armv7l' = $MACHINE ]; then
echo "`date -u '+%b %e %T'`: Machine is ARM (or equivalent)" >> $LOGFILE
MACHINE=armv5tel
MACHINE_TYPE=arm
CROSSTARGET=${MACHINE}-cross-linux-gnueabi
BUILDTARGET=${MACHINE}-unknown-linux-gnueabi
CFLAGS_ARCH="-march=armv5te -mfloat-abi=soft -fomit-frame-pointer"
else
echo "`date -u '+%b %e %T'`: Can't determine your architecture - $MACHINE"
exit 1
fi
CFLAGS="-O2 -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fPIC"
CFLAGS="${CFLAGS} -fstack-protector-all --param=ssp-buffer-size=4 ${CFLAGS_ARCH}"
CXXFLAGS="${CFLAGS}"
C2FLAGS="${CFLAGS}"
CXX2FLAGS="${CXXFLAGS}"
# Define immediately
stdumount() {
umount $BASEDIR/build/sys 2>/dev/null;
@@ -282,22 +319,136 @@ fake_environ() {
env="${env} UTS_RELEASE=${KVER}"
# Fake machine version.
env="${env} UTS_MACHINE=${MACHINE}"
env="${env} UTS_MACHINE=${TARGET_ARCH}"
echo "${env}"
}
qemu_environ() {
local env
# Don't add anything if qemu is not used.
if ! qemu_is_required; then
return
fi
# Set default qemu options
case "${TARGET_ARCH}" in
arm*)
QEMU_CPU="${QEMU_CPU:-cortex-a9}"
env="${env} QEMU_CPU=${QEMU_CPU}"
;;
esac
# Enable QEMU strace
#env="${env} QEMU_STRACE=1"
echo "${env}"
}
qemu_is_required() {
local target_arch="${1}"
if [ -z "${target_arch}" ]; then
target_arch="${TARGET_ARCH}"
fi
case "${BUILD_ARCH},${target_arch}" in
x86_64,arm*|i?86,arm*)
return 0
;;
*)
return 1
;;
esac
}
qemu_install_helper() {
# Do nothing, if qemu is not required
if ! qemu_is_required; then
return 0
fi
if [ -z "${QEMU_TARGET_HELPER}" ]; then
exiterror "QEMU_TARGET_HELPER not set"
fi
# Check if the helper is already installed.
if [ -x "${LFS}${QEMU_TARGET_HELPER}" ]; then
return 0
fi
# Try to find a suitable binary that we can install
# to the build environment.
local file
for file in "${QEMU_TARGET_HELPER}" "${QEMU_TARGET_HELPER}-static"; do
# file must exist and be executable.
[ -x "${file}" ] || continue
# Must be static.
file_is_static "${file}" || continue
local dirname="${LFS}$(dirname "${file}")"
mkdir -p "${dirname}"
install -m 755 "${file}" "${LFS}${QEMU_TARGET_HELPER}"
return 0
done
exiterror "Could not find a statically-linked QEMU emulator: ${QEMU_TARGET_HELPER}"
}
qemu_find_target_helper_name() {
local target_arch="${1}"
local magic
case "${target_arch}" in
arm*)
magic="7f454c4601010100000000000000000002002800"
;;
esac
[ -z "${magic}" ] && return 1
local file
for file in /proc/sys/fs/binfmt_misc/*; do
# Search for the file with the correct magic value.
grep -qE "^magic ${magic}$" "${file}" || continue
local interpreter="$(grep "^interpreter" "${file}" | awk '{ print $2 }')"
[ -n "${interpreter}" ] || continue
[ "${interpreter:0:1}" = "/" ] || continue
[ -x "${interpreter}" ] || continue
echo "${interpreter}"
return 0
done
return 1
}
file_is_static() {
local file="${1}"
file ${file} 2>/dev/null | grep -q "statically linked"
}
entershell() {
if [ ! -e $BASEDIR/build/usr/src/lfs/ ]; then
exiterror "No such file or directory: $BASEDIR/build/usr/src/lfs/"
fi
# Install QEMU helper, if needed
qemu_install_helper
echo "Entering to a shell inside LFS chroot, go out with exit"
chroot $LFS /tools/bin/env -i HOME=/root TERM=$TERM PS1='\u:\w\$ ' \
chroot $LFS /tools/bin/env -i HOME=/root TERM=$TERM PS1='ipfire build chroot ($(uname -m)) \u:\w\$ ' \
PATH=/tools/ccache/bin:/bin:/usr/bin:/sbin:/usr/sbin:/tools/bin \
VERSION=$VERSION CONFIG_ROOT=$CONFIG_ROOT \
NAME="$NAME" SNAME="$SNAME" SLOGAN="$SLOGAN" \
CFLAGS="$CF2LAGS" CXXFLAGS="$CXX2FLAGS" \
CFLAGS="${CFLAGS}" CXXFLAGS="${CXXFLAGS}" \
CCACHE_DIR=/usr/src/ccache \
CCACHE_COMPRESS=1 \
CCACHE_COMPILERCHECK="none" \
@@ -306,9 +457,9 @@ entershell() {
CROSSTARGET="${CROSSTARGET}" \
MACHINE="$MACHINE" \
MACHINE_TYPE="$MACHINE_TYPE" \
KGCC="ccache /usr/bin/gcc" \
$(fake_environ) \
/tools/bin/bash
$(qemu_environ) \
/tools/bin/bash -i
if [ $? -ne 0 ]; then
beautify message FAIL
exiterror "chroot error"
@@ -410,6 +561,9 @@ lfsmake2() {
lfsmakecommoncheck $*
[ $? == 1 ] && return 0
# Install QEMU helper, if needed
qemu_install_helper
local PKG_TIME_START=`date +%s`
chroot $LFS /tools/bin/env -i HOME=/root \
TERM=$TERM PS1='\u:\w\$ ' \
@@ -418,7 +572,7 @@ lfsmake2() {
SYSTEM_RELEASE="${SYSTEM_RELEASE}" \
CONFIG_ROOT=$CONFIG_ROOT \
NAME="$NAME" SNAME="$SNAME" SLOGAN="$SLOGAN" \
CFLAGS="$C2FLAGS" CXXFLAGS="$CXX2FLAGS" \
CFLAGS="${CFLAGS}" CXXFLAGS="${CXXFLAGS}" \
CCACHE_DIR=/usr/src/ccache CCACHE_COMPRESS=1 \
CCACHE_COMPILERCHECK="none" \
KVER=$KVER MAKETUNING=$MAKETUNING \
@@ -426,6 +580,7 @@ lfsmake2() {
CROSSTARGET="${CROSSTARGET}" \
MACHINE="$MACHINE" \
MACHINE_TYPE="$MACHINE_TYPE" \
$(qemu_environ) \
$(fake_environ) \
/tools/bin/bash -x -c "cd /usr/src/lfs && \
make -f $* LFS_BASEDIR=/usr/src install" >>$LOGFILE 2>&1
@@ -446,6 +601,9 @@ ipfiremake() {
lfsmakecommoncheck $*
[ $? == 1 ] && return 0
# Install QEMU helper, if needed
qemu_install_helper
local PKG_TIME_START=`date +%s`
chroot $LFS /tools/bin/env -i HOME=/root \
TERM=$TERM PS1='\u:\w\$ ' \
@@ -455,7 +613,7 @@ ipfiremake() {
CONFIG_ROOT=$CONFIG_ROOT \
NAME="$NAME" SNAME="$SNAME" SLOGAN="$SLOGAN" \
SYSTEM_RELEASE="$SYSTEM_RELEASE" \
CFLAGS="$C2FLAGS" CXXFLAGS="$CXX2FLAGS" \
CFLAGS="${CFLAGS}" CXXFLAGS="${CXXFLAGS}" \
CCACHE_DIR=/usr/src/ccache CCACHE_COMPRESS=1 \
CCACHE_COMPILERCHECK="none" \
KVER=$KVER MAKETUNING=$MAKETUNING \
@@ -463,6 +621,7 @@ ipfiremake() {
CROSSTARGET="${CROSSTARGET}" \
MACHINE="$MACHINE" \
MACHINE_TYPE="$MACHINE_TYPE" \
$(qemu_environ) \
$(fake_environ) \
/bin/bash -x -c "cd /usr/src/lfs && \
make -f $* LFS_BASEDIR=/usr/src install" >>$LOGFILE 2>&1
@@ -483,6 +642,9 @@ ipfiredist() {
lfsmakecommoncheck $*
[ $? == 1 ] && return 0
# Install QEMU helper, if needed
qemu_install_helper
local PKG_TIME_START=`date +%s`
chroot $LFS /tools/bin/env -i HOME=/root \
TERM=$TERM PS1='\u:\w\$ ' \
@@ -490,7 +652,7 @@ ipfiredist() {
VERSION=$VERSION \
CONFIG_ROOT=$CONFIG_ROOT \
NAME="$NAME" SNAME="$SNAME" SLOGAN="$SLOGAN" \
CFLAGS="$C2FLAGS" CXXFLAGS="$CXX2FLAGS" \
CFLAGS="${CFLAGS}" CXXFLAGS="${CXXFLAGS}" \
CCACHE_DIR=/usr/src/ccache CCACHE_COMPRESS=1 \
CCACHE_COMPILERCHECK="none" \
KVER=$KVER \
@@ -498,6 +660,7 @@ ipfiredist() {
CROSSTARGET="${CROSSTARGET}" \
MACHINE="$MACHINE" \
MACHINE_TYPE="$MACHINE_TYPE" \
$(qemu_environ) \
$(fake_environ) \
/bin/bash -x -c "cd /usr/src/lfs && \
make -f $1 LFS_BASEDIR=/usr/src dist" >>$LOGFILE 2>&1
@@ -518,6 +681,9 @@ installmake() {
lfsmakecommoncheck $*
[ $? == 1 ] && return 0
# Install QEMU helper, if needed
qemu_install_helper
local PKG_TIME_START=`date +%s`
chroot $LFS /tools/bin/env -i HOME=/root \
TERM=$TERM PS1='\u:\w\$ ' \
@@ -526,7 +692,7 @@ installmake() {
SYSTEM_RELEASE="${SYSTEM_RELEASE}" \
CONFIG_ROOT=$CONFIG_ROOT \
NAME="$NAME" SNAME="$SNAME" SLOGAN="$SLOGAN" \
CFLAGS="-Os" CXXFLAGS="-Os" \
CFLAGS="${CFLAGS}" CXXFLAGS="${CXXFLAGS}" \
CCACHE_DIR=/usr/src/ccache CCACHE_COMPRESS=1 CCACHE_HASHDIR=1 \
KVER=$KVER \
BUILDTARGET="$BUILDTARGET" \