Changeset bf5b6c3


Ignore:
Timestamp:
Aug 20, 2013 2:21:52 PM (8 months ago)
Author:
Ken Moore <ken@…>
Branches:
master, 9.2-release, releng/10.0, releng/10.0.1
Children:
e913299
Parents:
96c5e841 (diff), 3987ce6 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of github.com:pcbsd/pcbsd

Files:
2 added
16 edited

Legend:

Unmodified
Added
Removed
  • src-qt4/pc-installgui/dialogDesktopSelection.ui

    r1620346 r3987ce6  
    5757       <widget class="QLabel" name="label_25"> 
    5858        <property name="text"> 
    59          <string>Please select the software you wish to have installed. At least one desktop must be selected, and changes may be made after installation.</string> 
     59         <string>Please select the software to install. Post-install you may also add / remove software via the Package Manager (desktop) or &quot;pkg&quot; command (server).</string> 
    6060        </property> 
    6161        <property name="wordWrap"> 
  • src-qt4/pc-installgui/wizardDisk.ui

    r0ece806 r3d554ff  
    270270      </property> 
    271271      <property name="text"> 
    272        <string>Please select the disk or partition you wish to install onto. Please note that BSD can only be installed to an entire disk, or primary partition larger than 10GB. </string> 
     272       <string>Please select the disk or partition you wish to install onto. Please note that you must select either an entire disk or a primary partition that is at least 20GB for a server install or 50GB for a desktop install. </string> 
    273273      </property> 
    274274      <property name="wordWrap"> 
  • src-sh/pc-sysinstall/backend/functions-newfs.sh

    r3018894 r8378d50  
    4040  ROOTSLICE="`echo ${PART} | rev | cut -b 2- | rev`" 
    4141  ZPOOLNAME=$(get_zpool_name "${PART}") 
     42  export ZPOOLNAME 
    4243 
    4344  # Sleep a few moments, let the disk catch its breath 
  • src-sh/pc-sysinstall/backend/functions.sh

    reec2eb4 r8378d50  
    556556  echo_log "Upgrade finished!" 
    557557}; 
     558 
     559# We are restoring a ZFS replication 
     560restore_zfs() 
     561{ 
     562  # Lets start setting up the disk slices now 
     563  setup_disk_slice 
     564   
     565  # Disk setup complete, now lets parse WORKINGSLICES and setup the bsdlabels 
     566  setup_disk_label 
     567   
     568  # Now we've setup the bsdlabels, lets go ahead and run newfs / zfs  
     569  # to setup the filesystems 
     570  setup_filesystems 
     571 
     572  # We are ready to begin the restore process 
     573  do_zfs_restore 
     574 
     575  echo_log "Installation finished!" 
     576}; 
  • src-sh/pc-sysinstall/backend/parseconfig.sh

    rfe5d5c8 r8378d50  
    3434. ${BACKEND}/functions-cleanup.sh 
    3535. ${BACKEND}/functions-disk.sh 
     36. ${BACKEND}/functions-ftp.sh 
    3637. ${BACKEND}/functions-extractimage.sh 
    3738. ${BACKEND}/functions-installcomponents.sh 
     
    4445. ${BACKEND}/functions-parse.sh 
    4546. ${BACKEND}/functions-runcommands.sh 
    46 . ${BACKEND}/functions-ftp.sh 
    4747. ${BACKEND}/functions-unmount.sh 
    4848. ${BACKEND}/functions-upgrade.sh 
    4949. ${BACKEND}/functions-users.sh 
     50. ${BACKEND}/functions-zfsrestore.sh 
    5051 
    5152# Check that the config file exists 
     
    6465 
    6566# Start by doing a sanity check, which will catch any obvious mistakes in the config 
    66 file_sanity_check "installMode installType installMedium packageType" 
    6767 
    6868# We passed the Sanity check, lets grab some of the universal config settings and store them 
    69 check_value installMode "fresh upgrade extract" 
    70 check_value installType "PCBSD FreeBSD" 
    71 check_value installMedium "dvd usb ftp rsync image local" 
    72 check_value packageType "uzip tar rsync split dist" 
    73 if_check_value_exists mirrorbal "load prefer round-robin split" 
    74  
    75 # We passed all sanity checks! Yay, lets start the install 
    76 echo "File Sanity Check -> OK" 
     69check_value installMode "fresh upgrade extract zfsrestore" 
    7770 
    7871# Lets load the various universal settings now 
    7972get_value_from_cfg installMode 
    8073export INSTALLMODE="${VAL}" 
     74 
     75if [ "$INSTALLMODE" = "zfsrestore" ] ; then 
     76  file_sanity_check "sshHost sshPort sshUser sshKey zfsRemoteDataset" 
     77else 
     78  file_sanity_check "installMode installType installMedium packageType" 
     79  check_value installType "PCBSD FreeBSD" 
     80  check_value installMedium "dvd usb ftp rsync image local" 
     81  check_value packageType "uzip tar rsync split dist zfs" 
     82  if_check_value_exists mirrorbal "load prefer round-robin split" 
     83fi 
     84 
     85# We passed all sanity checks! Yay, lets start the install 
     86echo "File Sanity Check -> OK" 
    8187 
    8288get_value_from_cfg installType 
     
    106112# If we are not doing an upgrade, lets go ahead and setup the disk 
    107113case "${INSTALLMODE}" in 
     114  zfsrestore) restore_zfs ;; 
    108115  fresh) 
    109116    if [ "${INSTALLMEDIUM}" = "image" ] 
  • src-sh/warden/linux-installs/debian-6-squeeze

    r1620346 r70427a2  
    33# Author: Kris Moore <kris@pcbsd.org> 
    44 
    5 # Jail / chroot dir 
    6 jDIR="$1" 
     5SELF="debian-6-squeeze" 
     6SELFDIR="${JDIR}/.${SELF}" 
     7ERRORFILE="/tmp/.${SELF}.error" 
    78 
    8 # Target jail IP address 
    9 jIP="$2" 
     9get_distfiles() 
     10{ 
     11    rm -f "${ERRORFILE}" 
    1012 
    11 # Jail meta-directory 
    12 jMETA="$3" 
     13    if [ ! -d "${SELFDIR}" ] ; then 
     14      mkdir -p "${SELFDIR}" 
     15    fi 
     16} 
    1317 
    14 if [ ! -e "${jDIR}" ] ; then 
    15   mkdir -p "${jDIR}" 
    16 fi 
     18template_install() 
     19{ 
     20    rm -f "${ERRORFILE}" 
    1721 
    18 debootstrap squeeze ${jDIR} 
    19 err=$? 
     22    local TDIR="${1}" 
     23    if [ -z "${TDIR}" ] ; then  
     24      echo "TDIR is not defined" 
     25      touch "${ERRORFILE}"       
     26      exit 1 
     27    fi 
    2028 
    21 umount -f ${jDIR}/dev/fd >/dev/null 2>/dev/null 
    22 umount -f ${jDIR}/dev >/dev/null 2>/dev/null 
    23 umount -f ${jDIR}/sys >/dev/null 2>/dev/null 
    24 umount -f ${jDIR}/proc >/dev/null 2>/dev/null 
     29    debootstrap squeeze ${TDIR} 
    2530 
    26 # Fix log file 
    27 sed -i '' 's|/dev/xconsole|/var/log/xconsole|g' ${jDIR}/etc/rsyslog.conf 
     31    umount -f ${TDIR}/dev/fd >/dev/null 2>/dev/null 
     32    umount -f ${TDIR}/dev >/dev/null 2>/dev/null 
     33    umount -f ${TDIR}/sys >/dev/null 2>/dev/null 
     34    umount -f ${TDIR}/proc >/dev/null 2>/dev/null 
    2835 
    29 # Get rid of umount 
    30 mv ${jDIR}/sbin/umount ${jDIR}/sbin/umount.prev 
    31 ln -s /bin/true ${jDIR}/sbin/umount 
     36    # Fix log file 
     37    sed -i '' 's|/dev/xconsole|/var/log/xconsole|g' ${TDIR}/etc/rsyslog.conf 
    3238 
    33 # Setup some custom start / stop stuff 
    34 echo "/etc/init.d/rc 3" > ${jMETA}/jail-start 
    35 echo "/etc/init.d/rc 0" > ${jMETA}/jail-stop 
     39    # Get rid of umount 
     40    mv ${TDIR}/sbin/umount ${TDIR}/sbin/umount.prev 
     41    ln -s /bin/true ${TDIR}/sbin/umount 
     42} 
    3643 
    37 exit $err 
     44jail_configure() 
     45{ 
     46    rm -f "${ERRORFILE}" 
     47 
     48    local JMETADIR="${1}" 
     49    if [ -z "${JMETADIR}" ] ; then  
     50      echo "JMETADIR is not defined" 
     51      exit 1 
     52    fi 
     53 
     54    # Setup some custom start / stop stuff 
     55    echo "/etc/init.d/rc 3" > ${JMETADIR}/jail-start 
     56    echo "/etc/init.d/rc 0" > ${JMETADIR}/jail-stop 
     57} 
     58 
     59error() 
     60{ 
     61    if [ -f "${ERRORFILE}" ] ; then 
     62        rm -f "${ERRORFILE}" 
     63        return 1 
     64    fi 
     65 
     66    return 0 
     67} 
     68 
     69main() 
     70{ 
     71    case "${1}" in 
     72      get_distfiles) shift; get_distfiles "$@" ;;  
     73      template_install) shift; template_install "$@" ;; 
     74      jail_configure) shift; jail_configure "$@" ;; 
     75      error) shift; error "$@" ;; 
     76    esac 
     77 
     78    if [ "$?" != "0" ] ; then 
     79      touch "${ERRORFILE}" 
     80    fi 
     81} 
     82 
     83 
     84main "$@" 
  • src-sh/warden/linux-installs/gentoo-stage3-i486

    r1620346 r70427a2  
    33# Author: Kris Moore <kris@pcbsd.org> 
    44 
    5 # Jail / chroot dir 
    6 jDIR="$1" 
    7  
    8 # Target jail IP address 
    9 jIP="$2" 
    10  
    11 # Jail meta-directory 
    12 jMETA="$3" 
    13  
    14  
    15 if [ ! -e "${jDIR}" ] ; then 
    16   mkdir -p "${jDIR}" 
    17 fi 
    18  
     5SELF="gentoo-stage3-i486" 
     6SELFDIR="${JDIR}/.${SELF}" 
    197INDEXFILE="latest-stage3-i486.txt" 
    20 SUBDIR="releases/x86/autobuilds" 
    21 MASTER_SITE="http://ftp.roedu.net/pub/mirrors/gentoo.org/$SUBDIR/\n 
    22 http://distro.ibiblio.org/pub/linux/distributions/gentoo/$SUBDIR/\n 
    23 http://gentoo.mirrors.pair.com/$SUBDIR/\n 
    24 http://gentoo.chem.wisc.edu/gentoo/$SUBDIR/\n 
    25 http://adelie.polymtl.ca/$SUBDIR/\n 
    26 http://mirrors.tds.net/gentoo/$SUBDIR/\n 
    27 ftp://ftp.mirrorservice.org/sites/www.ibiblio.org/gentoo/$SUBDIR/\n 
    28 http://ftp.belnet.be/mirror/rsync.gentoo.org/gentoo/$SUBDIR/\n 
    29 http://ftp.easynet.nl/mirror/gentoo/$SUBDIR/\n 
    30 http://ftp.snt.utwente.nl/pub/os/linux/gentoo/$SUBDIR/\n 
    31 http://trumpetti.atm.tut.fi/gentoo/$SUBDIR/\n 
    32 http://sunsite.cnlab-switch.ch/ftp/mirror/gentoo/$SUBDIR/\n 
    33 http://linux.rz.ruhr-uni-bochum.de/download/gentoo-mirror/$SUBDIR/\n 
    34 http://ftp.uni-erlangen.de/pub/mirrors/gentoo/$SUBDIR/\n 
    35 http://darkstar.ist.utl.pt/gentoo/$SUBDIR/\n 
    36 http://gentoo.inode.at/$SUBDIR/\n 
    37 http://ftp.rhnet.is/pub/gentoo/$SUBDIR/\n 
    38 http://gentoo.mirror.sdv.fr/$SUBDIR/\n 
    39 http://gentoo.gg3.net/$SUBDIR/\n 
    40 http://gentoo.kems.net/$SUBDIR/\n 
    41 ftp://ftp.gtlib.gatech.edu/pub/gentoo/$SUBDIR/\n 
    42 ftp://mirror.iawnet.sandia.gov/pub/gentoo/$SUBDIR/\n 
    43 ftp://ftp.ussg.iu.edu/pub/linux/gentoo/$SUBDIR/\n 
    44 ftp://ftp.ucsb.edu/pub/mirrors/linux/gentoo/$SUBDIR/\n 
    45 ftp://gentoo.mirrors.pair.com/$SUBDIR/\n 
    46 ftp://mirrors.tds.net/gentoo/$SUBDIR/\n 
    47 ftp://ftp.belnet.be/mirror/rsync.gentoo.org/gentoo/$SUBDIR/\n 
    48 ftp://ftp.easynet.nl/mirror/gentoo/$SUBDIR/\n 
    49 ftp://ftp.snt.utwente.nl/pub/os/linux/gentoo/$SUBDIR/\n 
    50 ftp://trumpetti.atm.tut.fi/gentoo/$SUBDIR/\n 
    51 ftp://sunsite.cnlab-switch.ch/mirror/gentoo/$SUBDIR/\n 
    52 ftp://ftp.join.uni-muenster.de/pub/linux/distributions/gentoo/$SUBDIR/\n 
    53 ftp://ftp6.uni-muenster.de/pub/linux/distributions/gentoo/$SUBDIR/\n 
    54 ftp://ftp.tu-clausthal.de/pub/linux/gentoo/$SUBDIR/\n 
    55 ftp://sunsite.informatik.rwth-aachen.de/pub/Linux/gentoo/$SUBDIR/\n 
    56 ftp://linux.rz.ruhr-uni-bochum.de/gentoo-mirror/$SUBDIR/\n 
    57 ftp://ftp.uni-erlangen.de/pub/mirrors/gentoo/$SUBDIR/\n 
    58 ftp://darkstar.ist.utl.pt/pub/gentoo/$SUBDIR/\n 
    59 ftp://gentoo.inode.at/source/$SUBDIR/\n 
    60 ftp://ftp.rhnet.is/pub/gentoo/$SUBDIR/\n 
    61 ftp://files.gentoo.gr/$SUBDIR/\n 
    62 ftp://ftp.ecc.u-tokyo.ac.jp/GENTOO/$SUBDIR/\n 
    63 ftp://gentoo.kems.net/pub/mirrors/gentoo/$SUBDIR/" 
    64  
    65 echo -e $MASTER_SITE | while read url 
    66 do 
    67   echo "Trying to fetch index: ${url}${INDEXFILE}" 
    68   fetch -o ${INDEXFILE} ${url}${INDEXFILE} 
    69   if [ $? -eq 0 ] ; then 
    70      break 
    71   fi 
    72 done 
    73  
    74 ARCHIVEFILE="`cat ${INDEXFILE} | grep 'stage3'`" 
    75 DLFILE="`basename $ARCHIVEFILE`" 
    76 rm ${INDEXFILE} 
    77 if [ -z "$ARCHIVEFILE" ] ; then 
    78    echo "Failed to locate current archive" 
    79    exit 1 
    80 fi 
    81  
    82 echo -e $MASTER_SITE | while read url 
    83 do 
    84   echo "Fetching archive: ${url}${ARCHIVEFILE}" 
    85   fetch -o ${DLFILE} ${url}${ARCHIVEFILE} 
    86   if [ $? -eq 0 ] ; then 
    87      break 
    88   fi 
    89 done 
    90  
    91  
    92 if [ ! -e "${DLFILE}" ] ; then 
    93    echo "Failed to download.." 
    94    exit 1 
    95 fi 
    96  
    97 echo "Extracting Gentoo base...Please wait..." 
    98 tar --exclude=./dev -xpy --exclude=./proc --exclude=./lib/udev --exclude=./lib/udev-state -C ${jDIR} -f ${DLFILE} 
    99 err=$? 
    100 rm ${DLFILE} 
    101 mkdir ${jDIR}/dev >/dev/null 2>/dev/null 
    102 mkdir ${jDIR}/dev/fd >/dev/null 2>/dev/null 
    103 mkdir ${jDIR}/proc >/dev/null 2>/dev/null 
    104 mkdir ${jDIR}/sys >/dev/null 2>/dev/null 
    105  
    106 #@${FIND} ${PREFIX}/${PREFIX_SUBDIR}bin ${PREFIX}/${PREFIX_SUBDIR}sbin/ \ 
    107 #       ${PREFIX}/${PREFIX_SUBDIR}usr/bin ${PREFIX}/${PREFIX_SUBDIR}/usr/sbin \ 
    108 #       -type f -print0 | ${XARGS} -0 ${FILE} \ 
    109 #       | ${GREP} ELF | ${CUT} -d : -f 1 | ${XARGS} ${BRANDELF} -t Linux 
    110 #@${BRANDELF} -t Linux ${PREFIX}/${PREFIX_SUBDIR}/lib/ld-*.so 
    111  
    112 umount -f ${jDIR}/dev/fd >/dev/null 2>/dev/null 
    113 umount -f ${jDIR}/dev >/dev/null 2>/dev/null 
    114 umount -f ${jDIR}/sys >/dev/null 2>/dev/null 
    115 umount -f ${jDIR}/proc >/dev/null 2>/dev/null 
    116  
    117 # Get rid of umount 
    118 mv ${jDIR}/bin/umount ${jDIR}/bin/umount.prev 
    119 ln -s /bin/true ${jDIR}/bin/umount 
    120  
    121 # Setup some custom start / stop stuff 
    122 echo "/sbin/rc default" > ${jMETA}/jail-start 
    123 echo "/sbin/rc shutdown" > ${jMETA}/jail-stop 
    124  
    125 exit $err 
     8ERRORFILE="/tmp/.${SELF}.error" 
     9 
     10get_gentoo_mirrors() 
     11{ 
     12    local SUBDIR="releases/x86/autobuilds" 
     13 
     14    cat<<__EOF__ 
     15    http://ftp.roedu.net/pub/mirrors/gentoo.org/$SUBDIR/ 
     16    http://distro.ibiblio.org/pub/linux/distributions/gentoo/$SUBDIR/ 
     17    http://gentoo.mirrors.pair.com/$SUBDIR/ 
     18    http://gentoo.chem.wisc.edu/gentoo/$SUBDIR/ 
     19    http://adelie.polymtl.ca/$SUBDIR/ 
     20    http://mirrors.tds.net/gentoo/$SUBDIR/ 
     21    ftp://ftp.mirrorservice.org/sites/www.ibiblio.org/gentoo/$SUBDIR/ 
     22    http://ftp.belnet.be/mirror/rsync.gentoo.org/gentoo/$SUBDIR/ 
     23    http://ftp.easynet.nl/mirror/gentoo/$SUBDIR/ 
     24    http://ftp.snt.utwente.nl/pub/os/linux/gentoo/$SUBDIR/ 
     25    http://trumpetti.atm.tut.fi/gentoo/$SUBDIR/ 
     26    http://sunsite.cnlab-switch.ch/ftp/mirror/gentoo/$SUBDIR/ 
     27    http://linux.rz.ruhr-uni-bochum.de/download/gentoo-mirror/$SUBDIR/ 
     28    http://ftp.uni-erlangen.de/pub/mirrors/gentoo/$SUBDIR/ 
     29    http://darkstar.ist.utl.pt/gentoo/$SUBDIR/ 
     30    http://gentoo.inode.at/$SUBDIR/ 
     31    http://ftp.rhnet.is/pub/gentoo/$SUBDIR/ 
     32    http://gentoo.mirror.sdv.fr/$SUBDIR/ 
     33    http://gentoo.gg3.net/$SUBDIR/ 
     34    http://gentoo.kems.net/$SUBDIR/ 
     35    ftp://ftp.gtlib.gatech.edu/pub/gentoo/$SUBDIR/ 
     36    ftp://mirror.iawnet.sandia.gov/pub/gentoo/$SUBDIR/ 
     37    ftp://ftp.ussg.iu.edu/pub/linux/gentoo/$SUBDIR/ 
     38    ftp://ftp.ucsb.edu/pub/mirrors/linux/gentoo/$SUBDIR/ 
     39    ftp://gentoo.mirrors.pair.com/$SUBDIR/ 
     40    ftp://mirrors.tds.net/gentoo/$SUBDIR/ 
     41    ftp://ftp.belnet.be/mirror/rsync.gentoo.org/gentoo/$SUBDIR/ 
     42    ftp://ftp.easynet.nl/mirror/gentoo/$SUBDIR/ 
     43    ftp://ftp.snt.utwente.nl/pub/os/linux/gentoo/$SUBDIR/ 
     44    ftp://trumpetti.atm.tut.fi/gentoo/$SUBDIR/ 
     45    ftp://sunsite.cnlab-switch.ch/mirror/gentoo/$SUBDIR/ 
     46    ftp://ftp.join.uni-muenster.de/pub/linux/distributions/gentoo/$SUBDIR/ 
     47    ftp://ftp6.uni-muenster.de/pub/linux/distributions/gentoo/$SUBDIR/ 
     48    ftp://ftp.tu-clausthal.de/pub/linux/gentoo/$SUBDIR/ 
     49    ftp://sunsite.informatik.rwth-aachen.de/pub/Linux/gentoo/$SUBDIR/ 
     50    ftp://linux.rz.ruhr-uni-bochum.de/gentoo-mirror/$SUBDIR/ 
     51    ftp://ftp.uni-erlangen.de/pub/mirrors/gentoo/$SUBDIR/ 
     52    ftp://darkstar.ist.utl.pt/pub/gentoo/$SUBDIR/ 
     53    ftp://gentoo.inode.at/source/$SUBDIR/ 
     54    ftp://ftp.rhnet.is/pub/gentoo/$SUBDIR/ 
     55    ftp://files.gentoo.gr/$SUBDIR/ 
     56    ftp://ftp.ecc.u-tokyo.ac.jp/GENTOO/$SUBDIR/ 
     57    ftp://gentoo.kems.net/pub/mirrors/gentoo/$SUBDIR/ 
     58__EOF__ 
     59} 
     60 
     61get_gentoo_mirror_list() 
     62{ 
     63   local file="${1}" 
     64   local gentoo_mirrors="$(get_gentoo_mirrors)" 
     65 
     66   local mirrors= 
     67   for m in ${gentoo_mirrors} 
     68   do 
     69       mirrors="${mirrors} ${m}/${1}" 
     70   done 
     71 
     72   echo "${mirrors}" 
     73} 
     74 
     75get_linux_file() 
     76{ 
     77   local _rf="${1}" 
     78   local _lf="${2}" 
     79 
     80   local aDir="$(dirname $_lf)" 
     81   local aFile="$(basename $_lf)" 
     82 
     83   local astatfile="${HOME}/.${SELF}-aria-stat-i386" 
     84   if [ -e "${astatfile}" ] ; then 
     85     local astat="--server-stat-of=${astatfile} 
     86        --server-stat-if=${astatfile} 
     87        --uri-selector=adaptive 
     88        --server-stat-timeout=864000" 
     89   else 
     90     local astat=" --server-stat-of=${astatfile} --uri-selector=adaptive " 
     91   fi 
     92   touch $astatfile 
     93 
     94   local mirrors="$(get_gentoo_mirror_list ${1})" 
     95 
     96   aria2c -k 5M \ 
     97      ${astat} \ 
     98      --check-certificate=false \ 
     99      --file-allocation=none \ 
     100      -d ${aDir} \ 
     101      -o ${aFile} \ 
     102      ${mirrors} 
     103 
     104   return $? 
     105} 
     106 
     107get_dlfile_name() 
     108{ 
     109    local archivefile="`cat ${SELFDIR}/${INDEXFILE} | grep 'stage3'`" 
     110    local dlfile="`basename ${archivefile}`" 
     111 
     112    echo "${dlfile}" 
     113} 
     114 
     115get_distfiles() 
     116{ 
     117    rm -f "${ERRORFILE}" 
     118 
     119    if [ ! -d "${SELFDIR}" ] ; then 
     120      mkdir -p "${SELFDIR}" 
     121    fi 
     122 
     123    if [ ! -f "${SELFDIR}/${INDEXFILE}" ] ; then 
     124      echo "Trying to fetch index: ${INDEXFILE}" 
     125      get_linux_file "${INDEXFILE}" "${SELFDIR}/${INDEXFILE}" 
     126    fi 
     127 
     128    local archivefile="`cat ${SELFDIR}/${INDEXFILE} | grep 'stage3'`" 
     129    local dlfile="`basename ${archivefile}`" 
     130 
     131    if [ -z "${archivefile}" ] ; then 
     132      echo "Failed to locate current archive" 
     133      touch "${ERRORFILE}"       
     134      exit 1 
     135    fi 
     136 
     137    if [ ! -f "${SELFDIR}/${dlfile}" ] ; then 
     138      echo "Fetching archive: ${archivefile}" 
     139      get_linux_file "${archivefile}" "${SELFDIR}/${dlfile}" 
     140    fi 
     141 
     142    if [ ! -e "${SELFDIR}/${dlfile}" ] ; then 
     143      echo "Failed to download.." 
     144      touch "${ERRORFILE}"       
     145      exit 1 
     146    fi 
     147} 
     148 
     149template_install() 
     150{ 
     151    rm -f "${ERRORFILE}" 
     152 
     153    local TDIR="${1}" 
     154    if [ -z "${TDIR}" ] ; then  
     155      echo "TDIR is not defined" 
     156      exit 1 
     157    fi 
     158 
     159    get_distfiles "$@" 
     160 
     161    local dlfile="$(get_dlfile_name)" 
     162    if [ -z "${dlfile}" ] ; then  
     163      touch "${ERRORFILE}"       
     164      exit 1 
     165    fi 
     166 
     167    echo "Extracting Gentoo base...Please wait..." 
     168    tar --exclude=./dev -xpy --exclude=./proc --exclude=./lib/udev \ 
     169        --exclude=./lib/udev-state -C ${TDIR} -f "${SELFDIR}/${dlfile}" 
     170    err=$? 
     171 
     172    mkdir ${TDIR}/dev >/dev/null 2>/dev/null 
     173    mkdir ${TDIR}/dev/fd >/dev/null 2>/dev/null 
     174    mkdir ${TDIR}/proc >/dev/null 2>/dev/null 
     175    mkdir ${TDIR}/sys >/dev/null 2>/dev/null 
     176 
     177    umount -f ${TDIR}/dev/fd >/dev/null 2>/dev/null 
     178    umount -f ${TDIR}/dev >/dev/null 2>/dev/null 
     179    umount -f ${TDIR}/sys >/dev/null 2>/dev/null 
     180    umount -f ${TDIR}/proc >/dev/null 2>/dev/null 
     181 
     182    # Get rid of umount 
     183    mv ${TDIR}/bin/umount ${TDIR}/bin/umount.prev 
     184    ln -s /bin/true ${TDIR}/bin/umount 
     185 
     186    return $err 
     187} 
     188 
     189jail_configure() 
     190{ 
     191    rm -f "${ERRORFILE}" 
     192 
     193    local JMETADIR="${1}" 
     194    if [ -z "${JMETADIR}" ] ; then  
     195      echo "JMETADIR is not defined" 
     196      touch "${ERRORFILE}"       
     197      exit 1 
     198    fi 
     199 
     200    # Setup some custom start / stop stuff 
     201    echo "/sbin/rc default" > ${JMETADIR}/jail-start 
     202    echo "/sbin/rc shutdown" > ${JMETADIR}/jail-stop 
     203} 
     204 
     205error() 
     206{ 
     207    if [ -f "${ERRORFILE}" ] ; then 
     208        rm "${ERRORFILE}" 
     209        return 1 
     210    fi 
     211 
     212    return 0 
     213} 
     214 
     215main() 
     216{ 
     217    case "${1}" in 
     218      get_distfiles) shift; get_distfiles "$@" ;;  
     219      template_install) shift; template_install "$@" ;; 
     220      jail_configure) shift; jail_configure "$@" ;; 
     221      error) shift; error "$@" ;; 
     222    esac 
     223 
     224    if [ "$?" != "0" ] ; then 
     225      touch "${ERRORFILE}" 
     226    fi 
     227} 
     228 
     229 
     230main "$@" 
  • src-qt4/life-preserver/LPBackend.cpp

    r2a5e337 r96c5e841  
    2020  } 
    2121  list.removeDuplicates(); 
     22    
    2223  return list;   
    2324} 
     
    3839    if(!ds.isEmpty()){ list << ds; } 
    3940  } 
     41    
    4042  return list; 
    4143} 
     
    6163  } 
    6264  list.removeDuplicates();       
     65    
    6366  return list; 
    6467} 
     
    9194    } 
    9295  } 
     96    
    9397  return list;   
    9498} 
     
    111115    } 
    112116  } 
     117    
    113118  return list;           
    114119} 
     
    127132  for(int i=2; i<out.length(); i++){ //first 2 lines are headers 
    128133    //Format: <dataset>:::<lastsnapshot | NONE>:::<lastreplication | NONE> 
     134    if(out[i].isEmpty()){ continue; } 
    129135    QString ds  = out[i].section(" - ",0,0).simplified(); 
    130136    QString snap = out[i].section(" - ",1,1).simplified(); 
     
    134140    list << ds +":::"+ snap+":::"+rep; 
    135141  } 
     142    
    136143  return list; 
    137144} 
     
    152159  QString cmd = "lpreserver cronsnap "+dataset+" start "+freq+" "+QString::number(numToKeep); 
    153160  int ret = system(cmd.toUtf8()); 
     161    
    154162  return (ret == 0); 
    155163} 
     
    158166  QString cmd = "lpreserver cronsnap "+dataset+" stop"; 
    159167  int ret = system(cmd.toUtf8());        
     168    
    160169  return (ret == 0); 
    161170} 
     
    188197  } 
    189198  //qDebug() << "lpreserver cronsnap:\n" << out << QString::number(time) << QString::number(numToKeep); 
     199    
    190200  return ok; 
    191201} 
     
    197207  QString cmd = "lpreserver mksnap "+dataset; 
    198208  int ret = system(cmd.toUtf8()); 
     209    
    199210  return (ret == 0); 
    200211} 
     
    203214  QString cmd = "lpreserver rmsnap "+dataset +" "+snapshot; 
    204215  int ret = system(cmd.toUtf8());        
     216    
    205217  return (ret == 0); 
    206218} 
     
    209221  QString cmd = "lpreserver revertsnap "+dataset +" "+snapshot; 
    210222  int ret  = system(cmd.toUtf8()); 
     223    
    211224  return (ret == 0); 
    212225} 
     
    268281  QString cmd = "lpreserver replicate add "+remotehost+" "+user+" "+ QString::number(port)+" "+dataset+" "+remotedataset+" "+stime; 
    269282  int ret = system(cmd.toUtf8()); 
     283   
    270284  return (ret == 0); 
    271285} 
     
    274288  QString cmd = "lpreserver replicate remove "+dataset; 
    275289  int ret = system(cmd.toUtf8());        
     290    
    276291  return (ret == 0); 
    277292} 
     
    302317    } 
    303318  }        
     319    
    304320  return ok; 
    305321} 
     322 
     323// ====================== 
     324//          SSH Key Management 
     325// ====================== 
     326bool LPBackend::setupSSHKey(QString remoteHost, QString remoteUser, int remotePort){ 
     327  QString LPPATH = "/usr/local/share/lifePreserver"; 
     328  QString cmd = "xterm -e \""+LPPATH+"/scripts/setup-ssh-keys.sh "+remoteUser+" "+remoteHost+" "+QString::number(remotePort)+"\""; 
     329  int ret = system(cmd.toUtf8()); 
     330  return (ret == 0); 
     331} 
     332 
     333QStringList LPBackend::findValidUSBDevices(){ 
     334  //Return format: "<mountpoint> (<device node>") 
     335  QString cmd = "mount"; 
     336  //Need output, so run this in a QProcess 
     337  QProcess *proc = new QProcess; 
     338  proc->setProcessChannelMode(QProcess::MergedChannels); 
     339  proc->start(cmd); 
     340  proc->waitForFinished(); 
     341  QStringList out = QString(proc->readAllStandardOutput()).split("\n");  
     342  delete proc; 
     343  //Now process the output 
     344  QStringList list; 
     345  for(int i=0; i<out.length(); i++){ 
     346    if(out[i].startsWith("/dev/da") && out[i].contains("(msdosfs,local)")){ 
     347      QString mountpoint = out[i].section(" on ",1,1).section("(",0,0).simplified(); 
     348      QString devnode = out[i].section(" on ",0,0).section("/",-1).simplified(); 
     349      list << mountpoint +" ("+devnode+")"; 
     350    } 
     351  } 
     352  return list; 
     353} 
     354 
     355bool LPBackend::copySSHKey(QString mountPath, QString localHost){ 
     356  QString publicKey = "/root/.ssh/id_rsa.pub"; 
     357  //copy the file onto the designated USB stick 
     358  if(!mountPath.endsWith("/")){ mountPath.append("/"); } 
     359  mountPath.append("root/.ssh/"+localHost+"-id_rsa.pub"); 
     360  bool ok = QFile::copy(publicKey, mountPath); 
     361  return ok; 
     362} 
  • src-qt4/life-preserver/LPBackend.h

    r2a5e337 r96c5e841  
    3333        static bool removeReplication(QString dataset); 
    3434        static bool replicationInfo(QString dataset, QString& remotehost, QString& user, int& port, QString& remotedataset, int& time); 
    35  
     35        //SSH Key Management 
     36        static bool setupSSHKey(QString remoteHost, QString remoteUser, int remotePort); 
     37        static QStringList findValidUSBDevices(); 
     38        static bool copySSHKey(QString mountPath, QString localHost); 
    3639}; 
    3740#endif 
  • src-qt4/life-preserver/LPConfig.ui

    r2a5e337 r96c5e841  
    77    <x>0</x> 
    88    <y>0</y> 
    9     <width>400</width> 
    10     <height>315</height> 
     9    <width>374</width> 
     10    <height>327</height> 
    1111   </rect> 
    1212  </property> 
     
    176176         </property> 
    177177         <layout class="QGridLayout" name="gridLayout_5"> 
    178           <item row="0" column="0"> 
    179            <layout class="QHBoxLayout" name="horizontalLayout_8"> 
    180             <item> 
    181              <widget class="QLabel" name="label_9"> 
    182               <property name="text"> 
    183                <string>Host Name</string> 
    184               </property> 
    185              </widget> 
    186             </item> 
    187             <item> 
    188              <widget class="QLineEdit" name="lineHostName"/> 
    189             </item> 
    190            </layout> 
    191           </item> 
    192           <item row="1" column="0"> 
    193            <layout class="QHBoxLayout" name="horizontalLayout_7"> 
    194             <item> 
    195              <widget class="QLabel" name="label_10"> 
    196               <property name="text"> 
    197                <string>User Name</string> 
    198               </property> 
    199              </widget> 
    200             </item> 
    201             <item> 
    202              <widget class="QLineEdit" name="lineUserName"/> 
    203             </item> 
    204            </layout> 
    205           </item> 
    206178          <item row="2" column="0"> 
    207179           <layout class="QHBoxLayout" name="horizontalLayout_4"> 
     
    271243            <item> 
    272244             <widget class="QLineEdit" name="lineRemoteDataset"/> 
     245            </item> 
     246           </layout> 
     247          </item> 
     248          <item row="1" column="0"> 
     249           <layout class="QHBoxLayout" name="horizontalLayout_7"> 
     250            <item> 
     251             <widget class="QLabel" name="label_10"> 
     252              <property name="text"> 
     253               <string>User Name</string> 
     254              </property> 
     255             </widget> 
     256            </item> 
     257            <item> 
     258             <widget class="QLineEdit" name="lineUserName"/> 
     259            </item> 
     260           </layout> 
     261          </item> 
     262          <item row="0" column="0"> 
     263           <layout class="QHBoxLayout" name="horizontalLayout_8"> 
     264            <item> 
     265             <widget class="QLabel" name="label_9"> 
     266              <property name="text"> 
     267               <string>Host Name</string> 
     268              </property> 
     269             </widget> 
     270            </item> 
     271            <item> 
     272             <widget class="QLineEdit" name="lineHostName"/> 
    273273            </item> 
    274274           </layout> 
     
    324324           </widget> 
    325325          </item> 
     326          <item row="5" column="0"> 
     327           <spacer name="verticalSpacer"> 
     328            <property name="orientation"> 
     329             <enum>Qt::Vertical</enum> 
     330            </property> 
     331            <property name="sizeHint" stdset="0"> 
     332             <size> 
     333              <width>20</width> 
     334              <height>40</height> 
     335             </size> 
     336            </property> 
     337           </spacer> 
     338          </item> 
    326339         </layout> 
    327340        </widget> 
  • src-qt4/life-preserver/LPTray.cpp

    r2a5e337 r96c5e841  
    106106  } 
    107107  if(GUI->isVisible()){ 
    108     GUI->updateDisplay(); 
     108    GUI->setupUI(); 
    109109  } 
    110110} 
  • src-qt4/life-preserver/lPreserve.qrc

    r2a5e337 r96c5e841  
    11<RCC> 
    2   <qresource prefix="" > 
     2  <qresource> 
     3    <file>images/upload.png</file> 
     4    <file>images/key.png</file> 
    35    <file>images/lifepreserver.png</file> 
    46    <file>images/backup-ok.png</file> 
  • src-qt4/life-preserver/life-preserver.pro

    r2a5e337 r96c5e841  
    2828target.path=/usr/local/bin 
    2929 
     30scripts.path=/usr/local/share/lifePreserver/scripts 
     31scripts.files=scripts/setup-ssh-keys.sh 
     32 
    3033images.path=/usr/local/share/lifePreserver/images/ 
    3134images.files=images/lifepreserver.png 
     
    4043dotrans.extra=cd i18n && lrelease-qt4 -nounfinished *.ts && cp *.qm /usr/local/share/lifePreserver/i18n/ 
    4144 
    42 INSTALLS += target dotrans images 
     45INSTALLS += target dotrans images scripts 
    4346 
    4447TRANSLATIONS =  i18n/LifePreserver_af.ts \ 
  • src-qt4/life-preserver/mainUI.cpp

    r2a5e337 r96c5e841  
    1515  connect(brMenu,SIGNAL(triggered(QAction*)),this,SLOT(slotBrowseSnapshot(QAction*)) ); 
    1616  connect(addMenu, SIGNAL(triggered(QAction*)),this,SLOT(slotAddDataset(QAction*)) ); 
     17  //Setup the Key menu items (static items, never changed) 
     18  keyMenu = new QMenu(); 
     19    keyMenu->addAction(ui->actionKeyNew); //action from designer 
     20    keyMenu->addAction(ui->actionKeyCopy); //action from designer 
     21  ui->tool_keys->setMenu(keyMenu); 
     22  //Setup the update frequency limiter 
     23  freqTimer = new QTimer(); 
     24        freqTimer->setSingleShot(true); 
     25        freqTimer->setInterval(15000); 
     26        connect(freqTimer, SIGNAL(timeout()), this, SLOT(setupUI()) ); 
    1727} 
    1828 
     
    2232 
    2333void mainUI::setupUI(){ 
    24   qDebug() << "Setting up Life Preserver UI..."; 
    25   //Initialize the Hash 
    26   updateHash(); 
     34  //Initialize the Hash (make sure it is not run too frequently - causes kernel panics) 
     35  if(lastUpdate.isNull() || lastUpdate.addSecs(15) < QTime::currentTime() ){ 
     36    lastUpdate = QTime::currentTime();     
     37    qDebug() << "Updating the database"; 
     38    updateHash(); 
     39  }else{ 
     40    freqTimer->start(); 
     41  } 
    2742  //Update the display 
    28   updateUI(); 
    29   updateMenus(); 
    30 } 
    31  
    32 void mainUI::updateDisplay(){ 
    33   //Public function for the tray to be able to request that the UI update  
    34   // (In case there is a status message that goes by which changes things) 
    35   updateHash(); 
    3643  updateUI(); 
    3744  updateMenus(); 
     
    6572  } 
    6673  if(CLIST.isEmpty()){ ci = -1; } //catch for empty list 
    67    
    68   if(subsets.isEmpty()){ 
     74  if(DSC.subsetHash.size() < 1){ 
    6975    DSC.numberOfSnapshots = "0"; 
    7076    DSC.latestSnapshot= ""; 
     
    7379    DSC.numberOfSnapshots = QString::number(fSnap.length()); 
    7480    if(fSnap.isEmpty()){ DSC.latestSnapshot=""; } 
    75     else if(ci > -1){  
     81    else if(ci > -1 && ci < CLIST.length()){  
    7682      QString sna = CLIST[ci].section(":::",1,1); 
    7783      if(sna != "-"){ DSC.latestSnapshot= sna; } 
     
    95101// ================= 
    96102void mainUI::updateHash(QString ds){ 
     103  //qDebug() << "Get replication targets"; 
    97104  RLIST = LPBackend::listReplicationTargets(); //update list of replication datasets 
     105  //qDebug() << "Get possible datasets"; 
    98106  SLIST = LPBackend::listPossibleDatasets(); 
     107  //qDebug() << "List current status"; 
    99108  CLIST = LPBackend::listCurrentStatus(); 
     109  //qDebug() << "Check hash"; 
    100110  if(HLIST.contains(ds) && !ds.isEmpty()){ 
    101111    //only update the entry for the given dataset 
     
    103113  }else{ 
    104114    //Clear and fill the hash 
     115    //qDebug() << "Clear hash"; 
    105116    HLIST.clear(); 
     117    //qDebug() << "List datasets"; 
    106118    QStringList dsList = LPBackend::listDatasets(); 
    107119    for(int i=0; i<dsList.length(); i++){ 
     
    109121    } 
    110122  } 
    111  
     123  //qDebug() << "Done with Hash Update"; 
    112124} 
    113125 
     
    146158    ui->tool_remove->setVisible(false); 
    147159    ui->tool_config->setVisible(false); 
     160 
    148161  }else{ 
    149162    ui->tool_remove->setVisible(true); 
    150163    ui->tool_config->setVisible(true);     
     164  } 
     165  //Enabled/disable the SSH key management 
     166  if(RLIST.contains(ds) && !ds.isEmpty()){ 
     167    ui->tool_keys->setVisible(true); 
     168  }else{ 
     169    ui->tool_keys->setVisible(false); 
    151170  } 
    152171  //check for a valid ds/snapshot combination 
     
    225244  //Now update the UI if appropriate 
    226245  if(change){ 
    227     updateHash(ds); 
    228     updateUI(); 
    229     updateMenus(); 
     246    setupUI(); 
    230247  } 
    231248} 
     
    251268    } 
    252269  } 
    253   updateHash(); 
    254   updateUI(); 
    255   updateMenus(); 
     270  setupUI(); 
    256271} 
    257272 
     
    331346  } 
    332347  //Now update the UI/Hash 
    333   updateHash(); 
    334   updateUI(); 
    335   updateMenus(); 
     348  setupUI(); 
    336349} 
    337350 
     
    339352  this->close(); 
    340353} 
     354 
     355void mainUI::on_actionKeyNew_triggered(){ 
     356  QString ds = getSelectedDS(); 
     357  qDebug() << "New SSH Key triggered for DS:" << ds; 
     358  //Get the remote values for this dataset 
     359  QString remoteHost, user, remotedataset; 
     360  int port, time; 
     361  bool ok = LPBackend::replicationInfo(ds, remoteHost, user, port, remotedataset,  time); 
     362  if(ok){ 
     363    if( !LPBackend::setupSSHKey(remoteHost, user, port) ){ 
     364      QMessageBox::warning(this,tr("Failure"), tr("There was an error while creating the SSH key.")); 
     365    }else{ 
     366      QMessageBox::information(this,tr("Success"), tr("The SSH key was successfully generated.")); 
     367    } 
     368  }else{ 
     369    QMessageBox::warning(this,tr("Failure"), tr("There was an error in retrieving the remote replication information for this dataset. Please ensure that replication is enabled and try agin.") ); 
     370  } 
     371} 
     372 
     373void mainUI::on_actionKeyCopy_triggered(){ 
     374  QString ds = getSelectedDS();  
     375  qDebug() << "Copy SSH Key triggered for DS:" << ds; 
     376  //Get the local hostname 
     377  char host[1023] = "\0"; 
     378  gethostname(host,1023); 
     379  QString localHost = QString(host).simplified(); 
     380  qDebug() << " - hostname:" << localHost; 
     381  //Scan for mounted USB devices 
     382  QStringList devs = LPBackend::findValidUSBDevices(); 
     383  qDebug() << " - devs:" << devs; 
     384  if(devs.isEmpty()){ 
     385    QMessageBox::warning(this,tr("No Valid USB Devices"), tr("No valid USB devices could be found. Please mount a FAT32 formatted USB stick and try again.")); 
     386    return; 
     387  } 
     388  //Ask the user which one to save the file to 
     389  bool ok; 
     390  QString dev = QInputDialog::getItem(this, tr("Select USB Device"), tr("Available USB Devices:"), devs,0,false,&ok);    
     391  if(!ok or dev.isEmpty()){ return; } //cancelled 
     392  QString devPath = dev.section("(",0,0).simplified(); 
     393  //Now copy the file over 
     394  ok = LPBackend::copySSHKey(devPath, localHost); 
     395  if(ok){ 
     396    QMessageBox::information(this,tr("Success"), tr("The public SSH key file was successfully copied onto the USB device.")); 
     397  }else{ 
     398    QMessageBox::information(this,tr("Failure"), tr("The public SSH key file could not be copied onto the USB device.")); 
     399  } 
     400} 
     401 
    341402 
    342403// ============= 
  • src-qt4/life-preserver/mainUI.h

    r2a5e337 r96c5e841  
    1111#include <QCloseEvent> 
    1212#include <QFileDialog> 
     13#include <QInputDialog> 
     14#include <QTime> 
     15#include <QTimer> 
    1316 
    1417#include "LPBackend.h" 
     
    2932        explicit mainUI(QWidget* parent = 0); 
    3033        ~mainUI(); 
    31         void setupUI(); 
    3234 
    33         void updateDisplay(); //for the tray to call it as necessary 
     35 
     36public slots: 
     37        void setupUI(); //for the tray to call it as necessary 
    3438 
    3539private: 
     
    3943        QStringList SLIST; //available datasets on the system 
    4044        QStringList CLIST; //current status for all datasets 
    41         QMenu *revMenu, *brMenu, *addMenu; //revert/browse menu's 
     45        QMenu *revMenu, *brMenu, *addMenu, *keyMenu; //button menu's 
     46        QTime lastUpdate; 
     47        QTimer *freqTimer; 
    4248 
    4349        void updateHash(QString ds=""); 
     
    5763 
    5864        void on_actionClose_triggered(); 
     65        void on_actionKeyNew_triggered(); 
     66        void on_actionKeyCopy_triggered(); 
    5967 
    6068protected: 
  • src-qt4/life-preserver/mainUI.ui

    r2a5e337 r96c5e841  
    114114       </item> 
    115115       <item> 
     116        <widget class="QToolButton" name="tool_keys"> 
     117         <property name="statusTip"> 
     118          <string>Manage SSH keys for replication authentication</string> 
     119         </property> 
     120         <property name="text"> 
     121          <string>Key Setup</string> 
     122         </property> 
     123         <property name="icon"> 
     124          <iconset resource="lPreserve.qrc"> 
     125           <normaloff>:/images/key.png</normaloff>:/images/key.png</iconset> 
     126         </property> 
     127         <property name="popupMode"> 
     128          <enum>QToolButton::InstantPopup</enum> 
     129         </property> 
     130        </widget> 
     131       </item> 
     132       <item> 
    116133        <spacer name="horizontalSpacer_2"> 
    117134         <property name="orientation"> 
     
    192209   </property> 
    193210  </action> 
     211  <action name="actionKeyCopy"> 
     212   <property name="icon"> 
     213    <iconset resource="lPreserve.qrc"> 
     214     <normaloff>:/images/upload.png</normaloff>:/images/upload.png</iconset> 
     215   </property> 
     216   <property name="text"> 
     217    <string>Copy To USB Stick</string> 
     218   </property> 
     219  </action> 
     220  <action name="actionKeyNew"> 
     221   <property name="icon"> 
     222    <iconset resource="lPreserve.qrc"> 
     223     <normaloff>:/images/list-add.png</normaloff>:/images/list-add.png</iconset> 
     224   </property> 
     225   <property name="text"> 
     226    <string>Generate SSH Key</string> 
     227   </property> 
     228  </action> 
    194229 </widget> 
    195230 <resources> 
Note: See TracChangeset for help on using the changeset viewer.