Indent things consistently
PR: 149926 Submitted by: John Hixson
This commit is contained in:
parent
0c898ccd30
commit
b3b8bde704
@ -54,7 +54,6 @@ HEADS="${VAL}"
|
||||
get_disk_sectors "${DISK}"
|
||||
SECS="${VAL}"
|
||||
|
||||
|
||||
# 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})
|
||||
@ -62,10 +61,9 @@ MB=$(convert_byte_to_megabyte ${KB})
|
||||
# Now get the Controller Type
|
||||
CTYPE="`dmesg | grep "^${1}:" | grep "B <" | cut -d '>' -f 2 | cut -d ' ' -f 3-10`"
|
||||
|
||||
|
||||
echo "cylinders=${CYLS}"
|
||||
echo "heads=${HEADS}"
|
||||
echo "sectors=${SECS}"
|
||||
echo "size=$MB"
|
||||
echo "type=$CTYPE"
|
||||
echo "size=${MB}"
|
||||
echo "type=${CTYPE}"
|
||||
|
||||
|
@ -26,16 +26,32 @@
|
||||
# $FreeBSD$
|
||||
|
||||
ARGS=$1
|
||||
FLAGS_MD=""
|
||||
FLAGS_VERBOSE=""
|
||||
|
||||
shift
|
||||
while [ -n "$1" ]
|
||||
do
|
||||
case "$1" in
|
||||
-m)
|
||||
FLAGS_MD=1
|
||||
;;
|
||||
-v)
|
||||
FLAGS_VERBOSE=1
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
# Create our device listing
|
||||
SYSDISK=$(sysctl -n kern.disks)
|
||||
if [ "${ARGS}" = "-m" ]
|
||||
if [ -n "${FLAGS_MD}" ]
|
||||
then
|
||||
MDS=`mdconfig -l`
|
||||
if [ -n "${MDS}" ]
|
||||
then
|
||||
SYSDISK="${SYSDISK} ${MDS}"
|
||||
fi
|
||||
MDS=`mdconfig -l`
|
||||
if [ -n "${MDS}" ]
|
||||
then
|
||||
SYSDISK="${SYSDISK} ${MDS}"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Now loop through these devices, and list the disk drives
|
||||
@ -47,7 +63,7 @@ do
|
||||
|
||||
# Make sure we don't find any cd devices
|
||||
case "${DEV}" in
|
||||
acd[0-9]*|cd[0-9]*|scd[0-9]*) continue ;;
|
||||
acd[0-9]*|cd[0-9]*|scd[0-9]*) continue ;;
|
||||
esac
|
||||
|
||||
# Check the dmesg output for some more info about this device
|
||||
@ -55,11 +71,17 @@ do
|
||||
if [ -z "$NEWLINE" ]; then
|
||||
NEWLINE=" <Unknown Device>"
|
||||
fi
|
||||
if echo "${DEV}" | grep -E '^md[0-9]+' >/dev/null 2>/dev/null
|
||||
|
||||
if [ -n "${FLAGS_MD}" ] && echo "${DEV}" | grep -E '^md[0-9]+' >/dev/null 2>/dev/null
|
||||
then
|
||||
NEWLINE=" <Memory Disk>"
|
||||
fi
|
||||
|
||||
if [ -n "${FLAGS_VERBOSE}" ]
|
||||
then
|
||||
:
|
||||
fi
|
||||
|
||||
# Save the disk list
|
||||
if [ ! -z "$DLIST" ]
|
||||
then
|
||||
|
@ -51,8 +51,6 @@ 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
|
||||
@ -85,14 +83,14 @@ 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}"
|
||||
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}"
|
||||
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
|
||||
|
@ -60,6 +60,6 @@ else
|
||||
fi
|
||||
|
||||
case ${MIRRORFETCH} in
|
||||
ON|on|yes|YES) fetch -o /tmp/mirrors-list.txt ${MIRRORLIST} >/dev/null 2>/dev/null;;
|
||||
*) ;;
|
||||
ON|on|yes|YES) fetch -o /tmp/mirrors-list.txt ${MIRRORLIST} >/dev/null 2>/dev/null;;
|
||||
*) ;;
|
||||
esac
|
||||
|
@ -34,19 +34,19 @@
|
||||
ID=`id -u`
|
||||
if [ "${ID}" -ne "0" ]
|
||||
then
|
||||
echo "Error: must be root!"
|
||||
exit 1
|
||||
echo "Error: must be root!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -f "${PKGDIR}/INDEX" ]
|
||||
then
|
||||
get_package_index
|
||||
get_package_index
|
||||
fi
|
||||
|
||||
if [ -f "${PKGDIR}/INDEX" ]
|
||||
then
|
||||
echo "${PKGDIR}/INDEX"
|
||||
exit 0
|
||||
echo "${PKGDIR}/INDEX"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
exit 1
|
||||
|
@ -37,50 +37,50 @@ NARGS=0
|
||||
|
||||
if [ ! -f "${PKGDIR}/INDEX" ]
|
||||
then
|
||||
echo "Error: please fetch package index with get-packages!"
|
||||
exit 1
|
||||
echo "Error: please fetch package index with get-packages!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -f "${PKGDIR}/INDEX.parsed" ]
|
||||
then
|
||||
parse_package_index
|
||||
parse_package_index
|
||||
fi
|
||||
|
||||
if [ -n "${PACKAGE_CATEGORY}" ]
|
||||
then
|
||||
NARGS=$((NARGS+1))
|
||||
NARGS=$((NARGS+1))
|
||||
fi
|
||||
|
||||
if [ -n "${PACKAGE_NAME}" ]
|
||||
then
|
||||
NARGS=$((NARGS+1))
|
||||
NARGS=$((NARGS+1))
|
||||
fi
|
||||
|
||||
if [ "${NARGS}" -eq "0" ]
|
||||
then
|
||||
show_packages
|
||||
show_packages
|
||||
|
||||
elif [ "${NARGS}" -eq "1" ]
|
||||
then
|
||||
|
||||
if [ "${PACKAGE_CATEGORY}" = "@INDEX@" ]
|
||||
then
|
||||
if [ -f "${PKGDIR}/INDEX" ]
|
||||
then
|
||||
echo "${PKGDIR}/INDEX"
|
||||
exit 0
|
||||
else
|
||||
exit 1
|
||||
fi
|
||||
if [ "${PACKAGE_CATEGORY}" = "@INDEX@" ]
|
||||
then
|
||||
if [ -f "${PKGDIR}/INDEX" ]
|
||||
then
|
||||
echo "${PKGDIR}/INDEX"
|
||||
exit 0
|
||||
else
|
||||
exit 1
|
||||
fi
|
||||
|
||||
else
|
||||
show_packages_by_category "${PACKAGE_CATEGORY}"
|
||||
fi
|
||||
else
|
||||
show_packages_by_category "${PACKAGE_CATEGORY}"
|
||||
fi
|
||||
|
||||
elif [ "${NARGS}" -eq "2" ]
|
||||
then
|
||||
show_package_by_name "${PACKAGE_CATEGORY}" "${PACKAGE_NAME}"
|
||||
show_package_by_name "${PACKAGE_CATEGORY}" "${PACKAGE_NAME}"
|
||||
|
||||
else
|
||||
show_packages
|
||||
show_packages
|
||||
fi
|
||||
|
@ -32,8 +32,8 @@ MIRROR="${1}"
|
||||
|
||||
if [ -z "${MIRROR}" ]
|
||||
then
|
||||
echo "Error: No mirror specified!"
|
||||
exit 1
|
||||
echo "Error: No mirror specified!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
set_ftp_mirror "${MIRROR}"
|
||||
|
@ -35,15 +35,15 @@ 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
|
||||
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
|
||||
echo "ftp: Up"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "ftp: Down"
|
||||
|
@ -35,16 +35,17 @@ rm ${TMPDIR}/AvailUpgrades >/dev/null 2>/dev/null
|
||||
FSMNT="/mnt"
|
||||
|
||||
# Get the freebsd version on this partition
|
||||
get_fbsd_ver() {
|
||||
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
|
||||
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
|
||||
|
||||
}
|
||||
@ -62,7 +63,7 @@ do
|
||||
# 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}*`"
|
||||
DEVS="${DEVS} `ls /dev/${i}*`"
|
||||
fi
|
||||
|
||||
done
|
||||
@ -70,25 +71,25 @@ done
|
||||
# Search for regular UFS / Geom Partitions to upgrade
|
||||
for i in $DEVS
|
||||
do
|
||||
if [ ! -e "${i}a.journal" -a ! -e "${i}a" -a ! -e "${i}p2" -a ! -e "${i}p2.journal" ] ; then
|
||||
continue
|
||||
fi
|
||||
if [ ! -e "${i}a.journal" -a ! -e "${i}a" -a ! -e "${i}p2" -a ! -e "${i}p2.journal" ] ; then
|
||||
continue
|
||||
fi
|
||||
|
||||
if [ -e "${i}a.journal" ] ; then
|
||||
_dsk="${i}a.journal"
|
||||
elif [ -e "${i}a" ] ; then
|
||||
_dsk="${i}a"
|
||||
elif [ -e "${i}p2" ] ; then
|
||||
_dsk="${i}p2"
|
||||
elif [ -e "${i}p2.journal" ] ; then
|
||||
_dsk="${i}p2.journal"
|
||||
fi
|
||||
if [ -e "${i}a.journal" ] ; then
|
||||
_dsk="${i}a.journal"
|
||||
elif [ -e "${i}a" ] ; then
|
||||
_dsk="${i}a"
|
||||
elif [ -e "${i}p2" ] ; then
|
||||
_dsk="${i}p2"
|
||||
elif [ -e "${i}p2.journal" ] ; then
|
||||
_dsk="${i}p2.journal"
|
||||
fi
|
||||
|
||||
mount -o ro ${_dsk} ${FSMNT} >>${LOGOUT} 2>>${LOGOUT}
|
||||
if [ "${?}" = "0" -a -e "${FSMNT}/bin/sh" ] ; then
|
||||
get_fbsd_ver "`echo ${_dsk} | sed 's|/dev/||g'`"
|
||||
umount -f ${FSMNT} >/dev/null 2>/dev/null
|
||||
fi
|
||||
mount -o ro ${_dsk} ${FSMNT} >>${LOGOUT} 2>>${LOGOUT}
|
||||
if [ "${?}" = "0" -a -e "${FSMNT}/bin/sh" ] ; then
|
||||
get_fbsd_ver "`echo ${_dsk} | sed 's|/dev/||g'`"
|
||||
umount -f ${FSMNT} >/dev/null 2>/dev/null
|
||||
fi
|
||||
done
|
||||
|
||||
# Now search for any ZFS root partitions
|
||||
@ -101,9 +102,9 @@ umount_all_dir "${FSMNT}"
|
||||
_zps="`zpool list | grep -v 'NAME' | cut -d ' ' -f 1`"
|
||||
for _zpools in ${_zps}
|
||||
do
|
||||
mount -o ro -t zfs ${_zpools} ${FSMNT} >>${LOGOUT} 2>>${LOGOUT}
|
||||
if [ "${?}" = "0" -a -e "${FSMNT}/bin/sh" ] ; then
|
||||
get_fbsd_ver "${_zpools}"
|
||||
umount -f ${FSMNT} >/dev/null 2>/dev/null
|
||||
fi
|
||||
mount -o ro -t zfs ${_zpools} ${FSMNT} >>${LOGOUT} 2>>${LOGOUT}
|
||||
if [ "${?}" = "0" -a -e "${FSMNT}/bin/sh" ] ; then
|
||||
get_fbsd_ver "${_zpools}"
|
||||
umount -f ${FSMNT} >/dev/null 2>/dev/null
|
||||
fi
|
||||
done
|
||||
|
@ -36,7 +36,7 @@ do
|
||||
echo $line | grep '! ' >/dev/null 2>/dev/null
|
||||
if [ "$?" = "0" ]
|
||||
then
|
||||
exit 0
|
||||
exit 0
|
||||
else
|
||||
echo "$line"
|
||||
fi
|
||||
|
@ -36,7 +36,7 @@ do
|
||||
echo $line | grep '! ' >/dev/null 2>/dev/null
|
||||
if [ "$?" = "0" ]
|
||||
then
|
||||
exit 0
|
||||
exit 0
|
||||
else
|
||||
model="`echo $line | sed 's|(|[|g'`"
|
||||
model="`echo $model | sed 's|)|]|g'`"
|
||||
|
@ -36,7 +36,7 @@ do
|
||||
echo $line | grep '! ' >/dev/null 2>/dev/null
|
||||
if [ "$?" = "0" ]
|
||||
then
|
||||
exit 0
|
||||
exit 0
|
||||
else
|
||||
echo "$line"
|
||||
fi
|
||||
|
@ -76,7 +76,6 @@ get_fs_line_xvars()
|
||||
return
|
||||
fi # End of ZFS block
|
||||
|
||||
|
||||
fi # End of xtra-options block
|
||||
|
||||
# If we got here, set VAR to empty and export
|
||||
@ -86,30 +85,31 @@ get_fs_line_xvars()
|
||||
};
|
||||
|
||||
# Init each zfs mirror disk with a boot sector so we can failover
|
||||
setup_zfs_mirror_parts() {
|
||||
|
||||
_nZFS=""
|
||||
# Using mirroring, setup boot partitions on each disk
|
||||
_mirrline="`echo ${1} | sed 's|mirror ||g'`"
|
||||
for _zvars in $_mirrline
|
||||
do
|
||||
echo "Looping through _zvars: $_zvars" >>${LOGOUT}
|
||||
echo "$_zvars" | grep "${2}" >/dev/null 2>/dev/null
|
||||
if [ "$?" = "0" ] ; then continue ; fi
|
||||
if [ -z "$_zvars" ] ; then continue ; fi
|
||||
setup_zfs_mirror_parts()
|
||||
{
|
||||
_nZFS=""
|
||||
|
||||
is_disk "$_zvars" >/dev/null 2>/dev/null
|
||||
if [ "$?" = "0" ] ; then
|
||||
echo "Setting up ZFS mirror disk $_zvars" >>${LOGOUT}
|
||||
init_gpt_full_disk "$_zvars" >/dev/null 2>/dev/null
|
||||
rc_halt "gpart bootcode -p /boot/gptzfsboot -i 1 ${_zvars}" >/dev/null 2>/dev/null
|
||||
rc_halt "gpart add -t freebsd-zfs ${_zvars}" >/dev/null 2>/dev/null
|
||||
_nZFS="$_nZFS ${_zvars}p2"
|
||||
else
|
||||
_nZFS="$_nZFS ${_zvars}"
|
||||
fi
|
||||
done
|
||||
echo "mirror $2 `echo $_nZFS | tr -s ' '`"
|
||||
# Using mirroring, setup boot partitions on each disk
|
||||
_mirrline="`echo ${1} | sed 's|mirror ||g'`"
|
||||
for _zvars in $_mirrline
|
||||
do
|
||||
echo "Looping through _zvars: $_zvars" >>${LOGOUT}
|
||||
echo "$_zvars" | grep "${2}" >/dev/null 2>/dev/null
|
||||
if [ "$?" = "0" ] ; then continue ; fi
|
||||
if [ -z "$_zvars" ] ; then continue ; fi
|
||||
|
||||
is_disk "$_zvars" >/dev/null 2>/dev/null
|
||||
if [ "$?" = "0" ] ; then
|
||||
echo "Setting up ZFS mirror disk $_zvars" >>${LOGOUT}
|
||||
init_gpt_full_disk "$_zvars" >/dev/null 2>/dev/null
|
||||
rc_halt "gpart bootcode -p /boot/gptzfsboot -i 1 ${_zvars}" >/dev/null 2>/dev/null
|
||||
rc_halt "gpart add -t freebsd-zfs ${_zvars}" >/dev/null 2>/dev/null
|
||||
_nZFS="$_nZFS ${_zvars}p2"
|
||||
else
|
||||
_nZFS="$_nZFS ${_zvars}"
|
||||
fi
|
||||
done
|
||||
echo "mirror $2 `echo $_nZFS | tr -s ' '`"
|
||||
} ;
|
||||
|
||||
# Function which creates a unique label name for the specified mount
|
||||
@ -161,7 +161,6 @@ gen_glabel_name()
|
||||
# Function to setup / stamp a legacy MBR bsdlabel
|
||||
setup_mbr_partitions()
|
||||
{
|
||||
|
||||
DISKTAG="$1"
|
||||
WRKSLICE="$2"
|
||||
FOUNDPARTS="1"
|
||||
@ -218,7 +217,7 @@ setup_mbr_partitions()
|
||||
|
||||
# Now check that these values are sane
|
||||
case $FS in
|
||||
UFS|UFS+S|UFS+J|ZFS|SWAP) ;;
|
||||
UFS|UFS+S|UFS+J|ZFS|SWAP) ;;
|
||||
*) exit_err "ERROR: Invalid file system specified on $line" ;;
|
||||
esac
|
||||
|
||||
@ -316,16 +315,16 @@ setup_mbr_partitions()
|
||||
|
||||
# This partition letter is used, get the next one
|
||||
case ${PARTLETTER} in
|
||||
a) PARTLETTER="b" ;;
|
||||
b) # When we hit b, add the special c: setup for bsdlabel
|
||||
echo "c: * * unused" >>${BSDLABEL}
|
||||
PARTLETTER="d" ;;
|
||||
d) PARTLETTER="e" ;;
|
||||
e) PARTLETTER="f" ;;
|
||||
f) PARTLETTER="g" ;;
|
||||
g) PARTLETTER="h" ;;
|
||||
h) PARTLETTER="ERR" ;;
|
||||
*) exit_err "ERROR: bsdlabel only supports up to letter h for partitions." ;;
|
||||
a) PARTLETTER="b" ;;
|
||||
b) # When we hit b, add the special c: setup for bsdlabel
|
||||
echo "c: * * unused" >>${BSDLABEL}
|
||||
PARTLETTER="d" ;;
|
||||
d) PARTLETTER="e" ;;
|
||||
e) PARTLETTER="f" ;;
|
||||
f) PARTLETTER="g" ;;
|
||||
g) PARTLETTER="h" ;;
|
||||
h) PARTLETTER="ERR" ;;
|
||||
*) exit_err "ERROR: bsdlabel only supports up to letter h for partitions." ;;
|
||||
esac
|
||||
|
||||
fi # End of subsection locating a slice in config
|
||||
@ -402,7 +401,7 @@ setup_gpt_partitions()
|
||||
|
||||
# Now check that these values are sane
|
||||
case $FS in
|
||||
UFS|UFS+S|UFS+J|ZFS|SWAP) ;;
|
||||
UFS|UFS+S|UFS+J|ZFS|SWAP) ;;
|
||||
*) exit_err "ERROR: Invalid file system specified on $line" ;;
|
||||
esac
|
||||
|
||||
@ -464,9 +463,9 @@ setup_gpt_partitions()
|
||||
|
||||
# Figure out the gpart type to use
|
||||
case ${FS} in
|
||||
ZFS) PARTYPE="freebsd-zfs" ;;
|
||||
SWAP) PARTYPE="freebsd-swap" ;;
|
||||
*) PARTYPE="freebsd-ufs" ;;
|
||||
ZFS) PARTYPE="freebsd-zfs" ;;
|
||||
SWAP) PARTYPE="freebsd-swap" ;;
|
||||
*) PARTYPE="freebsd-ufs" ;;
|
||||
esac
|
||||
|
||||
# Create the partition
|
||||
@ -507,8 +506,8 @@ setup_gpt_partitions()
|
||||
# If this is the boot disk, stamp the right gptboot
|
||||
if [ ! -z "${BOOTTYPE}" ] ; then
|
||||
case ${BOOTTYPE} in
|
||||
freebsd-ufs) rc_halt "gpart bootcode -p /boot/gptboot -i 1 ${DISK}" ;;
|
||||
freebsd-zfs) rc_halt "gpart bootcode -p /boot/gptzfsboot -i 1 ${DISK}" ;;
|
||||
freebsd-ufs) rc_halt "gpart bootcode -p /boot/gptboot -i 1 ${DISK}" ;;
|
||||
freebsd-zfs) rc_halt "gpart bootcode -p /boot/gptzfsboot -i 1 ${DISK}" ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
|
@ -166,8 +166,8 @@ setup_fstab()
|
||||
# Set mount options for file-systems
|
||||
case $PARTFS in
|
||||
UFS+J) MNTOPTS="rw,noatime,async" ;;
|
||||
SWAP) MNTOPTS="sw" ;;
|
||||
*) MNTOPTS="rw,noatime" ;;
|
||||
SWAP) MNTOPTS="sw" ;;
|
||||
*) MNTOPTS="rw,noatime" ;;
|
||||
esac
|
||||
|
||||
|
||||
@ -391,30 +391,28 @@ set_root_pw()
|
||||
|
||||
run_final_cleanup()
|
||||
{
|
||||
# Check if we need to run any gmirror setup
|
||||
ls ${MIRRORCFGDIR}/* >/dev/null 2>/dev/null
|
||||
if [ "$?" = "0" ]
|
||||
then
|
||||
# Lets setup gmirror now
|
||||
setup_gmirror
|
||||
fi
|
||||
|
||||
# Check if we need to run any gmirror setup
|
||||
ls ${MIRRORCFGDIR}/* >/dev/null 2>/dev/null
|
||||
if [ "$?" = "0" ]
|
||||
then
|
||||
# Lets setup gmirror now
|
||||
setup_gmirror
|
||||
fi
|
||||
# Check if we need to save any geli keys
|
||||
ls ${GELIKEYDIR}/* >/dev/null 2>/dev/null
|
||||
if [ "$?" = "0" ]
|
||||
then
|
||||
# Lets setup geli loading
|
||||
setup_geli_loading
|
||||
fi
|
||||
|
||||
# Check if we need to save any geli keys
|
||||
ls ${GELIKEYDIR}/* >/dev/null 2>/dev/null
|
||||
if [ "$?" = "0" ]
|
||||
then
|
||||
# Lets setup geli loading
|
||||
setup_geli_loading
|
||||
fi
|
||||
# Set a hostname on the install system
|
||||
setup_hostname
|
||||
|
||||
# Set a hostname on the install system
|
||||
setup_hostname
|
||||
|
||||
# Set the root_pw if it is specified
|
||||
set_root_pw
|
||||
|
||||
# Generate the fstab for the installed system
|
||||
setup_fstab
|
||||
# Set the root_pw if it is specified
|
||||
set_root_pw
|
||||
|
||||
# Generate the fstab for the installed system
|
||||
setup_fstab
|
||||
};
|
||||
|
@ -28,13 +28,14 @@
|
||||
# Functions related to disk operations using gpart
|
||||
|
||||
# See if device is a full disk or partition/slice
|
||||
is_disk() {
|
||||
for _dsk in `sysctl -n kern.disks`
|
||||
do
|
||||
if [ "$_dsk" = "${1}" ] ; then return 0 ; fi
|
||||
done
|
||||
is_disk()
|
||||
{
|
||||
for _dsk in `sysctl -n kern.disks`
|
||||
do
|
||||
if [ "$_dsk" = "${1}" ] ; then return 0 ; fi
|
||||
done
|
||||
|
||||
return 1
|
||||
return 1
|
||||
}
|
||||
|
||||
# Get a MBR partitions sysid
|
||||
@ -190,9 +191,9 @@ get_disk_partitions()
|
||||
for i in ${SLICES}
|
||||
do
|
||||
case $type in
|
||||
MBR) name="${1}s${i}" ;;
|
||||
GPT) name="${1}p${i}";;
|
||||
*) name="${1}s${i}";;
|
||||
MBR) name="${1}s${i}" ;;
|
||||
GPT) name="${1}p${i}";;
|
||||
*) name="${1}s${i}";;
|
||||
esac
|
||||
if [ -z "${RSLICES}" ]
|
||||
then
|
||||
@ -226,8 +227,19 @@ get_disk_heads()
|
||||
VAL="${head}" ; export VAL
|
||||
};
|
||||
|
||||
# Function which returns a target disks mediasize in sectors
|
||||
get_disk_mediasize()
|
||||
{
|
||||
mediasize=`diskinfo -v ${1} | grep "# mediasize in sectors" | tr -s ' ' | cut -f 2`
|
||||
|
||||
# Not sure why this is, memory disks need it though.
|
||||
mediasize=`expr ${mediasize} - 10`
|
||||
VAL="${mediasize}" ; export VAL
|
||||
};
|
||||
|
||||
# Function which exports all zpools, making them safe to overwrite potentially
|
||||
export_all_zpools() {
|
||||
export_all_zpools()
|
||||
{
|
||||
# Export any zpools
|
||||
for i in `zpool list -H -o name`
|
||||
do
|
||||
@ -434,20 +446,30 @@ setup_disk_slice()
|
||||
if [ ! -z "${DISK}" -a ! -z "${PTYPE}" ]
|
||||
then
|
||||
case ${PTYPE} in
|
||||
all|ALL) if [ "$PSCHEME" = "MBR" -o -z "$PSCHEME" ] ; then
|
||||
PSCHEME="MBR"
|
||||
tmpSLICE="${DISK}s1"
|
||||
else
|
||||
tmpSLICE="${DISK}p1"
|
||||
fi
|
||||
run_gpart_full "${DISK}" "${BMANAGER}" "${PSCHEME}" ;;
|
||||
s1|s2|s3|s4) tmpSLICE="${DISK}${PTYPE}"
|
||||
# Get the number of the slice we are working on
|
||||
s="`echo ${PTYPE} | awk '{print substr($0,length,1)}'`"
|
||||
run_gpart_slice "${DISK}" "${BMANAGER}" "${s}" ;;
|
||||
free|FREE) tmpSLICE="${DISK}s${LASTSLICE}"
|
||||
run_gpart_free "${DISK}" "${LASTSLICE}" "${BMANAGER}" ;;
|
||||
*) exit_err "ERROR: Unknown PTYPE: $PTYPE" ;;
|
||||
all|ALL)
|
||||
if [ "$PSCHEME" = "MBR" -o -z "$PSCHEME" ] ; then
|
||||
PSCHEME="MBR"
|
||||
tmpSLICE="${DISK}s1"
|
||||
else
|
||||
tmpSLICE="${DISK}p1"
|
||||
fi
|
||||
|
||||
run_gpart_full "${DISK}" "${BMANAGER}" "${PSCHEME}"
|
||||
;;
|
||||
|
||||
s1|s2|s3|s4)
|
||||
tmpSLICE="${DISK}${PTYPE}"
|
||||
# Get the number of the slice we are working on
|
||||
s="`echo ${PTYPE} | awk '{print substr($0,length,1)}'`"
|
||||
run_gpart_slice "${DISK}" "${BMANAGER}" "${s}"
|
||||
;;
|
||||
|
||||
free|FREE)
|
||||
tmpSLICE="${DISK}s${LASTSLICE}"
|
||||
run_gpart_free "${DISK}" "${LASTSLICE}" "${BMANAGER}"
|
||||
;;
|
||||
|
||||
*) exit_err "ERROR: Unknown PTYPE: $PTYPE" ;;
|
||||
esac
|
||||
|
||||
# Now save which disk<num> this is, so we can parse it later during slice partition setup
|
||||
@ -478,7 +500,8 @@ setup_disk_slice()
|
||||
};
|
||||
|
||||
# Stop all gjournals on disk / slice
|
||||
stop_gjournal() {
|
||||
stop_gjournal()
|
||||
{
|
||||
_gdsk="$1"
|
||||
# Check if we need to shutdown any journals on this drive
|
||||
ls /dev/${_gdsk}*.journal >/dev/null 2>/dev/null
|
||||
@ -565,7 +588,11 @@ init_mbr_full_disk()
|
||||
# Multiply them all together to get our total blocks
|
||||
totalblocks="`expr ${cyl} \* ${head}`"
|
||||
totalblocks="`expr ${totalblocks} \* ${sec}`"
|
||||
|
||||
if [ -z "${totalblocks}" ]
|
||||
then
|
||||
get_disk_mediasize "${_intDISK}"
|
||||
totalblocks="${VAL}"
|
||||
fi
|
||||
|
||||
# Now set the ending block to the total disk block size
|
||||
sizeblock="`expr ${totalblocks} - ${startblock}`"
|
||||
|
@ -54,39 +54,41 @@ start_extract_uzip_tar()
|
||||
echo_log "pc-sysinstall: Starting Extraction"
|
||||
|
||||
case ${PACKAGETYPE} in
|
||||
uzip) # Start by mounting the uzip image
|
||||
MDDEVICE=`mdconfig -a -t vnode -o readonly -f ${INSFILE}`
|
||||
mkdir -p ${FSMNT}.uzip
|
||||
mount -r /dev/${MDDEVICE}.uzip ${FSMNT}.uzip
|
||||
if [ "$?" != "0" ]
|
||||
then
|
||||
exit_err "ERROR: Failed mounting the ${INSFILE}"
|
||||
fi
|
||||
cd ${FSMNT}.uzip
|
||||
uzip)
|
||||
# Start by mounting the uzip image
|
||||
MDDEVICE=`mdconfig -a -t vnode -o readonly -f ${INSFILE}`
|
||||
mkdir -p ${FSMNT}.uzip
|
||||
mount -r /dev/${MDDEVICE}.uzip ${FSMNT}.uzip
|
||||
if [ "$?" != "0" ]
|
||||
then
|
||||
exit_err "ERROR: Failed mounting the ${INSFILE}"
|
||||
fi
|
||||
cd ${FSMNT}.uzip
|
||||
|
||||
# Copy over all the files now!
|
||||
tar cvf - . 2>/dev/null | tar -xpv -C ${FSMNT} ${TAROPTS} -f - 2>&1 | tee -a ${FSMNT}/.tar-extract.log
|
||||
if [ "$?" != "0" ]
|
||||
then
|
||||
cd /
|
||||
echo "TAR failure occured:" >>${LOGOUT}
|
||||
cat ${FSMNT}/.tar-extract.log | grep "tar:" >>${LOGOUT}
|
||||
umount ${FSMNT}.uzip
|
||||
mdconfig -d -u ${MDDEVICE}
|
||||
exit_err "ERROR: Failed extracting the tar image"
|
||||
fi
|
||||
# Copy over all the files now!
|
||||
tar cvf - . 2>/dev/null | tar -xpv -C ${FSMNT} ${TAROPTS} -f - 2>&1 | tee -a ${FSMNT}/.tar-extract.log
|
||||
if [ "$?" != "0" ]
|
||||
then
|
||||
cd /
|
||||
echo "TAR failure occured:" >>${LOGOUT}
|
||||
cat ${FSMNT}/.tar-extract.log | grep "tar:" >>${LOGOUT}
|
||||
umount ${FSMNT}.uzip
|
||||
mdconfig -d -u ${MDDEVICE}
|
||||
exit_err "ERROR: Failed extracting the tar image"
|
||||
fi
|
||||
|
||||
# All finished, now lets umount and cleanup
|
||||
cd /
|
||||
umount ${FSMNT}.uzip
|
||||
mdconfig -d -u ${MDDEVICE}
|
||||
;;
|
||||
tar) tar -xpv -C ${FSMNT} -f ${INSFILE} ${TAROPTS} >&1 2>&1
|
||||
if [ "$?" != "0" ]
|
||||
then
|
||||
exit_err "ERROR: Failed extracting the tar image"
|
||||
fi
|
||||
;;
|
||||
# All finished, now lets umount and cleanup
|
||||
cd /
|
||||
umount ${FSMNT}.uzip
|
||||
mdconfig -d -u ${MDDEVICE}
|
||||
;;
|
||||
tar)
|
||||
tar -xpv -C ${FSMNT} -f ${INSFILE} ${TAROPTS} >&1 2>&1
|
||||
if [ "$?" != "0" ]
|
||||
then
|
||||
exit_err "ERROR: Failed extracting the tar image"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
# Check if this was a FTP download and clean it up now
|
||||
@ -120,10 +122,10 @@ start_extract_split()
|
||||
DIRS=`ls -d ${INSDIR}/*|grep -Ev '(uzip|kernels|src)'`
|
||||
for dir in ${DIRS}
|
||||
do
|
||||
cd "${dir}"
|
||||
if [ -f "install.sh" ]
|
||||
then
|
||||
echo_log "Extracting" `basename ${dir}`
|
||||
cd "${dir}"
|
||||
if [ -f "install.sh" ]
|
||||
then
|
||||
echo_log "Extracting" `basename ${dir}`
|
||||
echo "y" | sh install.sh >/dev/null
|
||||
if [ "$?" != "0" ]
|
||||
then
|
||||
@ -139,13 +141,13 @@ start_extract_split()
|
||||
cd "${KERNELS}"
|
||||
if [ -f "install.sh" ]
|
||||
then
|
||||
echo_log "Extracting" `basename ${KERNELS}`
|
||||
echo_log "Extracting" `basename ${KERNELS}`
|
||||
echo "y" | sh install.sh generic >/dev/null
|
||||
if [ "$?" != "0" ]
|
||||
then
|
||||
exit_err "ERROR: Failed extracting ${KERNELS}"
|
||||
fi
|
||||
echo 'kernel="GENERIC"' > "${FSMNT}/boot/loader.conf"
|
||||
mv "${FSMNT}/boot/GENERIC" "${FSMNT}/boot/kernel"
|
||||
else
|
||||
exit_err "ERROR: ${KERNELS}/install.sh does not exist"
|
||||
fi
|
||||
@ -155,7 +157,7 @@ start_extract_split()
|
||||
cd "${SOURCE}"
|
||||
if [ -f "install.sh" ]
|
||||
then
|
||||
echo_log "Extracting" `basename ${SOURCE}`
|
||||
echo_log "Extracting" `basename ${SOURCE}`
|
||||
echo "y" | sh install.sh all >/dev/null
|
||||
if [ "$?" != "0" ]
|
||||
then
|
||||
@ -206,14 +208,14 @@ fetch_install_file()
|
||||
# Function which will download freebsd install files
|
||||
fetch_split_files()
|
||||
{
|
||||
get_value_from_cfg ftpHost
|
||||
get_ftpHost
|
||||
if [ -z "$VAL" ]
|
||||
then
|
||||
exit_err "ERROR: Install medium was set to ftp, but no ftpHost was provided!"
|
||||
fi
|
||||
FTPHOST="${VAL}"
|
||||
|
||||
get_value_from_cfg ftpDir
|
||||
get_ftpDir
|
||||
if [ -z "$VAL" ]
|
||||
then
|
||||
exit_err "ERROR: Install medium was set to ftp, but no ftpDir was provided!"
|
||||
@ -228,6 +230,18 @@ fetch_split_files()
|
||||
OUTFILE="${FSMNT}/.fetch-${INSFILE}"
|
||||
fi
|
||||
|
||||
DIRS="base catpages dict doc games info manpages proflibs kernels src"
|
||||
if [ "${FBSD_ARCH}" = "amd64" ]
|
||||
then
|
||||
DIRS="${DIRS} lib32"
|
||||
fi
|
||||
|
||||
for d in ${DIRS}
|
||||
do
|
||||
mkdir -p "${OUTFILE}/${d}"
|
||||
done
|
||||
|
||||
|
||||
NETRC="${OUTFILE}/.netrc"
|
||||
cat<<EOF>"${NETRC}"
|
||||
machine ${FTPHOST}
|
||||
@ -238,22 +252,16 @@ bin
|
||||
prompt
|
||||
EOF
|
||||
|
||||
DIRS="base catpages dict doc games info manpages proflibs kernels src"
|
||||
if [ "${FBSD_ARCH}" = "amd64" ]
|
||||
then
|
||||
DIRS="${DIRS} lib32"
|
||||
fi
|
||||
|
||||
for d in ${DIRS}
|
||||
do
|
||||
cat<<EOF>>"${NETRC}"
|
||||
cat<<EOF>>"${NETRC}"
|
||||
cd ${FTPDIR}/${d}
|
||||
lcd ${OUTFILE}/${d}
|
||||
mreget *
|
||||
EOF
|
||||
done
|
||||
|
||||
cat<<EOF>>"${NETRC}"
|
||||
cat<<EOF>>"${NETRC}"
|
||||
bye
|
||||
|
||||
|
||||
@ -335,19 +343,19 @@ init_extraction()
|
||||
if [ "$INSTALLTYPE" = "FreeBSD" ]
|
||||
then
|
||||
case $PACKAGETYPE in
|
||||
uzip) INSFILE="${FBSD_UZIP_FILE}" ;;
|
||||
tar) INSFILE="${FBSD_TAR_FILE}" ;;
|
||||
split)
|
||||
INSDIR="${FBSD_BRANCH_DIR}"
|
||||
uzip) INSFILE="${FBSD_UZIP_FILE}" ;;
|
||||
tar) INSFILE="${FBSD_TAR_FILE}" ;;
|
||||
split)
|
||||
INSDIR="${FBSD_BRANCH_DIR}"
|
||||
|
||||
# This is to trick opt_mount into not failing
|
||||
INSFILE="${INSDIR}"
|
||||
;;
|
||||
# This is to trick opt_mount into not failing
|
||||
INSFILE="${INSDIR}"
|
||||
;;
|
||||
esac
|
||||
else
|
||||
case $PACKAGETYPE in
|
||||
uzip) INSFILE="${UZIP_FILE}" ;;
|
||||
tar) INSFILE="${TAR_FILE}" ;;
|
||||
uzip) INSFILE="${UZIP_FILE}" ;;
|
||||
tar) INSFILE="${TAR_FILE}" ;;
|
||||
esac
|
||||
fi
|
||||
export INSFILE
|
||||
@ -355,33 +363,37 @@ init_extraction()
|
||||
|
||||
# Lets start by figuring out what medium we are using
|
||||
case ${INSTALLMEDIUM} in
|
||||
dvd|usb) # Lets start by mounting the disk
|
||||
opt_mount
|
||||
if [ ! -z "${INSDIR}" ]
|
||||
then
|
||||
INSDIR="${CDMNT}/${INSDIR}" ; export INSDIR
|
||||
start_extract_split
|
||||
dvd|usb)
|
||||
# Lets start by mounting the disk
|
||||
opt_mount
|
||||
if [ ! -z "${INSDIR}" ]
|
||||
then
|
||||
INSDIR="${CDMNT}/${INSDIR}" ; export INSDIR
|
||||
start_extract_split
|
||||
|
||||
else
|
||||
INSFILE="${CDMNT}/${INSFILE}" ; export INSFILE
|
||||
start_extract_uzip_tar
|
||||
fi
|
||||
;;
|
||||
ftp)
|
||||
if [ "$PACKAGETYPE" = "split" ]
|
||||
then
|
||||
fetch_split_files
|
||||
else
|
||||
INSFILE="${CDMNT}/${INSFILE}" ; export INSFILE
|
||||
start_extract_uzip_tar
|
||||
fi
|
||||
;;
|
||||
|
||||
INSDIR="${INSFILE}" ; export INSDIR
|
||||
start_extract_split
|
||||
else
|
||||
fetch_install_file
|
||||
start_extract_uzip_tar
|
||||
fi
|
||||
;;
|
||||
rsync) start_rsync_copy
|
||||
;;
|
||||
*) exit_err "ERROR: Unknown install medium" ;;
|
||||
ftp|sftp)
|
||||
if [ "$PACKAGETYPE" = "split" ]
|
||||
then
|
||||
fetch_split_files
|
||||
|
||||
INSDIR="${INSFILE}" ; export INSDIR
|
||||
start_extract_split
|
||||
else
|
||||
fetch_install_file
|
||||
start_extract_uzip_tar
|
||||
fi
|
||||
;;
|
||||
|
||||
rsync) start_rsync_copy ;;
|
||||
img)
|
||||
;;
|
||||
*) exit_err "ERROR: Unknown install medium" ;;
|
||||
esac
|
||||
|
||||
};
|
||||
|
@ -280,20 +280,43 @@ show_mirrors()
|
||||
|
||||
set_ftp_mirror()
|
||||
{
|
||||
MIRROR="${1}"
|
||||
echo "${MIRROR}" > "${CONFDIR}/mirrors.conf"
|
||||
MIRROR="${1}"
|
||||
echo "${MIRROR}" > "${CONFDIR}/mirrors.conf"
|
||||
};
|
||||
|
||||
get_ftp_mirror()
|
||||
{
|
||||
MIRROR="${DEFAULT_FTP_SERVER}"
|
||||
if [ -f "${CONFDIR}/mirrors.conf" ]
|
||||
then
|
||||
MIRROR=`cat "${CONFDIR}/mirrors.conf"`
|
||||
fi
|
||||
MIRROR="${DEFAULT_FTP_SERVER}"
|
||||
if [ -f "${CONFDIR}/mirrors.conf" ]
|
||||
then
|
||||
MIRROR=`cat "${CONFDIR}/mirrors.conf"`
|
||||
fi
|
||||
|
||||
VAL="${MIRROR}"
|
||||
export VAL
|
||||
VAL="${MIRROR}"
|
||||
export VAL
|
||||
};
|
||||
|
||||
|
||||
get_ftpHost()
|
||||
{
|
||||
get_value_from_cfg ftpPath
|
||||
ftpPath="$VAL"
|
||||
|
||||
ftpHost=`echo "${ftpPath}" | sed -E 's|^(ftp://)([^/]*)(.*)|\2|'`
|
||||
VAL="${ftpHost}"
|
||||
|
||||
export VAL
|
||||
};
|
||||
|
||||
get_ftpDir()
|
||||
{
|
||||
get_value_from_cfg ftpPath
|
||||
ftpPath="$VAL"
|
||||
|
||||
ftpDir=`echo "${ftpPath}" | sed -E 's|^(ftp://)([^/]*)(.*)|\3|'`
|
||||
VAL="${ftpDir}"
|
||||
|
||||
export VAL
|
||||
};
|
||||
|
||||
get_ftp_mirrors()
|
||||
|
@ -52,23 +52,25 @@ copy_component()
|
||||
CFILEMD5="`echo $line | cut -d ':' -f 2`"
|
||||
CFILE2MD5="`echo $line | cut -d ':' -f 3`"
|
||||
|
||||
|
||||
case ${INSTALLMEDIUM} in
|
||||
dvd|usb) # On both dvd / usb, we can just copy the file
|
||||
cp ${CDMNT}/${COMPFILEDIR}/${SUBDIR}/${CFILE} \
|
||||
${FSMNT}/${COMPTMPDIR} >>${LOGOUT} 2>>${LOGOUT}
|
||||
dvd|usb)
|
||||
# On both dvd / usb, we can just copy the file
|
||||
cp ${CDMNT}/${COMPFILEDIR}/${SUBDIR}/${CFILE} \
|
||||
${FSMNT}/${COMPTMPDIR} >>${LOGOUT} 2>>${LOGOUT}
|
||||
RESULT="$?"
|
||||
;;
|
||||
ftp) get_value_from_cfg ftpPath
|
||||
if [ -z "$VAL" ]
|
||||
then
|
||||
exit_err "ERROR: Install medium was set to ftp, but no ftpPath was provided!"
|
||||
fi
|
||||
FTPPATH="${VAL}"
|
||||
;;
|
||||
|
||||
fetch_file "${FTPPATH}/${COMPFILEDIR}/${SUBDIR}/${CFILE}" "${FSMNT}/${COMPTMPDIR}/${CFILE}" "0"
|
||||
RESULT="$?"
|
||||
;;
|
||||
ftp|sftp)
|
||||
get_value_from_cfg ftpPath
|
||||
if [ -z "$VAL" ]
|
||||
then
|
||||
exit_err "ERROR: Install medium was set to ftp, but no ftpPath was provided!"
|
||||
fi
|
||||
FTPPATH="${VAL}"
|
||||
|
||||
fetch_file "${FTPPATH}/${COMPFILEDIR}/${SUBDIR}/${CFILE}" "${FSMNT}/${COMPTMPDIR}/${CFILE}" "0"
|
||||
RESULT="$?"
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ "${RESULT}" != "0" ]
|
||||
@ -120,47 +122,44 @@ export CFILE
|
||||
sh ${COMPTMPDIR}/install.sh
|
||||
|
||||
" >${FSMNT}/.componentwrapper.sh
|
||||
chmod 755 ${FSMNT}/.componentwrapper.sh
|
||||
chmod 755 ${FSMNT}/.componentwrapper.sh
|
||||
|
||||
# Copy over the install script for this component
|
||||
cp ${COMPDIR}/${COMPONENT}/install.sh ${FSMNT}/${COMPTMPDIR}/
|
||||
|
||||
echo_log "INSTALL COMPONENT: ${i}"
|
||||
chroot ${FSMNT} /.componentwrapper.sh >>${LOGOUT} 2>>${LOGOUT}
|
||||
rm ${FSMNT}/.componentwrapper.sh
|
||||
# Copy over the install script for this component
|
||||
cp ${COMPDIR}/${COMPONENT}/install.sh ${FSMNT}/${COMPTMPDIR}/
|
||||
|
||||
echo_log "INSTALL COMPONENT: ${i}"
|
||||
chroot ${FSMNT} /.componentwrapper.sh >>${LOGOUT} 2>>${LOGOUT}
|
||||
rm ${FSMNT}/.componentwrapper.sh
|
||||
|
||||
};
|
||||
|
||||
# Check for any modules specified, and begin loading them
|
||||
install_components()
|
||||
{
|
||||
# First, lets check and see if we even have any optional modules
|
||||
get_value_from_cfg installComponents
|
||||
if [ ! -z "${VAL}" ]
|
||||
then
|
||||
# Lets start by cleaning up the string and getting it ready to parse
|
||||
strip_white_space ${VAL}
|
||||
COMPONENTS=`echo ${VAL} | sed -e "s|,| |g"`
|
||||
for i in $COMPONENTS
|
||||
do
|
||||
if [ ! -e "${COMPDIR}/${i}/install.sh" -o ! -e "${COMPDIR}/${i}/distfiles" ]
|
||||
then
|
||||
echo_log "WARNING: Component ${i} doesn't seem to exist"
|
||||
else
|
||||
# First, lets check and see if we even have any optional modules
|
||||
get_value_from_cfg installComponents
|
||||
if [ ! -z "${VAL}" ]
|
||||
then
|
||||
# Lets start by cleaning up the string and getting it ready to parse
|
||||
strip_white_space ${VAL}
|
||||
COMPONENTS=`echo ${VAL} | sed -e "s|,| |g"`
|
||||
for i in $COMPONENTS
|
||||
do
|
||||
if [ ! -e "${COMPDIR}/${i}/install.sh" -o ! -e "${COMPDIR}/${i}/distfiles" ]
|
||||
then
|
||||
echo_log "WARNING: Component ${i} doesn't seem to exist"
|
||||
else
|
||||
|
||||
# Make the tmpdir on the disk
|
||||
mkdir -p ${FSMNT}/${COMPTMPDIR} >>${LOGOUT} 2>>${LOGOUT}
|
||||
# Make the tmpdir on the disk
|
||||
mkdir -p ${FSMNT}/${COMPTMPDIR} >>${LOGOUT} 2>>${LOGOUT}
|
||||
|
||||
# Start by grabbing the component files
|
||||
copy_component ${i}
|
||||
# Start by grabbing the component files
|
||||
copy_component ${i}
|
||||
|
||||
# Remove the tmpdir now
|
||||
rm -rf ${FSMNT}/${COMPTMPDIR} >>${LOGOUT} 2>>${LOGOUT}
|
||||
|
||||
fi
|
||||
done
|
||||
|
||||
fi
|
||||
# Remove the tmpdir now
|
||||
rm -rf ${FSMNT}/${COMPTMPDIR} >>${LOGOUT} 2>>${LOGOUT}
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
};
|
||||
|
@ -33,93 +33,93 @@
|
||||
# Recursively determine all dependencies for this package
|
||||
determine_package_dependencies()
|
||||
{
|
||||
local PKGNAME="${1}"
|
||||
local DEPFILE="${2}"
|
||||
local PKGNAME="${1}"
|
||||
local DEPFILE="${2}"
|
||||
|
||||
grep "${PKGNAME}" "${DEPFILE}" >/dev/null
|
||||
if [ "$?" -ne "0" ]
|
||||
then
|
||||
echo "${PKGNAME}" >> "${DEPFILE}"
|
||||
get_package_dependencies "${PKGNAME}" "1"
|
||||
local DEPS="${VAL}"
|
||||
grep "${PKGNAME}" "${DEPFILE}" >/dev/null
|
||||
if [ "$?" -ne "0" ]
|
||||
then
|
||||
echo "${PKGNAME}" >> "${DEPFILE}"
|
||||
get_package_dependencies "${PKGNAME}" "1"
|
||||
|
||||
for d in ${DEPS}
|
||||
do
|
||||
determine_package_dependencies "${d}" "${DEPFILE}"
|
||||
done
|
||||
fi
|
||||
local DEPS="${VAL}"
|
||||
for d in ${DEPS}
|
||||
do
|
||||
determine_package_dependencies "${d}" "${DEPFILE}"
|
||||
done
|
||||
fi
|
||||
};
|
||||
|
||||
# Fetch packages dependencies from a file
|
||||
fetch_package_dependencies()
|
||||
{
|
||||
local DEPFILE
|
||||
local DEPS
|
||||
local SAVEDIR
|
||||
local DEPFILE
|
||||
local DEPS
|
||||
local SAVEDIR
|
||||
|
||||
DEPFILE="${1}"
|
||||
DEPS=`cat "${DEPFILE}"`
|
||||
SAVEDIR="${2}"
|
||||
DEPFILE="${1}"
|
||||
DEPS=`cat "${DEPFILE}"`
|
||||
SAVEDIR="${2}"
|
||||
|
||||
for d in ${DEPS}
|
||||
do
|
||||
get_package_short_name "${d}"
|
||||
SNAME="${VAL}"
|
||||
for d in ${DEPS}
|
||||
do
|
||||
get_package_short_name "${d}"
|
||||
SNAME="${VAL}"
|
||||
|
||||
get_package_category "${SNAME}"
|
||||
CATEGORY="${VAL}"
|
||||
get_package_category "${SNAME}"
|
||||
CATEGORY="${VAL}"
|
||||
|
||||
fetch_package "${CATEGORY}" "${d}" "${SAVEDIR}"
|
||||
done
|
||||
fetch_package "${CATEGORY}" "${d}" "${SAVEDIR}"
|
||||
done
|
||||
};
|
||||
|
||||
# Check for any packages specified, and begin loading them
|
||||
install_packages()
|
||||
{
|
||||
# First, lets check and see if we even have any packages to install
|
||||
get_value_from_cfg installPackages
|
||||
if [ ! -z "${VAL}" ]
|
||||
then
|
||||
HERE=`pwd`
|
||||
rc_nohalt "mkdir -p ${FSMNT}/${PKGTMPDIR}"
|
||||
rc_nohalt "cd ${FSMNT}/${PKGTMPDIR}"
|
||||
# First, lets check and see if we even have any packages to install
|
||||
get_value_from_cfg installPackages
|
||||
if [ ! -z "${VAL}" ]
|
||||
then
|
||||
HERE=`pwd`
|
||||
rc_nohalt "mkdir -p ${FSMNT}/${PKGTMPDIR}"
|
||||
rc_nohalt "cd ${FSMNT}/${PKGTMPDIR}"
|
||||
|
||||
if [ ! -f "${CONFDIR}/INDEX" ]
|
||||
then
|
||||
get_package_index
|
||||
fi
|
||||
if [ ! -f "${CONFDIR}/INDEX" ]
|
||||
then
|
||||
get_package_index
|
||||
fi
|
||||
|
||||
if [ ! -f "${CONFDIR}/INDEX.parsed" ]
|
||||
then
|
||||
parse_package_index
|
||||
fi
|
||||
if [ ! -f "${CONFDIR}/INDEX.parsed" ]
|
||||
then
|
||||
parse_package_index
|
||||
fi
|
||||
|
||||
# Lets start by cleaning up the string and getting it ready to parse
|
||||
strip_white_space ${VAL}
|
||||
PACKAGES=`echo ${VAL} | sed -e "s|,| |g"`
|
||||
for i in $PACKAGES
|
||||
do
|
||||
if get_package_name "${i}"
|
||||
then
|
||||
PKGNAME="${VAL}"
|
||||
DEPFILE="${FSMNT}/${PKGTMPDIR}/.${PKGNAME}.deps"
|
||||
# Lets start by cleaning up the string and getting it ready to parse
|
||||
strip_white_space ${VAL}
|
||||
PACKAGES=`echo ${VAL} | sed -e "s|,| |g"`
|
||||
for i in $PACKAGES
|
||||
do
|
||||
if get_package_name "${i}"
|
||||
then
|
||||
PKGNAME="${VAL}"
|
||||
DEPFILE="${FSMNT}/${PKGTMPDIR}/.${PKGNAME}.deps"
|
||||
|
||||
rc_nohalt "touch ${DEPFILE}"
|
||||
determine_package_dependencies "${PKGNAME}" "${DEPFILE}"
|
||||
fetch_package_dependencies "${DEPFILE}" "${FSMNT}/${PKGTMPDIR}"
|
||||
rc_nohalt "touch ${DEPFILE}"
|
||||
determine_package_dependencies "${PKGNAME}" "${DEPFILE}"
|
||||
fetch_package_dependencies "${DEPFILE}" "${FSMNT}/${PKGTMPDIR}"
|
||||
|
||||
# If the package is not already installed, install it!
|
||||
if ! run_chroot_cmd "pkg_info -e ${PKGNAME}"
|
||||
then
|
||||
rc_nohalt "pkg_add -C ${FSMNT} ${PKGTMPDIR}/${PKGNAME}.tbz"
|
||||
fi
|
||||
# If the package is not already installed, install it!
|
||||
if ! run_chroot_cmd "pkg_info -e ${PKGNAME}"
|
||||
then
|
||||
rc_nohalt "pkg_add -C ${FSMNT} ${PKGTMPDIR}/${PKGNAME}.tbz"
|
||||
fi
|
||||
|
||||
rc_nohalt "rm ${DEPFILE}"
|
||||
fi
|
||||
rc_nohalt "rm ${DEPFILE}"
|
||||
fi
|
||||
|
||||
rc_nohalt "cd ${HERE}"
|
||||
done
|
||||
rc_nohalt "cd ${HERE}"
|
||||
done
|
||||
|
||||
#rm -rf "${FSMNT}/${PKGTMPDIR}"
|
||||
fi
|
||||
rm -rf "${FSMNT}/${PKGTMPDIR}"
|
||||
fi
|
||||
};
|
||||
|
@ -63,66 +63,66 @@ localize_pcbsd()
|
||||
|
||||
localize_x_keyboard()
|
||||
{
|
||||
KEYMOD="$1"
|
||||
KEYLAY="$2"
|
||||
KEYVAR="$3"
|
||||
COUNTRY="$4"
|
||||
OPTION="grp:alt_shift_toggle"
|
||||
SETXKBMAP=""
|
||||
KEYMOD="$1"
|
||||
KEYLAY="$2"
|
||||
KEYVAR="$3"
|
||||
COUNTRY="$4"
|
||||
OPTION="grp:alt_shift_toggle"
|
||||
SETXKBMAP=""
|
||||
|
||||
if [ "${COUNTRY}" = "NONE" -o "${COUNTRY}" = "us" -o "${COUNTRY}" = "C" ] ; then
|
||||
#In this case we don't need any additional language
|
||||
COUNTRY=""
|
||||
OPTION=""
|
||||
else
|
||||
COUNTRY=",${COUNTRY}"
|
||||
fi
|
||||
if [ "${COUNTRY}" = "NONE" -o "${COUNTRY}" = "us" -o "${COUNTRY}" = "C" ] ; then
|
||||
#In this case we don't need any additional language
|
||||
COUNTRY=""
|
||||
OPTION=""
|
||||
else
|
||||
COUNTRY=",${COUNTRY}"
|
||||
fi
|
||||
|
||||
if [ "${KEYMOD}" != "NONE" ]
|
||||
then
|
||||
SETXKBMAP="-model ${KEYMOD}"
|
||||
KXMODEL="${KEYMOD}"
|
||||
else
|
||||
KXMODEL="pc104"
|
||||
fi
|
||||
if [ "${KEYMOD}" != "NONE" ]
|
||||
then
|
||||
SETXKBMAP="-model ${KEYMOD}"
|
||||
KXMODEL="${KEYMOD}"
|
||||
else
|
||||
KXMODEL="pc104"
|
||||
fi
|
||||
|
||||
if [ "${KEYLAY}" != "NONE" ]
|
||||
then
|
||||
localize_key_layout "$KEYLAY"
|
||||
SETXKBMAP="${SETXKBMAP} -layout ${KEYLAY}"
|
||||
KXLAYOUT="${KEYLAY}"
|
||||
else
|
||||
KXLAYOUT="us"
|
||||
fi
|
||||
if [ "${KEYLAY}" != "NONE" ]
|
||||
then
|
||||
localize_key_layout "$KEYLAY"
|
||||
SETXKBMAP="${SETXKBMAP} -layout ${KEYLAY}"
|
||||
KXLAYOUT="${KEYLAY}"
|
||||
else
|
||||
KXLAYOUT="us"
|
||||
fi
|
||||
|
||||
if [ "${KEYVAR}" != "NONE" ]
|
||||
then
|
||||
SETXKBMAP="${SETXKBMAP} -variant ${KEYVAR}"
|
||||
KXVAR="(${KEYVAR})"
|
||||
else
|
||||
KXVAR=""
|
||||
fi
|
||||
if [ "${KEYVAR}" != "NONE" ]
|
||||
then
|
||||
SETXKBMAP="${SETXKBMAP} -variant ${KEYVAR}"
|
||||
KXVAR="(${KEYVAR})"
|
||||
else
|
||||
KXVAR=""
|
||||
fi
|
||||
|
||||
# Setup .xprofile with our setxkbmap call now
|
||||
if [ ! -z "${SETXKBMAP}" ]
|
||||
then
|
||||
if [ ! -e "${FSMNT}/usr/share/skel/.xprofile" ]
|
||||
then
|
||||
echo "#!/bin/sh" >${FSMNT}/usr/share/skel/.xprofile
|
||||
fi
|
||||
# Setup .xprofile with our setxkbmap call now
|
||||
if [ ! -z "${SETXKBMAP}" ]
|
||||
then
|
||||
if [ ! -e "${FSMNT}/usr/share/skel/.xprofile" ]
|
||||
then
|
||||
echo "#!/bin/sh" >${FSMNT}/usr/share/skel/.xprofile
|
||||
fi
|
||||
|
||||
# Save the keyboard layout for user / root X logins
|
||||
echo "setxkbmap ${SETXKBMAP}" >>${FSMNT}/usr/share/skel/.xprofile
|
||||
chmod 755 ${FSMNT}/usr/share/skel/.xprofile
|
||||
cp ${FSMNT}/usr/share/skel/.xprofile ${FSMNT}/root/.xprofile
|
||||
# Save the keyboard layout for user / root X logins
|
||||
echo "setxkbmap ${SETXKBMAP}" >>${FSMNT}/usr/share/skel/.xprofile
|
||||
chmod 755 ${FSMNT}/usr/share/skel/.xprofile
|
||||
cp ${FSMNT}/usr/share/skel/.xprofile ${FSMNT}/root/.xprofile
|
||||
|
||||
# Save it for KDM
|
||||
echo "setxkbmap ${SETXKBMAP}" >>${FSMNT}/usr/local/kde4/share/config/kdm/Xsetup
|
||||
fi
|
||||
# Save it for KDM
|
||||
echo "setxkbmap ${SETXKBMAP}" >>${FSMNT}/usr/local/kde4/share/config/kdm/Xsetup
|
||||
fi
|
||||
|
||||
|
||||
# Create the kxkbrc configuration using these options
|
||||
echo "[Layout]
|
||||
echo "[Layout]
|
||||
DisplayNames=${KXLAYOUT}${COUNTRY}
|
||||
IndicatorOnly=false
|
||||
LayoutList=${KXLAYOUT}${KXVAR}${COUNTRY}
|
||||
@ -211,157 +211,194 @@ localize_get_codes()
|
||||
TARGETLANG="${1}"
|
||||
# Setup the presets for the specific lang
|
||||
case $TARGETLANG in
|
||||
af) COUNTRY="C"
|
||||
SETLANG="af"
|
||||
LOCALE="af_ZA"
|
||||
;;
|
||||
ar) COUNTRY="C"
|
||||
SETLANG="ar"
|
||||
LOCALE="en_US"
|
||||
;;
|
||||
az) COUNTRY="C"
|
||||
SETLANG="az"
|
||||
LOCALE="en_US"
|
||||
;;
|
||||
ca) COUNTRY="es"
|
||||
SETLANG="es:ca"
|
||||
LOCALE="ca_ES"
|
||||
;;
|
||||
be) COUNTRY="be"
|
||||
SETLANG="be"
|
||||
LOCALE="be_BY"
|
||||
;;
|
||||
bn) COUNTRY="bn"
|
||||
SETLANG="bn"
|
||||
LOCALE="en_US"
|
||||
;;
|
||||
bg) COUNTRY="bg"
|
||||
SETLANG="bg"
|
||||
LOCALE="bg_BG"
|
||||
;;
|
||||
cs) COUNTRY="cz"
|
||||
SETLANG="cs"
|
||||
LOCALE="cs_CZ"
|
||||
;;
|
||||
da) COUNTRY="dk"
|
||||
SETLANG="da"
|
||||
LOCALE="da_DK"
|
||||
;;
|
||||
de) COUNTRY="de"
|
||||
SETLANG="de"
|
||||
LOCALE="de_DE"
|
||||
;;
|
||||
en_GB) COUNTRY="gb"
|
||||
SETLANG="en_GB:cy"
|
||||
LOCALE="en_GB"
|
||||
;;
|
||||
el) COUNTRY="gr"
|
||||
SETLANG="el:gr"
|
||||
LOCALE="el_GR"
|
||||
;;
|
||||
es) COUNTRY="es"
|
||||
SETLANG="es"
|
||||
LOCALE="es_ES"
|
||||
;;
|
||||
es_LA) COUNTRY="us"
|
||||
SETLANG="es:en_US"
|
||||
LOCALE="es_ES"
|
||||
;;
|
||||
et) COUNTRY="ee"
|
||||
SETLANG="et"
|
||||
LOCALE="et_EE"
|
||||
;;
|
||||
fr) COUNTRY="fr"
|
||||
SETLANG="fr"
|
||||
LOCALE="fr_FR"
|
||||
;;
|
||||
he) COUNTRY="il"
|
||||
SETLANG="he:ar"
|
||||
LOCALE="he_IL"
|
||||
;;
|
||||
hr) COUNTRY="hr"
|
||||
SETLANG="hr"
|
||||
LOCALE="hr_HR"
|
||||
;;
|
||||
hu) COUNTRY="hu"
|
||||
SETLANG="hu"
|
||||
LOCALE="hu_HU"
|
||||
;;
|
||||
it) COUNTRY="it"
|
||||
SETLANG="it"
|
||||
LOCALE="it_IT"
|
||||
;;
|
||||
ja) COUNTRY="jp"
|
||||
SETLANG="ja"
|
||||
LOCALE="ja_JP"
|
||||
;;
|
||||
ko) COUNTRY="kr"
|
||||
SETLANG="ko"
|
||||
LOCALE="ko_KR"
|
||||
;;
|
||||
nl) COUNTRY="nl"
|
||||
SETLANG="nl"
|
||||
LOCALE="nl_NL"
|
||||
;;
|
||||
nn) COUNTRY="no"
|
||||
SETLANG="nn"
|
||||
LOCALE="en_US"
|
||||
;;
|
||||
pa) COUNTRY="pa"
|
||||
SETLANG="pa"
|
||||
LOCALE="en_US"
|
||||
;;
|
||||
pl) COUNTRY="pl"
|
||||
SETLANG="pl"
|
||||
LOCALE="pl_PL"
|
||||
;;
|
||||
pt) COUNTRY="pt"
|
||||
SETLANG="pt"
|
||||
LOCALE="pt_PT"
|
||||
;;
|
||||
pt_BR) COUNTRY="br"
|
||||
SETLANG="pt_BR"
|
||||
LOCALE="pt_BR"
|
||||
;;
|
||||
ru) COUNTRY="ru"
|
||||
SETLANG="ru"
|
||||
LOCALE="ru_RU"
|
||||
;;
|
||||
sl) COUNTRY="si"
|
||||
SETLANG="sl"
|
||||
LOCALE="sl_SI"
|
||||
;;
|
||||
sk) COUNTRY="sk"
|
||||
SETLANG="sk"
|
||||
LOCALE="sk_SK"
|
||||
;;
|
||||
sv) COUNTRY="se"
|
||||
SETLANG="sv"
|
||||
LOCALE="sv_SE"
|
||||
;;
|
||||
uk) COUNTRY="ua"
|
||||
SETLANG="uk"
|
||||
LOCALE="uk_UA"
|
||||
;;
|
||||
vi) COUNTRY="vn"
|
||||
SETLANG="vi"
|
||||
LOCALE="en_US"
|
||||
;;
|
||||
zh_CN) COUNTRY="cn"
|
||||
SETLANG="zh_CN"
|
||||
LOCALE="zh_CN"
|
||||
;;
|
||||
zh_TW) COUNTRY="tw"
|
||||
SETLANG="zh_TW"
|
||||
LOCALE="zh_TW"
|
||||
;;
|
||||
*) COUNTRY="C"
|
||||
af)
|
||||
COUNTRY="C"
|
||||
SETLANG="af"
|
||||
LOCALE="af_ZA"
|
||||
;;
|
||||
ar)
|
||||
COUNTRY="C"
|
||||
SETLANG="ar"
|
||||
LOCALE="en_US"
|
||||
;;
|
||||
az)
|
||||
COUNTRY="C"
|
||||
SETLANG="az"
|
||||
LOCALE="en_US"
|
||||
;;
|
||||
ca)
|
||||
COUNTRY="es"
|
||||
SETLANG="es:ca"
|
||||
LOCALE="ca_ES"
|
||||
;;
|
||||
be)
|
||||
COUNTRY="be"
|
||||
SETLANG="be"
|
||||
LOCALE="be_BY"
|
||||
;;
|
||||
bn)
|
||||
COUNTRY="bn"
|
||||
SETLANG="bn"
|
||||
LOCALE="en_US"
|
||||
;;
|
||||
bg)
|
||||
COUNTRY="bg"
|
||||
SETLANG="bg"
|
||||
LOCALE="bg_BG"
|
||||
;;
|
||||
cs)
|
||||
COUNTRY="cz"
|
||||
SETLANG="cs"
|
||||
LOCALE="cs_CZ"
|
||||
;;
|
||||
da)
|
||||
COUNTRY="dk"
|
||||
SETLANG="da"
|
||||
LOCALE="da_DK"
|
||||
;;
|
||||
de)
|
||||
COUNTRY="de"
|
||||
SETLANG="de"
|
||||
LOCALE="de_DE"
|
||||
;;
|
||||
en_GB)
|
||||
COUNTRY="gb"
|
||||
SETLANG="en_GB:cy"
|
||||
LOCALE="en_GB"
|
||||
;;
|
||||
el)
|
||||
COUNTRY="gr"
|
||||
SETLANG="el:gr"
|
||||
LOCALE="el_GR"
|
||||
;;
|
||||
es)
|
||||
COUNTRY="es"
|
||||
SETLANG="es"
|
||||
LOCALE="es_ES"
|
||||
;;
|
||||
es_LA)
|
||||
COUNTRY="us"
|
||||
SETLANG="es:en_US"
|
||||
LOCALE="es_ES"
|
||||
;;
|
||||
et)
|
||||
COUNTRY="ee"
|
||||
SETLANG="et"
|
||||
LOCALE="et_EE"
|
||||
;;
|
||||
fr)
|
||||
COUNTRY="fr"
|
||||
SETLANG="fr"
|
||||
LOCALE="fr_FR"
|
||||
;;
|
||||
he)
|
||||
COUNTRY="il"
|
||||
SETLANG="he:ar"
|
||||
LOCALE="he_IL"
|
||||
;;
|
||||
hr)
|
||||
COUNTRY="hr"
|
||||
SETLANG="hr"
|
||||
LOCALE="hr_HR"
|
||||
;;
|
||||
hu)
|
||||
COUNTRY="hu"
|
||||
SETLANG="hu"
|
||||
LOCALE="hu_HU"
|
||||
;;
|
||||
it)
|
||||
COUNTRY="it"
|
||||
SETLANG="it"
|
||||
LOCALE="it_IT"
|
||||
;;
|
||||
ja)
|
||||
COUNTRY="jp"
|
||||
SETLANG="ja"
|
||||
LOCALE="ja_JP"
|
||||
;;
|
||||
ko)
|
||||
COUNTRY="kr"
|
||||
SETLANG="ko"
|
||||
LOCALE="ko_KR"
|
||||
;;
|
||||
nl)
|
||||
COUNTRY="nl"
|
||||
SETLANG="nl"
|
||||
LOCALE="nl_NL"
|
||||
;;
|
||||
nn)
|
||||
COUNTRY="no"
|
||||
SETLANG="nn"
|
||||
LOCALE="en_US"
|
||||
;;
|
||||
pa)
|
||||
COUNTRY="pa"
|
||||
SETLANG="pa"
|
||||
LOCALE="en_US"
|
||||
;;
|
||||
pl)
|
||||
COUNTRY="pl"
|
||||
SETLANG="pl"
|
||||
LOCALE="pl_PL"
|
||||
;;
|
||||
pt)
|
||||
COUNTRY="pt"
|
||||
SETLANG="pt"
|
||||
LOCALE="pt_PT"
|
||||
;;
|
||||
pt_BR)
|
||||
COUNTRY="br"
|
||||
SETLANG="pt_BR"
|
||||
LOCALE="pt_BR"
|
||||
;;
|
||||
ru)
|
||||
COUNTRY="ru"
|
||||
SETLANG="ru"
|
||||
LOCALE="ru_RU"
|
||||
;;
|
||||
sl)
|
||||
COUNTRY="si"
|
||||
SETLANG="sl"
|
||||
LOCALE="sl_SI"
|
||||
;;
|
||||
sk)
|
||||
COUNTRY="sk"
|
||||
SETLANG="sk"
|
||||
LOCALE="sk_SK"
|
||||
;;
|
||||
sv)
|
||||
COUNTRY="se"
|
||||
SETLANG="sv"
|
||||
LOCALE="sv_SE"
|
||||
;;
|
||||
uk)
|
||||
COUNTRY="ua"
|
||||
SETLANG="uk"
|
||||
LOCALE="uk_UA"
|
||||
;;
|
||||
vi)
|
||||
COUNTRY="vn"
|
||||
SETLANG="vi"
|
||||
LOCALE="en_US"
|
||||
;;
|
||||
zh_CN)
|
||||
COUNTRY="cn"
|
||||
SETLANG="zh_CN"
|
||||
LOCALE="zh_CN"
|
||||
;;
|
||||
zh_TW)
|
||||
COUNTRY="tw"
|
||||
SETLANG="zh_TW"
|
||||
LOCALE="zh_TW"
|
||||
;;
|
||||
*)
|
||||
COUNTRY="C"
|
||||
SETLANG="${TARGETLANG}"
|
||||
LOCALE="en_US"
|
||||
;;
|
||||
esac
|
||||
|
||||
export COUNTRY SETLANG LOCALE
|
||||
export COUNTRY SETLANG LOCALE
|
||||
|
||||
};
|
||||
|
||||
|
@ -52,32 +52,32 @@ mount_partition()
|
||||
#We are on ZFS, lets setup this mount-point
|
||||
if [ "${PARTFS}" = "ZFS" ]
|
||||
then
|
||||
ZPOOLNAME=$(get_zpool_name "${PART}")
|
||||
ZPOOLNAME=$(get_zpool_name "${PART}")
|
||||
|
||||
# Check if we have multiple zfs mounts specified
|
||||
for ZMNT in `echo ${MNTPOINT} | sed 's|,| |g'`
|
||||
do
|
||||
# First make sure we create the mount point
|
||||
if [ ! -d "${FSMNT}${ZMNT}" ] ; then
|
||||
mkdir -p ${FSMNT}${ZMNT} >>${LOGOUT} 2>>${LOGOUT}
|
||||
fi
|
||||
# Check if we have multiple zfs mounts specified
|
||||
for ZMNT in `echo ${MNTPOINT} | sed 's|,| |g'`
|
||||
do
|
||||
# First make sure we create the mount point
|
||||
if [ ! -d "${FSMNT}${ZMNT}" ] ; then
|
||||
mkdir -p ${FSMNT}${ZMNT} >>${LOGOUT} 2>>${LOGOUT}
|
||||
fi
|
||||
|
||||
if [ "${ZMNT}" = "/" ] ; then
|
||||
ZNAME=""
|
||||
else
|
||||
ZNAME="${ZMNT}"
|
||||
echo_log "zfs create -p ${ZPOOLNAME}${ZNAME}"
|
||||
rc_halt "zfs create -p ${ZPOOLNAME}${ZNAME}"
|
||||
fi
|
||||
sleep 2
|
||||
rc_halt "zfs set mountpoint=${FSMNT}${ZNAME} ${ZPOOLNAME}${ZNAME}"
|
||||
if [ "${ZMNT}" = "/" ] ; then
|
||||
ZNAME=""
|
||||
else
|
||||
ZNAME="${ZMNT}"
|
||||
echo_log "zfs create -p ${ZPOOLNAME}${ZNAME}"
|
||||
rc_halt "zfs create -p ${ZPOOLNAME}${ZNAME}"
|
||||
fi
|
||||
sleep 2
|
||||
rc_halt "zfs set mountpoint=${FSMNT}${ZNAME} ${ZPOOLNAME}${ZNAME}"
|
||||
|
||||
# Disable atime for this zfs partition, speed increase
|
||||
rc_nohalt "zfs set atime=off ${ZPOOLNAME}${ZNAME}"
|
||||
done
|
||||
# Disable atime for this zfs partition, speed increase
|
||||
rc_nohalt "zfs set atime=off ${ZPOOLNAME}${ZNAME}"
|
||||
done
|
||||
|
||||
else
|
||||
# If we are not on ZFS, lets do the mount now
|
||||
# If we are not on ZFS, lets do the mount now
|
||||
# First make sure we create the mount point
|
||||
if [ ! -d "${FSMNT}${MNTPOINT}" ]
|
||||
then
|
||||
@ -94,17 +94,17 @@ mount_partition()
|
||||
# Mounts all the new file systems to prepare for installation
|
||||
mount_all_filesystems()
|
||||
{
|
||||
# Make sure our mount point exists
|
||||
mkdir -p ${FSMNT} >/dev/null 2>/dev/null
|
||||
# Make sure our mount point exists
|
||||
mkdir -p ${FSMNT} >/dev/null 2>/dev/null
|
||||
|
||||
# First lets find and mount the / partition
|
||||
#########################################################
|
||||
for PART in `ls ${PARTDIR}`
|
||||
do
|
||||
if [ ! -e "/dev/${PART}" ]
|
||||
then
|
||||
exit_err "ERROR: The partition ${PART} does not exist. Failure in bsdlabel?"
|
||||
fi
|
||||
# First lets find and mount the / partition
|
||||
#########################################################
|
||||
for PART in `ls ${PARTDIR}`
|
||||
do
|
||||
if [ ! -e "/dev/${PART}" ]
|
||||
then
|
||||
exit_err "ERROR: The partition ${PART} does not exist. Failure in bsdlabel?"
|
||||
fi
|
||||
|
||||
PARTFS="`cat ${PARTDIR}/${PART} | cut -d ':' -f 1`"
|
||||
PARTMNT="`cat ${PARTDIR}/${PART} | cut -d ':' -f 2`"
|
||||
@ -122,69 +122,60 @@ mount_all_filesystems()
|
||||
if [ "$?" = "0" -o "$PARTMNT" = "/" ]
|
||||
then
|
||||
case ${PARTFS} in
|
||||
UFS) mount_partition ${PART}${EXT} ${PARTFS} ${PARTMNT} "noatime"
|
||||
;;
|
||||
UFS+S) mount_partition ${PART}${EXT} ${PARTFS} ${PARTMNT} "noatime"
|
||||
;;
|
||||
UFS+J) mount_partition ${PART}${EXT}.journal ${PARTFS} ${PARTMNT} "async,noatime"
|
||||
;;
|
||||
ZFS) mount_partition ${PART} ${PARTFS} ${PARTMNT}
|
||||
;;
|
||||
*) exit_err "ERROR: Got unknown file-system type $PARTFS" ;;
|
||||
UFS) mount_partition ${PART}${EXT} ${PARTFS} ${PARTMNT} "noatime" ;;
|
||||
UFS+S) mount_partition ${PART}${EXT} ${PARTFS} ${PARTMNT} "noatime" ;;
|
||||
UFS+J) mount_partition ${PART}${EXT}.journal ${PARTFS} ${PARTMNT} "async,noatime" ;;
|
||||
ZFS) mount_partition ${PART} ${PARTFS} ${PARTMNT} ;;
|
||||
*) exit_err "ERROR: Got unknown file-system type $PARTFS" ;;
|
||||
esac
|
||||
|
||||
fi
|
||||
done
|
||||
|
||||
# Now that we've mounted "/" lets do any other remaining mount-points
|
||||
##################################################################
|
||||
for PART in `ls ${PARTDIR}`
|
||||
do
|
||||
if [ ! -e "/dev/${PART}" ]
|
||||
then
|
||||
exit_err "ERROR: The partition ${PART} does not exist. Failure in bsdlabel?"
|
||||
fi
|
||||
|
||||
done
|
||||
PARTFS="`cat ${PARTDIR}/${PART} | cut -d ':' -f 1`"
|
||||
PARTMNT="`cat ${PARTDIR}/${PART} | cut -d ':' -f 2`"
|
||||
PARTENC="`cat ${PARTDIR}/${PART} | cut -d ':' -f 3`"
|
||||
|
||||
# Now that we've mounted "/" lets do any other remaining mount-points
|
||||
##################################################################
|
||||
for PART in `ls ${PARTDIR}`
|
||||
do
|
||||
if [ ! -e "/dev/${PART}" ]
|
||||
then
|
||||
exit_err "ERROR: The partition ${PART} does not exist. Failure in bsdlabel?"
|
||||
fi
|
||||
|
||||
PARTFS="`cat ${PARTDIR}/${PART} | cut -d ':' -f 1`"
|
||||
PARTMNT="`cat ${PARTDIR}/${PART} | cut -d ':' -f 2`"
|
||||
PARTENC="`cat ${PARTDIR}/${PART} | cut -d ':' -f 3`"
|
||||
if [ "${PARTENC}" = "ON" ]
|
||||
then
|
||||
EXT=".eli"
|
||||
else
|
||||
EXT=""
|
||||
fi
|
||||
|
||||
if [ "${PARTENC}" = "ON" ]
|
||||
then
|
||||
EXT=".eli"
|
||||
else
|
||||
EXT=""
|
||||
fi
|
||||
|
||||
# Check if we've found "/" again, don't need to mount it twice
|
||||
echo "$PARTMNT" | grep "/," >/dev/null
|
||||
if [ "$?" != "0" -a "$PARTMNT" != "/" ]
|
||||
then
|
||||
# Check if we've found "/" again, don't need to mount it twice
|
||||
echo "$PARTMNT" | grep "/," >/dev/null
|
||||
if [ "$?" != "0" -a "$PARTMNT" != "/" ]
|
||||
then
|
||||
case ${PARTFS} in
|
||||
UFS) mount_partition ${PART}${EXT} ${PARTFS} ${PARTMNT} "noatime"
|
||||
;;
|
||||
UFS+S) mount_partition ${PART}${EXT} ${PARTFS} ${PARTMNT} "noatime"
|
||||
;;
|
||||
UFS+J) mount_partition ${PART}${EXT}.journal ${PARTFS} ${PARTMNT} "async,noatime"
|
||||
;;
|
||||
ZFS) mount_partition ${PART} ${PARTFS} ${PARTMNT}
|
||||
;;
|
||||
SWAP) # Lets enable this swap now
|
||||
if [ "$PARTENC" = "ON" ]
|
||||
then
|
||||
echo_log "Enabling encrypted swap on /dev/${PART}"
|
||||
rc_halt "geli onetime -d -e 3des ${PART}"
|
||||
sleep 5
|
||||
rc_halt "swapon /dev/${PART}.eli"
|
||||
else
|
||||
echo_log "swapon ${PART}"
|
||||
sleep 5
|
||||
rc_halt "swapon /dev/${PART}"
|
||||
fi
|
||||
;;
|
||||
UFS) mount_partition ${PART}${EXT} ${PARTFS} ${PARTMNT} "noatime" ;;
|
||||
UFS+S) mount_partition ${PART}${EXT} ${PARTFS} ${PARTMNT} "noatime" ;;
|
||||
UFS+J) mount_partition ${PART}${EXT}.journal ${PARTFS} ${PARTMNT} "async,noatime" ;;
|
||||
ZFS) mount_partition ${PART} ${PARTFS} ${PARTMNT} ;;
|
||||
SWAP)
|
||||
# Lets enable this swap now
|
||||
if [ "$PARTENC" = "ON" ]
|
||||
then
|
||||
echo_log "Enabling encrypted swap on /dev/${PART}"
|
||||
rc_halt "geli onetime -d -e 3des ${PART}"
|
||||
sleep 5
|
||||
rc_halt "swapon /dev/${PART}.eli"
|
||||
else
|
||||
echo_log "swapon ${PART}"
|
||||
sleep 5
|
||||
rc_halt "swapon /dev/${PART}"
|
||||
fi
|
||||
;;
|
||||
*) exit_err "ERROR: Got unknown file-system type $PARTFS" ;;
|
||||
esac
|
||||
fi
|
||||
done
|
||||
esac
|
||||
fi
|
||||
done
|
||||
};
|
||||
|
@ -34,114 +34,114 @@
|
||||
# Displays an optical failure message
|
||||
opt_fail()
|
||||
{
|
||||
# If we got here, we must not have a DVD/USB we can find :(
|
||||
get_value_from_cfg installInteractive
|
||||
if [ "${VAL}" = "yes" ]
|
||||
then
|
||||
# We are running interactive, and didn't find a DVD, prompt user again
|
||||
echo_log "DISK ERROR: Unable to find installation disk!"
|
||||
echo_log "Please insert the installation disk and press enter."
|
||||
read tmp
|
||||
else
|
||||
exit_err "ERROR: Unable to locate installation DVD/USB"
|
||||
fi
|
||||
# If we got here, we must not have a DVD/USB we can find :(
|
||||
get_value_from_cfg installInteractive
|
||||
if [ "${VAL}" = "yes" ]
|
||||
then
|
||||
# We are running interactive, and didn't find a DVD, prompt user again
|
||||
echo_log "DISK ERROR: Unable to find installation disk!"
|
||||
echo_log "Please insert the installation disk and press enter."
|
||||
read tmp
|
||||
else
|
||||
exit_err "ERROR: Unable to locate installation DVD/USB"
|
||||
fi
|
||||
};
|
||||
|
||||
# Performs the extraction of data to disk
|
||||
opt_mount()
|
||||
{
|
||||
FOUND="0"
|
||||
FOUND="0"
|
||||
|
||||
# Ensure we have a directory where its supposed to be
|
||||
if [ ! -d "${CDMNT}" ]
|
||||
then
|
||||
mkdir -p ${CDMNT}
|
||||
fi
|
||||
# Ensure we have a directory where its supposed to be
|
||||
if [ ! -d "${CDMNT}" ]
|
||||
then
|
||||
mkdir -p ${CDMNT}
|
||||
fi
|
||||
|
||||
|
||||
# Start by checking if we already have a cd mounted at CDMNT
|
||||
mount | grep "${CDMNT} " >/dev/null 2>/dev/null
|
||||
if [ "$?" = "0" ]
|
||||
then
|
||||
if [ -e "${CDMNT}/${INSFILE}" ]
|
||||
then
|
||||
echo "MOUNTED" >${TMPDIR}/cdmnt
|
||||
echo_log "FOUND DVD: MOUNTED"
|
||||
FOUND="1"
|
||||
return
|
||||
fi
|
||||
# Start by checking if we already have a cd mounted at CDMNT
|
||||
mount | grep "${CDMNT} " >/dev/null 2>/dev/null
|
||||
if [ "$?" = "0" ]
|
||||
then
|
||||
if [ -e "${CDMNT}/${INSFILE}" ]
|
||||
then
|
||||
echo "MOUNTED" >${TMPDIR}/cdmnt
|
||||
echo_log "FOUND DVD: MOUNTED"
|
||||
FOUND="1"
|
||||
return
|
||||
fi
|
||||
|
||||
# failed to find optical disk
|
||||
opt_fail
|
||||
return
|
||||
fi
|
||||
# failed to find optical disk
|
||||
opt_fail
|
||||
return
|
||||
fi
|
||||
|
||||
# Setup our loop to search for installation media
|
||||
while
|
||||
z=1
|
||||
do
|
||||
# Setup our loop to search for installation media
|
||||
while
|
||||
z=1
|
||||
do
|
||||
|
||||
# Loop though and look for an installation disk
|
||||
for i in `ls -1 /dev/acd* /dev/cd* /dev/scd* /dev/rscd* 2>/dev/null`
|
||||
do
|
||||
# Find the CD Device
|
||||
/sbin/mount_cd9660 $i ${CDMNT}
|
||||
# Loop though and look for an installation disk
|
||||
for i in `ls -1 /dev/acd* /dev/cd* /dev/scd* /dev/rscd* 2>/dev/null`
|
||||
do
|
||||
# Find the CD Device
|
||||
/sbin/mount_cd9660 $i ${CDMNT}
|
||||
|
||||
# Check the package type to see if we have our install data
|
||||
if [ -e "${CDMNT}/${INSFILE}" ]
|
||||
then
|
||||
echo "${i}" >${TMPDIR}/cdmnt
|
||||
echo_log "FOUND DVD: ${i}"
|
||||
FOUND="1"
|
||||
break
|
||||
fi
|
||||
/sbin/umount ${CDMNT} >/dev/null 2>/dev/null
|
||||
done
|
||||
# Check the package type to see if we have our install data
|
||||
if [ -e "${CDMNT}/${INSFILE}" ]
|
||||
then
|
||||
echo "${i}" >${TMPDIR}/cdmnt
|
||||
echo_log "FOUND DVD: ${i}"
|
||||
FOUND="1"
|
||||
break
|
||||
fi
|
||||
/sbin/umount ${CDMNT} >/dev/null 2>/dev/null
|
||||
done
|
||||
|
||||
# If no DVD found, try USB
|
||||
if [ "$FOUND" != "1" ]
|
||||
then
|
||||
# Loop though and look for an installation disk
|
||||
for i in `ls -1 /dev/da* 2>/dev/null`
|
||||
do
|
||||
# Check if we can mount this device UFS
|
||||
/sbin/mount -r $i ${CDMNT}
|
||||
# If no DVD found, try USB
|
||||
if [ "$FOUND" != "1" ]
|
||||
then
|
||||
# Loop though and look for an installation disk
|
||||
for i in `ls -1 /dev/da* 2>/dev/null`
|
||||
do
|
||||
# Check if we can mount this device UFS
|
||||
/sbin/mount -r $i ${CDMNT}
|
||||
|
||||
# Check the package type to see if we have our install data
|
||||
if [ -e "${CDMNT}/${INSFILE}" ]
|
||||
then
|
||||
echo "${i}" >${TMPDIR}/cdmnt
|
||||
echo_log "FOUND USB: ${i}"
|
||||
FOUND="1"
|
||||
break
|
||||
fi
|
||||
/sbin/umount ${CDMNT} >/dev/null 2>/dev/null
|
||||
# Check the package type to see if we have our install data
|
||||
if [ -e "${CDMNT}/${INSFILE}" ]
|
||||
then
|
||||
echo "${i}" >${TMPDIR}/cdmnt
|
||||
echo_log "FOUND USB: ${i}"
|
||||
FOUND="1"
|
||||
break
|
||||
fi
|
||||
/sbin/umount ${CDMNT} >/dev/null 2>/dev/null
|
||||
|
||||
# Also check if it is a FAT mount
|
||||
/sbin/mount -r -t msdosfs $i ${CDMNT}
|
||||
# Also check if it is a FAT mount
|
||||
/sbin/mount -r -t msdosfs $i ${CDMNT}
|
||||
|
||||
# Check the package type to see if we have our install data
|
||||
if [ -e "${CDMNT}/${INSFILE}" ]
|
||||
then
|
||||
echo "${i}" >${TMPDIR}/cdmnt
|
||||
echo_log "FOUND USB: ${i}"
|
||||
FOUND="1"
|
||||
break
|
||||
fi
|
||||
/sbin/umount ${CDMNT} >/dev/null 2>/dev/null
|
||||
done
|
||||
fi # End of USB Check
|
||||
# Check the package type to see if we have our install data
|
||||
if [ -e "${CDMNT}/${INSFILE}" ]
|
||||
then
|
||||
echo "${i}" >${TMPDIR}/cdmnt
|
||||
echo_log "FOUND USB: ${i}"
|
||||
FOUND="1"
|
||||
break
|
||||
fi
|
||||
/sbin/umount ${CDMNT} >/dev/null 2>/dev/null
|
||||
done
|
||||
fi # End of USB Check
|
||||
|
||||
|
||||
if [ "$FOUND" = "1" ]
|
||||
then
|
||||
break
|
||||
fi
|
||||
if [ "$FOUND" = "1" ]
|
||||
then
|
||||
break
|
||||
fi
|
||||
|
||||
# Failed to find a disk, take action now
|
||||
opt_fail
|
||||
# Failed to find a disk, take action now
|
||||
opt_fail
|
||||
|
||||
done
|
||||
done
|
||||
|
||||
};
|
||||
|
||||
|
@ -68,8 +68,8 @@ get_first_wired_nic()
|
||||
check_is_wifi ${NIC}
|
||||
if [ "$?" != "0" ]
|
||||
then
|
||||
VAL="${NIC}" ; export VAL
|
||||
return
|
||||
VAL="${NIC}" ; export VAL
|
||||
return
|
||||
fi
|
||||
done < ${TMPDIR}/.niclist
|
||||
fi
|
||||
@ -241,22 +241,23 @@ enable_auto_dhcp()
|
||||
|
||||
is_nic_active "${NIC}"
|
||||
if [ "$?" = "0" ] ; then
|
||||
echo_log "Trying DHCP on $NIC $DESC"
|
||||
dhclient ${NIC} >/dev/null 2>/dev/null
|
||||
if [ "$?" = "0" ] ; then
|
||||
# Got a valid DHCP IP, we can return now
|
||||
WRKNIC="$NIC" ; export WRKNIC
|
||||
return 0
|
||||
fi
|
||||
echo_log "Trying DHCP on $NIC $DESC"
|
||||
dhclient ${NIC} >/dev/null 2>/dev/null
|
||||
if [ "$?" = "0" ] ; then
|
||||
# Got a valid DHCP IP, we can return now
|
||||
WRKNIC="$NIC" ; export WRKNIC
|
||||
return 0
|
||||
fi
|
||||
fi
|
||||
done < ${TMPDIR}/.niclist
|
||||
|
||||
};
|
||||
|
||||
# Get the mac address of a target NIC
|
||||
get_nic_mac() {
|
||||
FOUNDMAC="`ifconfig ${1} | grep 'ether' | tr -d '\t' | cut -d ' ' -f 2`"
|
||||
export FOUNDMAC
|
||||
get_nic_mac()
|
||||
{
|
||||
FOUNDMAC="`ifconfig ${1} | grep 'ether' | tr -d '\t' | cut -d ' ' -f 2`"
|
||||
export FOUNDMAC
|
||||
}
|
||||
|
||||
# Function which performs the manual setup of a target nic in the cfg
|
||||
|
@ -81,102 +81,112 @@ setup_zfs_filesystem()
|
||||
setup_filesystems()
|
||||
{
|
||||
|
||||
# Create the keydir
|
||||
rm -rf ${GELIKEYDIR} >/dev/null 2>/dev/null
|
||||
mkdir ${GELIKEYDIR}
|
||||
# Create the keydir
|
||||
rm -rf ${GELIKEYDIR} >/dev/null 2>/dev/null
|
||||
mkdir ${GELIKEYDIR}
|
||||
|
||||
# Lets go ahead and read through the saved partitions we created, and determine if we need to run
|
||||
# newfs on any of them
|
||||
for PART in `ls ${PARTDIR}`
|
||||
do
|
||||
if [ ! -e "/dev/${PART}" ]
|
||||
then
|
||||
exit_err "ERROR: The partition ${PART} does not exist. Failure in bsdlabel?"
|
||||
fi
|
||||
# Lets go ahead and read through the saved partitions we created, and determine if we need to run
|
||||
# newfs on any of them
|
||||
for PART in `ls ${PARTDIR}`
|
||||
do
|
||||
if [ ! -e "/dev/${PART}" ]
|
||||
then
|
||||
exit_err "ERROR: The partition ${PART} does not exist. Failure in bsdlabel?"
|
||||
fi
|
||||
|
||||
PARTFS="`cat ${PARTDIR}/${PART} | cut -d ':' -f 1`"
|
||||
PARTMNT="`cat ${PARTDIR}/${PART} | cut -d ':' -f 2`"
|
||||
PARTENC="`cat ${PARTDIR}/${PART} | cut -d ':' -f 3`"
|
||||
PARTLABEL="`cat ${PARTDIR}/${PART} | cut -d ':' -f 4`"
|
||||
PARTGEOM="`cat ${PARTDIR}/${PART} | cut -d ':' -f 5`"
|
||||
PARTXTRAOPTS="`cat ${PARTDIR}/${PART} | cut -d ':' -f 6`"
|
||||
PARTFS="`cat ${PARTDIR}/${PART} | cut -d ':' -f 1`"
|
||||
PARTMNT="`cat ${PARTDIR}/${PART} | cut -d ':' -f 2`"
|
||||
PARTENC="`cat ${PARTDIR}/${PART} | cut -d ':' -f 3`"
|
||||
PARTLABEL="`cat ${PARTDIR}/${PART} | cut -d ':' -f 4`"
|
||||
PARTGEOM="`cat ${PARTDIR}/${PART} | cut -d ':' -f 5`"
|
||||
PARTXTRAOPTS="`cat ${PARTDIR}/${PART} | cut -d ':' -f 6`"
|
||||
|
||||
# Make sure journaling isn't enabled on this device
|
||||
if [ -e "/dev/${PART}.journal" ]
|
||||
then
|
||||
rc_nohalt "gjournal stop -f ${PART}.journal"
|
||||
rc_nohalt "gjournal clear ${PART}"
|
||||
fi
|
||||
# Make sure journaling isn't enabled on this device
|
||||
if [ -e "/dev/${PART}.journal" ]
|
||||
then
|
||||
rc_nohalt "gjournal stop -f ${PART}.journal"
|
||||
rc_nohalt "gjournal clear ${PART}"
|
||||
fi
|
||||
|
||||
# Setup encryption if necessary
|
||||
if [ "${PARTENC}" = "ON" -a "${PARTFS}" != "SWAP" ]
|
||||
then
|
||||
echo_log "Creating geli provider for ${PART}"
|
||||
rc_halt "dd if=/dev/random of=${GELIKEYDIR}/${PART}.key bs=64 count=1"
|
||||
rc_halt "geli init -b -s 4096 -P -K ${GELIKEYDIR}/${PART}.key /dev/${PART}"
|
||||
rc_halt "geli attach -p -k ${GELIKEYDIR}/${PART}.key /dev/${PART}"
|
||||
# Setup encryption if necessary
|
||||
if [ "${PARTENC}" = "ON" -a "${PARTFS}" != "SWAP" ]
|
||||
then
|
||||
echo_log "Creating geli provider for ${PART}"
|
||||
rc_halt "dd if=/dev/random of=${GELIKEYDIR}/${PART}.key bs=64 count=1"
|
||||
rc_halt "geli init -b -s 4096 -P -K ${GELIKEYDIR}/${PART}.key /dev/${PART}"
|
||||
rc_halt "geli attach -p -k ${GELIKEYDIR}/${PART}.key /dev/${PART}"
|
||||
|
||||
EXT=".eli"
|
||||
else
|
||||
# No Encryption
|
||||
EXT=""
|
||||
fi
|
||||
EXT=".eli"
|
||||
else
|
||||
# No Encryption
|
||||
EXT=""
|
||||
fi
|
||||
|
||||
case ${PARTFS} in
|
||||
UFS) echo_log "NEWFS: /dev/${PART} - ${PARTFS}"
|
||||
sleep 2
|
||||
rc_halt "newfs /dev/${PART}${EXT}"
|
||||
sleep 2
|
||||
rc_halt "sync"
|
||||
rc_halt "glabel label ${PARTLABEL} /dev/${PART}${EXT}"
|
||||
rc_halt "sync"
|
||||
case ${PARTFS} in
|
||||
UFS)
|
||||
echo_log "NEWFS: /dev/${PART} - ${PARTFS}"
|
||||
sleep 2
|
||||
rc_halt "newfs /dev/${PART}${EXT}"
|
||||
sleep 2
|
||||
rc_halt "sync"
|
||||
rc_halt "glabel label ${PARTLABEL} /dev/${PART}${EXT}"
|
||||
rc_halt "sync"
|
||||
|
||||
# Set flag that we've found a boot partition
|
||||
if [ "$PARTMNT" = "/boot" -o "${PARTMNT}" = "/" ] ; then
|
||||
HAVEBOOT="YES"
|
||||
fi
|
||||
sleep 2
|
||||
;;
|
||||
UFS+S) echo_log "NEWFS: /dev/${PART} - ${PARTFS}"
|
||||
sleep 2
|
||||
rc_halt "newfs -U /dev/${PART}${EXT}"
|
||||
sleep 2
|
||||
rc_halt "sync"
|
||||
rc_halt "glabel label ${PARTLABEL} /dev/${PART}${EXT}"
|
||||
rc_halt "sync"
|
||||
# Set flag that we've found a boot partition
|
||||
if [ "$PARTMNT" = "/boot" -o "${PARTMNT}" = "/" ] ; then
|
||||
HAVEBOOT="YES"
|
||||
fi
|
||||
sleep 2
|
||||
;;
|
||||
UFS+J) echo_log "NEWFS: /dev/${PART} - ${PARTFS}"
|
||||
sleep 2
|
||||
rc_halt "newfs /dev/${PART}${EXT}"
|
||||
sleep 2
|
||||
rc_halt "gjournal label -f /dev/${PART}${EXT}"
|
||||
sleep 2
|
||||
rc_halt "newfs -O 2 -J /dev/${PART}${EXT}.journal"
|
||||
sleep 2
|
||||
rc_halt "sync"
|
||||
rc_halt "glabel label ${PARTLABEL} /dev/${PART}${EXT}.journal"
|
||||
rc_halt "sync"
|
||||
# Set flag that we've found a boot partition
|
||||
if [ "$PARTMNT" = "/boot" -o "${PARTMNT}" = "/" ] ; then
|
||||
HAVEBOOT="YES"
|
||||
fi
|
||||
sleep 2
|
||||
;;
|
||||
ZFS) echo_log "NEWFS: /dev/${PART} - ${PARTFS}"
|
||||
setup_zfs_filesystem "${PART}" "${PARTFS}" "${PARTMNT}" "${EXT}" "${PARTGEOM}" "${PARTXTRAOPTS}"
|
||||
;;
|
||||
SWAP) rc_halt "sync"
|
||||
rc_halt "glabel label ${PARTLABEL} /dev/${PART}${EXT}"
|
||||
rc_halt "sync"
|
||||
sleep 2
|
||||
;;
|
||||
*) exit_err "ERROR: Got unknown file-system type $PARTFS" ;;
|
||||
esac
|
||||
# Set flag that we've found a boot partition
|
||||
if [ "$PARTMNT" = "/boot" -o "${PARTMNT}" = "/" ] ; then
|
||||
HAVEBOOT="YES"
|
||||
fi
|
||||
sleep 2
|
||||
;;
|
||||
|
||||
done
|
||||
UFS+S)
|
||||
echo_log "NEWFS: /dev/${PART} - ${PARTFS}"
|
||||
sleep 2
|
||||
rc_halt "newfs -U /dev/${PART}${EXT}"
|
||||
sleep 2
|
||||
rc_halt "sync"
|
||||
rc_halt "glabel label ${PARTLABEL} /dev/${PART}${EXT}"
|
||||
rc_halt "sync"
|
||||
# Set flag that we've found a boot partition
|
||||
if [ "$PARTMNT" = "/boot" -o "${PARTMNT}" = "/" ] ; then
|
||||
HAVEBOOT="YES"
|
||||
fi
|
||||
sleep 2
|
||||
;;
|
||||
|
||||
UFS+J)
|
||||
echo_log "NEWFS: /dev/${PART} - ${PARTFS}"
|
||||
sleep 2
|
||||
rc_halt "newfs /dev/${PART}${EXT}"
|
||||
sleep 2
|
||||
rc_halt "gjournal label -f /dev/${PART}${EXT}"
|
||||
sleep 2
|
||||
rc_halt "newfs -O 2 -J /dev/${PART}${EXT}.journal"
|
||||
sleep 2
|
||||
rc_halt "sync"
|
||||
rc_halt "glabel label ${PARTLABEL} /dev/${PART}${EXT}.journal"
|
||||
rc_halt "sync"
|
||||
# Set flag that we've found a boot partition
|
||||
if [ "$PARTMNT" = "/boot" -o "${PARTMNT}" = "/" ] ; then
|
||||
HAVEBOOT="YES"
|
||||
fi
|
||||
sleep 2
|
||||
;;
|
||||
|
||||
ZFS)
|
||||
echo_log "NEWFS: /dev/${PART} - ${PARTFS}"
|
||||
setup_zfs_filesystem "${PART}" "${PARTFS}" "${PARTMNT}" "${EXT}" "${PARTGEOM}" "${PARTXTRAOPTS}"
|
||||
;;
|
||||
|
||||
SWAP)
|
||||
rc_halt "sync"
|
||||
rc_halt "glabel label ${PARTLABEL} /dev/${PART}${EXT}"
|
||||
rc_halt "sync"
|
||||
sleep 2
|
||||
;;
|
||||
|
||||
*) exit_err "ERROR: Got unknown file-system type $PARTFS" ;;
|
||||
esac
|
||||
|
||||
done
|
||||
};
|
||||
|
@ -34,347 +34,341 @@
|
||||
|
||||
get_package_index_by_ftp()
|
||||
{
|
||||
local INDEX_FILE
|
||||
local FTP_SERVER
|
||||
local INDEX_FILE
|
||||
local FTP_SERVER
|
||||
|
||||
FTP_SERVER="${1}"
|
||||
INDEX_FILE="INDEX"
|
||||
USE_BZIP2=0
|
||||
FTP_SERVER="${1}"
|
||||
INDEX_FILE="INDEX"
|
||||
USE_BZIP2=0
|
||||
|
||||
if [ -f "/usr/bin/bzip2" ]
|
||||
then
|
||||
INDEX_FILE="${INDEX_FILE}.bz2"
|
||||
USE_BZIP2=1
|
||||
fi
|
||||
if [ -f "/usr/bin/bzip2" ]
|
||||
then
|
||||
INDEX_FILE="${INDEX_FILE}.bz2"
|
||||
USE_BZIP2=1
|
||||
fi
|
||||
|
||||
INDEX_PATH="${CONFDIR}/${INDEX_FILE}"
|
||||
fetch_file "${FTP_SERVER}/${INDEX_FILE}" "${INDEX_PATH}" "1"
|
||||
if [ -f "${INDEX_PATH}" ] && [ "${USE_BZIP2}" -eq "1" ]
|
||||
then
|
||||
bzip2 -d "${INDEX_PATH}"
|
||||
fi
|
||||
INDEX_PATH="${CONFDIR}/${INDEX_FILE}"
|
||||
fetch_file "${FTP_SERVER}/${INDEX_FILE}" "${INDEX_PATH}" "1"
|
||||
if [ -f "${INDEX_PATH}" ] && [ "${USE_BZIP2}" -eq "1" ]
|
||||
then
|
||||
bzip2 -d "${INDEX_PATH}"
|
||||
fi
|
||||
};
|
||||
|
||||
get_package_index_by_fs()
|
||||
{
|
||||
local INDEX_FILE
|
||||
local INDEX_FILE
|
||||
|
||||
INDEX_FILE="${CDMNT}/packages/INDEX"
|
||||
fetch_file "${INDEX_FILE}" "${CONFDIR}/" "0"
|
||||
INDEX_FILE="${CDMNT}/packages/INDEX"
|
||||
fetch_file "${INDEX_FILE}" "${CONFDIR}/" "0"
|
||||
};
|
||||
|
||||
get_package_index_size()
|
||||
{
|
||||
if [ -f "${CONFDIR}/INDEX" ]
|
||||
then
|
||||
SIZE=`ls -l ${CONFDIR}/INDEX | awk '{ print $5 }'`
|
||||
else
|
||||
get_ftp_mirror
|
||||
FTPHOST="${VAL}"
|
||||
if [ -f "${CONFDIR}/INDEX" ]
|
||||
then
|
||||
SIZE=`ls -l ${CONFDIR}/INDEX | awk '{ print $5 }'`
|
||||
else
|
||||
get_ftp_mirror
|
||||
FTPHOST="${VAL}"
|
||||
|
||||
FTPDIR="/pub/FreeBSD/releases/${FBSD_ARCH}/${FBSD_BRANCH}"
|
||||
FTPPATH="ftp://${FTPHOST}${FTPDIR}/packages"
|
||||
FTPDIR="/pub/FreeBSD/releases/${FBSD_ARCH}/${FBSD_BRANCH}"
|
||||
FTPPATH="ftp://${FTPHOST}${FTPDIR}/packages"
|
||||
|
||||
fetch -s "${FTPPATH}/INDEX.bz2"
|
||||
fi
|
||||
fetch -s "${FTPPATH}/INDEX.bz2"
|
||||
fi
|
||||
};
|
||||
|
||||
get_package_index()
|
||||
{
|
||||
RES=0
|
||||
RES=0
|
||||
|
||||
if [ -z "${INSTALLMODE}" ]
|
||||
then
|
||||
get_ftp_mirror
|
||||
FTPHOST="${VAL}"
|
||||
if [ -z "${INSTALLMODE}" ]
|
||||
then
|
||||
get_ftp_mirror
|
||||
FTPHOST="${VAL}"
|
||||
|
||||
FTPDIR="/pub/FreeBSD/releases/${FBSD_ARCH}/${FBSD_BRANCH}"
|
||||
FTPPATH="ftp://${FTPHOST}${FTPDIR}/packages"
|
||||
FTPDIR="/pub/FreeBSD/releases/${FBSD_ARCH}/${FBSD_BRANCH}"
|
||||
FTPPATH="ftp://${FTPHOST}${FTPDIR}/packages"
|
||||
|
||||
get_package_index_by_ftp "${FTPPATH}"
|
||||
get_package_index_by_ftp "${FTPPATH}"
|
||||
|
||||
else
|
||||
get_value_from_cfg ftpHost
|
||||
if [ -z "$VAL" ]
|
||||
then
|
||||
exit_err "ERROR: Install medium was set to ftp, but no ftpHost was provided!"
|
||||
fi
|
||||
FTPHOST="${VAL}"
|
||||
else
|
||||
get_value_from_cfg ftpHost
|
||||
if [ -z "$VAL" ]
|
||||
then
|
||||
exit_err "ERROR: Install medium was set to ftp, but no ftpHost was provided!"
|
||||
fi
|
||||
|
||||
get_value_from_cfg ftpDir
|
||||
if [ -z "$VAL" ]
|
||||
then
|
||||
exit_err "ERROR: Install medium was set to ftp, but no ftpDir was provided!"
|
||||
fi
|
||||
FTPDIR="${VAL}"
|
||||
FTPHOST="${VAL}"
|
||||
|
||||
FTPPATH="ftp://${FTPHOST}${FTPDIR}"
|
||||
get_value_from_cfg ftpDir
|
||||
if [ -z "$VAL" ]
|
||||
then
|
||||
exit_err "ERROR: Install medium was set to ftp, but no ftpDir was provided!"
|
||||
fi
|
||||
|
||||
case "${INSTALLMEDIUM}" in
|
||||
usb|dvd) get_package_index_by_fs
|
||||
;;
|
||||
ftp) get_package_index_by_ftp "${FTPPATH}"
|
||||
;;
|
||||
*) RES=1
|
||||
;;
|
||||
esac
|
||||
FTPDIR="${VAL}"
|
||||
FTPPATH="ftp://${FTPHOST}${FTPDIR}"
|
||||
|
||||
fi
|
||||
case "${INSTALLMEDIUM}" in
|
||||
usb|dvd) get_package_index_by_fs ;;
|
||||
ftp|sftp) get_package_index_by_ftp "${FTPPATH}" ;;
|
||||
*) RES=1 ;;
|
||||
esac
|
||||
|
||||
return ${RES}
|
||||
fi
|
||||
|
||||
return ${RES}
|
||||
};
|
||||
|
||||
parse_package_index()
|
||||
{
|
||||
INDEX_FILE="${PKGDIR}/INDEX"
|
||||
INDEX_FILE="${PKGDIR}/INDEX"
|
||||
|
||||
exec 3<&0
|
||||
exec 0<"${INDEX_FILE}"
|
||||
exec 3<&0
|
||||
exec 0<"${INDEX_FILE}"
|
||||
|
||||
while read -r line
|
||||
do
|
||||
PKGNAME=""
|
||||
CATEGORY=""
|
||||
PACKAGE=""
|
||||
DESC=""
|
||||
DEPS=""
|
||||
i=0
|
||||
while read -r line
|
||||
do
|
||||
PKGNAME=""
|
||||
CATEGORY=""
|
||||
PACKAGE=""
|
||||
DESC=""
|
||||
DEPS=""
|
||||
i=0
|
||||
|
||||
SAVE_IFS="${IFS}"
|
||||
IFS="|"
|
||||
SAVE_IFS="${IFS}"
|
||||
IFS="|"
|
||||
|
||||
for part in ${line}
|
||||
do
|
||||
if [ "${i}" -eq "0" ]
|
||||
then
|
||||
PKGNAME="${part}"
|
||||
for part in ${line}
|
||||
do
|
||||
if [ "${i}" -eq "0" ]
|
||||
then
|
||||
PKGNAME="${part}"
|
||||
|
||||
elif [ "${i}" -eq "1" ]
|
||||
then
|
||||
PACKAGE=`basename "${part}"`
|
||||
elif [ "${i}" -eq "1" ]
|
||||
then
|
||||
PACKAGE=`basename "${part}"`
|
||||
|
||||
elif [ "${i}" -eq "3" ]
|
||||
then
|
||||
DESC="${part}"
|
||||
elif [ "${i}" -eq "3" ]
|
||||
then
|
||||
DESC="${part}"
|
||||
|
||||
elif [ "${i}" -eq "6" ]
|
||||
then
|
||||
CATEGORY=`echo "${part}" | cut -f1 -d' '`
|
||||
elif [ "${i}" -eq "6" ]
|
||||
then
|
||||
CATEGORY=`echo "${part}" | cut -f1 -d' '`
|
||||
|
||||
elif [ "${i}" -eq "8" ]
|
||||
then
|
||||
DEPS="${part}"
|
||||
fi
|
||||
elif [ "${i}" -eq "8" ]
|
||||
then
|
||||
DEPS="${part}"
|
||||
fi
|
||||
|
||||
i=$((i+1))
|
||||
done
|
||||
i=$((i+1))
|
||||
done
|
||||
|
||||
echo "${CATEGORY}|${PACKAGE}|${DESC}" >> "${INDEX_FILE}.parsed"
|
||||
echo "${PACKAGE}|${PKGNAME}|${DEPS}" >> "${INDEX_FILE}.deps"
|
||||
echo "${CATEGORY}|${PACKAGE}|${DESC}" >> "${INDEX_FILE}.parsed"
|
||||
echo "${PACKAGE}|${PKGNAME}|${DEPS}" >> "${INDEX_FILE}.deps"
|
||||
|
||||
IFS="${SAVE_IFS}"
|
||||
done
|
||||
IFS="${SAVE_IFS}"
|
||||
done
|
||||
|
||||
exec 0<&3
|
||||
exec 0<&3
|
||||
};
|
||||
|
||||
show_package_file()
|
||||
{
|
||||
PKGFILE="${1}"
|
||||
PKGFILE="${1}"
|
||||
|
||||
echo "Available Packages:"
|
||||
echo "Available Packages:"
|
||||
|
||||
exec 3<&0
|
||||
exec 0<"${PKGFILE}"
|
||||
exec 3<&0
|
||||
exec 0<"${PKGFILE}"
|
||||
|
||||
while read -r line
|
||||
do
|
||||
CATEGORY=`echo "${line}" | cut -f1 -d'|'`
|
||||
PACKAGE=`echo "${line}" | cut -f2 -d'|'`
|
||||
DESC=`echo "${line}" | cut -f3 -d'|'`
|
||||
while read -r line
|
||||
do
|
||||
CATEGORY=`echo "${line}" | cut -f1 -d'|'`
|
||||
PACKAGE=`echo "${line}" | cut -f2 -d'|'`
|
||||
DESC=`echo "${line}" | cut -f3 -d'|'`
|
||||
|
||||
echo "${CATEGORY}/${PACKAGE}:${DESC}"
|
||||
done
|
||||
echo "${CATEGORY}/${PACKAGE}:${DESC}"
|
||||
done
|
||||
|
||||
exec 0<&3
|
||||
exec 0<&3
|
||||
};
|
||||
|
||||
show_packages_by_category()
|
||||
{
|
||||
CATEGORY="${1}"
|
||||
INDEX_FILE="${PKGDIR}/INDEX.parsed"
|
||||
TMPFILE="/tmp/.pkg.cat"
|
||||
CATEGORY="${1}"
|
||||
INDEX_FILE="${PKGDIR}/INDEX.parsed"
|
||||
TMPFILE="/tmp/.pkg.cat"
|
||||
|
||||
grep "^${CATEGORY}|" "${INDEX_FILE}" > "${TMPFILE}"
|
||||
show_package_file "${TMPFILE}"
|
||||
rm "${TMPFILE}"
|
||||
grep "^${CATEGORY}|" "${INDEX_FILE}" > "${TMPFILE}"
|
||||
show_package_file "${TMPFILE}"
|
||||
rm "${TMPFILE}"
|
||||
};
|
||||
|
||||
show_package_by_name()
|
||||
{
|
||||
CATEGORY="${1}"
|
||||
PACKAGE="${2}"
|
||||
INDEX_FILE="${PKGDIR}/INDEX.parsed"
|
||||
TMPFILE="/tmp/.pkg.cat.pak"
|
||||
CATEGORY="${1}"
|
||||
PACKAGE="${2}"
|
||||
INDEX_FILE="${PKGDIR}/INDEX.parsed"
|
||||
TMPFILE="/tmp/.pkg.cat.pak"
|
||||
|
||||
grep "^${CATEGORY}|${PACKAGE}" "${INDEX_FILE}" > "${TMPFILE}"
|
||||
show_package_file "${TMPFILE}"
|
||||
rm "${TMPFILE}"
|
||||
grep "^${CATEGORY}|${PACKAGE}" "${INDEX_FILE}" > "${TMPFILE}"
|
||||
show_package_file "${TMPFILE}"
|
||||
rm "${TMPFILE}"
|
||||
};
|
||||
|
||||
show_packages()
|
||||
{
|
||||
show_package_file "${PKGDIR}/INDEX.parsed"
|
||||
show_package_file "${PKGDIR}/INDEX.parsed"
|
||||
};
|
||||
|
||||
get_package_dependencies()
|
||||
{
|
||||
PACKAGE="${1}"
|
||||
LONG="${2:-0}"
|
||||
RES=0
|
||||
PACKAGE="${1}"
|
||||
LONG="${2:-0}"
|
||||
RES=0
|
||||
|
||||
INDEX_FILE="${PKGDIR}/INDEX.deps"
|
||||
REGEX="^${PACKAGE}|"
|
||||
INDEX_FILE="${PKGDIR}/INDEX.deps"
|
||||
REGEX="^${PACKAGE}|"
|
||||
|
||||
if [ "${LONG}" -ne "0" ]
|
||||
then
|
||||
REGEX="^.*|${PACKAGE}|"
|
||||
fi
|
||||
if [ "${LONG}" -ne "0" ]
|
||||
then
|
||||
REGEX="^.*|${PACKAGE}|"
|
||||
fi
|
||||
|
||||
LINE=`grep "${REGEX}" "${INDEX_FILE}" 2>/dev/null`
|
||||
DEPS=`echo "${LINE}"|cut -f3 -d'|'`
|
||||
LINE=`grep "${REGEX}" "${INDEX_FILE}" 2>/dev/null`
|
||||
DEPS=`echo "${LINE}"|cut -f3 -d'|'`
|
||||
|
||||
VAL="${DEPS}"
|
||||
export VAL
|
||||
VAL="${DEPS}"
|
||||
export VAL
|
||||
|
||||
if [ -z "${VAL}" ]
|
||||
then
|
||||
RES=1
|
||||
fi
|
||||
if [ -z "${VAL}" ]
|
||||
then
|
||||
RES=1
|
||||
fi
|
||||
|
||||
return ${RES}
|
||||
return ${RES}
|
||||
};
|
||||
|
||||
get_package_name()
|
||||
{
|
||||
PACKAGE="${1}"
|
||||
RES=0
|
||||
PACKAGE="${1}"
|
||||
RES=0
|
||||
|
||||
INDEX_FILE="${PKGDIR}/INDEX.deps"
|
||||
REGEX="^${PACKAGE}|"
|
||||
INDEX_FILE="${PKGDIR}/INDEX.deps"
|
||||
REGEX="^${PACKAGE}|"
|
||||
|
||||
LINE=`grep "${REGEX}" "${INDEX_FILE}" 2>/dev/null`
|
||||
NAME=`echo "${LINE}"|cut -f2 -d'|'`
|
||||
LINE=`grep "${REGEX}" "${INDEX_FILE}" 2>/dev/null`
|
||||
NAME=`echo "${LINE}"|cut -f2 -d'|'`
|
||||
|
||||
VAL="${NAME}"
|
||||
export VAL
|
||||
VAL="${NAME}"
|
||||
export VAL
|
||||
|
||||
if [ -z "${VAL}" ]
|
||||
then
|
||||
RES=1
|
||||
fi
|
||||
if [ -z "${VAL}" ]
|
||||
then
|
||||
RES=1
|
||||
fi
|
||||
|
||||
return ${RES}
|
||||
return ${RES}
|
||||
};
|
||||
|
||||
get_package_short_name()
|
||||
{
|
||||
PACKAGE="${1}"
|
||||
RES=0
|
||||
PACKAGE="${1}"
|
||||
RES=0
|
||||
|
||||
INDEX_FILE="${PKGDIR}/INDEX.deps"
|
||||
REGEX="^.*|${PACKAGE}|"
|
||||
INDEX_FILE="${PKGDIR}/INDEX.deps"
|
||||
REGEX="^.*|${PACKAGE}|"
|
||||
|
||||
LINE=`grep "${REGEX}" "${INDEX_FILE}" 2>/dev/null`
|
||||
NAME=`echo "${LINE}"|cut -f1 -d'|'`
|
||||
LINE=`grep "${REGEX}" "${INDEX_FILE}" 2>/dev/null`
|
||||
NAME=`echo "${LINE}"|cut -f1 -d'|'`
|
||||
|
||||
VAL="${NAME}"
|
||||
export VAL
|
||||
VAL="${NAME}"
|
||||
export VAL
|
||||
|
||||
if [ -z "${VAL}" ]
|
||||
then
|
||||
RES=1
|
||||
fi
|
||||
if [ -z "${VAL}" ]
|
||||
then
|
||||
RES=1
|
||||
fi
|
||||
|
||||
return ${RES}
|
||||
return ${RES}
|
||||
};
|
||||
|
||||
get_package_category()
|
||||
{
|
||||
PACKAGE="${1}"
|
||||
INDEX_FILE="${PKGDIR}/INDEX.parsed"
|
||||
RES=0
|
||||
PACKAGE="${1}"
|
||||
INDEX_FILE="${PKGDIR}/INDEX.parsed"
|
||||
RES=0
|
||||
|
||||
LINE=`grep "|${PACKAGE}|" "${INDEX_FILE}" 2>/dev/null`
|
||||
NAME=`echo "${LINE}"|cut -f1 -d'|'`
|
||||
LINE=`grep "|${PACKAGE}|" "${INDEX_FILE}" 2>/dev/null`
|
||||
NAME=`echo "${LINE}"|cut -f1 -d'|'`
|
||||
|
||||
VAL="${NAME}"
|
||||
export VAL
|
||||
VAL="${NAME}"
|
||||
export VAL
|
||||
|
||||
if [ -z "${VAL}" ]
|
||||
then
|
||||
RES=1
|
||||
fi
|
||||
if [ -z "${VAL}" ]
|
||||
then
|
||||
RES=1
|
||||
fi
|
||||
|
||||
return ${RES}
|
||||
return ${RES}
|
||||
};
|
||||
|
||||
fetch_package_by_ftp()
|
||||
{
|
||||
CATEGORY="${1}"
|
||||
PACKAGE="${2}"
|
||||
SAVEDIR="${3}"
|
||||
CATEGORY="${1}"
|
||||
PACKAGE="${2}"
|
||||
SAVEDIR="${3}"
|
||||
|
||||
get_value_from_cfg ftpHost
|
||||
if [ -z "$VAL" ]
|
||||
then
|
||||
exit_err "ERROR: Install medium was set to ftp, but no ftpHost was provided!"
|
||||
fi
|
||||
FTPHOST="${VAL}"
|
||||
get_value_from_cfg ftpHost
|
||||
if [ -z "$VAL" ]
|
||||
then
|
||||
exit_err "ERROR: Install medium was set to ftp, but no ftpHost was provided!"
|
||||
fi
|
||||
FTPHOST="${VAL}"
|
||||
|
||||
get_value_from_cfg ftpDir
|
||||
if [ -z "$VAL" ]
|
||||
then
|
||||
exit_err "ERROR: Install medium was set to ftp, but no ftpDir was provided!"
|
||||
fi
|
||||
FTPDIR="${VAL}"
|
||||
get_value_from_cfg ftpDir
|
||||
if [ -z "$VAL" ]
|
||||
then
|
||||
exit_err "ERROR: Install medium was set to ftp, but no ftpDir was provided!"
|
||||
fi
|
||||
FTPDIR="${VAL}"
|
||||
|
||||
PACKAGE="${PACKAGE}.tbz"
|
||||
FTP_SERVER="ftp://${FTPHOST}${FTPDIR}"
|
||||
PACKAGE="${PACKAGE}.tbz"
|
||||
FTP_SERVER="ftp://${FTPHOST}${FTPDIR}"
|
||||
|
||||
if [ ! -f "${SAVEDIR}/${PACKAGE}" ]
|
||||
then
|
||||
PKGPATH="${CATEGORY}/${PACKAGE}"
|
||||
FTP_PATH="${FTP_HOST}/packages/${PKGPATH}"
|
||||
fetch_file "${FTP_PATH}" "${SAVEDIR}/" "0"
|
||||
fi
|
||||
if [ ! -f "${SAVEDIR}/${PACKAGE}" ]
|
||||
then
|
||||
PKGPATH="${CATEGORY}/${PACKAGE}"
|
||||
FTP_PATH="${FTP_HOST}/packages/${PKGPATH}"
|
||||
fetch_file "${FTP_PATH}" "${SAVEDIR}/" "0"
|
||||
fi
|
||||
};
|
||||
|
||||
fetch_package_by_fs()
|
||||
{
|
||||
CATEGORY="${1}"
|
||||
PACKAGE="${2}"
|
||||
SAVEDIR="${3}"
|
||||
CATEGORY="${1}"
|
||||
PACKAGE="${2}"
|
||||
SAVEDIR="${3}"
|
||||
|
||||
PACKAGE="${PACKAGE}.tbz"
|
||||
if [ ! -f "${SAVEDIR}/${PACKAGE}" ]
|
||||
then
|
||||
fetch_file "${CDMNT}/packages/${CATEGORY}/${PACKAGE}" "${SAVEDIR}/" "0"
|
||||
fi
|
||||
PACKAGE="${PACKAGE}.tbz"
|
||||
if [ ! -f "${SAVEDIR}/${PACKAGE}" ]
|
||||
then
|
||||
fetch_file "${CDMNT}/packages/${CATEGORY}/${PACKAGE}" "${SAVEDIR}/" "0"
|
||||
fi
|
||||
};
|
||||
|
||||
fetch_package()
|
||||
{
|
||||
CATEGORY="${1}"
|
||||
PACKAGE="${2}"
|
||||
SAVEDIR="${3}"
|
||||
CATEGORY="${1}"
|
||||
PACKAGE="${2}"
|
||||
SAVEDIR="${3}"
|
||||
|
||||
case "${INSTALLMEDIUM}" in
|
||||
usb|dvd)
|
||||
fetch_package_by_fs "${CATEGORY}" "${PACKAGE}" "${SAVEDIR}"
|
||||
;;
|
||||
ftp)
|
||||
fetch_package_by_ftp "${CATEGORY}" "${PACKAGE}" "${SAVEDIR}"
|
||||
;;
|
||||
esac
|
||||
case "${INSTALLMEDIUM}" in
|
||||
usb|dvd) fetch_package_by_fs "${CATEGORY}" "${PACKAGE}" "${SAVEDIR}" ;;
|
||||
ftp|sftp) fetch_package_by_ftp "${CATEGORY}" "${PACKAGE}" "${SAVEDIR}" ;;
|
||||
esac
|
||||
};
|
||||
|
@ -132,19 +132,19 @@ file_sanity_check()
|
||||
then
|
||||
for i in $1
|
||||
do
|
||||
grep "^${i}=" $CFGF >/dev/null 2>/dev/null
|
||||
if [ "$?" = "0" ]
|
||||
then
|
||||
LN=`grep "^${i}=" ${CFGF} | head -n 1 | cut -d '=' -f 2 | tr -d ' '`
|
||||
if [ -z "${LN}" ]
|
||||
then
|
||||
echo "Error: Config fails sanity test! ${i}= is empty"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "Error: Config fails sanity test! Missing ${i}="
|
||||
exit 1
|
||||
fi
|
||||
grep "^${i}=" $CFGF >/dev/null 2>/dev/null
|
||||
if [ "$?" = "0" ]
|
||||
then
|
||||
LN=`grep "^${i}=" ${CFGF} | head -n 1 | cut -d '=' -f 2 | tr -d ' '`
|
||||
if [ -z "${LN}" ]
|
||||
then
|
||||
echo "Error: Config fails sanity test! ${i}= is empty"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "Error: Config fails sanity test! Missing ${i}="
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
else
|
||||
echo "Error: Missing config file, and / or values to sanity check for!"
|
||||
|
@ -28,13 +28,14 @@
|
||||
# Functions which unmount all mounted disk filesystems
|
||||
|
||||
# Unmount all mounted partitions under specified dir
|
||||
umount_all_dir() {
|
||||
_udir="$1"
|
||||
_umntdirs=`mount | sort -r | grep "on $_udir" | cut -d ' ' -f 3`
|
||||
for _ud in $_umntdirs
|
||||
do
|
||||
umount -f ${_ud}
|
||||
done
|
||||
umount_all_dir()
|
||||
{
|
||||
_udir="$1"
|
||||
_umntdirs=`mount | sort -r | grep "on $_udir" | cut -d ' ' -f 3`
|
||||
for _ud in $_umntdirs
|
||||
do
|
||||
umount -f ${_ud}
|
||||
done
|
||||
}
|
||||
|
||||
# Script that adds our gmirror devices for syncing
|
||||
@ -58,93 +59,93 @@ start_gmirror_sync()
|
||||
# Unmounts all our mounted file-systems
|
||||
unmount_all_filesystems()
|
||||
{
|
||||
# Copy the logfile to disk before we unmount
|
||||
cp ${LOGOUT} ${FSMNT}/root/pc-sysinstall.log
|
||||
cd /
|
||||
# Copy the logfile to disk before we unmount
|
||||
cp ${LOGOUT} ${FSMNT}/root/pc-sysinstall.log
|
||||
cd /
|
||||
|
||||
# Start by unmounting any ZFS partitions
|
||||
zfs_cleanup_unmount
|
||||
# Start by unmounting any ZFS partitions
|
||||
zfs_cleanup_unmount
|
||||
|
||||
# Lets read our partition list, and unmount each
|
||||
##################################################################
|
||||
for PART in `ls ${PARTDIR}`
|
||||
do
|
||||
|
||||
PARTFS="`cat ${PARTDIR}/${PART} | cut -d ':' -f 1`"
|
||||
PARTMNT="`cat ${PARTDIR}/${PART} | cut -d ':' -f 2`"
|
||||
PARTENC="`cat ${PARTDIR}/${PART} | cut -d ':' -f 3`"
|
||||
PARTLABEL="`cat ${PARTDIR}/${PART} | cut -d ':' -f 4`"
|
||||
# Lets read our partition list, and unmount each
|
||||
##################################################################
|
||||
for PART in `ls ${PARTDIR}`
|
||||
do
|
||||
|
||||
PARTFS="`cat ${PARTDIR}/${PART} | cut -d ':' -f 1`"
|
||||
PARTMNT="`cat ${PARTDIR}/${PART} | cut -d ':' -f 2`"
|
||||
PARTENC="`cat ${PARTDIR}/${PART} | cut -d ':' -f 3`"
|
||||
PARTLABEL="`cat ${PARTDIR}/${PART} | cut -d ':' -f 4`"
|
||||
|
||||
if [ "${PARTENC}" = "ON" ]
|
||||
then
|
||||
EXT=".eli"
|
||||
else
|
||||
EXT=""
|
||||
fi
|
||||
if [ "${PARTENC}" = "ON" ]
|
||||
then
|
||||
EXT=".eli"
|
||||
else
|
||||
EXT=""
|
||||
fi
|
||||
|
||||
#if [ "${PARTFS}" = "SWAP" ]
|
||||
#then
|
||||
# rc_nohalt "swapoff /dev/${PART}${EXT}"
|
||||
#fi
|
||||
#if [ "${PARTFS}" = "SWAP" ]
|
||||
#then
|
||||
# rc_nohalt "swapoff /dev/${PART}${EXT}"
|
||||
#fi
|
||||
|
||||
# Check if we've found "/", and unmount that last
|
||||
if [ "$PARTMNT" != "/" -a "${PARTMNT}" != "none" -a "${PARTFS}" != "ZFS" ]
|
||||
then
|
||||
rc_halt "umount -f /dev/${PART}${EXT}"
|
||||
# Check if we've found "/", and unmount that last
|
||||
if [ "$PARTMNT" != "/" -a "${PARTMNT}" != "none" -a "${PARTFS}" != "ZFS" ]
|
||||
then
|
||||
rc_halt "umount -f /dev/${PART}${EXT}"
|
||||
|
||||
# Re-check if we are missing a label for this device and create it again if so
|
||||
if [ ! -e "/dev/label/${PARTLABEL}" ]
|
||||
then
|
||||
case ${PARTFS} in
|
||||
UFS) glabel label ${PARTLABEL} /dev/${PART}${EXT} ;;
|
||||
UFS+S) glabel label ${PARTLABEL} /dev/${PART}${EXT} ;;
|
||||
UFS+J) glabel label ${PARTLABEL} /dev/${PART}${EXT}.journal ;;
|
||||
*) ;;
|
||||
esac
|
||||
fi
|
||||
fi
|
||||
# Re-check if we are missing a label for this device and create it again if so
|
||||
if [ ! -e "/dev/label/${PARTLABEL}" ]
|
||||
then
|
||||
case ${PARTFS} in
|
||||
UFS) glabel label ${PARTLABEL} /dev/${PART}${EXT} ;;
|
||||
UFS+S) glabel label ${PARTLABEL} /dev/${PART}${EXT} ;;
|
||||
UFS+J) glabel label ${PARTLABEL} /dev/${PART}${EXT}.journal ;;
|
||||
*) ;;
|
||||
esac
|
||||
fi
|
||||
fi
|
||||
|
||||
# Check if we've found "/" and make sure the label exists
|
||||
if [ "$PARTMNT" = "/" -a "${PARTFS}" != "ZFS" ]
|
||||
then
|
||||
if [ ! -e "/dev/label/${PARTLABEL}" ]
|
||||
then
|
||||
case ${PARTFS} in
|
||||
UFS) ROOTRELABEL="glabel label ${PARTLABEL} /dev/${PART}${EXT}" ;;
|
||||
UFS+S) ROOTRELABEL="glabel label ${PARTLABEL} /dev/${PART}${EXT}" ;;
|
||||
UFS+J) ROOTRELABEL="glabel label ${PARTLABEL} /dev/${PART}${EXT}.journal" ;;
|
||||
*) ;;
|
||||
esac
|
||||
fi
|
||||
fi
|
||||
done
|
||||
# Check if we've found "/" and make sure the label exists
|
||||
if [ "$PARTMNT" = "/" -a "${PARTFS}" != "ZFS" ]
|
||||
then
|
||||
if [ ! -e "/dev/label/${PARTLABEL}" ]
|
||||
then
|
||||
case ${PARTFS} in
|
||||
UFS) ROOTRELABEL="glabel label ${PARTLABEL} /dev/${PART}${EXT}" ;;
|
||||
UFS+S) ROOTRELABEL="glabel label ${PARTLABEL} /dev/${PART}${EXT}" ;;
|
||||
UFS+J) ROOTRELABEL="glabel label ${PARTLABEL} /dev/${PART}${EXT}.journal" ;;
|
||||
*) ;;
|
||||
esac
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
# Last lets the /mnt partition
|
||||
#########################################################
|
||||
rc_nohalt "umount -f ${FSMNT}"
|
||||
# Last lets the /mnt partition
|
||||
#########################################################
|
||||
rc_nohalt "umount -f ${FSMNT}"
|
||||
|
||||
# If are using a ZFS on "/" set it to legacy
|
||||
if [ ! -z "${FOUNDZFSROOT}" ]
|
||||
then
|
||||
rc_halt "zfs set mountpoint=legacy ${FOUNDZFSROOT}"
|
||||
fi
|
||||
# If are using a ZFS on "/" set it to legacy
|
||||
if [ ! -z "${FOUNDZFSROOT}" ]
|
||||
then
|
||||
rc_halt "zfs set mountpoint=legacy ${FOUNDZFSROOT}"
|
||||
fi
|
||||
|
||||
# If we need to relabel "/" do it now
|
||||
if [ ! -z "${ROOTRELABEL}" ]
|
||||
then
|
||||
${ROOTRELABEL}
|
||||
fi
|
||||
# If we need to relabel "/" do it now
|
||||
if [ ! -z "${ROOTRELABEL}" ]
|
||||
then
|
||||
${ROOTRELABEL}
|
||||
fi
|
||||
|
||||
# Unmount our CDMNT
|
||||
rc_nohalt "umount -f ${CDMNT}" >/dev/null 2>/dev/null
|
||||
# Unmount our CDMNT
|
||||
rc_nohalt "umount -f ${CDMNT}" >/dev/null 2>/dev/null
|
||||
|
||||
# Check if we need to run any gmirror syncing
|
||||
ls ${MIRRORCFGDIR}/* >/dev/null 2>/dev/null
|
||||
if [ "$?" = "0" ]
|
||||
then
|
||||
# Lets start syncing now
|
||||
start_gmirror_sync
|
||||
fi
|
||||
# Check if we need to run any gmirror syncing
|
||||
ls ${MIRRORCFGDIR}/* >/dev/null 2>/dev/null
|
||||
if [ "$?" = "0" ]
|
||||
then
|
||||
# Lets start syncing now
|
||||
start_gmirror_sync
|
||||
fi
|
||||
|
||||
};
|
||||
|
||||
@ -164,43 +165,43 @@ unmount_all_filesystems_failure()
|
||||
for PART in `ls ${PARTDIR}`
|
||||
do
|
||||
|
||||
PARTFS="`cat ${PARTDIR}/${PART} | cut -d ':' -f 1`"
|
||||
PARTMNT="`cat ${PARTDIR}/${PART} | cut -d ':' -f 2`"
|
||||
PARTENC="`cat ${PARTDIR}/${PART} | cut -d ':' -f 3`"
|
||||
PARTFS="`cat ${PARTDIR}/${PART} | cut -d ':' -f 1`"
|
||||
PARTMNT="`cat ${PARTDIR}/${PART} | cut -d ':' -f 2`"
|
||||
PARTENC="`cat ${PARTDIR}/${PART} | cut -d ':' -f 3`"
|
||||
|
||||
#if [ "${PARTFS}" = "SWAP" ]
|
||||
#then
|
||||
# if [ "${PARTENC}" = "ON" ]
|
||||
# then
|
||||
# rc_nohalt "swapoff /dev/${PART}.eli"
|
||||
# else
|
||||
# rc_nohalt "swapoff /dev/${PART}"
|
||||
# fi
|
||||
#fi
|
||||
#if [ "${PARTFS}" = "SWAP" ]
|
||||
#then
|
||||
# if [ "${PARTENC}" = "ON" ]
|
||||
# then
|
||||
# rc_nohalt "swapoff /dev/${PART}.eli"
|
||||
# else
|
||||
# rc_nohalt "swapoff /dev/${PART}"
|
||||
# fi
|
||||
#fi
|
||||
|
||||
# Check if we've found "/" again, don't need to mount it twice
|
||||
if [ "$PARTMNT" != "/" -a "${PARTMNT}" != "none" -a "${PARTFS}" != "ZFS" ]
|
||||
then
|
||||
rc_nohalt "umount -f /dev/${PART}"
|
||||
rc_nohalt "umount -f ${FSMNT}${PARTMNT}"
|
||||
fi
|
||||
done
|
||||
# Check if we've found "/" again, don't need to mount it twice
|
||||
if [ "$PARTMNT" != "/" -a "${PARTMNT}" != "none" -a "${PARTFS}" != "ZFS" ]
|
||||
then
|
||||
rc_nohalt "umount -f /dev/${PART}"
|
||||
rc_nohalt "umount -f ${FSMNT}${PARTMNT}"
|
||||
fi
|
||||
done
|
||||
|
||||
# Last lets the /mnt partition
|
||||
#########################################################
|
||||
rc_nohalt "umount -f ${FSMNT}"
|
||||
# Last lets the /mnt partition
|
||||
#########################################################
|
||||
rc_nohalt "umount -f ${FSMNT}"
|
||||
|
||||
fi
|
||||
else
|
||||
# We are doing a upgrade, try unmounting any of these filesystems
|
||||
chroot ${FSMNT} /sbin/umount -a >>${LOGOUT} >>${LOGOUT}
|
||||
umount -f ${FSMNT}/usr >>${LOGOUT} 2>>${LOGOUT}
|
||||
umount -f ${FSMNT}/dev >>${LOGOUT} 2>>${LOGOUT}
|
||||
umount -f ${FSMNT} >>${LOGOUT} 2>>${LOGOUT}
|
||||
rc_nohalt "sh ${TMPDIR}/.upgrade-unmount"
|
||||
fi
|
||||
else
|
||||
# We are doing a upgrade, try unmounting any of these filesystems
|
||||
chroot ${FSMNT} /sbin/umount -a >>${LOGOUT} >>${LOGOUT}
|
||||
umount -f ${FSMNT}/usr >>${LOGOUT} 2>>${LOGOUT}
|
||||
umount -f ${FSMNT}/dev >>${LOGOUT} 2>>${LOGOUT}
|
||||
umount -f ${FSMNT} >>${LOGOUT} 2>>${LOGOUT}
|
||||
rc_nohalt "sh ${TMPDIR}/.upgrade-unmount"
|
||||
fi
|
||||
|
||||
# Unmount our CDMNT
|
||||
rc_nohalt "umount ${CDMNT}"
|
||||
# Unmount our CDMNT
|
||||
rc_nohalt "umount ${CDMNT}"
|
||||
|
||||
};
|
||||
|
@ -43,8 +43,8 @@ mount_target_slice()
|
||||
if [ -e "/dev/${MPART}" ] ; then
|
||||
rc_nohalt "mount /dev/${MPART} ${FSMNT}"
|
||||
if [ "$?" != "0" ] ; then
|
||||
# Check if we have ZFS tank name
|
||||
rc_halt "mount -t zfs ${MPART} ${FSMNT}"
|
||||
# Check if we have ZFS tank name
|
||||
rc_halt "mount -t zfs ${MPART} ${FSMNT}"
|
||||
fi
|
||||
else
|
||||
# Check if we have ZFS tank name
|
||||
@ -104,7 +104,7 @@ done
|
||||
run_chroot_cmd "rm -rf /libexec" >/dev/null 2>/dev/null
|
||||
fi
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
# Mount the target upgrade partitions
|
||||
mount_upgrade()
|
||||
@ -116,33 +116,33 @@ mount_upgrade()
|
||||
# We are ready to start mounting, lets read the config and do it
|
||||
while read line
|
||||
do
|
||||
echo $line | grep "^disk0=" >/dev/null 2>/dev/null
|
||||
if [ "$?" = "0" ]
|
||||
then
|
||||
echo $line | grep "^disk0=" >/dev/null 2>/dev/null
|
||||
if [ "$?" = "0" ]
|
||||
then
|
||||
|
||||
# Found a disk= entry, lets get the disk we are working on
|
||||
get_value_from_string "${line}"
|
||||
strip_white_space "$VAL"
|
||||
DISK="$VAL"
|
||||
fi
|
||||
# Found a disk= entry, lets get the disk we are working on
|
||||
get_value_from_string "${line}"
|
||||
strip_white_space "$VAL"
|
||||
DISK="$VAL"
|
||||
fi
|
||||
|
||||
echo $line | grep "^commitDiskPart" >/dev/null 2>/dev/null
|
||||
if [ "$?" = "0" ]
|
||||
then
|
||||
# Found our flag to commit this disk setup / lets do sanity check and do it
|
||||
if [ ! -z "${DISK}" ]
|
||||
then
|
||||
echo $line | grep "^commitDiskPart" >/dev/null 2>/dev/null
|
||||
if [ "$?" = "0" ]
|
||||
then
|
||||
# Found our flag to commit this disk setup / lets do sanity check and do it
|
||||
if [ ! -z "${DISK}" ]
|
||||
then
|
||||
|
||||
# Start mounting this slice
|
||||
mount_target_slice "${DISK}"
|
||||
# Start mounting this slice
|
||||
mount_target_slice "${DISK}"
|
||||
|
||||
# Increment our disk counter to look for next disk and unset
|
||||
unset DISK
|
||||
break
|
||||
else
|
||||
exit_err "ERROR: commitDiskPart was called without procceding disk<num>= and partition= entries!!!"
|
||||
fi
|
||||
fi
|
||||
# Increment our disk counter to look for next disk and unset
|
||||
unset DISK
|
||||
break
|
||||
else
|
||||
exit_err "ERROR: commitDiskPart was called without procceding disk<num>= and partition= entries!!!"
|
||||
fi
|
||||
fi
|
||||
|
||||
done <${CFGF}
|
||||
|
||||
@ -151,8 +151,8 @@ mount_upgrade()
|
||||
copy_skel_files_upgrade()
|
||||
{
|
||||
|
||||
# Now make sure we fix any user profile scripts, which cause problems from 7.x->8.x
|
||||
echo '#!/bin/sh
|
||||
# Now make sure we fix any user profile scripts, which cause problems from 7.x->8.x
|
||||
echo '#!/bin/sh
|
||||
|
||||
cd /home
|
||||
for i in `ls`
|
||||
@ -179,17 +179,17 @@ do
|
||||
|
||||
done
|
||||
' >${FSMNT}/.fixUserProfile.sh
|
||||
chmod 755 ${FSMNT}/.fixUserProfile.sh
|
||||
chroot ${FSMNT} /.fixUserProfile.sh >/dev/null 2>/dev/null
|
||||
rm ${FSMNT}/.fixUserProfile.sh
|
||||
chmod 755 ${FSMNT}/.fixUserProfile.sh
|
||||
chroot ${FSMNT} /.fixUserProfile.sh >/dev/null 2>/dev/null
|
||||
rm ${FSMNT}/.fixUserProfile.sh
|
||||
|
||||
|
||||
|
||||
# if the user wants to keep their original .kde4 profile
|
||||
###########################################################################
|
||||
get_value_from_cfg "upgradeKeepDesktopProfile"
|
||||
if [ "$VAL" = "YES" -o "$VAL" = "yes" ] ; then
|
||||
echo '#!/bin/sh
|
||||
# if the user wants to keep their original .kde4 profile
|
||||
###########################################################################
|
||||
get_value_from_cfg "upgradeKeepDesktopProfile"
|
||||
if [ "$VAL" = "YES" -o "$VAL" = "yes" ] ; then
|
||||
echo '#!/bin/sh
|
||||
cd /home
|
||||
for i in `ls`
|
||||
do
|
||||
@ -202,11 +202,11 @@ do
|
||||
fi
|
||||
done
|
||||
' >${FSMNT}/.fixUserProfile.sh
|
||||
chmod 755 ${FSMNT}/.fixUserProfile.sh
|
||||
chroot ${FSMNT} /.fixUserProfile.sh >/dev/null 2>/dev/null
|
||||
rm ${FSMNT}/.fixUserProfile.sh
|
||||
chmod 755 ${FSMNT}/.fixUserProfile.sh
|
||||
chroot ${FSMNT} /.fixUserProfile.sh >/dev/null 2>/dev/null
|
||||
rm ${FSMNT}/.fixUserProfile.sh
|
||||
|
||||
fi
|
||||
fi
|
||||
|
||||
};
|
||||
|
||||
@ -230,18 +230,18 @@ merge_old_configs()
|
||||
unmount_upgrade()
|
||||
{
|
||||
|
||||
# If on PC-BSD, make sure we copy any fixed skel files
|
||||
if [ "$INSTALLTYPE" != "FreeBSD" ] ; then
|
||||
copy_skel_files_upgrade
|
||||
fi
|
||||
# If on PC-BSD, make sure we copy any fixed skel files
|
||||
if [ "$INSTALLTYPE" != "FreeBSD" ] ; then
|
||||
copy_skel_files_upgrade
|
||||
fi
|
||||
|
||||
cd /
|
||||
cd /
|
||||
|
||||
# Unmount FS
|
||||
umount_all_dir "${FSMNT}"
|
||||
# Unmount FS
|
||||
umount_all_dir "${FSMNT}"
|
||||
|
||||
# Run our saved unmount script for these file-systems
|
||||
rc_nohalt "umount -f ${FSMNT}"
|
||||
# Run our saved unmount script for these file-systems
|
||||
rc_nohalt "umount -f ${FSMNT}"
|
||||
|
||||
umount ${CDMNT}
|
||||
umount ${CDMNT}
|
||||
};
|
||||
|
@ -72,99 +72,99 @@ setup_users()
|
||||
while read line
|
||||
do
|
||||
|
||||
echo $line | grep "^userName=" >/dev/null 2>/dev/null
|
||||
if [ "$?" = "0" ]
|
||||
then
|
||||
get_value_from_string "${line}"
|
||||
USERNAME="$VAL"
|
||||
fi
|
||||
echo $line | grep "^userName=" >/dev/null 2>/dev/null
|
||||
if [ "$?" = "0" ]
|
||||
then
|
||||
get_value_from_string "${line}"
|
||||
USERNAME="$VAL"
|
||||
fi
|
||||
|
||||
echo $line | grep "^userComment=" >/dev/null 2>/dev/null
|
||||
if [ "$?" = "0" ]
|
||||
then
|
||||
get_value_from_string "${line}"
|
||||
USERCOMMENT="$VAL"
|
||||
fi
|
||||
echo $line | grep "^userComment=" >/dev/null 2>/dev/null
|
||||
if [ "$?" = "0" ]
|
||||
then
|
||||
get_value_from_string "${line}"
|
||||
USERCOMMENT="$VAL"
|
||||
fi
|
||||
|
||||
echo $line | grep "^userPass=" >/dev/null 2>/dev/null
|
||||
if [ "$?" = "0" ]
|
||||
then
|
||||
get_value_from_string "${line}"
|
||||
USERPASS="$VAL"
|
||||
fi
|
||||
echo $line | grep "^userPass=" >/dev/null 2>/dev/null
|
||||
if [ "$?" = "0" ]
|
||||
then
|
||||
get_value_from_string "${line}"
|
||||
USERPASS="$VAL"
|
||||
fi
|
||||
|
||||
echo $line | grep "^userShell=" >/dev/null 2>/dev/null
|
||||
if [ "$?" = "0" ]
|
||||
then
|
||||
get_value_from_string "${line}"
|
||||
strip_white_space "$VAL"
|
||||
USERSHELL="$VAL"
|
||||
fi
|
||||
echo $line | grep "^userShell=" >/dev/null 2>/dev/null
|
||||
if [ "$?" = "0" ]
|
||||
then
|
||||
get_value_from_string "${line}"
|
||||
strip_white_space "$VAL"
|
||||
USERSHELL="$VAL"
|
||||
fi
|
||||
|
||||
echo $line | grep "^userHome=" >/dev/null 2>/dev/null
|
||||
if [ "$?" = "0" ]
|
||||
then
|
||||
get_value_from_string "${line}"
|
||||
USERHOME="$VAL"
|
||||
fi
|
||||
echo $line | grep "^userHome=" >/dev/null 2>/dev/null
|
||||
if [ "$?" = "0" ]
|
||||
then
|
||||
get_value_from_string "${line}"
|
||||
USERHOME="$VAL"
|
||||
fi
|
||||
|
||||
echo $line | grep "^userGroups=" >/dev/null 2>/dev/null
|
||||
if [ "$?" = "0" ]
|
||||
then
|
||||
get_value_from_string "${line}"
|
||||
USERGROUPS="$VAL"
|
||||
fi
|
||||
echo $line | grep "^userGroups=" >/dev/null 2>/dev/null
|
||||
if [ "$?" = "0" ]
|
||||
then
|
||||
get_value_from_string "${line}"
|
||||
USERGROUPS="$VAL"
|
||||
fi
|
||||
|
||||
|
||||
echo $line | grep "^commitUser" >/dev/null 2>/dev/null
|
||||
if [ "$?" = "0" ]
|
||||
then
|
||||
# Found our flag to commit this user, lets check and do it
|
||||
if [ ! -z "${USERNAME}" ]
|
||||
then
|
||||
echo $line | grep "^commitUser" >/dev/null 2>/dev/null
|
||||
if [ "$?" = "0" ]
|
||||
then
|
||||
# Found our flag to commit this user, lets check and do it
|
||||
if [ ! -z "${USERNAME}" ]
|
||||
then
|
||||
|
||||
# Now add this user to the system, by building our args list
|
||||
ARGS="-n ${USERNAME}"
|
||||
# Now add this user to the system, by building our args list
|
||||
ARGS="-n ${USERNAME}"
|
||||
|
||||
if [ ! -z "${USERCOMMENT}" ]
|
||||
then
|
||||
ARGS="${ARGS} -c \"${USERCOMMENT}\""
|
||||
fi
|
||||
if [ ! -z "${USERCOMMENT}" ]
|
||||
then
|
||||
ARGS="${ARGS} -c \"${USERCOMMENT}\""
|
||||
fi
|
||||
|
||||
if [ ! -z "${USERPASS}" ]
|
||||
then
|
||||
ARGS="${ARGS} -h 0"
|
||||
echo "${USERPASS}" >${FSMNT}/.tmpPass
|
||||
else
|
||||
ARGS="${ARGS} -h -"
|
||||
rm ${FSMNT}/.tmpPass 2>/dev/null 2>/dev/null
|
||||
fi
|
||||
if [ ! -z "${USERPASS}" ]
|
||||
then
|
||||
ARGS="${ARGS} -h 0"
|
||||
echo "${USERPASS}" >${FSMNT}/.tmpPass
|
||||
else
|
||||
ARGS="${ARGS} -h -"
|
||||
rm ${FSMNT}/.tmpPass 2>/dev/null 2>/dev/null
|
||||
fi
|
||||
|
||||
if [ ! -z "${USERSHELL}" ]
|
||||
then
|
||||
ARGS="${ARGS} -s \"${USERSHELL}\""
|
||||
else
|
||||
ARGS="${ARGS} -s \"/nonexistant\""
|
||||
fi
|
||||
if [ ! -z "${USERSHELL}" ]
|
||||
then
|
||||
ARGS="${ARGS} -s \"${USERSHELL}\""
|
||||
else
|
||||
ARGS="${ARGS} -s \"/nonexistant\""
|
||||
fi
|
||||
|
||||
if [ ! -z "${USERHOME}" ]
|
||||
then
|
||||
ARGS="${ARGS} -m -d \"${USERHOME}\""
|
||||
fi
|
||||
if [ ! -z "${USERHOME}" ]
|
||||
then
|
||||
ARGS="${ARGS} -m -d \"${USERHOME}\""
|
||||
fi
|
||||
|
||||
if [ ! -z "${USERGROUPS}" ]
|
||||
then
|
||||
ARGS="${ARGS} -G \"${USERGROUPS}\""
|
||||
fi
|
||||
if [ ! -z "${USERGROUPS}" ]
|
||||
then
|
||||
ARGS="${ARGS} -G \"${USERGROUPS}\""
|
||||
fi
|
||||
|
||||
add_user "${ARGS}"
|
||||
add_user "${ARGS}"
|
||||
|
||||
# Unset our vars before looking for any more users
|
||||
unset USERNAME USERCOMMENT USERPASS USERSHELL USERHOME USERGROUPS
|
||||
else
|
||||
exit_err "ERROR: commitUser was called without any userName= entry!!!"
|
||||
fi
|
||||
fi
|
||||
# Unset our vars before looking for any more users
|
||||
unset USERNAME USERCOMMENT USERPASS USERSHELL USERHOME USERGROUPS
|
||||
else
|
||||
exit_err "ERROR: commitUser was called without any userName= entry!!!"
|
||||
fi
|
||||
fi
|
||||
|
||||
done <${CFGF}
|
||||
|
||||
|
@ -98,18 +98,18 @@ strip_white_space()
|
||||
# Displays an error message and exits with error 1
|
||||
exit_err()
|
||||
{
|
||||
# Echo the message for the users benefit
|
||||
echo "$1"
|
||||
# Echo the message for the users benefit
|
||||
echo "$1"
|
||||
|
||||
# Save this error to the log file
|
||||
echo "${1}" >>$LOGOUT
|
||||
# Save this error to the log file
|
||||
echo "${1}" >>$LOGOUT
|
||||
|
||||
# Check if we need to unmount any file-systems after this failure
|
||||
unmount_all_filesystems_failure
|
||||
# Check if we need to unmount any file-systems after this failure
|
||||
unmount_all_filesystems_failure
|
||||
|
||||
echo "For more details see log file: $LOGOUT"
|
||||
echo "For more details see log file: $LOGOUT"
|
||||
|
||||
exit 1
|
||||
exit 1
|
||||
};
|
||||
|
||||
# Run-command, don't halt if command exits with non-0
|
||||
@ -195,66 +195,67 @@ echo_log()
|
||||
};
|
||||
|
||||
# Make sure we have a numeric
|
||||
is_num() {
|
||||
expr $1 + 1 2>/dev/null
|
||||
return $?
|
||||
is_num()
|
||||
{
|
||||
expr $1 + 1 2>/dev/null
|
||||
return $?
|
||||
}
|
||||
|
||||
# Function which uses "fetch" to download a file, and display a progress report
|
||||
fetch_file()
|
||||
{
|
||||
|
||||
FETCHFILE="$1"
|
||||
FETCHOUTFILE="$2"
|
||||
EXITFAILED="$3"
|
||||
FETCHFILE="$1"
|
||||
FETCHOUTFILE="$2"
|
||||
EXITFAILED="$3"
|
||||
|
||||
SIZEFILE="${TMPDIR}/.fetchSize"
|
||||
EXITFILE="${TMPDIR}/.fetchExit"
|
||||
SIZEFILE="${TMPDIR}/.fetchSize"
|
||||
EXITFILE="${TMPDIR}/.fetchExit"
|
||||
|
||||
rm ${SIZEFILE} 2>/dev/null >/dev/null
|
||||
rm ${FETCHOUTFILE} 2>/dev/null >/dev/null
|
||||
rm ${SIZEFILE} 2>/dev/null >/dev/null
|
||||
rm ${FETCHOUTFILE} 2>/dev/null >/dev/null
|
||||
|
||||
fetch -s "${FETCHFILE}" >${SIZEFILE}
|
||||
SIZE="`cat ${SIZEFILE}`"
|
||||
SIZE="`expr ${SIZE} / 1024`"
|
||||
echo "FETCH: ${FETCHFILE}"
|
||||
echo "FETCH: ${FETCHOUTFILE}" >>${LOGOUT}
|
||||
fetch -s "${FETCHFILE}" >${SIZEFILE}
|
||||
SIZE="`cat ${SIZEFILE}`"
|
||||
SIZE="`expr ${SIZE} / 1024`"
|
||||
echo "FETCH: ${FETCHFILE}"
|
||||
echo "FETCH: ${FETCHOUTFILE}" >>${LOGOUT}
|
||||
|
||||
( fetch -o ${FETCHOUTFILE} "${FETCHFILE}" >/dev/null 2>/dev/null ; echo "$?" > ${EXITFILE} ) &
|
||||
PID="$!"
|
||||
while
|
||||
z=1
|
||||
do
|
||||
( fetch -o ${FETCHOUTFILE} "${FETCHFILE}" >/dev/null 2>/dev/null ; echo "$?" > ${EXITFILE} ) &
|
||||
PID="$!"
|
||||
while
|
||||
z=1
|
||||
do
|
||||
|
||||
if [ -e "${FETCHOUTFILE}" ]
|
||||
then
|
||||
DSIZE=`du -k ${FETCHOUTFILE} | tr -d '\t' | cut -d '/' -f 1`
|
||||
if [ $(is_num "$DSIZE") ] ; then
|
||||
if [ $SIZE -lt $DSIZE ] ; then DSIZE="$SIZE"; fi
|
||||
if [ -e "${FETCHOUTFILE}" ]
|
||||
then
|
||||
DSIZE=`du -k ${FETCHOUTFILE} | tr -d '\t' | cut -d '/' -f 1`
|
||||
if [ $(is_num "$DSIZE") ] ; then
|
||||
if [ $SIZE -lt $DSIZE ] ; then DSIZE="$SIZE"; fi
|
||||
echo "SIZE: ${SIZE} DOWNLOADED: ${DSIZE}"
|
||||
echo "SIZE: ${SIZE} DOWNLOADED: ${DSIZE}" >>${LOGOUT}
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# Check if the download is finished
|
||||
ps -p ${PID} >/dev/null 2>/dev/null
|
||||
if [ "$?" != "0" ]
|
||||
# Check if the download is finished
|
||||
ps -p ${PID} >/dev/null 2>/dev/null
|
||||
if [ "$?" != "0" ]
|
||||
then
|
||||
break;
|
||||
fi
|
||||
|
||||
sleep 2
|
||||
done
|
||||
|
||||
echo "FETCHDONE"
|
||||
|
||||
EXIT="`cat ${EXITFILE}`"
|
||||
if [ "${EXIT}" != "0" -a "$EXITFAILED" = "1" ]
|
||||
then
|
||||
break;
|
||||
exit_err "Error: Failed to download ${FETCHFILE}"
|
||||
fi
|
||||
|
||||
sleep 2
|
||||
done
|
||||
|
||||
echo "FETCHDONE"
|
||||
|
||||
EXIT="`cat ${EXITFILE}`"
|
||||
if [ "${EXIT}" != "0" -a "$EXITFAILED" = "1" ]
|
||||
then
|
||||
exit_err "Error: Failed to download ${FETCHFILE}"
|
||||
fi
|
||||
|
||||
return $EXIT
|
||||
return $EXIT
|
||||
|
||||
};
|
||||
|
||||
|
@ -73,7 +73,7 @@ file_sanity_check "installMode disk0 installType installMedium packageType"
|
||||
check_value installMode "fresh upgrade"
|
||||
check_value bootManager "bsd none"
|
||||
check_value installType "PCBSD FreeBSD"
|
||||
check_value installMedium "dvd usb ftp rsync"
|
||||
check_value installMedium "dvd usb ftp rsync img"
|
||||
check_value packageType "uzip tar rsync split"
|
||||
if_check_value_exists partition "all ALL s1 s2 s3 s4 free FREE"
|
||||
if_check_value_exists mirrorbal "load prefer round-robin split"
|
||||
|
@ -38,8 +38,8 @@
|
||||
# Set this to the program location
|
||||
if [ -z "${PROGDIR}" ]
|
||||
then
|
||||
PROGDIR="/usr/share/pc-sysinstall"
|
||||
export PROGDIR
|
||||
PROGDIR="/usr/share/pc-sysinstall"
|
||||
export PROGDIR
|
||||
fi
|
||||
|
||||
# Set this to the components location
|
||||
@ -89,29 +89,31 @@ fi
|
||||
# Check if we are called without any flags and display help
|
||||
if [ -z "${1}" ]
|
||||
then
|
||||
# Display the help index
|
||||
display_help
|
||||
exit 0
|
||||
# Display the help index
|
||||
display_help
|
||||
exit 0
|
||||
fi
|
||||
|
||||
case $1 in
|
||||
# The -c flag has been given, time to parse the script
|
||||
-c) if [ -z "${2}" ]
|
||||
then
|
||||
display_help
|
||||
else
|
||||
${BACKEND}/parseconfig.sh ${2}
|
||||
exit $?
|
||||
fi
|
||||
-c)
|
||||
if [ -z "${2}" ]
|
||||
then
|
||||
display_help
|
||||
else
|
||||
${BACKEND}/parseconfig.sh ${2}
|
||||
exit $?
|
||||
fi
|
||||
;;
|
||||
|
||||
# The user requsted help
|
||||
help) if [ -z "${2}" ]
|
||||
then
|
||||
display_help
|
||||
else
|
||||
display_command_help ${2}
|
||||
fi
|
||||
help)
|
||||
if [ -z "${2}" ]
|
||||
then
|
||||
display_help
|
||||
else
|
||||
display_command_help ${2}
|
||||
fi
|
||||
;;
|
||||
|
||||
# Parse an auto-install directive, and begin the installation
|
||||
@ -143,7 +145,7 @@ case $1 in
|
||||
;;
|
||||
|
||||
# The user is wanting to query which disks are available
|
||||
disk-list) ${QUERYDIR}/disk-list.sh "${2}"
|
||||
disk-list) ${QUERYDIR}/disk-list.sh $*
|
||||
;;
|
||||
|
||||
# The user is wanting to query a disk's partitions
|
||||
|
Loading…
Reference in New Issue
Block a user