mirror of
https://github.com/vincentmli/bpfire.git
synced 2026-04-28 11:43:25 +02:00
ExtraHD! Die Erweiterung um Festplatten schnell einzubinden!
git-svn-id: http://svn.ipfire.org/svn/ipfire/trunk@420 ea5c0bd1-69bd-2848-81d8-4f18e57aeed8
This commit is contained in:
80
config/extrahd/extrahd.pl
Normal file
80
config/extrahd/extrahd.pl
Normal file
@@ -0,0 +1,80 @@
|
|||||||
|
#!/usr/bin/perl
|
||||||
|
#
|
||||||
|
# IPFire Scripts
|
||||||
|
#
|
||||||
|
# This code is distributed under the terms of the GPL
|
||||||
|
#
|
||||||
|
# (c) The IPFire Team
|
||||||
|
#
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
# enable only the following on debugging purpose
|
||||||
|
# use warnings;
|
||||||
|
|
||||||
|
require '/var/ipfire/general-functions.pl';
|
||||||
|
require "${General::swroot}/lang.pl";
|
||||||
|
require "${General::swroot}/header.pl";
|
||||||
|
|
||||||
|
my %extrahdsettings = ();
|
||||||
|
my $ok = "true";
|
||||||
|
my @devices = ();
|
||||||
|
my @deviceline = ();
|
||||||
|
my $deviceentry = "";
|
||||||
|
my $devicefile = "/var/ipfire/extrahd/devices";
|
||||||
|
my $fstab = "/var/ipfire/extrahd/fstab";
|
||||||
|
|
||||||
|
### Values that have to be initialized
|
||||||
|
$extrahdsettings{'PATH'} = '';
|
||||||
|
$extrahdsettings{'FS'} = '';
|
||||||
|
$extrahdsettings{'DEVICE'} = '';
|
||||||
|
$extrahdsettings{'ACTION'} = '';
|
||||||
|
|
||||||
|
open( FILE, "< $devicefile" ) or die "Unable to read $devicefile";
|
||||||
|
@devices = <FILE>;
|
||||||
|
close FILE;
|
||||||
|
|
||||||
|
############################################################################################################################
|
||||||
|
############################################################################################################################
|
||||||
|
|
||||||
|
print "$ARGV[0] $ARGV[1]";
|
||||||
|
|
||||||
|
if ( "$ARGV[0]" eq "mount" ) {
|
||||||
|
system("/bin/cp -f /etc/fstab $fstab");
|
||||||
|
|
||||||
|
foreach $deviceentry (sort @devices)
|
||||||
|
{
|
||||||
|
@deviceline = split( /\;/, $deviceentry );
|
||||||
|
if ( "$ARGV[1]" eq "$deviceline[2]" ) {
|
||||||
|
print "Insert /dev/$deviceline[0] ($deviceline[1]) --> $deviceline[2] into /etc/fstab!\n";
|
||||||
|
unless ( -d $deviceline[2] ) { system("/bin/mkdir -p $deviceline[2] && chmod 0777 $deviceline[2]"); }
|
||||||
|
open(FILE, ">>$fstab");
|
||||||
|
print FILE "/dev/$deviceline[0]\t$deviceline[2]\t$deviceline[1]\tdefaults\t0\t0\n";
|
||||||
|
close(FILE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
system("/bin/cp -f $fstab /etc/fstab");
|
||||||
|
if ( `/bin/mount -a` ) {
|
||||||
|
exit(0);
|
||||||
|
} else {
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
} elsif ( "$ARGV[0]" eq "umount" ) {
|
||||||
|
system("/bin/umount $ARGV[1]");
|
||||||
|
if ( ! `/bin/mount | /bin/fgrep $ARGV[1]` ) {
|
||||||
|
system("/bin/cp -f /etc/fstab $fstab");
|
||||||
|
system("/bin/fgrep -v $ARGV[1] <$fstab >/etc/fstab");
|
||||||
|
print "Succesfully umounted $ARGV[1].\n";
|
||||||
|
exit(0);
|
||||||
|
} else {
|
||||||
|
print "Can't umount $ARGV[1].\n";
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
print "Usage: $0 (mount|umount) mountpoint\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
############################################################################################################################
|
||||||
|
############################################################################################################################
|
||||||
@@ -30,3 +30,8 @@
|
|||||||
'uri' => '/cgi-bin/ids.cgi',
|
'uri' => '/cgi-bin/ids.cgi',
|
||||||
'title' => "$tr{'intrusion detection system'}",
|
'title' => "$tr{'intrusion detection system'}",
|
||||||
};
|
};
|
||||||
|
$subservices->{'70.extrahd'} = {'caption' => "ExtraHD"},
|
||||||
|
'enabled' => 1,
|
||||||
|
'uri' => '/cgi-bin/extrahd.cgi',
|
||||||
|
'title' => "ExtraHD",
|
||||||
|
};
|
||||||
226
html/cgi-bin/extrahd.cgi
Normal file
226
html/cgi-bin/extrahd.cgi
Normal file
@@ -0,0 +1,226 @@
|
|||||||
|
#!/usr/bin/perl
|
||||||
|
#
|
||||||
|
# IPFire CGIs
|
||||||
|
#
|
||||||
|
# This code is distributed under the terms of the GPL
|
||||||
|
#
|
||||||
|
# (c) The IPFire Team
|
||||||
|
#
|
||||||
|
|
||||||
|
use strict;
|
||||||
|
# enable only the following on debugging purpose
|
||||||
|
use warnings;
|
||||||
|
use CGI::Carp 'fatalsToBrowser';
|
||||||
|
|
||||||
|
require '/var/ipfire/general-functions.pl';
|
||||||
|
require "${General::swroot}/lang.pl";
|
||||||
|
require "${General::swroot}/header.pl";
|
||||||
|
|
||||||
|
my %extrahdsettings = ();
|
||||||
|
my $message = "";
|
||||||
|
my $errormessage = "";
|
||||||
|
my $size = "";
|
||||||
|
my $ok = "true";
|
||||||
|
my @tmp = ();
|
||||||
|
my @tmpline = ();
|
||||||
|
my $tmpentry = "";
|
||||||
|
my @devices = ();
|
||||||
|
my @deviceline = ();
|
||||||
|
my $deviceentry = "";
|
||||||
|
my @scans = ();
|
||||||
|
my @scanline = ();
|
||||||
|
my $scanentry = "";
|
||||||
|
my @partitions = ();
|
||||||
|
my @partitionline = ();
|
||||||
|
my $partitionentry = "";
|
||||||
|
my $devicefile = "/var/ipfire/extrahd/devices";
|
||||||
|
my $scanfile = "/var/ipfire/extrahd/scan";
|
||||||
|
my $partitionsfile = "/var/ipfire/extrahd/partitions";
|
||||||
|
system("/usr/local/bin/scanhd ide");
|
||||||
|
system("/usr/local/bin/scanhd partitions");
|
||||||
|
|
||||||
|
&Header::showhttpheaders();
|
||||||
|
|
||||||
|
### Values that have to be initialized
|
||||||
|
$extrahdsettings{'PATH'} = '';
|
||||||
|
$extrahdsettings{'FS'} = '';
|
||||||
|
$extrahdsettings{'DEVICE'} = '';
|
||||||
|
$extrahdsettings{'ACTION'} = '';
|
||||||
|
|
||||||
|
&General::readhash("${General::swroot}/extrahd/settings", \%extrahdsettings);
|
||||||
|
&Header::getcgihash(\%extrahdsettings);
|
||||||
|
|
||||||
|
&Header::openpage('ExtraHD', 1, '');
|
||||||
|
&Header::openbigbox('100%', 'left', '', $errormessage);
|
||||||
|
|
||||||
|
############################################################################################################################
|
||||||
|
############################################################################################################################
|
||||||
|
|
||||||
|
if ($extrahdsettings{'ACTION'} eq $Lang::tr{'add'})
|
||||||
|
{
|
||||||
|
open( FILE, "< $devicefile" ) or die "Unable to read $devicefile";
|
||||||
|
@devices = <FILE>;
|
||||||
|
close FILE;
|
||||||
|
foreach $deviceentry (sort @devices)
|
||||||
|
{
|
||||||
|
@deviceline = split( /\;/, $deviceentry );
|
||||||
|
if ( "$extrahdsettings{'PATH'}" eq "$deviceline[2]" ) {
|
||||||
|
$ok = "false";
|
||||||
|
$errormessage = "You can't mount $extrahdsettings{'DEVICE'} to $extrahdsettings{'PATH'}, because there is already a device mounted.";
|
||||||
|
}
|
||||||
|
if ( "$extrahdsettings{'PATH'}" eq "/" ) {
|
||||||
|
$ok = "false";
|
||||||
|
$errormessage = "You can't mount $extrahdsettings{'DEVICE'} to root /.";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( "$ok" eq "true" ) {
|
||||||
|
open(FILE, ">> $devicefile" ) or die "Unable to write $devicefile";
|
||||||
|
print FILE <<END
|
||||||
|
$extrahdsettings{'DEVICE'};$extrahdsettings{'FS'};$extrahdsettings{'PATH'};
|
||||||
|
END
|
||||||
|
;
|
||||||
|
system("/usr/local/bin/extrahdctrl mount $extrahdsettings{'PATH'}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
elsif ($extrahdsettings{'ACTION'} eq $Lang::tr{'delete'})
|
||||||
|
{
|
||||||
|
if ( `/usr/local/bin/extrahdctrl umount $extrahdsettings{'PATH'}` ) {
|
||||||
|
open( FILE, "< $devicefile" ) or die "Unable to read $devicefile";
|
||||||
|
@tmp = <FILE>;
|
||||||
|
close FILE;
|
||||||
|
open( FILE, "> $devicefile" ) or die "Unable to write $devicefile";
|
||||||
|
foreach $deviceentry (sort @tmp)
|
||||||
|
{
|
||||||
|
@tmpline = split( /\;/, $deviceentry );
|
||||||
|
if ( $tmpline[2] ne $extrahdsettings{'PATH'} )
|
||||||
|
{
|
||||||
|
print FILE $deviceentry;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
close FILE;
|
||||||
|
} else {
|
||||||
|
$errormessage = "Can't umount $extrahdsettings{'PATH'}. Maybe the device is in use?";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($errormessage) {
|
||||||
|
&Header::openbox('100%', 'left', $Lang::tr{'error messages'});
|
||||||
|
print "<class name='base'>$errormessage\n";
|
||||||
|
print " </class>\n";
|
||||||
|
&Header::closebox();
|
||||||
|
}
|
||||||
|
|
||||||
|
############################################################################################################################
|
||||||
|
############################################################################################################################
|
||||||
|
|
||||||
|
&Header::openbox('100%', 'center', 'ExtraHD');
|
||||||
|
open( FILE, "< $devicefile" ) or die "Unable to read $devicefile";
|
||||||
|
@devices = <FILE>;
|
||||||
|
close FILE;
|
||||||
|
print <<END
|
||||||
|
<table border='0' width='600' cellspacing="0">
|
||||||
|
END
|
||||||
|
;
|
||||||
|
foreach $deviceentry (sort @devices)
|
||||||
|
{
|
||||||
|
@deviceline = split( /\;/, $deviceentry );
|
||||||
|
my $color="$Header::colourred";
|
||||||
|
if ( `/bin/mount | /bin/fgrep $deviceline[2] | /bin/fgrep /dev/$deviceline[0]` ) {
|
||||||
|
$color=$Header::colourgreen;
|
||||||
|
}
|
||||||
|
print <<END
|
||||||
|
<tr><td colspan="5">
|
||||||
|
<tr><td align='center'><font color=$color><b>/dev/$deviceline[0]</b></font>
|
||||||
|
<td align='center'>$deviceline[1]
|
||||||
|
<td align='center'>$deviceline[2]
|
||||||
|
<td align='center'>
|
||||||
|
<form method='post' action='$ENV{'SCRIPT_NAME'}'>
|
||||||
|
<input type='hidden' name='DEVICE' value='$deviceline[0]' />
|
||||||
|
<input type='hidden' name='FS' value='$deviceline[1]' />
|
||||||
|
<input type='hidden' name='PATH' value='$deviceline[2]' />
|
||||||
|
<input type='hidden' name='ACTION' value=$Lang::tr{'delete'} />
|
||||||
|
<input type='image' alt=$Lang::tr{'delete'} src='/images/delete.gif' />
|
||||||
|
</form>
|
||||||
|
END
|
||||||
|
;
|
||||||
|
}
|
||||||
|
print <<END
|
||||||
|
</table>
|
||||||
|
END
|
||||||
|
;
|
||||||
|
|
||||||
|
&Header::closebox();
|
||||||
|
|
||||||
|
&Header::openbox('100%', 'center', 'Gefundene Laufwerke');
|
||||||
|
print <<END
|
||||||
|
<table border='0' width='600' cellspacing="0">
|
||||||
|
END
|
||||||
|
;
|
||||||
|
open( FILE, "< $scanfile" ) or die "Unable to read $scanfile";
|
||||||
|
@scans = <FILE>;
|
||||||
|
close FILE;
|
||||||
|
open( FILE, "< $partitionsfile" ) or die "Unable to read $partitionsfile";
|
||||||
|
@partitions = <FILE>;
|
||||||
|
close FILE;
|
||||||
|
foreach $scanentry (sort @scans)
|
||||||
|
{
|
||||||
|
@scanline = split( /\;/, $scanentry );
|
||||||
|
print <<END
|
||||||
|
<tr><td colspan="5">
|
||||||
|
<tr><td align='center'><b>/dev/$scanline[0]</b>
|
||||||
|
<td align='center' colspan="2">$scanline[1]
|
||||||
|
END
|
||||||
|
;
|
||||||
|
foreach $partitionentry (sort @partitions)
|
||||||
|
{
|
||||||
|
@partitionline = split( /\;/, $partitionentry );
|
||||||
|
if ( "$partitionline[0]" eq "$scanline[0]" ) {
|
||||||
|
$size = int($partitionline[1] / 1024);
|
||||||
|
print <<END
|
||||||
|
<td align='center'>$Lang::tr{'size'} $size MB
|
||||||
|
<td>
|
||||||
|
<tr><td colspan="5">
|
||||||
|
END
|
||||||
|
;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach $partitionentry (sort @partitions)
|
||||||
|
{
|
||||||
|
@partitionline = split( /\;/, $partitionentry );
|
||||||
|
if (( "$partitionline[0]" =~ /^$scanline[0]/ ) && ! ( "$partitionline[0]" eq "$scanline[0]" )) {
|
||||||
|
$size = int($partitionline[1] / 1024);
|
||||||
|
print <<END
|
||||||
|
<form method='post' action='$ENV{'SCRIPT_NAME'}'>
|
||||||
|
<tr><td align="center" bgcolor='#EAEAEA'>/dev/$partitionline[0]
|
||||||
|
<td align="center" bgcolor='#EAEAEA'>$Lang::tr{'size'} $size MB
|
||||||
|
<td align='center' bgcolor='#EAEAEA'><select name="FS">
|
||||||
|
<option value="auto">auto</option>
|
||||||
|
<option value="ext3">ext3</option>
|
||||||
|
<option value="reiserfs">reiserfs</option>
|
||||||
|
<option value="vfat">fat</option>
|
||||||
|
<option value="ntfs-3g">ntfs (experimental)</option>
|
||||||
|
</select>
|
||||||
|
<td align="center" bgcolor='#EAEAEA'><input type='text' name='PATH' value=/mnt/harddisk />
|
||||||
|
<td align="center">
|
||||||
|
<input type='hidden' name='DEVICE' value='$partitionline[0]' />
|
||||||
|
<input type='hidden' name='ACTION' value=$Lang::tr{'add'} />
|
||||||
|
<input type='image' alt=$Lang::tr{'add'} src='/images/add.gif' />
|
||||||
|
</form>
|
||||||
|
|
||||||
|
END
|
||||||
|
;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
print <<END
|
||||||
|
<tr><td align="center" colspan="5">If your device isn't listed here, you need to install or load the driver.<br />If you can see your device but no partitions you have to create them first.
|
||||||
|
</table>
|
||||||
|
END
|
||||||
|
;
|
||||||
|
&Header::closebox();
|
||||||
|
|
||||||
|
&Header::closebigbox();
|
||||||
|
&Header::closepage();
|
||||||
@@ -53,7 +53,7 @@ $(TARGET) :
|
|||||||
|
|
||||||
# Create all directories
|
# Create all directories
|
||||||
for i in addon-lang alcatelusb auth backup ca certs cnx_pci connscheduler crls ddns dhcp dhcpc dmzholes \
|
for i in addon-lang alcatelusb auth backup ca certs cnx_pci connscheduler crls ddns dhcp dhcpc dmzholes \
|
||||||
eagle-usb eciadsl ethernet isdn key langs logging main mbmon menu.d modem net-traffic nfs optionsfw outgoing/bin patches pakfire portfw \
|
eagle-usb eciadsl ethernet extrahd/bin isdn key langs logging main mbmon menu.d modem net-traffic nfs optionsfw outgoing/bin patches pakfire portfw \
|
||||||
ppp private proxy/advanced qos/bin red remote snort time urlfilter/autoupdate urlfilter/bin upnp vpn wakeonlan wireless xtaccess ; do \
|
ppp private proxy/advanced qos/bin red remote snort time urlfilter/autoupdate urlfilter/bin upnp vpn wakeonlan wireless xtaccess ; do \
|
||||||
mkdir -p $(CONFIG_ROOT)/$$i; \
|
mkdir -p $(CONFIG_ROOT)/$$i; \
|
||||||
done
|
done
|
||||||
@@ -62,6 +62,7 @@ $(TARGET) :
|
|||||||
for i in auth/users backup/include.user backup/exclude.user \
|
for i in auth/users backup/include.user backup/exclude.user \
|
||||||
certs/index.txt ddns/config ddns/noipsettings ddns/settings ddns/ipcache dhcp/settings \
|
certs/index.txt ddns/config ddns/noipsettings ddns/settings ddns/ipcache dhcp/settings \
|
||||||
dhcp/fixleases dhcp/advoptions dmzholes/config ethernet/aliases ethernet/settings \
|
dhcp/fixleases dhcp/advoptions dmzholes/config ethernet/aliases ethernet/settings \
|
||||||
|
extrahd/scan extrahd/devices extrahd/partitions extrahd/settings
|
||||||
isdn/settings main/hosts main/settings optionsfw/settings outgoing/settings outgoing/rules pakfire/settings \
|
isdn/settings main/hosts main/settings optionsfw/settings outgoing/settings outgoing/rules pakfire/settings \
|
||||||
portfw/config ppp/settings-1 ppp/settings-2 ppp/settings-3 ppp/settings-4 \
|
portfw/config ppp/settings-1 ppp/settings-2 ppp/settings-3 ppp/settings-4 \
|
||||||
ppp/settings-5 ppp/settings proxy/settings proxy/advanced/settings remote/settings qos/settings qos/classes qos/subclasses qos/level7config qos/portconfig \
|
ppp/settings-5 ppp/settings proxy/settings proxy/advanced/settings remote/settings qos/settings qos/classes qos/subclasses qos/level7config qos/portconfig \
|
||||||
@@ -81,6 +82,7 @@ $(TARGET) :
|
|||||||
cp $(DIR_SRC)/config/cfgroot/backup-exclude.hardware $(CONFIG_ROOT)/backup/exclude.hardware
|
cp $(DIR_SRC)/config/cfgroot/backup-exclude.hardware $(CONFIG_ROOT)/backup/exclude.hardware
|
||||||
cp $(DIR_SRC)/config/cfgroot/connscheduler-lib.pl $(CONFIG_ROOT)/connscheduler/lib.pl
|
cp $(DIR_SRC)/config/cfgroot/connscheduler-lib.pl $(CONFIG_ROOT)/connscheduler/lib.pl
|
||||||
cp $(DIR_SRC)/config/cfgroot/connscheduler.conf $(CONFIG_ROOT)/connscheduler
|
cp $(DIR_SRC)/config/cfgroot/connscheduler.conf $(CONFIG_ROOT)/connscheduler
|
||||||
|
cp $(DIR_SRC)/config/extrahd/* $(CONFIG_ROOT)/extrahd/bin/
|
||||||
cp $(DIR_SRC)/config/cfgroot/mbmon-settings $(CONFIG_ROOT)/mbmon/settings
|
cp $(DIR_SRC)/config/cfgroot/mbmon-settings $(CONFIG_ROOT)/mbmon/settings
|
||||||
cp $(DIR_SRC)/config/menu/* $(CONFIG_ROOT)/menu.d/
|
cp $(DIR_SRC)/config/menu/* $(CONFIG_ROOT)/menu.d/
|
||||||
cp $(DIR_SRC)/config/cfgroot/modem-defaults $(CONFIG_ROOT)/modem/defaults
|
cp $(DIR_SRC)/config/cfgroot/modem-defaults $(CONFIG_ROOT)/modem/defaults
|
||||||
|
|||||||
2
make.sh
2
make.sh
@@ -582,7 +582,7 @@ buildpackages() {
|
|||||||
for i in $IPFVER
|
for i in $IPFVER
|
||||||
do
|
do
|
||||||
if [ $i == "devel" ]; then
|
if [ $i == "devel" ]; then
|
||||||
if [ ! -f ipfire-$VER.i586-devel.iso ]; then
|
if [ ! -e ipfire-$VERSION.i586-devel.iso ]; then
|
||||||
ipfiremake cdrom ED=$i
|
ipfiremake cdrom ED=$i
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -191,7 +191,7 @@ int main(int argc, char *argv[])
|
|||||||
int cdmounted = 0; /* Loop flag for inserting a cd. */
|
int cdmounted = 0; /* Loop flag for inserting a cd. */
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
char commandstring[STRING_SIZE];
|
char commandstring[STRING_SIZE];
|
||||||
char *installtypes[] = { "CDROM", "HTTP/FTP", NULL };
|
char *installtypes[] = { "CDROM/USB", "HTTP/FTP", NULL };
|
||||||
int installtype = CDROM_INSTALL;
|
int installtype = CDROM_INSTALL;
|
||||||
char insertmessage[STRING_SIZE];
|
char insertmessage[STRING_SIZE];
|
||||||
char insertdevnode[STRING_SIZE];
|
char insertdevnode[STRING_SIZE];
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ SUID_PROGS = setdmzholes setportfw setfilters setxtaccess restartdhcp restartsno
|
|||||||
restartapplejuice setdate rebuildhosts \
|
restartapplejuice setdate rebuildhosts \
|
||||||
restartsyslogd logwatch openvpnctrl timecheckctrl \
|
restartsyslogd logwatch openvpnctrl timecheckctrl \
|
||||||
restartwireless getipstat qosctrl launch-ether-wake \
|
restartwireless getipstat qosctrl launch-ether-wake \
|
||||||
redctrl
|
redctrl extrahdctrl
|
||||||
|
|
||||||
install : all
|
install : all
|
||||||
install -m 755 $(PROGS) /usr/local/bin
|
install -m 755 $(PROGS) /usr/local/bin
|
||||||
@@ -46,6 +46,9 @@ qosctrl: qosctrl.c setuid.o ../install+setup/libsmooth/varval.o
|
|||||||
redctrl: redctrl.c setuid.o ../install+setup/libsmooth/varval.o
|
redctrl: redctrl.c setuid.o ../install+setup/libsmooth/varval.o
|
||||||
$(COMPILE) -I../install+setup/libsmooth/ redctrl.c setuid.o ../install+setup/libsmooth/varval.o -o $@
|
$(COMPILE) -I../install+setup/libsmooth/ redctrl.c setuid.o ../install+setup/libsmooth/varval.o -o $@
|
||||||
|
|
||||||
|
extrahdctrl: extrahdctrl.c setuid.o ../install+setup/libsmooth/varval.o
|
||||||
|
$(COMPILE) -I../install+setup/libsmooth/ extrahdctrl.c setuid.o ../install+setup/libsmooth/varval.o -o $@
|
||||||
|
|
||||||
launch-ether-wake: launch-ether-wake.c setuid.o ../install+setup/libsmooth/varval.o
|
launch-ether-wake: launch-ether-wake.c setuid.o ../install+setup/libsmooth/varval.o
|
||||||
$(COMPILE) -I../install+setup/libsmooth/ launch-ether-wake.c setuid.o ../install+setup/libsmooth/varval.o -o $@
|
$(COMPILE) -I../install+setup/libsmooth/ launch-ether-wake.c setuid.o ../install+setup/libsmooth/varval.o -o $@
|
||||||
|
|
||||||
|
|||||||
25
src/misc-progs/extrahdctrl.c
Normal file
25
src/misc-progs/extrahdctrl.c
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
/* This file is part of the IPFire Firewall.
|
||||||
|
*
|
||||||
|
* This program is distributed under the terms of the GNU General Public
|
||||||
|
* Licence. See the file COPYING for details.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include "setuid.h"
|
||||||
|
|
||||||
|
int main(int argc, char *argv[]) {
|
||||||
|
|
||||||
|
char command[512];
|
||||||
|
if (!(initsetuid()))
|
||||||
|
exit(1);
|
||||||
|
|
||||||
|
snprintf(command, 512, "/var/ipfire/extrahd/bin/extrahd.pl %s %s", argv[1], argv[2]);
|
||||||
|
safe_system("chmod 755 /var/ipfire/extrahd/bin/extrahd.pl 2>&1 >/dev/null");
|
||||||
|
safe_system(command);
|
||||||
|
}
|
||||||
13
src/scripts/scanhd
Normal file
13
src/scripts/scanhd
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
case "$1" in
|
||||||
|
ide)
|
||||||
|
/sbin/kudzu -qps -c HD | egrep "desc|device" | awk -F': ' '{print $2}' | sed -e '/"$/a\\' -e "s/$/\;/g" | tr "\n" "XX" | sed -e "s/XX/\n/g" -e "s/\;X/\;/g" > /var/ipfire/extrahd/scan
|
||||||
|
;;
|
||||||
|
partitions)
|
||||||
|
cat /proc/partitions | awk '{print $4 ";" $3 ";"}' | grep -v name | grep -v "^;;$" > /var/ipfire/extrahd/partitions
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Usage: $0 (ide|partitions)"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
Reference in New Issue
Block a user