Commit 7e9da45e authored by Georges Khaznadar's avatar Georges Khaznadar

Import Upstream version 2.20.11

parents
# Makefile
#
# License: GPL
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
#
SHELL := bash -e
DESTDIR =
SHAREDIR = /usr/share/drbl/
SCRIPTS = bin/* sbin/* $(SHAREDIR)/sbin/* $(SHAREDIR)/bin/*
all: drbl-sbin-link languages
build:
@echo "Nothing to build."
drbl-sbin-link:
@echo "Files linking..."
$(MAKE) -C sbin all
languages:
@echo "Files linking..."
$(MAKE) -C lang all
install:
# install exec files
install -d $(DESTDIR)/usr/
cp -a sbin bin $(DESTDIR)/usr/
rm -f $(DESTDIR)/usr/sbin/Makefile
# install setup dir
install -d $(DESTDIR)/$(SHAREDIR)/
cp -a setup $(DESTDIR)/$(SHAREDIR)/
# install other shared files
cp -a lang doc pkg pki image prerun postrun scripts/sbin scripts/bin $(DESTDIR)/$(SHAREDIR)/
# erase an extra COPYING
rm -f $(DESTDIR)/$(SHAREDIR)/pkg/misc/COPYING
rm -f $(DESTDIR)/$(SHAREDIR)/pkg/misc/Makefile $(DESTDIR)/$(SHAREDIR)/lang/Makefile
# install config files
install -d $(DESTDIR)/etc/drbl/
cp -a conf/* $(DESTDIR)/etc/drbl/
# install themes
install -d $(DESTDIR)/usr/share/gdm/themes/drbl-gdm
cp -a themes/* $(DESTDIR)/usr/share/gdm/themes/drbl-gdm/
clean:
$(MAKE) -C sbin clean
$(MAKE) -C lang clean
#!/bin/bash
#
# Copyright (C) 2002-2003 by NCHC, Steven Shiau, K. L. Huang
# (steven _at_ nchc org tw, klhaung _at_ gmail com)
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
# Load DRBL setting and functions
# Setting
# Source function library.
[ -f /etc/rc.d/init.d/functions ] && . /etc/rc.d/init.d/functions
# Load DRBL setting and functions
DRBL_SCRIPT_PATH="${DRBL_SCRIPT_PATH:-/usr/share/drbl}"
. $DRBL_SCRIPT_PATH/sbin/drbl-conf-functions
# get the distribution name and type: OS_Version and OS_type
check_distribution_name
# Settings
# PKG_FROM_DRBL is loaded from drbl.conf, we append "drbl, partimage, ntfsprogs lzop..."
PKG_FROM_DRBL="drbl $PKG_FROM_DRBL partimage ntfsprogs gzip bzip2 lzop pigz pbzip2 udpcast syslinux"
echo -n "Acquiring some info about the system."
#
echo -n .
case "$OS_Version" in
RH*|FC*|CO*|MDK*|MDV*|SUSE*)
for ipkg in $PKG_FROM_DRBL; do
ipkg_ver=""
ipkg_ver="$(rpm -q $ipkg)"
[ -n $ipkg_ver ] && installed_pkgs="$installed_pkgs $ipkg_ver"
done
# Extra: glibc and mkpxeinitrd-net
glibc_ver="$(rpm -q glibc)"
LC_ALL=C rpm -q --qf '%{ARCH}' glibc > /dev/null && glibc_arch=`rpm -q --qf '%{ARCH}' glibc`
;;
DBN*)
for ipkg in $PKG_FROM_DRBL; do
ipkg_ver=""
ipkg_ver="$(LC_ALL=C dpkg -l $ipkg | tail -n 1 | awk -F" " '{print $2"-"$3}')"
[ -n $ipkg_ver ] && installed_pkgs="$installed_pkgs $ipkg_ver"
done
;;
*)
echo "This version in this distribution is NOT supported by DRBL, maybe you can try to use the drbl in testing or unstable repository. Program terminated!"
exit 1
esac
echo -n .
ARCH="$(LC_ALL=C uname -m)"
Kernel_VER="$(LC_ALL=C uname -r)"
SERVER_CPU="$(LC_ALL=C awk -F":" '/^model name/ {print $2}' /proc/cpuinfo | sort | uniq)"
echo -n .
if [ -f $pxecfg_pd/kernel_version_in_initrd.txt ]; then
client_kernel_ver="$(LC_ALL=C cat $pxecfg_pd/kernel_version_in_initrd.txt)"
fi
if [ -f $pxecfg_pd/client_kernel_arch.txt ]; then
client_kernel_arch="$(LC_ALL=C cat $pxecfg_pd/client_kernel_arch.txt)"
fi
echo -n .
# server memory
server_mem_size="$(LC_ALL=C cat /proc/meminfo | grep "^MemTotal:" | awk -F" " '{print $2" " $3}')"
#
echo -n .
total_client_no="$(LC_ALL=C get-client-ip-list | wc -l)"
# To strip the line feed, we use echo ``
echo -n .
private_NIC="$(LC_ALL=C get-all-nic-ip --private-ip-port)"
echo -n .
private_IP="$(LC_ALL=C get-all-nic-ip --private-ip-address)"
echo -n .
client_IP="$(echo `get-client-ip-list`)"
echo " done!"
# output the results:
time_now="$(LC_ALL=C date +%Y%m%d-%H%M)"
output_filename="DRBL-BUG-RPT-${time_now}.txt"
# dump it
cat <<-REP_END > $output_filename
To report the bug, fill the contents in the following table, then send it to DRBL mailing list or post it on the DRBL forum."
-------CUT BEGIN HERE--------------------------------------------
Description of problem:
How reproducible:
Steps to Reproduce:
Actual results:
Expected results:
Some info about the DRBL environment (PLEASE DO NOT EDIT THEM!):
===
OS version: $FULL_OS_Version
Server arch: $ARCH
Server CPU: $SERVER_CPU
Server memory size: $server_mem_size
Server Kernel version: $Kernel_VER
Installed DRBL-related packages: $installed_pkgs
REP_END
# This is only necessary for RH-like
if [ -n "$glibc_ver" ]; then
cat <<-REP_END >> $output_filename
Server glibc ver and arch: $glibc_ver $glibc_arch
REP_END
fi
cat <<-REP_END >> $output_filename
Client kernel version: $client_kernel_ver
Client kernel arch: $client_kernel_arch
NICs with private IP address in server: $private_NIC
Private IP address in server: $private_IP
Total client no: $total_client_no
Client IP address: $client_IP
===
-------CUT END HERE----------------------------------------------
REP_END
[ "$BOOTUP" = "color" ] && $SETCOLOR_WARNING
echo "The results are in file $output_filename"
[ "$BOOTUP" = "color" ] && $SETCOLOR_NORMAL
echo "To report the bug, fill the contents in file $output_filename then send it to DRBL mailing list or post it on the DRBL forum."
This diff is collapsed.
#!/bin/bash
# drbl-run-parts - modified from Fedora 17's run-parts in crontabs package. License is GPLv2.
# The reason we do not use run-parts from Debian is people are always confused:
# http://drbl.org/faq/fine-print.php?path=./2_System/31_prerun_postrun_not_working.faq#31_prerun_postrun_not_working.faq
# keep going when something fails
set +e
if [ $# -lt 1 ]; then
echo "Usage: run-parts [--list | --test] <dir>"
exit 1
fi
while [ $# -gt 1 ]; do
case $1 in
--list)
list=1
shift
break
;;
--test)
test=1
shift
break
;;
--)
# -- end of options
shift
break
;;
*)
# directory
break
;;
esac
done
if [ ! -d $1 ]; then
echo "Not a directory: $1"
exit 1
fi
# Ignore *~ and *, scripts
for i in $(LC_ALL=C; echo ${1%/}/*[^~,]) ; do
[ -d $i ] && continue
if [ -e $i ]; then
if [ -x $i ]; then
# run executable files
$i
fi
fi
done
exit 0
#!/usr/bin/perl -w
#
# $Id: drbl-wakeonlan,v 1.1 2008-05-13 15:10:41 c00jhs00 Exp $
#
#########################################################################
# download from
# http://gsd.di.uminho.pt/jpo/software/wakeonlan/
# http://gsd.di.uminho.pt/jpo/software/wakeonlan/downloads/wakeonlan-0.41.tar.gz
#
# Copyright (c) 2000-2002 Jos\x{00E9} Pedro Oliveira.
# This is free software. You may modify it and distribute it under Perl's Artistic License. Modified versions must be clearly indicated.
# Jos Pedro Oliveira <jpo at di.uminho.pt>
#########################################################################
use strict;
use Socket;
use Getopt::Std;
use vars qw($VERSION $opt_v $opt_h $opt_i $opt_p $opt_f);
$VERSION = '0.41';
my $DEFAULT_IP = '255.255.255.255';
my $DEFAULT_PORT = getservbyname('discard', 'udp');
#
# Process the command line
#
getopts("hvp:i:f:");
if ($opt_h) { usage(); exit(0); }
if ($opt_v) { print "wakeonlan version $VERSION\n"; exit(0); }
if (!$opt_f and !@ARGV) { usage(); exit(0); }
if ($opt_i) { $DEFAULT_IP = $opt_i; } # override default value
if ($opt_p) { $DEFAULT_PORT = $opt_p; } # override default value
if ($opt_f) { process_file($opt_f); }
# The rest of the command line is a list of hardware addresses
foreach (@ARGV) {
wake($_, $opt_i, $opt_p);
}
#
# wake
#
# The 'magic packet' consists of 6 times 0xFF followed by 16 times
# the hardware address of the NIC. This sequence can be encapsulated
# in any kind of packet, in this case an UDP packet targeted at the
# discard port (9).
#
sub wake
{
my $hwaddr = shift;
my $ipaddr = shift || $DEFAULT_IP;
my $port = shift || $DEFAULT_PORT;
my ($raddr, $them, $proto);
my ($hwaddr_re, $pkt);
# Validate hardware address (ethernet address)
$hwaddr_re = join(':', ('[0-9A-Fa-f]{1,2}') x 6);
if ($hwaddr !~ m/^$hwaddr_re$/) {
warn "Invalid hardware address: $hwaddr\n";
return undef;
}
# Generate magic sequence
foreach (split /:/, $hwaddr) {
$pkt .= chr(hex($_));
}
$pkt = chr(0xFF) x 6 . $pkt x 16;
# Allocate socket and send packet
$raddr = gethostbyname($ipaddr);
$them = pack_sockaddr_in($port, $raddr);
$proto = getprotobyname('udp');
socket(S, AF_INET, SOCK_DGRAM, $proto) or die "socket : $!";
setsockopt(S, SOL_SOCKET, SO_BROADCAST, 1) or die "setsockopt : $!";
print "Sending magic packet to $ipaddr:$port with $hwaddr\n";
send(S, $pkt, 0, $them) or die "send : $!";
close S;
}
#
# process_file
#
sub process_file {
my $filename = shift;
my ($hwaddr, $ipaddr, $port);
open (F, "<$filename") or die "open : $!";
while(<F>) {
next if /^\s*#/; # ignore comments
next if /^\s*$/; # ignore empty lines
chomp;
($hwaddr, $ipaddr, $port) = split;
wake($hwaddr, $ipaddr, $port);
}
close F;
}
#
# Usage
#
sub usage {
print <<__USAGE__;
Usage
wakeonlan [-h] [-v] [-i IP_address] [-p port] [-f file] [[hardware_address] ...]
Options
-h
this information
-v
displays the script version
-i ip_address
set the destination IP address
default: 255.255.255.255 (the limited broadcast address)
-p port
set the destination port
default: 9 (the discard port)
-f file
uses file as a source of hardware addresses
See also
wakeonlan(1)
__USAGE__
}
__END__
# Script documentation
=head1 NAME
wakeonlan - Perl script to wake up computers
=head1 SYNOPSIS
wakeonlan [-h] [-v] [-i IP_address] [-p port] [-f file] [[hardware_address] ...]
=head1 DESCRIPTION
This script sends 'magic packets' to wake-on-lan enabled ethernet adapters and motherboards, in order to switch on the called PC. Be sure to connect the NIC with the motherboard if neccesary, and enable the WOL function in the BIOS.
The 'magic packet' consists of 6 times 0xFF followed by 16 times the hardware address of the NIC. This sequence can be encapsulated in any kind of packet. This script uses UDP packets.
=head1 OPTIONS
=over
=item B<-h>
Displays the help information.
=item B<-v>
Displays the script version.
=item B<-i ip_address>
Destination IP address. Unless you have static ARP tables you should
use some kind of broadcast address (the broadcast address of the network where the computer resides or the limited broadcast address). Default: 255.255.255.255 (the limited broadcast address).
=item B<-p port>
Destination port. Default: 9 (the discard port).
=item B<-f file>
File with hardware addresses of wakeable computers. For an example check
the file lab001.wol in the examples subdirectory.
=back
=head1 EXAMPLES
Using the limited broadcast address (255.255.255.255):
$ wakeonlan 01:02:03:04:05:06
$ wakeonlan 01:02:03:04:05:06 01:02:03:04:05:07
Using a subnet broadcast address:
$ wakeonlan -i 192.168.1.255 01:02:03:04:05:06
Using another destination port:
$ wakeonlan -i 192.168.1.255 -p 1234 01:02:03:04:05:06
Using a file as source of hardware and IP addresses:
$ wakeonlan -f examples/lab001.wol
$ wakeonlan -f examples/lab001.wol 01:02:03:04:05:06
=head1 AUTHOR
Jos Pedro Oliveira <jpo@di.uminho.pt> maintaining and expanding original work done by Ico Doornekamp <ico@edd.dhs.org>.
=head1 COPYRIGHT
Copyright (c) 2000-2005 Jos Pedro Oliveira.
This is free software. You may modify it and distribute it under Perl's Artistic Licence. Modified versions must be clearly indicated.
=head1 SEE ALSO
For more information regarding this script and Wakeonlan technology just check the following address http://gsd.di.uminho.pt/jpo/software/wakeonlan/.
=cut
#!/bin/bash
# Author: Steven Shiau <steven _at_ nchc org tw>
# License: GPL
# This file should be in /usr/bin/, not in /usr/share/drbl, so drblpush can call it in the beginning.
export LC_ALL=C
# Source DRBL setting
DRBL_SCRIPT_PATH="${DRBL_SCRIPT_PATH:-/usr/share/drbl}"
. /etc/drbl/drbl.conf
wanted=$1
eval return_var=\$$wanted
[ -n "$return_var" ] && echo $return_var
# DRBL clients HOST- ACCOUNT- PASSWD Mapping
# The format is:
# ---------------------
# "hostname" "auto-login account" "passwd for this account"
# ---------------------
# List them line by line, edit this before you run "drblpush -i".
# *******NOTE********
# 1. The hostname must be unique! Do NOT duplicate them.
# 2. Random password would be assigned if 3th field is empty (as the example 3)
#
# Example:
# host-01 autouser-01 passw111
# host-02 autouser-01 passwd222
# cust-host-03 random-passwd-account
# This file is for DRBL client to append specific mount point in fstab
# Yo can put local device to be mounted in this file
# The mount point will be created by drblpush.
# The format is just like /etc/fstab
# Ex:
# /dev/hda1 /work1 ext3 defaults 1 2
# In the example,
# (1) A dir /tftpboot/node_root/work1 will be created in drbl server.
# (2) This line will be appended to client's /etc/fstab
#
# NOTE! NOTE! NOTE! NOTE! NOTE! NOTE! NOTE! NOTE!
# NOTE! You have to create the partition table and format the partition by yourself.
# You can put the extra service you want client to run, put them in one line.
# The necessary services (nfs, firstboot, xfs...) for DRBL client are already
# specified in the drblpush, so you do not have to add them.
# Example:
# service_extra_added="webmin apmd"
#
service_extra_added=""
# DRBL clients IP-Address HOSTNAME Mapping
# The format is:
# ---------------------
# IP-Address Hostname
# ---------------------
# List them line by line, edit this before you run "drblpush -i".
# *******NOTE********
# 1. The hostname must be unique! Do NOT duplicate them.
# 2. For IP address format, do NOT use something like 192.168.001.010,
# use 192.168.1.10, i.e. do NOT put extra "0" for IP address digits.
# 3. If some client you do not assign here, drblpush will automatically
# create one for you. It is based on the prefix you assing when
# running "drblpush -i"
# 4. Host names may contain only alphanumeric characters, minus signs ("-"),
# and periods ("."). They must begin with an alphabetic character and end
# with an alphanumeric character. "man hosts" for more details.
# 5. This hostname is not FQDN (Fully Qualified Domain Name), it's just Unix hostname
#
# Example:
# 192.168.1.1 tux
# 192.168.51.1 forge
# 192.168.51.2 Tiger
# 192.168.1.10 Lion
# This file is for dcs (drbl-client-switch) user setting. Copy this file to your home directory and rename it as .dcsrc if you want to use it.
# 3 language options are available: