diff options
author | Scott Ullrich <sullrich@pfsense.org> | 2010-05-22 20:43:01 -0400 |
---|---|---|
committer | Scott Ullrich <sullrich@pfsense.org> | 2010-05-22 20:43:01 -0400 |
commit | ff161129ab87735eccc2ffba61db977ff4d4cd8c (patch) | |
tree | c7b2ba2de39bc4e398b0a93c1b666a485b9f5daa /PCBSD/pc-sysinstall/backend-query | |
parent | 4e9203174a2172e2321839b1a59bcbde0ebf8f24 (diff) | |
download | pfsense-ff161129ab87735eccc2ffba61db977ff4d4cd8c.zip pfsense-ff161129ab87735eccc2ffba61db977ff4d4cd8c.tar.gz |
Adding pc-sysinstall so that I can start experimenting with a php based installer. This is necssary because PCBSD must live in the root of the disk and there is no way to include it in a unionfs. By default it will not be copied to a new hard disk installation.
Diffstat (limited to 'PCBSD/pc-sysinstall/backend-query')
62 files changed, 2108 insertions, 0 deletions
diff --git a/PCBSD/pc-sysinstall/backend-query/.svn/entries b/PCBSD/pc-sysinstall/backend-query/.svn/entries new file mode 100644 index 0000000..1d2ea30 --- /dev/null +++ b/PCBSD/pc-sysinstall/backend-query/.svn/entries @@ -0,0 +1,708 @@ +10 + +dir +6759 +svn://svn.pcbsd.org/pcbsd/current/pc-sysinstall/backend-query +svn://svn.pcbsd.org + + + +2010-05-19T15:53:43.658786Z +6745 +kris + + + + + + + + + + + + + + +212fe199-4beb-da11-a70e-00e08102fd27 + +query-langs.sh +file + + + + +2010-05-23T00:20:49.000000Z +3bcc757592871aa1aaf6f3d954b98f82 +2009-10-07T19:49:26.064302Z +4603 +kris +has-props + + + + + + + + + + + + + + + + + + + + +62 + +detect-vmware.sh +file + + + + +2010-05-23T00:20:49.000000Z +0561c61c16dc42b87f502eaea614207f +2009-07-09T18:57:31.007874Z +4206 +kris +has-props + + + + + + + + + + + + + + + + + + + + +154 + +test-netup.sh +file + + + + +2010-05-23T00:20:49.000000Z +58211165da0e9f63f239830fa04839b1 +2009-11-13T01:20:07.446403Z +4987 +kris +has-props + + + + + + + + + + + + + + + + + + + + +499 + +xkeyboard-models.sh +file + + + + +2010-05-23T00:20:49.000000Z +d870a898806a1fce1657ed67c56abe47 +2010-02-18T21:04:33.090720Z +6275 +kris +has-props + + + + + + + + + + + + + + + + + + + + +585 + +enable-net.sh +file + + + + +2010-05-23T00:20:49.000000Z +9425af03a0bd26036a7b0ba56a3ea62d +2010-04-26T13:39:59.440346Z +6589 +kris +has-props + + + + + + + + + + + + + + + + + + + + +789 + +test-live.sh +file + + + + +2010-05-23T00:20:49.000000Z +1c52843a04eca3510ab24d26e60e9828 +2009-11-04T17:58:14.335537Z +4868 +kris +has-props + + + + + + + + + + + + + + + + + + + + +315 + +xkeyboard-variants.sh +file + + + + +2010-05-23T00:20:49.000000Z +71cac092f572af1c6506e17b8f4a072c +2009-08-13T17:35:25.800191Z +4327 +kris +has-props + + + + + + + + + + + + + + + + + + + + +501 + +disk-info.sh +file + + + + +2010-05-23T00:20:49.000000Z +78ec4b3d543c261f5ccbf2844e8eecd2 +2010-05-16T18:52:47.285311Z +6724 +kris +has-props + + + + + + + + + + + + + + + + + + + + +830 + +xkeyboard-layouts.sh +file + + + + +2010-05-23T00:20:49.000000Z +29bf5c99439499dfa4991ae42e0ec28c +2009-08-13T17:35:25.800191Z +4327 +kris +has-props + + + + + + + + + + + + + + + + + + + + +499 + +sys-mem.sh +file + + + + +2010-05-23T00:20:49.000000Z +8cb23015f16b5ded6916a6cb54a5beb9 +2009-11-19T21:08:33.521287Z +5094 +kris +has-props + + + + + + + + + + + + + + + + + + + + +117 + +send-logs.sh +file + + + + +2010-05-23T00:20:49.000000Z +79540df57cdab844730bafd90bc5d9ff +2010-04-07T16:05:18.981194Z +6521 +kris +has-props + + + + + + + + + + + + + + + + + + + + +1364 + +list-tzones.sh +file + + + + +2010-05-23T00:20:49.000000Z +a9a1d730fff2e97f6d2495a110265554 +2009-11-24T20:27:39.829718Z +5138 +kris +has-props + + + + + + + + + + + + + + + + + + + + +436 + +list-rsync-backups.sh +file + + + + +2010-05-23T00:20:49.000000Z +ad1419c38766a6aedb68e3e651f1bac7 +2010-04-06T22:49:12.599480Z +6517 +kris +has-props + + + + + + + + + + + + + + + + + + + + +980 + +list-components.sh +file + + + + +2010-05-23T00:20:49.000000Z +ce5a3d8f9e5bd98611ca7c70115adb3f +2010-01-13T20:56:14.439980Z +5997 +kris +has-props + + + + + + + + + + + + + + + + + + + + +729 + +disk-part.sh +file + + + + +2010-05-23T00:20:49.000000Z +ad28392754729c65ece91d3f465e7d31 +2010-05-16T18:52:47.285311Z +6724 +kris +has-props + + + + + + + + + + + + + + + + + + + + +2154 + +update-part-list.sh +file + + + + +2010-05-23T00:20:49.000000Z +1a5d703a44e51dc0dec1c626811efce0 +2010-05-19T15:53:43.658786Z +6745 +kris +has-props + + + + + + + + + + + + + + + + + + + + +1854 + +detect-nics.sh +file + + + + +2010-05-23T00:20:49.000000Z +ff5a9f5e02f2b909e28846786d2eebb4 +2009-12-08T21:27:43.712949Z +5488 +kris +has-props + + + + + + + + + + + + + + + + + + + + +401 + +disk-list.sh +file + + + + +2010-05-23T00:20:49.000000Z +4947a1ee7ead62f138643f1c51a5c22f +2010-05-18T14:01:16.376891Z +6733 +kris +has-props + + + + + + + + + + + + + + + + + + + + +692 + +setup-ssh-keys.sh +file + + + + +2010-05-23T00:20:49.000000Z +568df0d9a1e34ed042220b7882805559 +2009-11-12T17:28:32.178595Z +4973 +kris +has-props + + + + + + + + + + + + + + + + + + + + +953 + +detect-laptop.sh +file + + + + +2010-05-23T00:20:49.000000Z +b5e2ca171e221374acb517fdecd3c72f +2009-07-09T18:57:31.007874Z +4206 +kris +has-props + + + + + + + + + + + + + + + + + + + + +133 + diff --git a/PCBSD/pc-sysinstall/backend-query/.svn/lock b/PCBSD/pc-sysinstall/backend-query/.svn/lock new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/PCBSD/pc-sysinstall/backend-query/.svn/lock diff --git a/PCBSD/pc-sysinstall/backend-query/.svn/prop-base/detect-laptop.sh.svn-base b/PCBSD/pc-sysinstall/backend-query/.svn/prop-base/detect-laptop.sh.svn-base new file mode 100644 index 0000000..869ac71 --- /dev/null +++ b/PCBSD/pc-sysinstall/backend-query/.svn/prop-base/detect-laptop.sh.svn-base @@ -0,0 +1,5 @@ +K 14 +svn:executable +V 1 +* +END diff --git a/PCBSD/pc-sysinstall/backend-query/.svn/prop-base/detect-nics.sh.svn-base b/PCBSD/pc-sysinstall/backend-query/.svn/prop-base/detect-nics.sh.svn-base new file mode 100644 index 0000000..869ac71 --- /dev/null +++ b/PCBSD/pc-sysinstall/backend-query/.svn/prop-base/detect-nics.sh.svn-base @@ -0,0 +1,5 @@ +K 14 +svn:executable +V 1 +* +END diff --git a/PCBSD/pc-sysinstall/backend-query/.svn/prop-base/detect-vmware.sh.svn-base b/PCBSD/pc-sysinstall/backend-query/.svn/prop-base/detect-vmware.sh.svn-base new file mode 100644 index 0000000..869ac71 --- /dev/null +++ b/PCBSD/pc-sysinstall/backend-query/.svn/prop-base/detect-vmware.sh.svn-base @@ -0,0 +1,5 @@ +K 14 +svn:executable +V 1 +* +END diff --git a/PCBSD/pc-sysinstall/backend-query/.svn/prop-base/disk-info.sh.svn-base b/PCBSD/pc-sysinstall/backend-query/.svn/prop-base/disk-info.sh.svn-base new file mode 100644 index 0000000..869ac71 --- /dev/null +++ b/PCBSD/pc-sysinstall/backend-query/.svn/prop-base/disk-info.sh.svn-base @@ -0,0 +1,5 @@ +K 14 +svn:executable +V 1 +* +END diff --git a/PCBSD/pc-sysinstall/backend-query/.svn/prop-base/disk-list.sh.svn-base b/PCBSD/pc-sysinstall/backend-query/.svn/prop-base/disk-list.sh.svn-base new file mode 100644 index 0000000..869ac71 --- /dev/null +++ b/PCBSD/pc-sysinstall/backend-query/.svn/prop-base/disk-list.sh.svn-base @@ -0,0 +1,5 @@ +K 14 +svn:executable +V 1 +* +END diff --git a/PCBSD/pc-sysinstall/backend-query/.svn/prop-base/disk-part.sh.svn-base b/PCBSD/pc-sysinstall/backend-query/.svn/prop-base/disk-part.sh.svn-base new file mode 100644 index 0000000..869ac71 --- /dev/null +++ b/PCBSD/pc-sysinstall/backend-query/.svn/prop-base/disk-part.sh.svn-base @@ -0,0 +1,5 @@ +K 14 +svn:executable +V 1 +* +END diff --git a/PCBSD/pc-sysinstall/backend-query/.svn/prop-base/enable-net.sh.svn-base b/PCBSD/pc-sysinstall/backend-query/.svn/prop-base/enable-net.sh.svn-base new file mode 100644 index 0000000..869ac71 --- /dev/null +++ b/PCBSD/pc-sysinstall/backend-query/.svn/prop-base/enable-net.sh.svn-base @@ -0,0 +1,5 @@ +K 14 +svn:executable +V 1 +* +END diff --git a/PCBSD/pc-sysinstall/backend-query/.svn/prop-base/list-components.sh.svn-base b/PCBSD/pc-sysinstall/backend-query/.svn/prop-base/list-components.sh.svn-base new file mode 100644 index 0000000..869ac71 --- /dev/null +++ b/PCBSD/pc-sysinstall/backend-query/.svn/prop-base/list-components.sh.svn-base @@ -0,0 +1,5 @@ +K 14 +svn:executable +V 1 +* +END diff --git a/PCBSD/pc-sysinstall/backend-query/.svn/prop-base/list-rsync-backups.sh.svn-base b/PCBSD/pc-sysinstall/backend-query/.svn/prop-base/list-rsync-backups.sh.svn-base new file mode 100644 index 0000000..869ac71 --- /dev/null +++ b/PCBSD/pc-sysinstall/backend-query/.svn/prop-base/list-rsync-backups.sh.svn-base @@ -0,0 +1,5 @@ +K 14 +svn:executable +V 1 +* +END diff --git a/PCBSD/pc-sysinstall/backend-query/.svn/prop-base/list-tzones.sh.svn-base b/PCBSD/pc-sysinstall/backend-query/.svn/prop-base/list-tzones.sh.svn-base new file mode 100644 index 0000000..869ac71 --- /dev/null +++ b/PCBSD/pc-sysinstall/backend-query/.svn/prop-base/list-tzones.sh.svn-base @@ -0,0 +1,5 @@ +K 14 +svn:executable +V 1 +* +END diff --git a/PCBSD/pc-sysinstall/backend-query/.svn/prop-base/query-langs.sh.svn-base b/PCBSD/pc-sysinstall/backend-query/.svn/prop-base/query-langs.sh.svn-base new file mode 100644 index 0000000..869ac71 --- /dev/null +++ b/PCBSD/pc-sysinstall/backend-query/.svn/prop-base/query-langs.sh.svn-base @@ -0,0 +1,5 @@ +K 14 +svn:executable +V 1 +* +END diff --git a/PCBSD/pc-sysinstall/backend-query/.svn/prop-base/send-logs.sh.svn-base b/PCBSD/pc-sysinstall/backend-query/.svn/prop-base/send-logs.sh.svn-base new file mode 100644 index 0000000..869ac71 --- /dev/null +++ b/PCBSD/pc-sysinstall/backend-query/.svn/prop-base/send-logs.sh.svn-base @@ -0,0 +1,5 @@ +K 14 +svn:executable +V 1 +* +END diff --git a/PCBSD/pc-sysinstall/backend-query/.svn/prop-base/setup-ssh-keys.sh.svn-base b/PCBSD/pc-sysinstall/backend-query/.svn/prop-base/setup-ssh-keys.sh.svn-base new file mode 100644 index 0000000..869ac71 --- /dev/null +++ b/PCBSD/pc-sysinstall/backend-query/.svn/prop-base/setup-ssh-keys.sh.svn-base @@ -0,0 +1,5 @@ +K 14 +svn:executable +V 1 +* +END diff --git a/PCBSD/pc-sysinstall/backend-query/.svn/prop-base/sys-mem.sh.svn-base b/PCBSD/pc-sysinstall/backend-query/.svn/prop-base/sys-mem.sh.svn-base new file mode 100644 index 0000000..869ac71 --- /dev/null +++ b/PCBSD/pc-sysinstall/backend-query/.svn/prop-base/sys-mem.sh.svn-base @@ -0,0 +1,5 @@ +K 14 +svn:executable +V 1 +* +END diff --git a/PCBSD/pc-sysinstall/backend-query/.svn/prop-base/test-live.sh.svn-base b/PCBSD/pc-sysinstall/backend-query/.svn/prop-base/test-live.sh.svn-base new file mode 100644 index 0000000..869ac71 --- /dev/null +++ b/PCBSD/pc-sysinstall/backend-query/.svn/prop-base/test-live.sh.svn-base @@ -0,0 +1,5 @@ +K 14 +svn:executable +V 1 +* +END diff --git a/PCBSD/pc-sysinstall/backend-query/.svn/prop-base/test-netup.sh.svn-base b/PCBSD/pc-sysinstall/backend-query/.svn/prop-base/test-netup.sh.svn-base new file mode 100644 index 0000000..869ac71 --- /dev/null +++ b/PCBSD/pc-sysinstall/backend-query/.svn/prop-base/test-netup.sh.svn-base @@ -0,0 +1,5 @@ +K 14 +svn:executable +V 1 +* +END diff --git a/PCBSD/pc-sysinstall/backend-query/.svn/prop-base/update-part-list.sh.svn-base b/PCBSD/pc-sysinstall/backend-query/.svn/prop-base/update-part-list.sh.svn-base new file mode 100644 index 0000000..869ac71 --- /dev/null +++ b/PCBSD/pc-sysinstall/backend-query/.svn/prop-base/update-part-list.sh.svn-base @@ -0,0 +1,5 @@ +K 14 +svn:executable +V 1 +* +END diff --git a/PCBSD/pc-sysinstall/backend-query/.svn/prop-base/xkeyboard-layouts.sh.svn-base b/PCBSD/pc-sysinstall/backend-query/.svn/prop-base/xkeyboard-layouts.sh.svn-base new file mode 100644 index 0000000..869ac71 --- /dev/null +++ b/PCBSD/pc-sysinstall/backend-query/.svn/prop-base/xkeyboard-layouts.sh.svn-base @@ -0,0 +1,5 @@ +K 14 +svn:executable +V 1 +* +END diff --git a/PCBSD/pc-sysinstall/backend-query/.svn/prop-base/xkeyboard-models.sh.svn-base b/PCBSD/pc-sysinstall/backend-query/.svn/prop-base/xkeyboard-models.sh.svn-base new file mode 100644 index 0000000..869ac71 --- /dev/null +++ b/PCBSD/pc-sysinstall/backend-query/.svn/prop-base/xkeyboard-models.sh.svn-base @@ -0,0 +1,5 @@ +K 14 +svn:executable +V 1 +* +END diff --git a/PCBSD/pc-sysinstall/backend-query/.svn/prop-base/xkeyboard-variants.sh.svn-base b/PCBSD/pc-sysinstall/backend-query/.svn/prop-base/xkeyboard-variants.sh.svn-base new file mode 100644 index 0000000..869ac71 --- /dev/null +++ b/PCBSD/pc-sysinstall/backend-query/.svn/prop-base/xkeyboard-variants.sh.svn-base @@ -0,0 +1,5 @@ +K 14 +svn:executable +V 1 +* +END diff --git a/PCBSD/pc-sysinstall/backend-query/.svn/text-base/detect-laptop.sh.svn-base b/PCBSD/pc-sysinstall/backend-query/.svn/text-base/detect-laptop.sh.svn-base new file mode 100644 index 0000000..bf42842 --- /dev/null +++ b/PCBSD/pc-sysinstall/backend-query/.svn/text-base/detect-laptop.sh.svn-base @@ -0,0 +1,8 @@ +#!/bin/sh + +dmesgLine=`dmesg | grep "acpi_acad0"` +if test "${dmesgLine}" = ""; then + echo "laptop: NO" +else + echo "laptop: YES" +fi diff --git a/PCBSD/pc-sysinstall/backend-query/.svn/text-base/detect-nics.sh.svn-base b/PCBSD/pc-sysinstall/backend-query/.svn/text-base/detect-nics.sh.svn-base new file mode 100644 index 0000000..ead211d --- /dev/null +++ b/PCBSD/pc-sysinstall/backend-query/.svn/text-base/detect-nics.sh.svn-base @@ -0,0 +1,16 @@ +#!/bin/sh + +rm /tmp/netCards 2>/dev/null +touch /tmp/netCards + +config="`ifconfig -l`" + +for i in $config +do + echo "${i}" | grep -e "lo0" -e "^fwe" -e "^fwip" -e "lo1" -e "^plip" -e "^pfsync" -e "^pflog" -e "^tun" >/dev/null 2>/dev/null + if [ "$?" != "0" ] + then + IDENT="<`dmesg | grep ^${i} | grep -v "miibus" | grep '<' | cut -d '<' -f 2 | cut -d '>' -f 1 | head -1`>" + echo "${i}: $IDENT" + fi +done diff --git a/PCBSD/pc-sysinstall/backend-query/.svn/text-base/detect-vmware.sh.svn-base b/PCBSD/pc-sysinstall/backend-query/.svn/text-base/detect-vmware.sh.svn-base new file mode 100644 index 0000000..74b32db --- /dev/null +++ b/PCBSD/pc-sysinstall/backend-query/.svn/text-base/detect-vmware.sh.svn-base @@ -0,0 +1,12 @@ +#!/bin/sh + + +pciconf -lv | grep -i vmware >/dev/null 2>/dev/null +if [ "$?" = "0" ] +then + echo "vmware: YES" + exit 0 +else + echo "vmware: NO" + exit 1 +fi diff --git a/PCBSD/pc-sysinstall/backend-query/.svn/text-base/disk-info.sh.svn-base b/PCBSD/pc-sysinstall/backend-query/.svn/text-base/disk-info.sh.svn-base new file mode 100644 index 0000000..1a4ca7e --- /dev/null +++ b/PCBSD/pc-sysinstall/backend-query/.svn/text-base/disk-info.sh.svn-base @@ -0,0 +1,42 @@ +#!/bin/sh +# Query a disk for partitions and display them +############################# + +. ${PROGDIR}/backend/functions.sh +. ${PROGDIR}/backend/functions-disk.sh + +if [ -z "${1}" ] +then + echo "Error: No disk specified!" + exit 1 +fi + +if [ ! -e "/dev/${1}" ] +then + echo "Error: Disk /dev/${1} does not exist!" + exit 1 +fi + +DISK="${1}" + +get_disk_cyl "${DISK}" +CYLS="${VAL}" + +get_disk_heads "${DISK}" +HEADS="${VAL}" + +get_disk_sectors "${DISK}" +SECS="${VAL}" + +echo "cylinders=${CYLS}" +echo "heads=${HEADS}" +echo "sectors=${SECS}" + +# Now get the disks size in MB +KB="`diskinfo -v ${1} | grep 'bytes' | cut -d '#' -f 1 | tr -s '\t' ' ' | tr -d ' '`" +MB=$(convert_byte_to_megabyte ${KB}) +echo "size=$MB" + +# Now get the Controller Type +CTYPE="`dmesg | grep "^${1}:" | grep "B <" | cut -d '>' -f 2 | cut -d ' ' -f 3-10`" +echo "type=$CTYPE" diff --git a/PCBSD/pc-sysinstall/backend-query/.svn/text-base/disk-list.sh.svn-base b/PCBSD/pc-sysinstall/backend-query/.svn/text-base/disk-list.sh.svn-base new file mode 100644 index 0000000..4a17133 --- /dev/null +++ b/PCBSD/pc-sysinstall/backend-query/.svn/text-base/disk-list.sh.svn-base @@ -0,0 +1,35 @@ +#!/bin/sh + +# Create our device listing +SYSDISK=$(sysctl -n kern.disks) + +# Now loop through these devices, and list the disk drives +for i in ${SYSDISK} +do + + # Get the current device + DEV="${i}" + + # Make sure we don't find any cd devices + case "${DEV}" in + acd[0-9]*|cd[0-9]*|scd[0-9]*) continue ;; + esac + + # Check the dmesg output for some more info about this device + NEWLINE=$(dmesg | sed -n "s/^$DEV: .*<\(.*\)>.*$/ <\1>/p" | head -n 1) + if [ -z "$NEWLINE" ]; then + NEWLINE=" <Unknown Device>" + fi + + # Save the disk list + if [ ! -z "$DLIST" ] + then + DLIST="\n${DLIST}" + fi + + DLIST="${DEV}:${NEWLINE}${DLIST}" + +done + +# Echo out the found line +echo -e "$DLIST" | sort diff --git a/PCBSD/pc-sysinstall/backend-query/.svn/text-base/disk-part.sh.svn-base b/PCBSD/pc-sysinstall/backend-query/.svn/text-base/disk-part.sh.svn-base new file mode 100644 index 0000000..ab78768 --- /dev/null +++ b/PCBSD/pc-sysinstall/backend-query/.svn/text-base/disk-part.sh.svn-base @@ -0,0 +1,93 @@ +#!/bin/sh +# Query a disk for partitions and display them +############################# + +. ${PROGDIR}/backend/functions.sh +. ${PROGDIR}/backend/functions-disk.sh + +if [ -z "${1}" ] +then + echo "Error: No disk specified!" + exit 1 +fi + +if [ ! -e "/dev/${1}" ] +then + echo "Error: Disk /dev/${1} does not exist!" + exit 1 +fi + +DISK="${1}" + +# Now get the disks size in MB +KB="`diskinfo -v ${1} | grep 'bytes' | cut -d '#' -f 1 | tr -s '\t' ' ' | tr -d ' '`" +MB=$(convert_byte_to_megabyte ${KB}) +TOTALSIZE="$MB" +TOTALB="`diskinfo -v ${1} | grep 'in sectors' | tr -s '\t' ' ' | cut -d ' ' -f 2`" + + + +gpart show ${1} >/dev/null 2>/dev/null +if [ "$?" != "0" ] ; then + # No partitions on this disk, display entire disk size and exit + echo "${1}-freemb: ${TOTALSIZE}" + echo "${1}-freeblocks: ${TOTALB}" + exit +fi + +# Display if this is GPT or MBR formatted +gpart show ${1} | grep "GPT" >/dev/null 2>/dev/null +if [ "$?" = "0" ] ; then + echo "${1}-format: GPT" + TYPE="GPT" +else + echo "${1}-format: MBR" + TYPE="MBR" +fi + +# Set some search flags +PART="0" +EXTENDED="0" +START="0" +SIZEB="0" + +# Get a listing of partitions on this disk +get_disk_partitions "${DISK}" +PARTS="${VAL}" +for curpart in $PARTS +do + + # First get the sysid / label for this partition + if [ "$TYPE" = "MBR" ] ; then + get_partition_sysid_mbr "${DISK}" "${curpart}" + echo "${curpart}-sysid: ${VAL}" + get_partition_label_mbr "${DISK}" "${curpart}" + echo "${curpart}-label: ${VAL}" + else + get_partition_label_gpt "${DISK}" "${curpart}" + echo "${curpart}-sysid: ${VAL}" + echo "${curpart}-label: ${VAL}" + fi + + # Now get the startblock, blocksize and MB size of this partition + + get_partition_startblock "${DISK}" "${curpart}" + START="${VAL}" + echo "${curpart}-blockstart: ${START}" + + get_partition_blocksize "${DISK}" "${curpart}" + SIZEB="${VAL}" + echo "${curpart}-blocksize: ${SIZEB}" + + SIZEMB=$(convert_blocks_to_megabyte ${SIZEB}) + echo "${curpart}-sizemb: ${SIZEMB}" + +done + + +# Now calculate any free space +LASTB="`expr $SIZEB + $START`" +FREEB="`expr $TOTALB - $LASTB`" +FREEMB="`expr ${FREEB} / 2048`" +echo "${1}-freemb: $FREEMB" +echo "${1}-freeblocks: $FREEB" diff --git a/PCBSD/pc-sysinstall/backend-query/.svn/text-base/enable-net.sh.svn-base b/PCBSD/pc-sysinstall/backend-query/.svn/text-base/enable-net.sh.svn-base new file mode 100644 index 0000000..ca3115d --- /dev/null +++ b/PCBSD/pc-sysinstall/backend-query/.svn/text-base/enable-net.sh.svn-base @@ -0,0 +1,39 @@ +#!/bin/sh +# Script which enables networking with specified options +########################################################################### + +. ${PROGDIR}/backend/functions.sh +. ${PROGDIR}/conf/pc-sysinstall.conf +. ${BACKEND}/functions-networking.sh +. ${BACKEND}/functions-parse.sh + + +NIC="$1" +IP="$2" +NETMASK="$3" +DNS="$4" +GATEWAY="$5" +MIRRORFETCH="$6" + +if [ -z "${NIC}" ] +then + echo "ERROR: Usage enable-net <nic> <ip> <netmask> <dns> <gateway>" + exit 150 +fi + +if [ "$NIC" = "AUTO-DHCP" ] +then + enable_auto_dhcp +else + echo "Enabling NIC: $NIC" + ifconfig ${NIC} ${IP} ${NETMASK} + + echo "nameserver ${DNS}" >/etc/resolv.conf + + route add default ${GATE} +fi + +case ${MIRRORFETCH} in + ON|on|yes|YES) fetch -o /tmp/mirrors-list.txt ${MIRRORLIST} >/dev/null 2>/dev/null;; + *) ;; +esac diff --git a/PCBSD/pc-sysinstall/backend-query/.svn/text-base/list-components.sh.svn-base b/PCBSD/pc-sysinstall/backend-query/.svn/text-base/list-components.sh.svn-base new file mode 100644 index 0000000..6833dc7 --- /dev/null +++ b/PCBSD/pc-sysinstall/backend-query/.svn/text-base/list-components.sh.svn-base @@ -0,0 +1,28 @@ +#!/bin/sh +# Script which lists the available components for this release +########################################################################### + +. ${PROGDIR}/backend/functions.sh + +echo "Available Components:" + +cd ${COMPDIR} +for i in `ls -d *` +do + if [ -e "${i}/component.cfg" -a -e "${i}/install.sh" -a -e "${i}/distfiles" ] + then + NAME="`grep 'name:' ${i}/component.cfg | cut -d ':' -f 2`" + DESC="`grep 'description:' ${i}/component.cfg | cut -d ':' -f 2`" + TYPE="`grep 'type:' ${i}/component.cfg | cut -d ':' -f 2`" + echo " " + echo "name: ${i}" + echo "desc:${DESC}" + echo "type:${TYPE}" + if [ -e "${i}/component.png" ] + then + echo "icon: ${COMPDIR}/${i}/component.png" + fi + fi + +done + diff --git a/PCBSD/pc-sysinstall/backend-query/.svn/text-base/list-rsync-backups.sh.svn-base b/PCBSD/pc-sysinstall/backend-query/.svn/text-base/list-rsync-backups.sh.svn-base new file mode 100644 index 0000000..6b32fb1 --- /dev/null +++ b/PCBSD/pc-sysinstall/backend-query/.svn/text-base/list-rsync-backups.sh.svn-base @@ -0,0 +1,44 @@ +#!/bin/sh +# Script which lists the backups present on a server +########################################################################### + +. ${PROGDIR}/backend/functions.sh + +SSHUSER=$1 +SSHHOST=$2 +SSHPORT=$3 + +if [ -z "${SSHHOST}" -o -z "${SSHPORT}" ] +then + echo "ERROR: Usage list-rsync-backups.sh <user> <host> <port>" + exit 150 +fi + +# Look for full-system backups, needs at minimum a kernel to be bootable +FINDCMD="find . -type d -maxdepth 6 -name 'kernel' | grep '/boot/kernel'" + +# Get a listing of the number of full backups saved +OLDBACKUPS=`ssh -o 'BatchMode=yes' -p ${SSHPORT} ${SSHUSER}@${SSHHOST} "${FINDCMD}"` +if [ "$?" = "0" ] +then + for i in ${OLDBACKUPS} + do + BACKPATH="`echo ${i} | sed 's|/boot/.*||g' | sed 's|^./||g'`" + if [ -z "${BACKLIST}" ] + then + BACKLIST="${BACKPATH}" + else + BACKLIST="${BACKLIST}:${BACKPATH}" + fi + done + + if [ -z "${BACKLIST}" ] + then + echo "NONE" + else + echo "$BACKLIST" + fi + +else + echo "FAILED" +fi diff --git a/PCBSD/pc-sysinstall/backend-query/.svn/text-base/list-tzones.sh.svn-base b/PCBSD/pc-sysinstall/backend-query/.svn/text-base/list-tzones.sh.svn-base new file mode 100644 index 0000000..38bae91 --- /dev/null +++ b/PCBSD/pc-sysinstall/backend-query/.svn/text-base/list-tzones.sh.svn-base @@ -0,0 +1,18 @@ +#!/bin/sh + +rm ${TMPDIR}/.tzonetmp >/dev/null 2>/dev/null + +# Backend script which lists all the available timezones for front-ends to display +while read line +do + echo "$line" | grep "^#" >/dev/null 2>/dev/null + if [ "$?" != "0" ] + then + echo "$line" | tr -s "\t" ":" | cut -d ":" -f 3-4 >>${TMPDIR}/.tzonetmp + fi +done < /usr/share/zoneinfo/zone.tab + +sort ${TMPDIR}/.tzonetmp +rm ${TMPDIR}/.tzonetmp >/dev/null 2>/dev/null + +exit 0 diff --git a/PCBSD/pc-sysinstall/backend-query/.svn/text-base/query-langs.sh.svn-base b/PCBSD/pc-sysinstall/backend-query/.svn/text-base/query-langs.sh.svn-base new file mode 100644 index 0000000..7951ca6f --- /dev/null +++ b/PCBSD/pc-sysinstall/backend-query/.svn/text-base/query-langs.sh.svn-base @@ -0,0 +1,7 @@ +#!/bin/sh + +FOUND="0" + +cat ${PROGDIR}/conf/avail-langs + +exit 0 diff --git a/PCBSD/pc-sysinstall/backend-query/.svn/text-base/send-logs.sh.svn-base b/PCBSD/pc-sysinstall/backend-query/.svn/text-base/send-logs.sh.svn-base new file mode 100644 index 0000000..c182b22 --- /dev/null +++ b/PCBSD/pc-sysinstall/backend-query/.svn/text-base/send-logs.sh.svn-base @@ -0,0 +1,57 @@ +#!/bin/sh +# Script which creates a gzipped log and optionally mails it to the specified address +############################################################################ + +. ${PROGDIR}/backend/functions.sh +. ${PROGDIR}/conf/pc-sysinstall.conf +. ${BACKEND}/functions-networking.sh +. ${BACKEND}/functions-parse.sh + +# Bring up all NICS under DHCP +enable_auto_dhcp + +MAILTO="$1" +MAILRESULT="0" + +# Set the location of our compressed log +TMPLOG="/tmp/pc-sysinstall.log" + +echo "# PC-SYSINSTALL LOG" >${TMPLOG} +cat ${LOGOUT} >> ${TMPLOG} + +# Check if we have a GUI generated install cfg +if [ -e "/tmp/sys-install.cfg" ] +then + echo "" >>${TMPLOG} + echo "# PC-SYSINSTALL CFG " >>${TMPLOG} + cat /tmp/sys-install.cfg >> ${TMPLOG} +fi + +# Save dmesg output +echo "" >>${TMPLOG} +echo "# DMESG OUTPUT " >>${TMPLOG} +dmesg >> ${TMPLOG} + +# Get gpart info on all disks +for i in `${PROGDIR}/pc-sysinstall disk-list | cut -d ':' -f 1` +do + echo "" >>${TMPLOG} + echo "# DISK INFO $i " >>${TMPLOG} + ls /dev/${i}* >>${TMPLOG} + gpart show ${i} >> ${TMPLOG} +done + +# Show Mounted volumes +echo "" >>${TMPLOG} +echo "# MOUNT OUTPUT " >>${TMPLOG} +mount >> ${TMPLOG} + +echo "Log file saved to ${TMPLOG}" +echo "Warning: This file will be lost once the system is rebooted." + +echo "Do you wish to view this logfile now? (Y/N)" +read tmp +if [ "$tmp" = "Y" -o "$tmp" = "y" ] +then + more ${TMPLOG} +fi diff --git a/PCBSD/pc-sysinstall/backend-query/.svn/text-base/setup-ssh-keys.sh.svn-base b/PCBSD/pc-sysinstall/backend-query/.svn/text-base/setup-ssh-keys.sh.svn-base new file mode 100644 index 0000000..9b09e99 --- /dev/null +++ b/PCBSD/pc-sysinstall/backend-query/.svn/text-base/setup-ssh-keys.sh.svn-base @@ -0,0 +1,38 @@ +#!/bin/sh +# Script which sets up password-less logins for ssh host +########################################################################### + +. ${PROGDIR}/backend/functions.sh + +SSHUSER=$1 +SSHHOST=$2 +SSHPORT=$3 + +if [ -z "${SSHUSER}" -o -z "${SSHHOST}" -o -z "${SSHPORT}" ] +then + echo "ERROR: Usage setup-ssh-keys <user> <host> <port>" + exit 150 +fi + +cd ~ + +echo "Preparing to setup SSH key authorization..." +echo "When prompted, enter your password for ${SSHUSER}@${SSHHOST}" + +if [ ! -e ".ssh/id_rsa.pub" ] +then + mkdir .ssh >/dev/null 2>/dev/null + ssh-keygen -q -t rsa -N '' -f .ssh/id_rsa + sleep 1 +fi + +if [ ! -e ".ssh/id_rsa.pub" ] +then + echo "ERROR: Failed creating .ssh/id_rsa.pub" + exit 150 +fi + +# Get the .pub key +PUBKEY="`cat .ssh/id_rsa.pub`" + +ssh -p ${SSHPORT} ${SSHUSER}@${SSHHOST} "mkdir .ssh ; echo $PUBKEY >> .ssh/authorized_keys; chmod 600 .ssh/authorized_keys ; echo $PUBKEY >> .ssh/authorized_keys2; chmod 600 .ssh/authorized_keys2" diff --git a/PCBSD/pc-sysinstall/backend-query/.svn/text-base/sys-mem.sh.svn-base b/PCBSD/pc-sysinstall/backend-query/.svn/text-base/sys-mem.sh.svn-base new file mode 100644 index 0000000..f087621 --- /dev/null +++ b/PCBSD/pc-sysinstall/backend-query/.svn/text-base/sys-mem.sh.svn-base @@ -0,0 +1,6 @@ +#!/bin/sh + +MEM=`sysctl hw.realmem | sed "s|hw.realmem: ||g"` +MEM=`expr $MEM / 1024` +MEM=`expr $MEM / 1024` +echo $MEM diff --git a/PCBSD/pc-sysinstall/backend-query/.svn/text-base/test-live.sh.svn-base b/PCBSD/pc-sysinstall/backend-query/.svn/text-base/test-live.sh.svn-base new file mode 100644 index 0000000..67ec7a5 --- /dev/null +++ b/PCBSD/pc-sysinstall/backend-query/.svn/text-base/test-live.sh.svn-base @@ -0,0 +1,14 @@ +#!/bin/sh +# Script which checks if we are running from install media, or real system +############################################################################# + +dmesg | grep "md0: Preloaded image" >/dev/null 2>/dev/null +if [ "$?" = "0" ] +then + echo "INSTALL-MEDIA" + exit 0 +else + echo "REAL-DISK" + exit 1 +fi + diff --git a/PCBSD/pc-sysinstall/backend-query/.svn/text-base/test-netup.sh.svn-base b/PCBSD/pc-sysinstall/backend-query/.svn/text-base/test-netup.sh.svn-base new file mode 100644 index 0000000..666781d --- /dev/null +++ b/PCBSD/pc-sysinstall/backend-query/.svn/text-base/test-netup.sh.svn-base @@ -0,0 +1,23 @@ +#!/bin/sh +# Script which tests "fetch" when using a network connection, and saves +# if we are using direct connect, or need FTP passive mode +############################################################################# + +rm ${TMPDIR}/.testftp >/dev/null 2>/dev/null + +ping -c 2 www.pcbsd.org >/dev/null 2>/dev/null +if [ "$?" = "0" ] +then + echo "ftp: Up" + exit 0 +fi + +ping -c 2 www.freebsd.org >/dev/null 2>/dev/null +if [ "$?" = "0" ] +then + echo "ftp: Up" + exit 0 +fi + +echo "ftp: Down" +exit 1 diff --git a/PCBSD/pc-sysinstall/backend-query/.svn/text-base/update-part-list.sh.svn-base b/PCBSD/pc-sysinstall/backend-query/.svn/text-base/update-part-list.sh.svn-base new file mode 100644 index 0000000..9e38b53 --- /dev/null +++ b/PCBSD/pc-sysinstall/backend-query/.svn/text-base/update-part-list.sh.svn-base @@ -0,0 +1,75 @@ +#!/bin/sh + +echo "Running: find-update-parts" >> ${LOGOUT} + +rm ${TMPDIR}/AvailUpgrades >/dev/null 2>/dev/null + +FSMNT="/mnt" + +# Get the freebsd version on this partition +get_fbsd_ver() { + + VER="`file ${FSMNT}/bin/sh | grep 'for FreeBSD' | sed 's|for FreeBSD |;|g' | cut -d ';' -f 2 | cut -d ',' -f 1`" + if [ "$?" = "0" ] ; then + file ${FSMNT}/bin/sh | grep '32-bit' >/dev/null 2>/dev/null + if [ "${?}" = "0" ] ; then + echo "${1}: FreeBSD ${VER} (32bit)" + else + echo "${1}: FreeBSD ${VER} (64bit)" + fi + fi + +} + +# Create our device listing +SYSDISK="`sysctl kern.disks | cut -d ':' -f 2 | sed 's/^[ \t]*//'`" +DEVS="" + +# Now loop through these devices, and list the disk drives +for i in ${SYSDISK} +do + + # Get the current device + DEV="${i}" + # Make sure we don't find any cd devices + echo "${DEV}" | grep -e "^acd[0-9]" -e "^cd[0-9]" -e "^scd[0-9]" >/dev/null 2>/dev/null + if [ "$?" != "0" ] ; then + DEVS="${DEVS} `ls /dev/${i}s*`" + fi + +done + +# Import any zpools +zpool import -a + +for i in $DEVS +do + if [ -e "${i}a.journal" ] ; then + mount ${i}a.journal ${FSMNT} >>${LOGOUT} 2>>${LOGOUT} + if [ "${?}" = "0" ] ; then + get_fbsd_ver ${i} + umount -f ${FSMNT} >/dev/null 2>/dev/null + fi + elif [ -e "${i}a" ] + then + mount ${i}a ${FSMNT} >>${LOGOUT} 2>>${LOGOUT} + if [ "${?}" = "0" ] ; then + get_fbsd_ver ${i} + umount -f ${FSMNT} >/dev/null 2>/dev/null + else + # Lets try ZFS of this device + ZNAME=`echo ${i} | cut -d '/' -f 3` + mount -t zfs ${ZNAME}a ${FSMNT} + if [ "${?}" = "0" ] ; then + get_fbsd_ver ${i} + umount -f ${FSMNT} >/dev/null 2>/dev/null + fi + fi + fi +done + +# Export all zpools again, so that we can overwrite these partitions potentially +#for i in `zpool list -H -o name` +#do +# zpool export -f ${i} +#done diff --git a/PCBSD/pc-sysinstall/backend-query/.svn/text-base/xkeyboard-layouts.sh.svn-base b/PCBSD/pc-sysinstall/backend-query/.svn/text-base/xkeyboard-layouts.sh.svn-base new file mode 100644 index 0000000..b2b92f3 --- /dev/null +++ b/PCBSD/pc-sysinstall/backend-query/.svn/text-base/xkeyboard-layouts.sh.svn-base @@ -0,0 +1,31 @@ +#!/bin/sh + +FOUND="0" + +# Lets parse the xorg.list file, and see what layouts are supported +while read line +do + + if [ "$FOUND" = "1" -a ! -z "$line" ] + then + echo $line | grep '! ' >/dev/null 2>/dev/null + if [ "$?" = "0" ] + then + exit 0 + else + echo "$line" + fi + fi + + if [ "${FOUND}" = "0" ] + then + echo $line | grep '! layout' >/dev/null 2>/dev/null + if [ "$?" = "0" ] + then + FOUND="1" + fi + fi + +done < /usr/local/share/X11/xkb/rules/xorg.lst + +exit 0 diff --git a/PCBSD/pc-sysinstall/backend-query/.svn/text-base/xkeyboard-models.sh.svn-base b/PCBSD/pc-sysinstall/backend-query/.svn/text-base/xkeyboard-models.sh.svn-base new file mode 100644 index 0000000..0d72681 --- /dev/null +++ b/PCBSD/pc-sysinstall/backend-query/.svn/text-base/xkeyboard-models.sh.svn-base @@ -0,0 +1,33 @@ +#!/bin/sh + +FOUND="0" + +# Lets parse the xorg.list file, and see what models are supported +while read line +do + + if [ "$FOUND" = "1" -a ! -z "$line" ] + then + echo $line | grep '! ' >/dev/null 2>/dev/null + if [ "$?" = "0" ] + then + exit 0 + else + model="`echo $line | sed 's|(|[|g'`" + model="`echo $model | sed 's|)|]|g'`" + echo "$model" + fi + fi + + if [ "${FOUND}" = "0" ] + then + echo $line | grep '! model' >/dev/null 2>/dev/null + if [ "$?" = "0" ] + then + FOUND="1" + fi + fi + +done < /usr/local/share/X11/xkb/rules/xorg.lst + +exit 0 diff --git a/PCBSD/pc-sysinstall/backend-query/.svn/text-base/xkeyboard-variants.sh.svn-base b/PCBSD/pc-sysinstall/backend-query/.svn/text-base/xkeyboard-variants.sh.svn-base new file mode 100644 index 0000000..3bf18d7 --- /dev/null +++ b/PCBSD/pc-sysinstall/backend-query/.svn/text-base/xkeyboard-variants.sh.svn-base @@ -0,0 +1,31 @@ +#!/bin/sh + +FOUND="0" + +# Lets parse the xorg.list file, and see what varients are supported +while read line +do + + if [ "$FOUND" = "1" -a ! -z "$line" ] + then + echo $line | grep '! ' >/dev/null 2>/dev/null + if [ "$?" = "0" ] + then + exit 0 + else + echo "$line" + fi + fi + + if [ "${FOUND}" = "0" ] + then + echo $line | grep '! variant' >/dev/null 2>/dev/null + if [ "$?" = "0" ] + then + FOUND="1" + fi + fi + +done < /usr/local/share/X11/xkb/rules/xorg.lst + +exit 0 diff --git a/PCBSD/pc-sysinstall/backend-query/detect-laptop.sh b/PCBSD/pc-sysinstall/backend-query/detect-laptop.sh new file mode 100755 index 0000000..bf42842 --- /dev/null +++ b/PCBSD/pc-sysinstall/backend-query/detect-laptop.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +dmesgLine=`dmesg | grep "acpi_acad0"` +if test "${dmesgLine}" = ""; then + echo "laptop: NO" +else + echo "laptop: YES" +fi diff --git a/PCBSD/pc-sysinstall/backend-query/detect-nics.sh b/PCBSD/pc-sysinstall/backend-query/detect-nics.sh new file mode 100755 index 0000000..ead211d --- /dev/null +++ b/PCBSD/pc-sysinstall/backend-query/detect-nics.sh @@ -0,0 +1,16 @@ +#!/bin/sh + +rm /tmp/netCards 2>/dev/null +touch /tmp/netCards + +config="`ifconfig -l`" + +for i in $config +do + echo "${i}" | grep -e "lo0" -e "^fwe" -e "^fwip" -e "lo1" -e "^plip" -e "^pfsync" -e "^pflog" -e "^tun" >/dev/null 2>/dev/null + if [ "$?" != "0" ] + then + IDENT="<`dmesg | grep ^${i} | grep -v "miibus" | grep '<' | cut -d '<' -f 2 | cut -d '>' -f 1 | head -1`>" + echo "${i}: $IDENT" + fi +done diff --git a/PCBSD/pc-sysinstall/backend-query/detect-vmware.sh b/PCBSD/pc-sysinstall/backend-query/detect-vmware.sh new file mode 100755 index 0000000..74b32db --- /dev/null +++ b/PCBSD/pc-sysinstall/backend-query/detect-vmware.sh @@ -0,0 +1,12 @@ +#!/bin/sh + + +pciconf -lv | grep -i vmware >/dev/null 2>/dev/null +if [ "$?" = "0" ] +then + echo "vmware: YES" + exit 0 +else + echo "vmware: NO" + exit 1 +fi diff --git a/PCBSD/pc-sysinstall/backend-query/disk-info.sh b/PCBSD/pc-sysinstall/backend-query/disk-info.sh new file mode 100755 index 0000000..1a4ca7e --- /dev/null +++ b/PCBSD/pc-sysinstall/backend-query/disk-info.sh @@ -0,0 +1,42 @@ +#!/bin/sh +# Query a disk for partitions and display them +############################# + +. ${PROGDIR}/backend/functions.sh +. ${PROGDIR}/backend/functions-disk.sh + +if [ -z "${1}" ] +then + echo "Error: No disk specified!" + exit 1 +fi + +if [ ! -e "/dev/${1}" ] +then + echo "Error: Disk /dev/${1} does not exist!" + exit 1 +fi + +DISK="${1}" + +get_disk_cyl "${DISK}" +CYLS="${VAL}" + +get_disk_heads "${DISK}" +HEADS="${VAL}" + +get_disk_sectors "${DISK}" +SECS="${VAL}" + +echo "cylinders=${CYLS}" +echo "heads=${HEADS}" +echo "sectors=${SECS}" + +# Now get the disks size in MB +KB="`diskinfo -v ${1} | grep 'bytes' | cut -d '#' -f 1 | tr -s '\t' ' ' | tr -d ' '`" +MB=$(convert_byte_to_megabyte ${KB}) +echo "size=$MB" + +# Now get the Controller Type +CTYPE="`dmesg | grep "^${1}:" | grep "B <" | cut -d '>' -f 2 | cut -d ' ' -f 3-10`" +echo "type=$CTYPE" diff --git a/PCBSD/pc-sysinstall/backend-query/disk-list.sh b/PCBSD/pc-sysinstall/backend-query/disk-list.sh new file mode 100755 index 0000000..4a17133 --- /dev/null +++ b/PCBSD/pc-sysinstall/backend-query/disk-list.sh @@ -0,0 +1,35 @@ +#!/bin/sh + +# Create our device listing +SYSDISK=$(sysctl -n kern.disks) + +# Now loop through these devices, and list the disk drives +for i in ${SYSDISK} +do + + # Get the current device + DEV="${i}" + + # Make sure we don't find any cd devices + case "${DEV}" in + acd[0-9]*|cd[0-9]*|scd[0-9]*) continue ;; + esac + + # Check the dmesg output for some more info about this device + NEWLINE=$(dmesg | sed -n "s/^$DEV: .*<\(.*\)>.*$/ <\1>/p" | head -n 1) + if [ -z "$NEWLINE" ]; then + NEWLINE=" <Unknown Device>" + fi + + # Save the disk list + if [ ! -z "$DLIST" ] + then + DLIST="\n${DLIST}" + fi + + DLIST="${DEV}:${NEWLINE}${DLIST}" + +done + +# Echo out the found line +echo -e "$DLIST" | sort diff --git a/PCBSD/pc-sysinstall/backend-query/disk-part.sh b/PCBSD/pc-sysinstall/backend-query/disk-part.sh new file mode 100755 index 0000000..ab78768 --- /dev/null +++ b/PCBSD/pc-sysinstall/backend-query/disk-part.sh @@ -0,0 +1,93 @@ +#!/bin/sh +# Query a disk for partitions and display them +############################# + +. ${PROGDIR}/backend/functions.sh +. ${PROGDIR}/backend/functions-disk.sh + +if [ -z "${1}" ] +then + echo "Error: No disk specified!" + exit 1 +fi + +if [ ! -e "/dev/${1}" ] +then + echo "Error: Disk /dev/${1} does not exist!" + exit 1 +fi + +DISK="${1}" + +# Now get the disks size in MB +KB="`diskinfo -v ${1} | grep 'bytes' | cut -d '#' -f 1 | tr -s '\t' ' ' | tr -d ' '`" +MB=$(convert_byte_to_megabyte ${KB}) +TOTALSIZE="$MB" +TOTALB="`diskinfo -v ${1} | grep 'in sectors' | tr -s '\t' ' ' | cut -d ' ' -f 2`" + + + +gpart show ${1} >/dev/null 2>/dev/null +if [ "$?" != "0" ] ; then + # No partitions on this disk, display entire disk size and exit + echo "${1}-freemb: ${TOTALSIZE}" + echo "${1}-freeblocks: ${TOTALB}" + exit +fi + +# Display if this is GPT or MBR formatted +gpart show ${1} | grep "GPT" >/dev/null 2>/dev/null +if [ "$?" = "0" ] ; then + echo "${1}-format: GPT" + TYPE="GPT" +else + echo "${1}-format: MBR" + TYPE="MBR" +fi + +# Set some search flags +PART="0" +EXTENDED="0" +START="0" +SIZEB="0" + +# Get a listing of partitions on this disk +get_disk_partitions "${DISK}" +PARTS="${VAL}" +for curpart in $PARTS +do + + # First get the sysid / label for this partition + if [ "$TYPE" = "MBR" ] ; then + get_partition_sysid_mbr "${DISK}" "${curpart}" + echo "${curpart}-sysid: ${VAL}" + get_partition_label_mbr "${DISK}" "${curpart}" + echo "${curpart}-label: ${VAL}" + else + get_partition_label_gpt "${DISK}" "${curpart}" + echo "${curpart}-sysid: ${VAL}" + echo "${curpart}-label: ${VAL}" + fi + + # Now get the startblock, blocksize and MB size of this partition + + get_partition_startblock "${DISK}" "${curpart}" + START="${VAL}" + echo "${curpart}-blockstart: ${START}" + + get_partition_blocksize "${DISK}" "${curpart}" + SIZEB="${VAL}" + echo "${curpart}-blocksize: ${SIZEB}" + + SIZEMB=$(convert_blocks_to_megabyte ${SIZEB}) + echo "${curpart}-sizemb: ${SIZEMB}" + +done + + +# Now calculate any free space +LASTB="`expr $SIZEB + $START`" +FREEB="`expr $TOTALB - $LASTB`" +FREEMB="`expr ${FREEB} / 2048`" +echo "${1}-freemb: $FREEMB" +echo "${1}-freeblocks: $FREEB" diff --git a/PCBSD/pc-sysinstall/backend-query/enable-net.sh b/PCBSD/pc-sysinstall/backend-query/enable-net.sh new file mode 100755 index 0000000..ca3115d --- /dev/null +++ b/PCBSD/pc-sysinstall/backend-query/enable-net.sh @@ -0,0 +1,39 @@ +#!/bin/sh +# Script which enables networking with specified options +########################################################################### + +. ${PROGDIR}/backend/functions.sh +. ${PROGDIR}/conf/pc-sysinstall.conf +. ${BACKEND}/functions-networking.sh +. ${BACKEND}/functions-parse.sh + + +NIC="$1" +IP="$2" +NETMASK="$3" +DNS="$4" +GATEWAY="$5" +MIRRORFETCH="$6" + +if [ -z "${NIC}" ] +then + echo "ERROR: Usage enable-net <nic> <ip> <netmask> <dns> <gateway>" + exit 150 +fi + +if [ "$NIC" = "AUTO-DHCP" ] +then + enable_auto_dhcp +else + echo "Enabling NIC: $NIC" + ifconfig ${NIC} ${IP} ${NETMASK} + + echo "nameserver ${DNS}" >/etc/resolv.conf + + route add default ${GATE} +fi + +case ${MIRRORFETCH} in + ON|on|yes|YES) fetch -o /tmp/mirrors-list.txt ${MIRRORLIST} >/dev/null 2>/dev/null;; + *) ;; +esac diff --git a/PCBSD/pc-sysinstall/backend-query/list-components.sh b/PCBSD/pc-sysinstall/backend-query/list-components.sh new file mode 100755 index 0000000..6833dc7 --- /dev/null +++ b/PCBSD/pc-sysinstall/backend-query/list-components.sh @@ -0,0 +1,28 @@ +#!/bin/sh +# Script which lists the available components for this release +########################################################################### + +. ${PROGDIR}/backend/functions.sh + +echo "Available Components:" + +cd ${COMPDIR} +for i in `ls -d *` +do + if [ -e "${i}/component.cfg" -a -e "${i}/install.sh" -a -e "${i}/distfiles" ] + then + NAME="`grep 'name:' ${i}/component.cfg | cut -d ':' -f 2`" + DESC="`grep 'description:' ${i}/component.cfg | cut -d ':' -f 2`" + TYPE="`grep 'type:' ${i}/component.cfg | cut -d ':' -f 2`" + echo " " + echo "name: ${i}" + echo "desc:${DESC}" + echo "type:${TYPE}" + if [ -e "${i}/component.png" ] + then + echo "icon: ${COMPDIR}/${i}/component.png" + fi + fi + +done + diff --git a/PCBSD/pc-sysinstall/backend-query/list-rsync-backups.sh b/PCBSD/pc-sysinstall/backend-query/list-rsync-backups.sh new file mode 100755 index 0000000..6b32fb1 --- /dev/null +++ b/PCBSD/pc-sysinstall/backend-query/list-rsync-backups.sh @@ -0,0 +1,44 @@ +#!/bin/sh +# Script which lists the backups present on a server +########################################################################### + +. ${PROGDIR}/backend/functions.sh + +SSHUSER=$1 +SSHHOST=$2 +SSHPORT=$3 + +if [ -z "${SSHHOST}" -o -z "${SSHPORT}" ] +then + echo "ERROR: Usage list-rsync-backups.sh <user> <host> <port>" + exit 150 +fi + +# Look for full-system backups, needs at minimum a kernel to be bootable +FINDCMD="find . -type d -maxdepth 6 -name 'kernel' | grep '/boot/kernel'" + +# Get a listing of the number of full backups saved +OLDBACKUPS=`ssh -o 'BatchMode=yes' -p ${SSHPORT} ${SSHUSER}@${SSHHOST} "${FINDCMD}"` +if [ "$?" = "0" ] +then + for i in ${OLDBACKUPS} + do + BACKPATH="`echo ${i} | sed 's|/boot/.*||g' | sed 's|^./||g'`" + if [ -z "${BACKLIST}" ] + then + BACKLIST="${BACKPATH}" + else + BACKLIST="${BACKLIST}:${BACKPATH}" + fi + done + + if [ -z "${BACKLIST}" ] + then + echo "NONE" + else + echo "$BACKLIST" + fi + +else + echo "FAILED" +fi diff --git a/PCBSD/pc-sysinstall/backend-query/list-tzones.sh b/PCBSD/pc-sysinstall/backend-query/list-tzones.sh new file mode 100755 index 0000000..38bae91 --- /dev/null +++ b/PCBSD/pc-sysinstall/backend-query/list-tzones.sh @@ -0,0 +1,18 @@ +#!/bin/sh + +rm ${TMPDIR}/.tzonetmp >/dev/null 2>/dev/null + +# Backend script which lists all the available timezones for front-ends to display +while read line +do + echo "$line" | grep "^#" >/dev/null 2>/dev/null + if [ "$?" != "0" ] + then + echo "$line" | tr -s "\t" ":" | cut -d ":" -f 3-4 >>${TMPDIR}/.tzonetmp + fi +done < /usr/share/zoneinfo/zone.tab + +sort ${TMPDIR}/.tzonetmp +rm ${TMPDIR}/.tzonetmp >/dev/null 2>/dev/null + +exit 0 diff --git a/PCBSD/pc-sysinstall/backend-query/query-langs.sh b/PCBSD/pc-sysinstall/backend-query/query-langs.sh new file mode 100755 index 0000000..7951ca6f --- /dev/null +++ b/PCBSD/pc-sysinstall/backend-query/query-langs.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +FOUND="0" + +cat ${PROGDIR}/conf/avail-langs + +exit 0 diff --git a/PCBSD/pc-sysinstall/backend-query/send-logs.sh b/PCBSD/pc-sysinstall/backend-query/send-logs.sh new file mode 100755 index 0000000..c182b22 --- /dev/null +++ b/PCBSD/pc-sysinstall/backend-query/send-logs.sh @@ -0,0 +1,57 @@ +#!/bin/sh +# Script which creates a gzipped log and optionally mails it to the specified address +############################################################################ + +. ${PROGDIR}/backend/functions.sh +. ${PROGDIR}/conf/pc-sysinstall.conf +. ${BACKEND}/functions-networking.sh +. ${BACKEND}/functions-parse.sh + +# Bring up all NICS under DHCP +enable_auto_dhcp + +MAILTO="$1" +MAILRESULT="0" + +# Set the location of our compressed log +TMPLOG="/tmp/pc-sysinstall.log" + +echo "# PC-SYSINSTALL LOG" >${TMPLOG} +cat ${LOGOUT} >> ${TMPLOG} + +# Check if we have a GUI generated install cfg +if [ -e "/tmp/sys-install.cfg" ] +then + echo "" >>${TMPLOG} + echo "# PC-SYSINSTALL CFG " >>${TMPLOG} + cat /tmp/sys-install.cfg >> ${TMPLOG} +fi + +# Save dmesg output +echo "" >>${TMPLOG} +echo "# DMESG OUTPUT " >>${TMPLOG} +dmesg >> ${TMPLOG} + +# Get gpart info on all disks +for i in `${PROGDIR}/pc-sysinstall disk-list | cut -d ':' -f 1` +do + echo "" >>${TMPLOG} + echo "# DISK INFO $i " >>${TMPLOG} + ls /dev/${i}* >>${TMPLOG} + gpart show ${i} >> ${TMPLOG} +done + +# Show Mounted volumes +echo "" >>${TMPLOG} +echo "# MOUNT OUTPUT " >>${TMPLOG} +mount >> ${TMPLOG} + +echo "Log file saved to ${TMPLOG}" +echo "Warning: This file will be lost once the system is rebooted." + +echo "Do you wish to view this logfile now? (Y/N)" +read tmp +if [ "$tmp" = "Y" -o "$tmp" = "y" ] +then + more ${TMPLOG} +fi diff --git a/PCBSD/pc-sysinstall/backend-query/setup-ssh-keys.sh b/PCBSD/pc-sysinstall/backend-query/setup-ssh-keys.sh new file mode 100755 index 0000000..9b09e99 --- /dev/null +++ b/PCBSD/pc-sysinstall/backend-query/setup-ssh-keys.sh @@ -0,0 +1,38 @@ +#!/bin/sh +# Script which sets up password-less logins for ssh host +########################################################################### + +. ${PROGDIR}/backend/functions.sh + +SSHUSER=$1 +SSHHOST=$2 +SSHPORT=$3 + +if [ -z "${SSHUSER}" -o -z "${SSHHOST}" -o -z "${SSHPORT}" ] +then + echo "ERROR: Usage setup-ssh-keys <user> <host> <port>" + exit 150 +fi + +cd ~ + +echo "Preparing to setup SSH key authorization..." +echo "When prompted, enter your password for ${SSHUSER}@${SSHHOST}" + +if [ ! -e ".ssh/id_rsa.pub" ] +then + mkdir .ssh >/dev/null 2>/dev/null + ssh-keygen -q -t rsa -N '' -f .ssh/id_rsa + sleep 1 +fi + +if [ ! -e ".ssh/id_rsa.pub" ] +then + echo "ERROR: Failed creating .ssh/id_rsa.pub" + exit 150 +fi + +# Get the .pub key +PUBKEY="`cat .ssh/id_rsa.pub`" + +ssh -p ${SSHPORT} ${SSHUSER}@${SSHHOST} "mkdir .ssh ; echo $PUBKEY >> .ssh/authorized_keys; chmod 600 .ssh/authorized_keys ; echo $PUBKEY >> .ssh/authorized_keys2; chmod 600 .ssh/authorized_keys2" diff --git a/PCBSD/pc-sysinstall/backend-query/sys-mem.sh b/PCBSD/pc-sysinstall/backend-query/sys-mem.sh new file mode 100755 index 0000000..f087621 --- /dev/null +++ b/PCBSD/pc-sysinstall/backend-query/sys-mem.sh @@ -0,0 +1,6 @@ +#!/bin/sh + +MEM=`sysctl hw.realmem | sed "s|hw.realmem: ||g"` +MEM=`expr $MEM / 1024` +MEM=`expr $MEM / 1024` +echo $MEM diff --git a/PCBSD/pc-sysinstall/backend-query/test-live.sh b/PCBSD/pc-sysinstall/backend-query/test-live.sh new file mode 100755 index 0000000..67ec7a5 --- /dev/null +++ b/PCBSD/pc-sysinstall/backend-query/test-live.sh @@ -0,0 +1,14 @@ +#!/bin/sh +# Script which checks if we are running from install media, or real system +############################################################################# + +dmesg | grep "md0: Preloaded image" >/dev/null 2>/dev/null +if [ "$?" = "0" ] +then + echo "INSTALL-MEDIA" + exit 0 +else + echo "REAL-DISK" + exit 1 +fi + diff --git a/PCBSD/pc-sysinstall/backend-query/test-netup.sh b/PCBSD/pc-sysinstall/backend-query/test-netup.sh new file mode 100755 index 0000000..666781d --- /dev/null +++ b/PCBSD/pc-sysinstall/backend-query/test-netup.sh @@ -0,0 +1,23 @@ +#!/bin/sh +# Script which tests "fetch" when using a network connection, and saves +# if we are using direct connect, or need FTP passive mode +############################################################################# + +rm ${TMPDIR}/.testftp >/dev/null 2>/dev/null + +ping -c 2 www.pcbsd.org >/dev/null 2>/dev/null +if [ "$?" = "0" ] +then + echo "ftp: Up" + exit 0 +fi + +ping -c 2 www.freebsd.org >/dev/null 2>/dev/null +if [ "$?" = "0" ] +then + echo "ftp: Up" + exit 0 +fi + +echo "ftp: Down" +exit 1 diff --git a/PCBSD/pc-sysinstall/backend-query/update-part-list.sh b/PCBSD/pc-sysinstall/backend-query/update-part-list.sh new file mode 100755 index 0000000..9e38b53 --- /dev/null +++ b/PCBSD/pc-sysinstall/backend-query/update-part-list.sh @@ -0,0 +1,75 @@ +#!/bin/sh + +echo "Running: find-update-parts" >> ${LOGOUT} + +rm ${TMPDIR}/AvailUpgrades >/dev/null 2>/dev/null + +FSMNT="/mnt" + +# Get the freebsd version on this partition +get_fbsd_ver() { + + VER="`file ${FSMNT}/bin/sh | grep 'for FreeBSD' | sed 's|for FreeBSD |;|g' | cut -d ';' -f 2 | cut -d ',' -f 1`" + if [ "$?" = "0" ] ; then + file ${FSMNT}/bin/sh | grep '32-bit' >/dev/null 2>/dev/null + if [ "${?}" = "0" ] ; then + echo "${1}: FreeBSD ${VER} (32bit)" + else + echo "${1}: FreeBSD ${VER} (64bit)" + fi + fi + +} + +# Create our device listing +SYSDISK="`sysctl kern.disks | cut -d ':' -f 2 | sed 's/^[ \t]*//'`" +DEVS="" + +# Now loop through these devices, and list the disk drives +for i in ${SYSDISK} +do + + # Get the current device + DEV="${i}" + # Make sure we don't find any cd devices + echo "${DEV}" | grep -e "^acd[0-9]" -e "^cd[0-9]" -e "^scd[0-9]" >/dev/null 2>/dev/null + if [ "$?" != "0" ] ; then + DEVS="${DEVS} `ls /dev/${i}s*`" + fi + +done + +# Import any zpools +zpool import -a + +for i in $DEVS +do + if [ -e "${i}a.journal" ] ; then + mount ${i}a.journal ${FSMNT} >>${LOGOUT} 2>>${LOGOUT} + if [ "${?}" = "0" ] ; then + get_fbsd_ver ${i} + umount -f ${FSMNT} >/dev/null 2>/dev/null + fi + elif [ -e "${i}a" ] + then + mount ${i}a ${FSMNT} >>${LOGOUT} 2>>${LOGOUT} + if [ "${?}" = "0" ] ; then + get_fbsd_ver ${i} + umount -f ${FSMNT} >/dev/null 2>/dev/null + else + # Lets try ZFS of this device + ZNAME=`echo ${i} | cut -d '/' -f 3` + mount -t zfs ${ZNAME}a ${FSMNT} + if [ "${?}" = "0" ] ; then + get_fbsd_ver ${i} + umount -f ${FSMNT} >/dev/null 2>/dev/null + fi + fi + fi +done + +# Export all zpools again, so that we can overwrite these partitions potentially +#for i in `zpool list -H -o name` +#do +# zpool export -f ${i} +#done diff --git a/PCBSD/pc-sysinstall/backend-query/xkeyboard-layouts.sh b/PCBSD/pc-sysinstall/backend-query/xkeyboard-layouts.sh new file mode 100755 index 0000000..b2b92f3 --- /dev/null +++ b/PCBSD/pc-sysinstall/backend-query/xkeyboard-layouts.sh @@ -0,0 +1,31 @@ +#!/bin/sh + +FOUND="0" + +# Lets parse the xorg.list file, and see what layouts are supported +while read line +do + + if [ "$FOUND" = "1" -a ! -z "$line" ] + then + echo $line | grep '! ' >/dev/null 2>/dev/null + if [ "$?" = "0" ] + then + exit 0 + else + echo "$line" + fi + fi + + if [ "${FOUND}" = "0" ] + then + echo $line | grep '! layout' >/dev/null 2>/dev/null + if [ "$?" = "0" ] + then + FOUND="1" + fi + fi + +done < /usr/local/share/X11/xkb/rules/xorg.lst + +exit 0 diff --git a/PCBSD/pc-sysinstall/backend-query/xkeyboard-models.sh b/PCBSD/pc-sysinstall/backend-query/xkeyboard-models.sh new file mode 100755 index 0000000..0d72681 --- /dev/null +++ b/PCBSD/pc-sysinstall/backend-query/xkeyboard-models.sh @@ -0,0 +1,33 @@ +#!/bin/sh + +FOUND="0" + +# Lets parse the xorg.list file, and see what models are supported +while read line +do + + if [ "$FOUND" = "1" -a ! -z "$line" ] + then + echo $line | grep '! ' >/dev/null 2>/dev/null + if [ "$?" = "0" ] + then + exit 0 + else + model="`echo $line | sed 's|(|[|g'`" + model="`echo $model | sed 's|)|]|g'`" + echo "$model" + fi + fi + + if [ "${FOUND}" = "0" ] + then + echo $line | grep '! model' >/dev/null 2>/dev/null + if [ "$?" = "0" ] + then + FOUND="1" + fi + fi + +done < /usr/local/share/X11/xkb/rules/xorg.lst + +exit 0 diff --git a/PCBSD/pc-sysinstall/backend-query/xkeyboard-variants.sh b/PCBSD/pc-sysinstall/backend-query/xkeyboard-variants.sh new file mode 100755 index 0000000..3bf18d7 --- /dev/null +++ b/PCBSD/pc-sysinstall/backend-query/xkeyboard-variants.sh @@ -0,0 +1,31 @@ +#!/bin/sh + +FOUND="0" + +# Lets parse the xorg.list file, and see what varients are supported +while read line +do + + if [ "$FOUND" = "1" -a ! -z "$line" ] + then + echo $line | grep '! ' >/dev/null 2>/dev/null + if [ "$?" = "0" ] + then + exit 0 + else + echo "$line" + fi + fi + + if [ "${FOUND}" = "0" ] + then + echo $line | grep '! variant' >/dev/null 2>/dev/null + if [ "$?" = "0" ] + then + FOUND="1" + fi + fi + +done < /usr/local/share/X11/xkb/rules/xorg.lst + +exit 0 |