Changeset ff5a5e4


Ignore:
Timestamp:
02/25/14 11:37:34 (6 months ago)
Author:
Ken Moore <ken@…>
Branches:
master, releng/10.0.1, releng/10.0.2, releng/10.0.3
Children:
32be23f
Parents:
9cbf5aa (diff), 9cd0fa0 (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:
10 edited

Legend:

Unmodified
Added
Removed
  • src-sh/lpreserver/backend/functions.sh

    r44bdd65 r9cd0fa0  
    113113       30min) cLine="0,30    *       *       *       *" ;; 
    114114       10min) cLine="*/10    *       *       *       *" ;; 
    115         5min) cLine="*/5     *       *       *       *" ;; 
    116           *) exit_err "Invalid time specified" ;;  
     115   5min|auto) cLine="*/5     *       *       *       *" ;; 
     116           *) exit_err "Invalid time specified" ;; 
    117117   esac  
    118118 
  • src-sh/lpreserver/backend/runsnap.sh

    rc0e6494 r9cd0fa0  
    1010. ${PROGDIR}/backend/functions.sh 
    1111 
     12do_auto_prune() { 
     13  echo_log "Pruning old snapshot: $2" 
     14  rmZFSSnap "$1" "$2" 
     15  if [ $? -ne 0 ] ; then 
     16     echo_log "ERROR: Failed pruning snapshot $2 on ${1}" 
     17     queue_msg "ERROR: Failed pruning snapshot $2 on ${1} @ `date`\n\r`cat $CMDLOG`" 
     18     snapStat=1 
     19  else 
     20     queue_msg "Success pruning snapshot $2 on ${1} @ `date`\n\r`cat $CMDLOG`" 
     21  fi 
     22} 
     23 
     24do_numeric_prune() 
     25{ 
     26 
     27  # Get our list of snaps 
     28  snaps=$(snaplist "${DATASET}") 
     29 
     30  # Reverse the list 
     31  for tmp in $snaps 
     32  do 
     33     rSnaps="$tmp $rSnaps" 
     34  done 
     35 
     36  # Do any pruning 
     37  num=0 
     38  for snap in $rSnaps 
     39  do 
     40     # Only remove snapshots which are auto-created, so we don't delete one the user 
     41     # made specifically 
     42     cur="`echo $snap | cut -d '-' -f 1`" 
     43     if [ "$cur" != "auto" ] ; then continue; fi 
     44 
     45     num=`expr $num + 1` 
     46     if [ $num -gt $KEEP ] ; then 
     47        do_auto_prune "$DATASET" "$snap" 
     48     fi 
     49  done 
     50} 
     51 
     52# Function to do automatic rotation / pruning 
     53do_automatic_prune() 
     54{ 
     55  curEpoc=`date +%s` 
     56  lastYear=""; lastMon=""; lastDay=""; lastHour="" lastMin="" ; lastSec="" 
     57  # Get our list of snaps 
     58  snaps=$(snaplist "${DATASET}") 
     59 
     60  # Reverse the list, sort from newest to oldest 
     61  for tmp in $snaps 
     62  do 
     63     rSnaps="$tmp $rSnaps" 
     64  done 
     65 
     66  num=0 
     67  for snap in $rSnaps 
     68  do 
     69     # Skip snaps not created by life-preserver 
     70     cur="`echo $snap | cut -d '-' -f 1`" 
     71     if [ "$cur" != "auto" ] ; then continue; fi 
     72 
     73     sec="`echo $snap | cut -d '-' -f 7`" 
     74     min="`echo $snap | cut -d '-' -f 6`" 
     75     hour="`echo $snap | cut -d '-' -f 5`" 
     76     day="`echo $snap | cut -d '-' -f 4`" 
     77     mon="`echo $snap | cut -d '-' -f 3`" 
     78     year="`echo $snap | cut -d '-' -f 2`" 
     79 
     80     # Convert this snap to epoc time 
     81     snapEpoc=`date -j -f "%Y %m %d %H %M %S" "$year $mon $day $hour $min $sec" "+%s"` 
     82 
     83     # Get the epoch time elapsed 
     84     check=`expr $curEpoc - $snapEpoc` 
     85     pruned=0 
     86 
     87     # Looking for snaps older than 12 months 
     88     if [ $check -gt 31536000 ]; then 
     89        do_auto_prune "$DATASET" "$snap" 
     90        pruned=1 
     91     fi 
     92 
     93     # Looking for multiple snaps older than 30 days 
     94     if [ $check -gt 2592000 -a $pruned -eq 0 ]; then 
     95        # Did we already have a snapshot from this month? 
     96        if [ "$year" = "$lastYear" -a "$mon" = "$lastMon" ] ; then 
     97          do_auto_prune "$DATASET" "$snap" 
     98          pruned=1 
     99        fi 
     100     fi 
     101 
     102     # Looking for multiple snaps older than a day 
     103     if [ $check -gt 86400 -a $pruned -eq 0 ]; then 
     104        if [ "$year" = "$lastYear" -a "$mon" = "$lastMon" -a "$day" = "$lastDay" ] ; then 
     105          do_auto_prune "$DATASET" "$snap" 
     106          pruned=1 
     107        fi 
     108     fi 
     109 
     110     # Looking for multiple snaps older than an hour 
     111     if [ $check -gt 3600 -a $pruned -eq 0 ]; then 
     112        if [ "$year" = "$lastYear" -a "$mon" = "$lastMon" -a "$day" = "$lastDay" -a "$hour" = "$lastHour" ] ; then 
     113          do_auto_prune "$DATASET" "$snap" 
     114          pruned=1 
     115        fi 
     116     fi 
     117 
     118     # Save values of this snapshot for next pass 
     119     lastYear="$year" ; lastMon="$mon" ; lastDay="$day" ; lastHour="$hour" 
     120     lastMin="$min" ; lastSec="$sec" 
     121  done 
     122 
     123} 
     124 
     125# Now run the main script 
    12126DATASET="${1}" 
    13127KEEP="${2}" 
     
    35149fi 
    36150 
    37 # Get our list of snaps 
    38 snaps=$(snaplist "${DATASET}") 
    39  
    40 # Reverse the list 
    41 for tmp in $snaps 
    42 do 
    43    rSnaps="$tmp $rSnaps" 
    44 done 
    45  
    46151# Before we start pruning, check if any replication is running 
    47152skipPrune=0 
     
    56161  echo_log "WARNING: Skipped pruning snapshots on ${DATASET} while replication is running." 
    57162  queue_msg "WARNING: Skipped pruning snapshots on ${DATASET} while replication is running." 
    58  
    59163else 
    60   # Do any pruning 
    61   num=0 
    62   for snap in $rSnaps 
    63   do 
    64      # Only remove snapshots which are auto-created, so we don't delete one the user 
    65      # made specifically 
    66      cur="`echo $snap | cut -d '-' -f 1`"  
    67      if [ "$cur" != "auto" ] ; then 
    68        continue; 
    69      fi 
    70  
    71      num=`expr $num + 1` 
    72      if [ $num -gt $KEEP ] ; then 
    73         echo_log "Pruning old snapshot: $snap" 
    74         rmZFSSnap "${DATASET}" "$snap" 
    75         if [ $? -ne 0 ] ; then 
    76           echo_log "ERROR: Failed pruning snapshot $snap on ${DATASET}" 
    77           queue_msg "ERROR: Failed pruning snapshot $snap on ${DATASET} @ `date`\n\r`cat $CMDLOG`" 
    78           snapStat=1 
    79         else 
    80           queue_msg "Success pruning snapshot $snap on ${DATASET} @ `date`\n\r`cat $CMDLOG`" 
    81         fi 
    82       fi 
    83   done 
     164  # Safe to do the pruning, no replication is in progress 
     165  if [ "$KEEP" = "auto" ] ; then 
     166     do_automatic_prune 
     167  else 
     168     do_numeric_prune 
     169  fi 
    84170fi 
    85171 
  • src-sh/lpreserver/backend/zfscronsnap.sh

    rf615958 r9cd0fa0  
    2222 
    2323  TIME="${3}" 
     24 
     25  if [ "$TIME" = "auto" ] ; then 
     26     enable_cron "$DATASET" "auto" "auto" "auto" 
     27     echo "Snapshot frequency set: Automatic" 
     28     exit 0 
     29  fi 
    2430 
    2531  # See if the user is running daily with a hour specified 
  • src-sh/lpreserver/backend/zfslistcron.sh

    r2b45e58 r9cd0fa0  
    2525   if [ "$min" = '*/10' ] ; then time="10min" ; fi 
    2626   if [ "$min" = '*/5' ] ; then time="5min" ; fi 
     27   if [ "$min" = '*/5' -a "$count" = "auto" ] ; then time="Automatic" ; fi 
    2728   echo "$i - $time - total: $count" 
    2829done 
  • src-sh/lpreserver/lpreserver

    r9558561 r9cd0fa0  
    313313   
    314314  action = start / stop 
    315   frequency = daily@XX / hourly / 30min / 10min / 5min 
    316                     ^^ Hour to execute 
     315  frequency = auto / daily@XX / hourly / 30min / 10min / 5min 
     316                           ^^ Hour to execute 
    317317  numToKeep = Number of snapshots to keep total 
     318 
     319  NOTE: When frequency is set to "auto" the following will take place: 
     320    * Snapshots will be created every 5 minutes and kept for an hour. 
     321    * A hourly snapshot will be kept for a day. 
     322    * A daily snapshot will be kept for a month. 
     323    * A Monthly snapshot will be kept for a year. 
     324    * The life-preserver daemon will also keep track of the zpool disk space, 
     325      if the capacity falls below 75%, the oldest snapshot will be auto-pruned. 
    318326 
    319327Example: 
  • src-qt4/pc-softwaremanager/containers.h

    rc24d6287 r9cbf5aa  
    3737  public: 
    3838    enum PBISTATUS{ NONE, DOWNLOADING, INSTALLING, REMOVING, UPDATING, PENDINGDOWNLOAD, PENDINGINSTALL, PENDINGREMOVAL, PENDINGUPDATE, UPDATEAVAILABLE, WORKING }; 
    39     QString name, version, author, website, arch, path, icon, license, mdate, metaID, downloadfile, description, maintainer, fbsdversion, rawmdate; 
     39    QString name, version, author, website, arch, path, icon, license, mdate, metaID, downloadfile, description, maintainer, fbsdversion; 
    4040    PBISTATUS status; 
    4141    bool rootInstall, autoUpdate, desktopIcons, menuIcons, mimetypes; 
  • src-qt4/pc-softwaremanager/mainUI.cpp

    r68eacde r9cbf5aa  
    685685    //Not currently running - hide the display indicators 
    686686    ui->group_install_appStat->setVisible(false); 
    687   }else if(stat.startsWith("DLSTAT::")){ 
     687  /*}else if(stat.startsWith("DLSTAT::")){ 
    688688    //Currently downloading - show download status indicators 
    689689    QString percent = stat.section("::",1,1); 
     
    704704      ui->label_install_DL->setVisible(TRUE); 
    705705      ui->label_install_DL->setText(speed); 
    706     } 
     706    }*/ 
    707707  }else{ 
    708708    //Currently installing/removing/updating - show last message from process 
     
    710710    else{ ui->label_install_status->setText(stat); } 
    711711    ui->group_install_appStat->setVisible(TRUE); 
    712       ui->progress_install_DL->setVisible(FALSE); 
    713       ui->label_install_DL->setVisible(FALSE); 
     712      //ui->progress_install_DL->setVisible(FALSE); 
     713      //ui->label_install_DL->setVisible(FALSE); 
    714714  } 
    715715} 
     
    916916  QString ico; 
    917917  QString working = PBI->currentAppStatus(cApp); 
     918  QString rawstat = PBI->currentAppStatus(cApp, true); 
    918919  QStringList info = PBI->AppInfo(cApp, QStringList() << "latestversion" << "backupversion" << "requiresroot"); 
    919920  QString pbiID = PBI->isInstalled(cApp); 
    920   if(!working.isEmpty()){ //app currently pending or actually doing something 
    921     ui->tool_bapp_download->setText(working); 
     921  qDebug() << "App Download status:" << working << rawstat; 
     922  if(!working.isEmpty() && !rawstat.isEmpty() ){ //app currently pending or actually doing something 
     923    if(rawstat.startsWith("DLSTAT::")){ ui->tool_bapp_download->setText(tr("Downloading..")); } 
     924    else{ ui->tool_bapp_download->setText(working); } 
    922925    ui->tool_bapp_download->setIcon(QIcon(":icons/working.png")); 
    923926    ui->tool_bapp_download->setEnabled(FALSE); 
  • src-qt4/pc-softwaremanager/mainUI.ui

    r4be3e27 r9cbf5aa  
    6464          </property> 
    6565          <property name="currentIndex"> 
    66            <number>0</number> 
     66           <number>1</number> 
    6767          </property> 
    6868          <widget class="QWidget" name="page_install_list"> 
    6969           <layout class="QVBoxLayout" name="verticalLayout_21"> 
     70            <property name="margin"> 
     71             <number>0</number> 
     72            </property> 
    7073            <item> 
    7174             <layout class="QHBoxLayout" name="horizontalLayout_11"> 
     
    191194          <widget class="QWidget" name="page_install_details"> 
    192195           <layout class="QGridLayout" name="gridLayout_2"> 
     196            <property name="margin"> 
     197             <number>0</number> 
     198            </property> 
    193199            <item row="3" column="0"> 
    194200             <widget class="QFrame" name="frame_2"> 
     
    349355                   <property name="wordWrap"> 
    350356                    <bool>true</bool> 
    351                    </property> 
    352                   </widget> 
    353                  </item> 
    354                 </layout> 
    355                </item> 
    356                <item> 
    357                 <layout class="QHBoxLayout" name="horizontalLayout_9"> 
    358                  <item> 
    359                   <widget class="QProgressBar" name="progress_install_DL"> 
    360                    <property name="value"> 
    361                     <number>24</number> 
    362                    </property> 
    363                   </widget> 
    364                  </item> 
    365                  <item> 
    366                   <widget class="QLabel" name="label_install_DL"> 
    367                    <property name="minimumSize"> 
    368                     <size> 
    369                      <width>80</width> 
    370                      <height>0</height> 
    371                     </size> 
    372                    </property> 
    373                    <property name="text"> 
    374                     <string notr="true">label</string> 
    375                    </property> 
    376                    <property name="alignment"> 
    377                     <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> 
    378357                   </property> 
    379358                  </widget> 
     
    872851                    <x>0</x> 
    873852                    <y>0</y> 
    874                     <width>70</width> 
    875                     <height>16</height> 
     853                    <width>98</width> 
     854                    <height>28</height> 
    876855                   </rect> 
    877856                  </property> 
     
    923902                    <x>0</x> 
    924903                    <y>0</y> 
    925                     <width>49</width> 
    926                     <height>16</height> 
     904                    <width>98</width> 
     905                    <height>28</height> 
    927906                   </rect> 
    928907                  </property> 
     
    948927                 <x>0</x> 
    949928                 <y>0</y> 
    950                  <width>86</width> 
    951                  <height>16</height> 
     929                 <width>98</width> 
     930                 <height>28</height> 
    952931                </rect> 
    953932               </property> 
     
    14091388                    <x>0</x> 
    14101389                    <y>0</y> 
    1411                     <width>55</width> 
    1412                     <height>16</height> 
     1390                    <width>98</width> 
     1391                    <height>28</height> 
    14131392                   </rect> 
    14141393                  </property> 
     
    14471426                    <x>0</x> 
    14481427                    <y>0</y> 
    1449                     <width>55</width> 
    1450                     <height>16</height> 
     1428                    <width>98</width> 
     1429                    <height>28</height> 
    14511430                   </rect> 
    14521431                  </property> 
  • src-qt4/pc-softwaremanager/pbiBackend.cpp

    rc24d6287 r9cbf5aa  
    5555   currentRepoNum = "001"; //first repo by default 
    5656   //Filesystem watcher 
     57   watchTimer = new QTimer(this); 
     58     watchTimer->setSingleShot(true); 
     59     watchTimer->setInterval(500); //1/2 a second intervals (to make sure we do not run it too freqently) 
     60     connect(watchTimer, SIGNAL(timeout()), this, SLOT(slotSyncToDatabase()) ); 
    5761   watcher = new QFileSystemWatcher(); 
    58    connect(watcher,SIGNAL(directoryChanged(QString)),this,SLOT(slotSyncToDatabase()) ); 
     62   connect(watcher,SIGNAL(directoryChanged(QString)),this,SLOT(slotWatcherNotification()) ); 
    5963    
    6064 } 
     
    526530    if(!APPHASH.contains(appID)){ return ""; } 
    527531    QStringList pbilist = PBIHASH.keys(); 
     532    bool active = false; 
    528533    for(int i=0; i<pbilist.length(); i++){ 
    529       if(PBIHASH[pbilist[i]].metaID == appID){ status = PBIHASH[pbilist[i]].status; metaID=appID; break; } 
     534      //Be careful about more than one pbiID matching the given appID - grab the active one 
     535      if(PBIHASH[pbilist[i]].metaID == appID){  
     536        status = PBIHASH[pbilist[i]].status;  
     537        metaID=appID; 
     538        active = !(status==InstalledPBI::UPDATEAVAILABLE || status==InstalledPBI::NONE); 
     539      } 
     540      if(active){ break; } 
    530541    } 
    531542  } 
     
    534545    switch (status){ 
    535546        case InstalledPBI::DOWNLOADING: 
    536           output = lDownload; break; 
     547          output = lDownload; 
     548          if(output.isEmpty()){ output = "Downloading"; } 
     549          break; 
    537550        case InstalledPBI::INSTALLING: 
    538           output = lInstall; break; 
     551          output = lInstall;  
     552          if(output.isEmpty()){ output = "Installing"; } 
     553          break; 
    539554        case InstalledPBI::REMOVING: 
    540           output = lRemove; break; 
     555          output = lRemove;  
     556          if(output.isEmpty()){ output = "Removing"; } 
     557          break; 
    541558        case InstalledPBI::UPDATING: 
    542           output = lUpdate; break; 
     559          output = lUpdate;  
     560          if(output.isEmpty()){ output = "Updating"; } 
     561          break; 
     562        case InstalledPBI::NONE: 
     563        case InstalledPBI::UPDATEAVAILABLE: 
     564          output.clear(); break; 
    543565        default: 
    544           output.clear(); 
     566          output = "Pending"; 
    545567    } 
    546568  }else{ 
     
    956978   } 
    957979   if(!dlDir.endsWith("/")){ dlDir.append("/"); }  
     980 } 
     981  
     982 void PBIBackend::slotWatcherNotification(){ 
     983  watchTimer->start();    
    958984 } 
    959985  
  • src-qt4/pc-softwaremanager/pbiBackend.h

    rf7905b5 r9cbf5aa  
    8585private: 
    8686        QWidget *parentWidget; 
     87        QTimer *watchTimer; 
    8788        //variables - warden mode 
    8889        QString wardenDir, wardenIP; 
     
    130131private slots: 
    131132        void updateDlDirPath(QString); 
    132          
     133        void slotWatcherNotification(); 
     134 
    133135        //Process functions 
    134136        void checkProcesses(); 
Note: See TracChangeset for help on using the changeset viewer.