Initial commit
This commit is contained in:
1
customcd/files/etc/conf.d/hostname
Normal file
1
customcd/files/etc/conf.d/hostname
Normal file
@@ -0,0 +1 @@
|
||||
HOSTNAME=rescuebru
|
||||
54
customcd/files/etc/conf.d/pxebootsrv
Normal file
54
customcd/files/etc/conf.d/pxebootsrv
Normal file
@@ -0,0 +1,54 @@
|
||||
# Copyright 2003-2007 Francois Dupoux - www.sysresccd.org
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
# Config file for /etc/init.d/pxebootsrv
|
||||
# Have a look at the PXE chapter in the official manual for more details:
|
||||
# http://www.sysresccd.org/Sysresccd-manual-en_PXE_network_booting
|
||||
|
||||
# ------------------------- README ------------------------------------
|
||||
# The pxebootsrv service allows to provide a PXE-boot-server for
|
||||
# SystemRescueCd out of the box. You just need to edit the following
|
||||
# options and run "/etc/init.d/pxebootsrv restart", and you can boot
|
||||
# any computer of your local network with PXE.
|
||||
#
|
||||
# You must configure these options if the current SystemRescueCd system
|
||||
# acts as DHCP-server and TFTP-server and HTTP-server. If you keep this
|
||||
# default behavior you just need to edit these options and start the
|
||||
# service with "/etc/init.d/pxebootsrv restart".
|
||||
# If you don't want the current system to be the DHCP server, you will have
|
||||
# to configure everything by hand and it will not be possible to use
|
||||
# the pxebootsrv service.
|
||||
|
||||
# ------------------------ CONFIGURATION -------------------------------
|
||||
# By default the current systems acts as DHCP and TFTP and HTTP server
|
||||
# If you want another machine of you network to act as one of those
|
||||
# you will have to turn the appropriate option yo "no"
|
||||
|
||||
# Set to "yes" if you want this machine to act as a DHCP server
|
||||
PXEBOOTSRV_DODHCPD="yes"
|
||||
# Set to "yes" if you want this machine to act as a TFTP server
|
||||
PXEBOOTSRV_DOTFTPD="yes"
|
||||
# Set to "yes" if you want this machine to act as an HTTP server
|
||||
PXEBOOTSRV_DOHTTPD="yes"
|
||||
# Set to "yes" if you want this machine to act as an NFS server
|
||||
PXEBOOTSRV_DONFSD="no"
|
||||
|
||||
# Here is a typical PXE-Boot configuration --> update with your settings
|
||||
PXEBOOTSRV_SUBNET="10.111.1.0" # Used only if PXEBOOTSRV_DODHCPD="yes"
|
||||
PXEBOOTSRV_NETMASK="255.255.255.0" # Used only if PXEBOOTSRV_DODHCPD="yes"
|
||||
PXEBOOTSRV_DEFROUTE="10.111.1.1" # Used only if PXEBOOTSRV_DODHCPD="yes"
|
||||
PXEBOOTSRV_DNS="10.111.1.1" # Used only if PXEBOOTSRV_DODHCPD="yes"
|
||||
PXEBOOTSRV_DHCPRANGE="10.111.1.50 10.111.1.90" # Used only if PXEBOOTSRV_DODHCPD="yes"
|
||||
PXEBOOTSRV_LOCALIP="10.111.1.1"
|
||||
PXEBOOTSRV_IF="eth0"
|
||||
|
||||
# Keep these values to $PXEBOOTSRV_LOCALIP if the current computer
|
||||
# acts as TFTP server and HTTP server as well as DHCP server
|
||||
PXEBOOTSRV_TFTPSERVER="$PXEBOOTSRV_LOCALIP" # IP address of the TFTP server if PXEBOOTSRV_DODHCPD="yes"
|
||||
PXEBOOTSRV_HTTPSERVER="http://$PXEBOOTSRV_LOCALIP/sysrcd.dat" # download URL
|
||||
|
||||
# Set a low value to boot faster. Default, wait 900 deciseconds (1min30sec)
|
||||
PXEBOOTSRV_TIMEOUT="50" # Used only if PXEBOOTSRV_DOTFTPD="yes"
|
||||
# You can append extra parameters
|
||||
PXEBOOTSRV_EXTRA="" # Used only if PXEBOOTSRV_DOTFTPD="yes"
|
||||
|
||||
101
customcd/files/etc/dhcp/dhcpd.conf.rbruserver
Normal file
101
customcd/files/etc/dhcp/dhcpd.conf.rbruserver
Normal file
@@ -0,0 +1,101 @@
|
||||
# dhcpd.conf.rbruserver
|
||||
# Rescue CD Backup & Restore Utility DHCP server configuration
|
||||
# version 7.2.2
|
||||
# Rod Wright 6/20/2018
|
||||
# Refer to CHANGELOG file for details.
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
# see /usr/share/doc/dhcp*/dhcpd.conf.sample
|
||||
#
|
||||
|
||||
ddns-update-style interim;
|
||||
ignore client-updates;
|
||||
|
||||
class "rescuebruclients" {
|
||||
match if substring(option host-name,0,9) = "rescuebru";
|
||||
}
|
||||
|
||||
class "pxeclients" {
|
||||
match if substring(option vendor-class-identifier, 0, 9) = "PXEClient";
|
||||
filename "/pxelinux.0";
|
||||
}
|
||||
|
||||
subnet 10.111.1.0 netmask 255.255.255.0 {
|
||||
option routers 10.111.1.1;
|
||||
default-lease-time 21600;
|
||||
max-lease-time 43200;
|
||||
next-server 10.111.1.1; # IP addr of the TFTP server
|
||||
allow booting;
|
||||
allow bootp;
|
||||
pool {
|
||||
allow members of "rescuebruclients";
|
||||
range dynamic-bootp 10.111.1.100 10.111.1.199;
|
||||
}
|
||||
}
|
||||
|
||||
subnet 10.111.2.0 netmask 255.255.255.0 {
|
||||
option routers 10.111.2.1;
|
||||
default-lease-time 21600;
|
||||
max-lease-time 43200;
|
||||
next-server 10.111.2.1; # IP addr of the TFTP server
|
||||
allow booting;
|
||||
allow bootp;
|
||||
pool {
|
||||
allow members of "rescuebruclients";
|
||||
range dynamic-bootp 10.111.2.100 10.111.2.199;
|
||||
}
|
||||
}
|
||||
|
||||
subnet 10.111.3.0 netmask 255.255.255.0 {
|
||||
option routers 10.111.3.1;
|
||||
default-lease-time 21600;
|
||||
max-lease-time 43200;
|
||||
next-server 10.111.3.1; # IP addr of the TFTP server
|
||||
allow booting;
|
||||
allow bootp;
|
||||
pool {
|
||||
allow members of "rescuebruclients";
|
||||
range dynamic-bootp 10.111.3.100 10.111.3.199;
|
||||
}
|
||||
}
|
||||
|
||||
subnet 10.111.4.0 netmask 255.255.255.0 {
|
||||
option routers 10.111.4.1;
|
||||
default-lease-time 21600;
|
||||
max-lease-time 43200;
|
||||
next-server 10.111.4.1; # IP addr of the TFTP server
|
||||
allow booting;
|
||||
allow bootp;
|
||||
pool {
|
||||
allow members of "rescuebruclients";
|
||||
range dynamic-bootp 10.111.4.100 10.111.4.199;
|
||||
}
|
||||
}
|
||||
|
||||
subnet 10.111.5.0 netmask 255.255.255.0 {
|
||||
option routers 10.111.5.1;
|
||||
default-lease-time 21600;
|
||||
max-lease-time 43200;
|
||||
next-server 10.111.5.1; # IP addr of the TFTP server
|
||||
allow booting;
|
||||
allow bootp;
|
||||
pool {
|
||||
allow members of "rescuebruclients";
|
||||
range dynamic-bootp 10.111.5.100 10.111.5.199;
|
||||
}
|
||||
}
|
||||
|
||||
subnet 10.111.6.0 netmask 255.255.255.0 {
|
||||
option routers 10.111.6.1;
|
||||
default-lease-time 21600;
|
||||
max-lease-time 43200;
|
||||
allow booting;
|
||||
allow bootp;
|
||||
next-server 10.111.6.1; # IP addr of the TFTP server
|
||||
pool {
|
||||
allow members of "rescuebruclients";
|
||||
range dynamic-bootp 10.111.6.100 10.111.6.199;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
91
customcd/files/etc/dhcp/dhcpd.conf.rbruserver.pxeboot
Normal file
91
customcd/files/etc/dhcp/dhcpd.conf.rbruserver.pxeboot
Normal file
@@ -0,0 +1,91 @@
|
||||
# dhcpd.conf.rbruserver.pxeboot
|
||||
# Rescue CD Backup & Restore Utility PXE DHCP server configuration
|
||||
# version 7.2.2
|
||||
# Rod Wright 6/20/2018
|
||||
# Refer to CHANGELOG file for details.
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
# see /usr/share/doc/dhcp*/dhcpd.conf.sample
|
||||
#
|
||||
|
||||
ddns-update-style interim;
|
||||
ignore client-updates;
|
||||
|
||||
class "pxeclients" {
|
||||
match if substring(option vendor-class-identifier, 0, 9) = "PXEClient";
|
||||
filename "/pxelinux.0";
|
||||
}
|
||||
|
||||
subnet 10.111.1.0 netmask 255.255.255.0 {
|
||||
option routers 10.111.1.1;
|
||||
default-lease-time 21600;
|
||||
max-lease-time 43200;
|
||||
next-server 10.111.1.1; # IP addr of the TFTP server
|
||||
allow booting;
|
||||
allow bootp;
|
||||
pool {
|
||||
range dynamic-bootp 10.111.1.100 10.111.1.199;
|
||||
}
|
||||
}
|
||||
|
||||
subnet 10.111.2.0 netmask 255.255.255.0 {
|
||||
option routers 10.111.2.1;
|
||||
default-lease-time 21600;
|
||||
max-lease-time 43200;
|
||||
next-server 10.111.2.1; # IP addr of the TFTP server
|
||||
allow booting;
|
||||
allow bootp;
|
||||
pool {
|
||||
range dynamic-bootp 10.111.2.100 10.111.2.199;
|
||||
}
|
||||
}
|
||||
|
||||
subnet 10.111.3.0 netmask 255.255.255.0 {
|
||||
option routers 10.111.3.1;
|
||||
default-lease-time 21600;
|
||||
max-lease-time 43200;
|
||||
next-server 10.111.3.1; # IP addr of the TFTP server
|
||||
allow booting;
|
||||
allow bootp;
|
||||
pool {
|
||||
range dynamic-bootp 10.111.3.100 10.111.3.199;
|
||||
}
|
||||
}
|
||||
|
||||
subnet 10.111.4.0 netmask 255.255.255.0 {
|
||||
option routers 10.111.4.1;
|
||||
default-lease-time 21600;
|
||||
max-lease-time 43200;
|
||||
next-server 10.111.4.1; # IP addr of the TFTP server
|
||||
allow booting;
|
||||
allow bootp;
|
||||
pool {
|
||||
range dynamic-bootp 10.111.4.100 10.111.4.199;
|
||||
}
|
||||
}
|
||||
|
||||
subnet 10.111.5.0 netmask 255.255.255.0 {
|
||||
option routers 10.111.5.1;
|
||||
default-lease-time 21600;
|
||||
max-lease-time 43200;
|
||||
next-server 10.111.5.1; # IP addr of the TFTP server
|
||||
allow booting;
|
||||
allow bootp;
|
||||
pool {
|
||||
range dynamic-bootp 10.111.5.100 10.111.5.199;
|
||||
}
|
||||
}
|
||||
|
||||
subnet 10.111.6.0 netmask 255.255.255.0 {
|
||||
option routers 10.111.6.1;
|
||||
default-lease-time 21600;
|
||||
max-lease-time 43200;
|
||||
allow booting;
|
||||
allow bootp;
|
||||
next-server 10.111.6.1; # IP addr of the TFTP server
|
||||
pool {
|
||||
range dynamic-bootp 10.111.6.100 10.111.6.199;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<deviceinfo version="0.2">
|
||||
<device>
|
||||
<match key="scsi.type" string="cdrom">
|
||||
<merge key="storage.media_check_enabled" type="bool">false</merge>
|
||||
</match>
|
||||
</device>
|
||||
</deviceinfo>
|
||||
|
||||
120
customcd/files/etc/init.d/dhcpd
Normal file
120
customcd/files/etc/init.d/dhcpd
Normal file
@@ -0,0 +1,120 @@
|
||||
#!/sbin/openrc-run
|
||||
# Copyright 1999-2015 Gentoo Foundation
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
extra_commands="configtest"
|
||||
|
||||
: ${DHCPD_CONF:=/etc/dhcp/${SVCNAME}.conf}
|
||||
|
||||
depend() {
|
||||
#need net
|
||||
provide net
|
||||
use logger dns
|
||||
}
|
||||
|
||||
get_var() {
|
||||
local var="$(sed -n 's/^[[:blank:]]\?'"$1"' "*\([^#";]\+\).*/\1/p' "${chroot}${DHCPD_CONF}")"
|
||||
echo ${var:-$2}
|
||||
}
|
||||
|
||||
setup_opts() {
|
||||
DHCPD_CHROOT=${DHCPD_CHROOT%/}
|
||||
|
||||
# Work out our cffile if it's in our DHCPD_OPTS
|
||||
case " ${DHCPD_OPTS} " in
|
||||
*" -cf "*)
|
||||
DHCPD_CONF=" ${DHCPD_OPTS} "
|
||||
DHCPD_CONF="${DHCPD_CONF##* -cf }"
|
||||
DHCPD_CONF="${DHCPD_CONF%% *}"
|
||||
;;
|
||||
*) DHCPD_OPTS="${DHCPD_OPTS} -cf ${DHCPD_CONF}"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
checkconfig() {
|
||||
set -- ${DHCPD_OPTS} -chroot "${DHCPD_CHROOT:-/}" -t
|
||||
|
||||
dhcpd "$@" 1>/dev/null 2>&1
|
||||
local ret=$?
|
||||
if [ ${ret} -ne 0 ] ; then
|
||||
eerror "${SVCNAME} has detected a syntax error in your configuration files:"
|
||||
dhcpd "$@"
|
||||
fi
|
||||
|
||||
return ${ret}
|
||||
}
|
||||
|
||||
configtest() {
|
||||
setup_opts
|
||||
|
||||
ebegin "Checking ${SVCNAME} configuration"
|
||||
checkconfig
|
||||
eend $?
|
||||
}
|
||||
|
||||
start() {
|
||||
setup_opts
|
||||
local chroot="${DHCPD_CHROOT}"
|
||||
|
||||
if [ -n "${chroot}" ] ; then
|
||||
# the config test want's these to exist
|
||||
mkdir -p \
|
||||
"${chroot}"/var/run/dhcp \
|
||||
"${chroot}"/var/lib/dhcp \
|
||||
"${chroot}"/etc/dhcp
|
||||
fi
|
||||
|
||||
# see comment in get_var() above
|
||||
if [ ! -f "${chroot}${DHCPD_CONF}" ] ; then
|
||||
eerror "${chroot}${DHCPD_CONF} does not exist"
|
||||
return 1
|
||||
fi
|
||||
|
||||
checkconfig || return 1
|
||||
|
||||
checkpath -d -o dhcp:dhcp "${chroot}"/var/run/dhcp "${chroot}"/var/lib/dhcp
|
||||
|
||||
local leasefile="$(get_var lease-file-name /var/lib/dhcp/${SVCNAME}.leases)"
|
||||
checkpath -f -o dhcp:dhcp "${chroot}${leasefile}"
|
||||
|
||||
# Setup LD_PRELOAD so name resolution works in our chroot.
|
||||
if [ -n "${chroot}" ] ; then
|
||||
checkpath -d -o root:root -m 755 "${chroot}"/dev "${chroot}"/etc "${chroot}"/proc
|
||||
cp -pP /etc/localtime /etc/resolv.conf "${chroot}"/etc/
|
||||
export LD_PRELOAD="${LD_PRELOAD} libresolv.so libnss_dns.so"
|
||||
if ! mountinfo -q "${chroot}/proc" ; then
|
||||
mount --bind /proc "${chroot}/proc"
|
||||
fi
|
||||
fi
|
||||
|
||||
local pidfile="$(get_var pid-file-name /var/run/dhcp/${SVCNAME}.pid)"
|
||||
|
||||
ebegin "Starting ${chroot:+chrooted }${SVCNAME}"
|
||||
start-stop-daemon --start --exec /usr/sbin/dhcpd \
|
||||
--pidfile "${chroot}/${pidfile}" \
|
||||
-- ${DHCPD_OPTS} -q -pf "${pidfile}" -lf "${leasefile}" \
|
||||
-user dhcp -group dhcp \
|
||||
-chroot "${chroot:-/}" ${DHCPD_IFACE}
|
||||
eend $? \
|
||||
&& save_options dhcpd_chroot "${chroot}" \
|
||||
&& save_options pidfile "${pidfile}"
|
||||
}
|
||||
|
||||
stop() {
|
||||
local chroot="$(get_options dhcpd_chroot)"
|
||||
[ -z "${chroot}" ] && chroot="$(get_options chroot)"
|
||||
|
||||
ebegin "Stopping ${chroot:+chrooted }${SVCNAME}"
|
||||
start-stop-daemon --stop --exec /usr/sbin/dhcpd \
|
||||
--pidfile "${chroot}/$(get_options pidfile)"
|
||||
res=$?
|
||||
|
||||
if [ ${res} -eq 0 ] && [ -n "${chroot}" ] ; then
|
||||
if mountinfo -q "${chroot}/proc" ; then
|
||||
umount "${chroot}/proc"
|
||||
fi
|
||||
fi
|
||||
|
||||
eend ${res}
|
||||
}
|
||||
44
customcd/files/etc/init.d/dostartx
Normal file
44
customcd/files/etc/init.d/dostartx
Normal file
@@ -0,0 +1,44 @@
|
||||
#!/sbin/runscript
|
||||
|
||||
DAEMON="/usr/bin/xinit"
|
||||
ARGS="/etc/X11/xinit/xinitrc"
|
||||
PIDFILE="/var/run/dostartx.pid"
|
||||
LOGFILE="/var/log/dostartx.log"
|
||||
CWD="/root"
|
||||
|
||||
totalmem=`free|grep Mem:|awk '{print $2}'`
|
||||
if [ "$totalmem" -lt 500000 ]; then
|
||||
if grep -q "autoruns=3" /proc/cmdline ; then
|
||||
dotextonly=1
|
||||
fi
|
||||
fi
|
||||
|
||||
depend() {
|
||||
after sysresccd
|
||||
}
|
||||
|
||||
start() {
|
||||
if grep -q "dostartx" /proc/cmdline
|
||||
then
|
||||
if [ "$dotextonly" ]
|
||||
then
|
||||
ebegin "Not enough memory to start the graphical environment"
|
||||
eend 0
|
||||
else
|
||||
ebegin "Starting the graphical environment"
|
||||
start-stop-daemon --start --quiet --user root --env SHELL="/bin/bash" --env PATH="$PATH:/root/rescuebru" \
|
||||
--pidfile $PIDFILE --exec $DAEMON --background --chdir $CWD \
|
||||
--stdout $LOGFILE --make-pidfile -- $ARGS
|
||||
eend $?
|
||||
fi
|
||||
else
|
||||
eend 0
|
||||
fi
|
||||
}
|
||||
|
||||
stop() {
|
||||
ebegin "Stopping the graphical environment"
|
||||
start-stop-daemon --stop --quiet --pidfile $PIDFILE --exec $DAEMON
|
||||
eend $?
|
||||
}
|
||||
|
||||
187
customcd/files/etc/init.d/pxebootsrv
Normal file
187
customcd/files/etc/init.d/pxebootsrv
Normal file
@@ -0,0 +1,187 @@
|
||||
#!/sbin/runscript
|
||||
# Distributed under the terms of the GNU General Public License, v2 or later
|
||||
|
||||
bootdir='/livemnt/boot'
|
||||
|
||||
depend()
|
||||
{
|
||||
need net
|
||||
}
|
||||
|
||||
start()
|
||||
{
|
||||
ebegin "Starting the pxe-boot-server"
|
||||
|
||||
# ---- check the cdrom files exist
|
||||
if ! ls -l ${bootdir}/sysrcd.dat ${bootdir}/???linux/???linux.cfg >/dev/null 2>&1
|
||||
then
|
||||
eerror "Files are missing, please check you are running a valid SystemRescueCd"
|
||||
return 1
|
||||
fi
|
||||
|
||||
# ---- check the config file exists
|
||||
if [ ! -f /etc/conf.d/pxebootsrv ]
|
||||
then
|
||||
eerror "The pxebootsrv configuration file \"/etc/conf.d/pxebootsrv\" does not exists. Cannot continue."
|
||||
return 1
|
||||
fi
|
||||
|
||||
# ---- check the major options are set to 'yes' or 'no'
|
||||
if [ $PXEBOOTSRV_DODHCPD != "yes" ] && [ $PXEBOOTSRV_DODHCPD != "no" ]
|
||||
then
|
||||
eerror "Invalid value for PXEBOOTSRV_DODHCPD. Must be \"yes\" or \"no\" (lowercase)."
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [ $PXEBOOTSRV_DOTFTPD != "yes" ] && [ $PXEBOOTSRV_DOTFTPD != "no" ]
|
||||
then
|
||||
eerror "Invalid value for PXEBOOTSRV_DOTFTPD. Must be \"yes\" or \"no\" (lowercase)."
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [ $PXEBOOTSRV_DOHTTPD != "yes" ] && [ $PXEBOOTSRV_DOHTTPD != "no" ]
|
||||
then
|
||||
eerror "Invalid value for PXEBOOTSRV_DOHTTPD. Must be \"yes\" or \"no\" (lowercase)."
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [ $PXEBOOTSRV_DONFSD != "yes" ] && [ $PXEBOOTSRV_DONFSD != "no" ]
|
||||
then
|
||||
eerror "Invalid value for PXEBOOTSRV_DONFSD. Must be \"yes\" or \"no\" (lowercase)."
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [ $PXEBOOTSRV_DODHCPD == "yes" ]
|
||||
then
|
||||
# ---- prepare /etc/dhcp/dhcpd.conf from /etc/conf.d/pxebootsrv
|
||||
[ -f /etc/dhcp/dhcpd.conf ] && cp /etc/dhcp/dhcpd.conf /etc/dhcp/dhcpd.bak
|
||||
cp /etc/dhcp/dhcpd.orig /etc/dhcp/dhcpd.conf
|
||||
|
||||
if [ -z "$PXEBOOTSRV_SUBNET" -o -z "$PXEBOOTSRV_NETMASK" ]
|
||||
then
|
||||
eerror "Invalid values for PXEBOOTSRV_SUBNET or PXEBOOTSRV_NETMASK"
|
||||
return 1
|
||||
else
|
||||
sed -i -e "s/subnet 192.168.1.0 netmask 255.255.255.0/subnet $PXEBOOTSRV_SUBNET netmask $PXEBOOTSRV_NETMASK/" /etc/dhcp/dhcpd.conf
|
||||
sed -i -e "s/option subnet-mask 255.255.255.0;/option subnet-mask $PXEBOOTSRV_NETMASK;/" /etc/dhcp/dhcpd.conf
|
||||
fi
|
||||
|
||||
if [ -z "$PXEBOOTSRV_DEFROUTE" ]
|
||||
then
|
||||
eerror "The config variable PXEBOOTSRV_DEFROUTE is missing"
|
||||
return 1
|
||||
else
|
||||
sed -i -e "s/option routers 192.168.1.254;/option routers $PXEBOOTSRV_DEFROUTE;/" /etc/dhcp/dhcpd.conf
|
||||
fi
|
||||
|
||||
if [ -z "$PXEBOOTSRV_DHCPRANGE" ]
|
||||
then
|
||||
eerror "The config variable PXEBOOTSRV_DHCPRANGE is missing"
|
||||
return 1
|
||||
else
|
||||
sed -i -e "s/range dynamic-bootp 192.168.1.100 192.168.1.150;/range dynamic-bootp $PXEBOOTSRV_DHCPRANGE;/" /etc/dhcp/dhcpd.conf
|
||||
fi
|
||||
|
||||
if [ -z "$PXEBOOTSRV_TFTPSERVER" ]
|
||||
then
|
||||
eerror "The config variable PXEBOOTSRV_TFTPSERVER is missing"
|
||||
return 1
|
||||
else
|
||||
sed -i -e "s/next-server 192.168.1.5;/next-server $PXEBOOTSRV_TFTPSERVER;/" /etc/dhcp/dhcpd.conf
|
||||
fi
|
||||
|
||||
if [ -n "$PXEBOOTSRV_DNS" ]
|
||||
then
|
||||
sed -i -e "s/option domain-name-servers 192.168.1.254;/option domain-name-servers $PXEBOOTSRV_DNS;/" /etc/dhcp/dhcpd.conf
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ $PXEBOOTSRV_DOTFTPD == "yes" ]
|
||||
then
|
||||
# ---- prepare pxelinux config file
|
||||
[ ! -d /tftpboot/pxelinux.cfg ] && mkdir -p /tftpboot/pxelinux.cfg
|
||||
[ ! -f /tftpboot/pxelinux.0 ] && cp /usr/share/syslinux/pxelinux.0 /tftpboot/
|
||||
[ -f /tftpboot/pxelinux.cfg/default.bak ] && rm -f /tftpboot/pxelinux.cfg/default.bak
|
||||
[ -f /tftpboot/pxelinux.cfg/default ] && mv /tftpboot/pxelinux.cfg/default /tftpboot/pxelinux.cfg/default.bak
|
||||
cp --remove-destination ${bootdir}/???linux/{*msg,*c32,*.0,memdisk,netboot} /tftpboot/
|
||||
cp --remove-destination ${bootdir}/???linux/???linux.cfg /tftpboot/pxelinux.cfg/default
|
||||
if [ -n "$PXEBOOTSRV_TIMEOUT" ]
|
||||
then
|
||||
sed -i -e "s!^TIMEOUT .*!TIMEOUT $PXEBOOTSRV_TIMEOUT!i" /tftpboot/pxelinux.cfg/default
|
||||
fi
|
||||
sed -i -e "s!scandelay=1!scandelay=5 netboot=$PXEBOOTSRV_HTTPSERVER ${PXEBOOTSRV_EXTRA}!g" /tftpboot/pxelinux.cfg/default
|
||||
fi
|
||||
|
||||
# ---- start the NFS server
|
||||
if [ $PXEBOOTSRV_DONFSD == "yes" ]
|
||||
then
|
||||
# ---- nfs export /tftpboot
|
||||
touch /etc/exports
|
||||
sed -i -e 's!^/tftpboot!#/tftpboot!g' /etc/exports
|
||||
echo "/tftpboot *(fsid=0,ro,no_subtree_check,all_squash,insecure,anonuid=1000,anongid=1000)" >> /etc/exports
|
||||
fi
|
||||
|
||||
# ---- stop network manager to avoid conflicts
|
||||
/etc/init.d/NetworkManager stop
|
||||
|
||||
# ---- bring up network interface
|
||||
ifconfig $PXEBOOTSRV_IF $PXEBOOTSRV_LOCALIP/24
|
||||
|
||||
# ---- start the DHCPD service
|
||||
if [ $PXEBOOTSRV_DODHCPD == "yes" ]
|
||||
then
|
||||
/etc/init.d/dhcpd restart
|
||||
if [ "$?" != "0" ]
|
||||
then
|
||||
eerror "Cannot start /etc/init.d/dhcpd, check /var/log/messages"
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# ---- start the THTTPD service
|
||||
if [ $PXEBOOTSRV_DOHTTPD == "yes" ]
|
||||
then
|
||||
/etc/init.d/thttpd restart
|
||||
if [ "$?" != "0" ]
|
||||
then
|
||||
eerror "Cannot start /etc/init.d/thttpd"
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# ---- start the TFTPD service
|
||||
if [ $PXEBOOTSRV_DOTFTPD == "yes" ]
|
||||
then
|
||||
/etc/init.d/in.tftpd restart
|
||||
if [ "$?" != "0" ]
|
||||
then
|
||||
eerror "Cannot start /etc/init.d/in.tftpd"
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# ---- start the NFS server
|
||||
if [ $PXEBOOTSRV_DONFSD == "yes" ]
|
||||
then
|
||||
/etc/init.d/nfs restart
|
||||
if [ "$?" != "0" ]
|
||||
then
|
||||
eerror "Cannot start /etc/init.d/nfs"
|
||||
return 1
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
stop()
|
||||
{
|
||||
ebegin "Stopping the pxe-boot-server"
|
||||
|
||||
/etc/init.d/thttpd stop
|
||||
/etc/init.d/in.tftpd stop
|
||||
/etc/init.d/dhcpd stop
|
||||
|
||||
return 0
|
||||
}
|
||||
128
customcd/files/etc/init.d/sysresccd
Normal file
128
customcd/files/etc/init.d/sysresccd
Normal file
@@ -0,0 +1,128 @@
|
||||
#!/sbin/runscript
|
||||
|
||||
source /sbin/livecd-functions.sh
|
||||
|
||||
depend()
|
||||
{
|
||||
before xdm autorun tigervnc
|
||||
after pwgen sshd portmap hald
|
||||
}
|
||||
|
||||
start()
|
||||
{
|
||||
ebegin "Performing the SystemRescueCd specific initializations"
|
||||
|
||||
CMDLINE="$(cat /proc/cmdline)"
|
||||
|
||||
# ---- create file /var/log/lastlog so that ssh does not complain in the logs ----
|
||||
touch /var/log/lastlog
|
||||
|
||||
# ---- create various directories ----
|
||||
mkdir -p /var/log/samba
|
||||
mkdir -p /var/cache/revdep-rebuild
|
||||
mkdir -p /var/run/dhcp
|
||||
chown dhcp:dhcp /var/run/dhcp
|
||||
|
||||
# ---- disable screensaver in the console
|
||||
setterm -blank 0 -powersave off
|
||||
|
||||
# ---- auto-detect software raid ----
|
||||
[ -n "$(which mdadm)" ] && mdadm --auto-detect 2>&1
|
||||
|
||||
# ---- change the root password if requested in cmdline ----
|
||||
for curopt in ${CMDLINE}
|
||||
do
|
||||
if echo "${curopt}" | grep -q -E '^rootpass=[^ ]{1,32}$'
|
||||
then
|
||||
newpass="$(echo ${curopt} | sed -r -e 's!^rootpass=([^ ]{1,32})$!\1!g')"
|
||||
( echo root:${newpass} ) | chpasswd 1>/dev/null 2>&1
|
||||
fi
|
||||
done
|
||||
|
||||
# ---- options to start/stop services ----
|
||||
for curopt in ${CMDLINE}
|
||||
do
|
||||
if echo "${curopt}" | grep -q -E '^initscript=[a-zA-Z0-9]{1,32}:[a-z]{1,32}$'
|
||||
then
|
||||
touch /var/log/initscript.log
|
||||
service="$(echo ${curopt} | sed -r -e 's!^initscript=([a-zA-Z0-9]{1,32}):([a-z]{1,32})$!\1!g')"
|
||||
action="$(echo ${curopt} | sed -r -e 's!^initscript=([a-zA-Z0-9]{1,32}):([a-z]{1,32})$!\2!g')"
|
||||
echo "initscript: found option ${curopt} (service=${service} and action=${action}" >| /var/log/initscript.log
|
||||
if [ -x "/etc/init.d/${service}" ]
|
||||
then
|
||||
cmd="/etc/init.d/${service} ${action}"
|
||||
${cmd} > /var/log/initscript-${service}.log 2>&1
|
||||
res=$?
|
||||
echo "initscript: ${cmd} --> ${res}" | tee -a /var/log/initscript.log
|
||||
else
|
||||
echo "initscript: /etc/init.d/${service} not found" | tee -a /var/log/initscript.log
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
# ---- options to configure and start the vncserver ----
|
||||
# eg: "rescuecd vncserver=2:mYpAsWd" will create two vnc displays (display=1 on port 5900 and display=2 on port 5901)
|
||||
# and the two displays will use the same password and the root user account (password=mYpAsWd)
|
||||
# this option should be used only once, but in case of multiple usages the last vncserver option overwrite the previous ones
|
||||
vnclog='/var/log/vncserver.log'
|
||||
for curopt in ${CMDLINE}
|
||||
do
|
||||
case "${curopt}" in
|
||||
vncserver\=*)
|
||||
echo '' >| ${vnclog}
|
||||
vncopt="$(echo ${curopt} | cut -d= -f2)"
|
||||
echo "vncserver: found option vncserver=${vncopt}" | tee -a ${vnclog}
|
||||
if echo "${vncopt}" | grep -q -E '^[1-9]:[^ ]{6,12}$'
|
||||
then
|
||||
[ -f /root/.vnc/passwd ] && rm -f /root/.vnc/passwd
|
||||
[ ! -d /root/.vnc ] && mkdir -p /root/.vnc
|
||||
sed -i -e 's!^DISPLAYS=.*!!g' /etc/conf.d/tigervnc
|
||||
displaycnt="$(echo ${curopt} | sed -r -e 's!^vncserver=([1-9]):([^ ]{6,12})$!\1!g')"
|
||||
password="$(echo ${curopt} | sed -r -e 's!^vncserver=([1-9]):([^ ]{6,12})$!\2!g')"
|
||||
echo "vncserver: ${displaycnt} displays will be created" | tee -a ${vnclog}
|
||||
echo "vncserver: creating password file in /root/.vnc/passwd:" >>${vnclog}
|
||||
echo -e "${password}\n${password}\n" | vncpasswd /root/.vnc/passwd >>${vnclog} 2>&1
|
||||
|
||||
chmod 600 /root/.vnc/passwd
|
||||
echo "exec /usr/bin/startxfce4 >/dev/null 2>&1" >| /root/.vnc/xstartup
|
||||
chmod 700 /root/.vnc/xstartup
|
||||
displayopt=''
|
||||
for ((i=1; i <= displaycnt; i++))
|
||||
do
|
||||
echo "vncserver: preparing display number $i" | tee -a ${vnclog}
|
||||
displayopt="${displayopt} root:$i"
|
||||
displayopt="$(echo ${displayopt} | sed -e 's!^ !!g' | sed -e 's! $!!g')"
|
||||
done
|
||||
echo "DISPLAYS=\"${displayopt}\"" >> /etc/conf.d/tigervnc
|
||||
else
|
||||
echo "vncserver: invalid syntax (expected \"vncserver=x:mYpAsWd\")"
|
||||
echo " where x is the number of displays (1 or 2 in general)"
|
||||
echo " mYpAsWd is a password (between 6 and 12 characters)"
|
||||
sleep 2
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# ---- clean /etc/mtab ----
|
||||
if grep -q -F 'tmpfs /newroot' /etc/mtab
|
||||
then
|
||||
rm -f /etc/mtab.bak
|
||||
cp /etc/mtab /etc/mtab.bak
|
||||
sed -i -e "/ \/newroot/d" /etc/mtab
|
||||
fi
|
||||
|
||||
# ---- create a kernel options file ----
|
||||
if [ -f /proc/config.gz ]
|
||||
then
|
||||
cat /proc/config.gz | gzip -d > /root/kernel-$(uname -r).conf
|
||||
fi
|
||||
|
||||
# ---- fix inittab for serial consoles
|
||||
livecd_fix_inittab
|
||||
/sbin/telinit q &>/dev/null
|
||||
|
||||
# ---- mount tmpfs (important for backing store)
|
||||
mount -t tmpfs tmpfs /tmp
|
||||
}
|
||||
|
||||
69
customcd/files/etc/profile
Normal file
69
customcd/files/etc/profile
Normal file
@@ -0,0 +1,69 @@
|
||||
# /etc/profile: login shell setup
|
||||
#
|
||||
# That this file is used by any Bourne-shell derivative to setup the
|
||||
# environment for login shells.
|
||||
#
|
||||
|
||||
# Load environment settings from profile.env, which is created by
|
||||
# env-update from the files in /etc/env.d
|
||||
if [ -e /etc/profile.env ] ; then
|
||||
. /etc/profile.env
|
||||
fi
|
||||
|
||||
# You should override these in your ~/.bashrc (or equivalent) for per-user
|
||||
# settings. For system defaults, you can add a new file in /etc/profile.d/.
|
||||
export EDITOR=${EDITOR:-/bin/nano}
|
||||
export PAGER=${PAGER:-/usr/bin/less}
|
||||
|
||||
# 077 would be more secure, but 022 is generally quite realistic
|
||||
umask 022
|
||||
|
||||
# Set up PATH depending on whether we're root or a normal user.
|
||||
# There's no real reason to exclude sbin paths from the normal user,
|
||||
# but it can make tab-completion easier when they aren't in the
|
||||
# user's PATH to pollute the executable namespace.
|
||||
#
|
||||
# It is intentional in the following line to use || instead of -o.
|
||||
# This way the evaluation can be short-circuited and calling whoami is
|
||||
# avoided.
|
||||
if [ "$EUID" = "0" ] || [ "$USER" = "root" ] ; then
|
||||
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/root/rescuebru:${ROOTPATH}"
|
||||
else
|
||||
PATH="/usr/local/bin:/usr/bin:/bin:/root/rescuebru:${PATH}"
|
||||
fi
|
||||
export PATH
|
||||
unset ROOTPATH
|
||||
|
||||
if [ -n "${BASH_VERSION}" ] ; then
|
||||
# Newer bash ebuilds include /etc/bash/bashrc which will setup PS1
|
||||
# including color. We leave out color here because not all
|
||||
# terminals support it.
|
||||
if [ -f /etc/bash/bashrc ] ; then
|
||||
# Bash login shells run only /etc/profile
|
||||
# Bash non-login shells run only /etc/bash/bashrc
|
||||
# Since we want to run /etc/bash/bashrc regardless, we source it
|
||||
# from here. It is unfortunate that there is no way to do
|
||||
# this *after* the user's .bash_profile runs (without putting
|
||||
# it in the user's dot-files), but it shouldn't make any
|
||||
# difference.
|
||||
. /etc/bash/bashrc
|
||||
else
|
||||
PS1='\u@\h \w \$ '
|
||||
fi
|
||||
else
|
||||
# Setup a bland default prompt. Since this prompt should be useable
|
||||
# on color and non-color terminals, as well as shells that don't
|
||||
# understand sequences such as \h, don't put anything special in it.
|
||||
PS1="${USER:-$(type whoami >/dev/null && whoami)}@$(type uname >/dev/null && uname -n) \$ "
|
||||
fi
|
||||
|
||||
for sh in /etc/profile.d/*.sh ; do
|
||||
[ -r "$sh" ] && . "$sh"
|
||||
done
|
||||
unset sh
|
||||
alias cp='cp -i'
|
||||
alias mv='mv -i'
|
||||
alias rm='rm -i'
|
||||
alias ls='ls --color=auto'
|
||||
alias ll='ls -l'
|
||||
alias grep='grep --color=auto'
|
||||
44
customcd/files/etc/zsh/zprofile
Normal file
44
customcd/files/etc/zsh/zprofile
Normal file
@@ -0,0 +1,44 @@
|
||||
# /etc/zsh/zprofile
|
||||
# $Header: /mnt/raid/cvsroot/rescuebru/customcd/files/etc/zsh/Attic/zprofile,v 1.1.2.1.2.4 2010/12/22 19:42:04 rwright Exp $
|
||||
|
||||
# Load environment settings from profile.env, which is created by
|
||||
# env-update from the files in /etc/env.d
|
||||
if [ -e /etc/profile.env ] ; then
|
||||
. /etc/profile.env
|
||||
fi
|
||||
|
||||
# You should override these in your ~/.zprofile (or equivalent) for per-user
|
||||
# settings. For system defaults, you can add a new file in /etc/profile.d/.
|
||||
export EDITOR=${EDITOR:-/bin/nano}
|
||||
export PAGER=${PAGER:-/usr/bin/less}
|
||||
|
||||
# 077 would be more secure, but 022 is generally quite realistic
|
||||
umask 022
|
||||
|
||||
# Set up PATH depending on whether we're root or a normal user.
|
||||
# There's no real reason to exclude sbin paths from the normal user,
|
||||
# but it can make tab-completion easier when they aren't in the
|
||||
# user's PATH to pollute the executable namespace.
|
||||
#
|
||||
# It is intentional in the following line to use || instead of -o.
|
||||
# This way the evaluation can be short-circuited and calling whoami is
|
||||
# avoided.
|
||||
if [ "$EUID" = "0" ] || [ "$USER" = "root" ] ; then
|
||||
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:${ROOTPATH}"
|
||||
else
|
||||
PATH="/usr/local/bin:/usr/bin:/bin:${PATH}"
|
||||
fi
|
||||
# Add /root/rescuebru and /root to all paths
|
||||
PATH="${PATH}:/root/rescuebru"
|
||||
PATH="${PATH}:/root"
|
||||
export PATH
|
||||
unset ROOTPATH
|
||||
|
||||
shopts=$-
|
||||
setopt nullglob
|
||||
for sh in /etc/profile.d/*.sh ; do
|
||||
[ -r "$sh" ] && . "$sh"
|
||||
done
|
||||
unsetopt nullglob
|
||||
set -$shopts
|
||||
unset sh shopts
|
||||
Reference in New Issue
Block a user