/dev/null;if=$1;bs=1;count=11;skip=43;|;dd;2>/dev/null;of=$TMPFILE; printf;>>$TXTFILE;"0s;:;%sn";"Volu。Linux 和 Windows 共享交换区( 二 )。" />

Linux 和 Windows 共享交换区( 二 )


"nCan"t;find;a;FAT16;filesystem;on;$1";14;60;
exit;2;
fi;

#;get;volume;label;in;boot;sector;
dd;2>/dev/null;if=$1;bs=1;count=11;skip=43;|;dd;2>/dev/null;of=$TMPFILE;
printf;>>$TXTFILE;"0s;:;%sn";"Volume;label;in;boot;sector";"`cat
$TMPFILE`";

#;get;Sector;size;
dd;2>/dev/null;if=$1;bs=1;count=2;skip=11|;od;-An;-tdS;|;dd;2>/dev/null
of=$TMPFILE;
printf;>>$TXTFILE;"0s;:;%dn";"Sector;size";`cat;$TMPFILE`;
sector_size=`cat;$TMPFILE`;


#;get;Reserved;sectors;
dd;2>/dev/null;if=$1;bs=1;count=2;skip=14|;od;-An;-tdS;|;dd;2>/dev/null
of=$TMPFILE;
printf;>>$TXTFILE;"0s;:;%dn";";Reserved;sectors";`cat;$TMPFILE`;
reserved_sectors=`cat;$TMPFILE`;


#;get;FAT;sectors;
dd;2>/dev/null;if=$1;bs=1;count=1;skip=16|;od;-An;-tdS;|;dd;2>/dev/null
of=$TMPFILE;
fat_count=`cat;$TMPFILE`;

dd;2>/dev/null;if=$1;bs=1;count=2;skip=22|;od;-An;-tdS;|;dd;2>/dev/null
of=$TMPFILE;
sectors_per_fat=`cat;$TMPFILE`;

#;calculate;the;no;of;sectors;allocated;for;FAT"s;
let;fat_sectors=fat_count*sectors_per_fat;

printf;>>$TXTFILE;"0s;:;\u;(\u;x;\u);n";"FAT;sectors";"$fat_sectors"
"$fat_count";"$sectors_per_fat";


#;get;root;directory;sectors;
dd;2>/dev/null;if=$1;bs=1;count=2;skip=17|;od;-An;-tdS;|;dd;2>/dev/null
of=$TMPFILE;
root_sectors=`cat;$TMPFILE`;

#;calculate;the;no;of;sectors;allocated;for;root;directory;
let;root_sectors=root_sectors*32/sector_size;

printf;>>$TXTFILE;"0s;:;\un";"Root;directory;sectors";"$root_sectors";


#;get;Total;special;sectors;
let;total=reserved_sectors fat_sectors root_sectors;
printf;>>$TXTFILE;"0s;:;\un";"Total;special;sectors";"$total";

#;display;the;information;in;a;message;box;
dialog;--title;"Boot;sector;of;$1";--backtitle;"$back_title";--msgbox
"`cat;$TXTFILE`";14;60;

#;delete;temporary;files;
rm;-f;$TMPFILE;
rm;-f;$TXTFILE;

#;end;of;msinfo.sh;

2.;swapinit.sh;
#!/bin/sh;
#;
#;/etc/rc.d/init.d/swapinit.sh;-;activate;the;swap;partition;
#;
#;written;by;Rahul;U.;Joshi;
#;Verify;and;initialize;swap;space;
#;

echo;-n;"Verifying;swap;space...;";

loopcount=0;

#;flag;to;indicate;whether;the;partition;has;been;activated;or;not;
activated=0;

#;check;for;signatures;6;times;before;giving;up;
while;[;$loopcount;-lt;6;];
do;
if;[;"`/bin/dd;2>/dev/null;if=/dev/winswap;bs=1;count=10;skip=4086`";=
"SWAPSPACE2";];;then;

echo;"Linux;signature;found,;iteration;$loopcount";
echo;"Activating;swap;partitions";
swapon;/dev/winswap;
activated=1;
break;

elif;[;"`/bin/dd;2>/dev/null;if=/dev/winswap;bs=1;count=5;skip=54`";=
"FAT16";];;then;
echo;"DOS;signature;found,;iteration;$loopcount";
echo;"Making;swap;partition";
mkswap;/dev/winswap;377496;
echo;"Activating;swap;partitions";
swapon;/dev/winswap;
activated=1;
break;

else;
let;loopcount=loopcount 1;
fi;

done;


if;[;$activated;-ne;1;];;;then;
echo;"Swap;signature;not;found;after;$loopcount;tries";
echo;"No;swapping;partitions;activated";
exit;1;
fi;

3.;swaphalt.sh;
#!/bin/sh;
#;
#;/etc/rc.d/init.d/swapinit.sh;-;activate;the;swap;partition;
#;
#;written;by;Rahul;U.;Joshi;
#;Verify;and;initialize;swap;space;
#;

echo;-n;"Verifying;swap;space...;";

loopcount=0;

#;flag;to;indicate;whether;the;partition;has;been;activated;or;not;
activated=0;

#;check;for;signatures;6;times;before;giving;up;
while;[;$loopcount;-lt;6;];
do;
if;[;"`/bin/dd;2>/dev/null;if=/dev/winswap;bs=1;count=10;skip=4086`";=
"SWAPSPACE2";];;then;

echo;"Linux;signature;found,;iteration;$loopcount";
echo;"Activating;swap;partitions";
swapon;/dev/winswap;
activated=1;
break;

elif;[;"`/bin/dd;2>/dev/null;if=/dev/winswap;bs=1;count=5;skip=54`";=
"FAT16";];;then;
echo;"DOS;signature;found,;iteration;$loopcount";

推荐阅读