Changeset 6ef290c


Ignore:
Timestamp:
05/09/14 14:06:26 (14 months ago)
Author:
Josh <joshms@…>
Branches:
master, enter/10, releng/10.0.2, releng/10.0.3, releng/10.1, releng/10.1.1, releng/10.1.2
Children:
eaea8ff, eff0357
Parents:
d6609ed (diff), 49942f24 (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 git://github.com/pcbsd/pcbsd

Files:
6 added
15 edited

Legend:

Unmodified
Added
Removed
  • lumina/libLumina/LuminaX11.cpp

    r7e29143 r0ccf75ef  
    223223             false, AnyPropertyType, &realType, &format, &num, &bytes, &data); 
    224224  if( (status >= Success) && (num > 0) ){ 
    225     number = *data; 
     225    number = data[0]; 
    226226    XFree(data); 
    227227  } 
  • lumina/lumina-desktop/AppMenu.cpp

    rc47b1152 r5f42f3f  
    5353      else if(cats[i] == "System"){ name = tr("System"); icon = "applications-system"; } 
    5454      else if(cats[i] == "Utility"){ name = tr("Utility"); icon = "applications-utilities"; } 
    55       else if(cats[i] == "Unsorted"){ name = tr("Unsorted"); icon = "applications-other"; } 
     55      else{ name = tr("Unsorted"); icon = "applications-other"; } 
     56       
    5657      QMenu *menu = new QMenu(name, this); 
    5758      menu->setIcon(LXDG::findIcon(icon,"")); 
  • lumina/lumina-desktop/Globals.h

    rf12e79a r17692af  
    77#ifndef _LUMINA_DESKTOP_GLOBALS_H 
    88#define _LUMINA_DESKTOP_GLOBALS_H 
     9 
     10#include <LuminaUtils.h> 
    911 
    1012#include <unistd.h> 
     
    4244        //Restart the system 
    4345        static void restart(){ system("(shutdown -r now) &"); } 
     46         
     47        //Determine if there is battery support 
     48        static bool hasBattery(){ 
     49          int val = LUtils::getCmdOutput("apm -l").join("").toInt(); 
     50          return (val >= 0 && val <= 100); 
     51        } 
     52         
     53        //Get the current battery charge percentage 
     54        static int batteryCharge(){ 
     55          int charge = LUtils::getCmdOutput("apm -l").join("").toInt(); 
     56          if(charge > 100){ charge = -1; } //invalid charge  
     57          return charge; 
     58        } 
     59         
     60        //Get the current battery charge percentage 
     61        static bool batteryIsCharging(){ 
     62          return (LUtils::getCmdOutput("apm -a").join("").simplified() == "1"); 
     63        } 
     64         
     65        //Get the amount of time remaining for the battery 
     66        static int batterySecondsLeft(){ 
     67          return LUtils::getCmdOutput("apm -t").join("").toInt(); 
     68        } 
    4469}; 
    4570 
  • lumina/lumina-desktop/LDesktop.cpp

    rf06effb r92c8291  
    1919  deskMenu = new QMenu(0); 
    2020  appmenu = new AppMenu(0); 
     21  workspacelabel = new QLabel(0); 
     22    workspacelabel->setAlignment(Qt::AlignCenter); 
     23  wkspaceact = new QWidgetAction(0); 
     24    wkspaceact->setDefaultWidget(workspacelabel); 
    2125  //Setup the internal variables 
    2226  settings = new QSettings(QSettings::UserScope, "LuminaDE","desktopsettings", this); 
     
    4953  delete appmenu; 
    5054  delete bgWindow; 
     55  delete workspacelabel; 
     56  delete wkspaceact; 
    5157} 
    5258 
     
    6571  qDebug() << " - Update Menu:" << desktopnumber; 
    6672  deskMenu->clear(); 
     73  //Put a label at the top  
     74  int num = LX11::GetCurrentDesktop(); 
     75  qDebug() << "Found desktop number:" << num; 
     76  if(num < 0){ workspacelabel->setText( "<b>"+tr("Lumina Desktop")+"</b>"); } 
     77  else{ workspacelabel->setText( "<b>"+QString(tr("Workspace %1")).arg(QString::number(num+1))+"</b>"); } 
     78  deskMenu->addAction(wkspaceact); 
     79  deskMenu->addSeparator(); 
    6780  //Add in the system applications menu 
    6881  deskMenu->addAction(LXDG::findIcon("utilities-terminal",""), tr("Terminal"), this, SLOT(SystemTerminal()) ); 
  • lumina/lumina-desktop/LDesktop.h

    r51ace02 r92c8291  
    1717#include <QTimer> 
    1818#include <QFileSystemWatcher> 
     19#include <QLabel> 
     20#include <QWidgetAction> 
    1921 
    2022 
     
    5153        QMenu *deskMenu; 
    5254        AppMenu *appmenu; 
     55        QLabel *workspacelabel; 
     56        QWidgetAction *wkspaceact; 
    5357        QList<LDPlugin*> PLUGINS; 
    5458        QFileSystemWatcher *watcher; 
     
    5963        void UpdateMenu(); 
    6064        void ShowMenu(){ 
     65          UpdateMenu(); 
    6166          deskMenu->popup(QCursor::pos()); 
    6267        } 
  • lumina/lumina-desktop/LPanel.cpp

    r59bd6842 r5f42f3f  
    7171  QStringList plugins = settings->value(PPREFIX+"pluginlist", QStringList()).toStringList(); 
    7272  if(defaultpanel && plugins.isEmpty()){ 
    73     plugins << "userbutton" << "desktopbar" << "spacer"  << "clock"; 
     73    plugins << "userbutton" << "desktopbar" << "desktopswitcher" << "spacer"  << "clock"; 
     74    if(SYSTEM::hasBattery()){ plugins << "battery"; } 
    7475  }else if(defaultpanel && !plugins.contains("userbutton") ){ 
    7576    plugins.prepend("userbutton"); //make sure we have this button since that lets the user logout 
  • lumina/lumina-desktop/fluxboxconf/fluxbox-init-rc

    r3ef1a66 r77631c2  
    1515session.screen0.toolbar.layer:  Dock 
    1616session.screen0.toolbar.height: 0 
    17 session.screen0.toolbar.tools:  prevworkspace, workspacename, nextworkspace, iconbar, systemtray 
     17session.screen0.toolbar.tools:  iconbar, systemtray 
    1818session.screen0.iconbar.iconWidth:      128 
    1919session.screen0.iconbar.alignment:      Left 
  • lumina/lumina-desktop/panel-plugins/battery/LBattery.cpp

    r8ec8faf r5f42f3f  
    1010  iconOld = -1; 
    1111  //Setup the widget 
    12   label = new LTBWidget(this); 
     12  label = new QLabel(this); 
     13    label->setScaledContents(true); 
    1314    //label->setAlignment(Qt::AlignCenter); 
    1415  this->layout()->addWidget(label); 
     
    2829void LBattery::updateBattery(){ 
    2930  // Get current state of charge 
    30   QStringList result = LUtils::getCmdOutput("/usr/sbin/apm", QStringList() << "-al"); 
    31   int charge = result.at(1).toInt(); 
     31  //QStringList result = LUtils::getCmdOutput("/usr/sbin/apm", QStringList() << "-al"); 
     32  int charge = SYSTEM::batteryCharge(); //result.at(1).toInt(); 
    3233//qDebug() << "1: " << result.at(0).toInt() << " 2: " << result.at(1).toInt(); 
    33   int icon = 0; 
    34   if (charge > 100) { icon = 5; } 
    35   else if (charge > 90) { icon = 4; } 
     34  int icon = -1; 
     35  if (charge > 90) { icon = 4; } 
    3636  else if (charge > 70) { icon = 3; } 
    3737  else if (charge > 50) { icon = 2; } 
    3838  else if (charge > 30) { icon = 1; } 
    39   icon = icon + result.at(0).toInt() * 10; 
     39  else if (charge > 0 ) { icon = 0; } 
     40  if(SYSTEM::batteryIsCharging()){ icon = icon+10; } 
     41  //icon = icon + result.at(0).toInt() * 10; 
    4042  if (icon != iconOld) { 
    4143    switch (icon) { 
    4244      case 0: 
    43         label->setIcon( LXDG::findIcon("battery-caution", ":/images/battery-caution.png") ); 
     45        label->setPixmap( LXDG::findIcon("battery-caution", "").pixmap(label->size()) ); 
    4446        break; 
    4547      case 1: 
    46         label->setIcon( LXDG::findIcon("battery-040", ":/images/battery-040.png") ); 
     48        label->setPixmap( LXDG::findIcon("battery-040", "").pixmap(label->size()) ); 
    4749        break; 
    4850      case 2: 
    49         label->setIcon( LXDG::findIcon("battery-060", ":/images/battery-060.png") ); 
     51        label->setPixmap( LXDG::findIcon("battery-060", "").pixmap(label->size()) ); 
    5052        break; 
    5153      case 3: 
    52         label->setIcon( LXDG::findIcon("battery-080", ":/images/battery-080.png") ); 
     54        label->setPixmap( LXDG::findIcon("battery-080", "").pixmap(label->size()) ); 
    5355        break; 
    5456      case 4: 
    55         label->setIcon( LXDG::findIcon("battery-100", ":/images/battery-100.png") ); 
     57        label->setPixmap( LXDG::findIcon("battery-100", "").pixmap(label->size()) ); 
    5658        break; 
    5759      case 10: 
    58         label->setIcon( LXDG::findIcon("battery-charging-caution", ":/images/battery-caution.png") ); 
     60        label->setPixmap( LXDG::findIcon("battery-charging-caution", "").pixmap(label->size()) ); 
    5961        break; 
    6062      case 11: 
    61         label->setIcon( LXDG::findIcon("battery-charging-040", ":/images/battery-040.png") ); 
     63        label->setPixmap( LXDG::findIcon("battery-charging-040", "").pixmap(label->size()) ); 
    6264        break; 
    6365      case 12: 
    64         label->setIcon( LXDG::findIcon("battery-charging-060", ":/images/battery-060.png") ); 
     66        label->setPixmap( LXDG::findIcon("battery-charging-060", "").pixmap(label->size()) ); 
    6567        break; 
    6668      case 13: 
    67         label->setIcon( LXDG::findIcon("battery-charging-080", ":/images/battery-080.png") ); 
     69        label->setPixmap( LXDG::findIcon("battery-charging-080", "").pixmap(label->size()) ); 
    6870        break; 
    6971      case 14: 
    70         label->setIcon( LXDG::findIcon("battery-charging", ":/images/battery-100.png") ); 
     72        label->setPixmap( LXDG::findIcon("battery-charging", "").pixmap(label->size()) ); 
    7173        break; 
    7274      default: 
    73         label->setIcon( LXDG::findIcon("battery-missing", ":/images/battery-missing.png") ); 
     75        label->setPixmap( LXDG::findIcon("battery-missing", "").pixmap(label->size()) ); 
    7476        break; 
    7577    } 
     
    7779  } 
    7880  //Now update the display 
    79   label->setToolTip(QString("%1 %").arg(charge).append(icon > 9 && icon < 15 ? " and charging" : "")); 
     81  QString tt; 
     82  //Make sure the tooltip can be properly translated as necessary (Ken Moore 5/9/14) 
     83  if(icon > 9 && icon < 15){ tt = QString(tr("%1 % (Charging)")).arg(QString::number(charge)); } 
     84  else{ tt = QString( tr("%1 % (%2 Remaining)") ).arg(QString::number(charge), getRemainingTime() ); } 
     85  label->setToolTip(tt); 
    8086} 
     87 
     88QString LBattery::getRemainingTime(){ 
     89  int secs = SYSTEM::batterySecondsLeft(); 
     90  if(secs < 0){ return "??"; } 
     91  QString rem; //remaining 
     92  if(secs > 3600){ 
     93    int hours = secs/3600; 
     94    rem.append( QString::number(hours)+"h "); 
     95    secs = secs - (hours*3600); 
     96  } 
     97  if(secs > 60){ 
     98    int min = secs/60; 
     99    rem.append( QString::number(min)+"m "); 
     100    secs = secs - (min*60); 
     101  } 
     102  if(secs > 0){ 
     103    rem.append(QString::number(secs)+"s"); 
     104  } 
     105  return rem; 
     106} 
  • lumina/lumina-desktop/panel-plugins/battery/LBattery.h

    r418d23a r5f42f3f  
    1111#include <QWidget> 
    1212#include <QString> 
     13#include <QLabel> 
    1314 
    1415#include <LuminaUtils.h> 
    1516#include <LuminaXDG.h> 
    1617 
    17 #include "../LTBWidget.h" 
     18#include "../../Globals.h" 
     19//#include "../LTBWidget.h" 
    1820#include "../LPPlugin.h" 
    1921 
     
    2628private: 
    2729        QTimer *timer; 
    28         QToolButton *label; 
     30        QLabel *label; 
    2931        int iconOld; 
    3032         
    3133private slots: 
    3234        void updateBattery(); 
     35        QString getRemainingTime(); 
    3336         
    3437}; 
  • lumina/lumina-desktop/panel-plugins/desktopswitcher/LDesktopSwitcher.cpp

    rf435093 r92c8291  
    1212  //Setup the widget 
    1313  label = new LTBWidget(this); 
    14   label->setIcon( LXDG::findIcon("preferences-desktop-display-color", ":/images/preferences-desktop-display-color.png") ); 
     14  label->setIcon( LXDG::findIcon("preferences-desktop-display-color", "") ); 
    1515  label->setToolTip(QString("Workspace 1")); 
    1616  menu = new QMenu(this); 
     
    2222  // becasue the workspace could be switched via Keyboard-shortcuts ... 
    2323 
    24   createMenu(); 
     24  QTimer::singleShot(500, this, SLOT(createMenu()) ); //needs a delay to make sure it works right the first time 
    2525} 
    2626 
     
    113113  int cur = LX11::GetCurrentDesktop(); //current desktop number 
    114114  int tot = LX11::GetNumberOfDesktops(); //total number of desktops 
    115   qDebug() << "-- vor getCurrentDesktop SWITCH"; 
    116   qDebug() << cur; 
     115  //qDebug() << "-- vor getCurrentDesktop SWITCH"; 
     116  qDebug() << "Virtual Desktops:" << tot << cur; 
    117117  menu->clear(); 
    118118  for (int i = 0; i < tot; i++) { 
    119     menu->addAction(newAction(i, QString("Workspace %1").arg(i +1))); 
     119    QString name = QString(tr("Workspace %1")).arg( QString::number(i+1) ); 
     120    if(i == cur){ name.prepend("*"); name.append("*");} //identify which desktop this is currently 
     121    menu->addAction(newAction(i, name)); 
    120122  } 
    121123} 
     
    123125void LDesktopSwitcher::menuActionTriggered(QAction* act) { 
    124126  LX11::SetCurrentDesktop(act->whatsThis().toInt()); 
    125   label->setToolTip(QString("Workspace %1").arg(act->whatsThis().toInt() +1)); 
     127  label->setToolTip(QString(tr("Workspace %1")).arg(act->whatsThis().toInt() +1)); 
     128  QTimer::singleShot(500, this, SLOT(createMenu()) ); //make sure the menu gets updated 
    126129} 
  • lumina/lumina-desktop/panel-plugins/desktopswitcher/LDesktopSwitcher.h

    rf435093 r5f42f3f  
    4242        //int getCurrentDesktop(); 
    4343 
    44         void createMenu(); 
     44 
    4545        QAction* newAction(int, QString); 
    4646         
    4747private slots: 
     48        void createMenu(); 
    4849        void menuActionTriggered(QAction*); 
    4950}; 
  • src-sh/lpreserver/backend/functions.sh

    r1e85620 r49942f24  
    187187  echo "with the correct permissions!" 
    188188 
    189   rem_rep_task "$LDATA" 
     189  rem_rep_task "$LDATA" "$HOST" 
    190190  echo "$LDATA:$TIME:$HOST:$USER:$PORT:$RDATA" >> ${REPCONF} 
    191191 
     
    199199    cronscript="${PROGDIR}/backend/runrep.sh" 
    200200    cLine="$cTime       *       *       *" 
    201     echo -e "$cLine\troot    ${cronscript} ${LDATA}" >> /etc/crontab 
     201    echo -e "$cLine\troot    ${cronscript} ${LDATA} ${HOST}" >> /etc/crontab 
    202202  fi 
    203203} 
     
    205205rem_rep_task() { 
    206206  if [ ! -e "$REPCONF" ] ; then return ; fi 
    207   cat ${REPCONF} | grep -v "^${1}:" > ${REPCONF}.tmp 
     207  cat ${REPCONF} | grep -v "^${1}:.*:${2}:" > ${REPCONF}.tmp 
    208208  mv ${REPCONF}.tmp ${REPCONF} 
    209209 
    210210  # Make sure we remove any old replication entries for this dataset 
    211211  cronscript="${PROGDIR}/backend/runrep.sh" 
    212   cat /etc/crontab | grep -v " $cronscript $1" > /etc/crontab.new 
     212  cat /etc/crontab | grep -v " $cronscript ${1} ${2}" > /etc/crontab.new 
    213213  mv /etc/crontab.new /etc/crontab 
    214214} 
     
    238238  if [ ! -e "$REPCONF" ] ; then return 0; fi 
    239239 
    240   repLine=`cat ${REPCONF} | grep "^${1}:"` 
    241   if [ -z "$repLine" ] ; then return 0; fi 
    242  
    243   # We have a replication task for this dataset, lets check if we need to do it now 
    244   LDATA="$1" 
    245   REPTIME=`echo $repLine | cut -d ':' -f 2` 
    246  
    247   # Export the replication variables we will be using 
    248   export REPHOST=`echo $repLine | cut -d ':' -f 3` 
    249   export REPUSER=`echo $repLine | cut -d ':' -f 4` 
    250   export REPPORT=`echo $repLine | cut -d ':' -f 5` 
    251   export REPRDATA=`echo $repLine | cut -d ':' -f 6` 
    252  
    253   if [ "$2" = "force" ] ; then 
    254      # Ready to do a forced replication 
    255      export DIDREP=1 
    256      echo_log "Starting replication MANUAL task on ${DATASET}: ${REPLOGSEND}" 
    257      queue_msg "`date`: Starting replication MANUAL task on ${DATASET}\n" 
    258      start_rep_task "$LDATA" 
    259      return $? 
    260   fi 
    261  
    262   # If we are checking for a sync task, and the rep isn't marked as sync we can return 
    263   if [ "$2" = "sync" -a "$REPTIME" != "sync" ] ; then return 0; fi 
    264  
    265   # Doing a replication task, check if one is in progress 
    266   export pidFile="${DBDIR}/.reptask-`echo ${LDATA} | sed 's|/|-|g'`" 
    267   if [ -e "${pidFile}" ] ; then 
    268      pgrep -F ${pidFile} >/dev/null 2>/dev/null 
    269      if [ $? -eq 0 ] ; then 
    270         echo_log "Skipped replication on $LDATA, previous replication is still running." 
    271         return 0 
    272      else 
    273         rm ${pidFile} 
    274      fi 
    275   fi 
    276  
    277   # Save this PID 
    278   echo "$$" > ${pidFile} 
    279  
    280   # Is this a sync-task we do at the time of a snapshot? 
    281   if [ "$2" = "sync" -a "$REPTIME" = "sync" ] ; then 
    282      export DIDREP=1 
    283      echo_log "Starting replication SYNC task on ${DATASET}: ${REPLOGSEND}" 
    284      queue_msg "`date`: Starting replication SYNC task on ${DATASET}\n" 
    285      start_rep_task "$LDATA" 
    286      return $? 
    287   else 
    288      # Ready to do a scheduled replication 
    289      export DIDREP=1 
    290      echo_log "Starting replication SCHEDULED task on ${DATASET}: ${REPLOGSEND}" 
    291      queue_msg "`date`: Starting replication SCHEDULED task on ${DATASET}\n" 
    292      start_rep_task "$LDATA" 
    293      return $? 
    294   fi 
     240  ret=0 
     241  for repLine in `cat ${REPCONF} | grep "^${1}:"` 
     242  do 
     243 
     244    # We have a replication task for this dataset, lets check if we need to do it now 
     245    LDATA="$1" 
     246    REPTIME=`echo $repLine | cut -d ':' -f 2` 
     247 
     248    # Export the replication variables we will be using 
     249    export REPHOST=`echo $repLine | cut -d ':' -f 3` 
     250    export REPUSER=`echo $repLine | cut -d ':' -f 4` 
     251    export REPPORT=`echo $repLine | cut -d ':' -f 5` 
     252    export REPRDATA=`echo $repLine | cut -d ':' -f 6` 
     253 
     254    if [ "$2" = "force" ] ; then 
     255       # Ready to do a forced replication 
     256       export DIDREP=1 
     257       echo_log "Starting replication MANUAL task on ${DATASET}: ${REPLOGSEND}" 
     258       queue_msg "`date`: Starting replication MANUAL task on ${DATASET}\n" 
     259       start_rep_task "$LDATA" "$REPHOST" 
     260       if [ $? -ne 0 ] ; then ret=1; fi 
     261       continue 
     262    fi 
     263 
     264    # If we are checking for a sync task, and the rep isn't marked as sync we can continue 
     265    if [ "$2" = "sync" -a "$REPTIME" != "sync" ] ; then continue; fi 
     266 
     267    # Doing a replication task, check if one is in progress 
     268    export pidFile="${DBDIR}/.reptask-`echo ${LDATA} | sed 's|/|-|g'`" 
     269    if [ -e "${pidFile}" ] ; then 
     270       pgrep -F ${pidFile} >/dev/null 2>/dev/null 
     271       if [ $? -eq 0 ] ; then 
     272          echo_log "Skipped replication on $LDATA, previous replication is still running." 
     273          continue 
     274       else 
     275          rm ${pidFile} 
     276       fi 
     277    fi 
     278 
     279    # Save this PID 
     280    echo "$$" > ${pidFile} 
     281 
     282    # Is this a sync-task we do at the time of a snapshot? 
     283    if [ "$2" = "sync" -a "$REPTIME" = "sync" ] ; then 
     284       export DIDREP=1 
     285       echo_log "Starting replication SYNC task on ${DATASET}: ${REPLOGSEND}" 
     286       queue_msg "`date`: Starting replication SYNC task on ${DATASET}\n" 
     287       start_rep_task "$LDATA" 
     288       if [ $? -ne 0 ] ; then ret=1; fi 
     289       continue 
     290    else 
     291       # Ready to do a scheduled replication 
     292       export DIDREP=1 
     293       echo_log "Starting replication SCHEDULED task on ${DATASET}: ${REPLOGSEND}" 
     294       queue_msg "`date`: Starting replication SCHEDULED task on ${DATASET}\n" 
     295       start_rep_task "$LDATA" 
     296       if [ $? -ne 0 ] ; then ret=1; fi 
     297       continue 
     298    fi 
     299  done 
     300  return $ret 
    295301} 
    296302 
     
    300306 
    301307  # Check for the last snapshot marked as replicated already 
    302   lastSEND=`zfs get -d 1 backup:lpreserver ${LDATA} | grep LATEST | awk '{$1=$1}1' OFS=" " | tail -1 | cut -d '@' -f 2 | cut -d ' ' -f 1` 
     308  lastSEND=`zfs get -d 1 lpreserver:${REPHOST} ${LDATA} | grep LATEST | awk '{$1=$1}1' OFS=" " | tail -1 | cut -d '@' -f 2 | cut -d ' ' -f 1` 
    303309 
    304310  # Lets get the last snapshot for this dataset 
     
    336342     # Lets mark our new latest snapshot and unmark the last one 
    337343     if [ -n "$lastSEND" ] ; then 
    338        zfs set backup:lpreserver=' ' ${LDATA}@$lastSEND 
     344       zfs set lpreserver:${REPHOST}=' ' ${LDATA}@$lastSEND 
    339345     fi 
    340      zfs set backup:lpreserver=LATEST ${LDATA}@$lastSNAP 
     346     zfs set lpreserver:${REPHOST}=LATEST ${LDATA}@$lastSNAP 
    341347     echo_log "Finished replication task on ${DATASET}" 
    342348     save_rep_props 
     
    387393  for i in `grep "${PROGDIR}/backend/runsnap.sh" /etc/crontab | awk '{print $8}'` 
    388394  do 
    389     echo -e "DATASET - SNAPSHOT - REPLICATION" 
    390     echo "------------------------------------------" 
    391  
    392     lastSEND=`zfs get -d 1 backup:lpreserver ${i} | grep LATEST | awk '{$1=$1}1' OFS=" " | tail -1 | cut -d '@' -f 2 | cut -d ' ' -f 1` 
    393     lastSNAP=`zfs list -t snapshot -d 1 -H ${i} | tail -1 | awk '{$1=$1}1' OFS=" " | cut -d '@' -f 2 | cut -d ' ' -f 1` 
    394  
    395     if [ -z "$lastSEND" ] ; then lastSEND="NONE"; fi 
    396     if [ -z "$lastSNAP" ] ; then lastSNAP="NONE"; fi 
    397  
    398     echo "$i - $lastSNAP - $lastSEND" 
     395    echo -e "DATASET - TARGET - SNAPSHOT - REPLICATION" 
     396    echo "---------------------------------------------------" 
     397 
     398    # Get some details about this host 
     399    for repLine in `cat ${REPCONF} | grep "^${i}:"` 
     400    do 
     401      REPHOST=`echo $repLine | cut -d ':' -f 3` 
     402 
     403      lastSEND=`zfs get -d 1 lpreserver:${REPHOST} ${i} | grep LATEST | awk '{$1=$1}1' OFS=" " | tail -1 | cut -d '@' -f 2 | cut -d ' ' -f 1` 
     404      lastSNAP=`zfs list -t snapshot -d 1 -H ${i} | tail -1 | awk '{$1=$1}1' OFS=" " | cut -d '@' -f 2 | cut -d ' ' -f 1` 
     405 
     406      if [ -z "$lastSEND" ] ; then lastSEND="NONE"; fi 
     407      if [ -z "$lastSNAP" ] ; then lastSNAP="NONE"; fi 
     408      echo "$i -> $REPHOST - $lastSNAP - $lastSEND" 
     409    done 
    399410  done 
    400411} 
     
    585596 
    586597  LDATA="$1" 
    587  
    588   repLine=`cat ${REPCONF} | grep "^${LDATA}:"` 
     598  if [ -z "$1" -o -z "$2" ] ; then 
     599     exit_err "Usage: lpreserver replicate init <zpool> <target host>" 
     600  fi 
     601 
     602  repLine=`cat ${REPCONF} | grep "^${LDATA}:.*:${2}:"` 
    589603  if [ -z "$repLine" ] ; then return 0; fi 
    590604  
     
    608622 
    609623  # Now lets mark none of our datasets as replicated 
    610   lastSEND=`zfs get -d 1 backup:lpreserver ${LDATA} | grep LATEST | awk '{$1=$1}1' OFS=" " | tail -1 | cut -d '@' -f 2 | cut -d ' ' -f 1` 
     624  lastSEND=`zfs get -d 1 lpreserver:${REPHOST} ${LDATA} | grep LATEST | awk '{$1=$1}1' OFS=" " | tail -1 | cut -d '@' -f 2 | cut -d ' ' -f 1` 
    611625  if [ -n "$lastSEND" ] ; then 
    612      zfs set backup:lpreserver=' ' ${LDATA}@$lastSEND 
     626     zfs set lpreserver:${REPHOST}=' ' ${LDATA}@$lastSEND 
    613627  fi 
    614628 
  • src-sh/lpreserver/backend/runsnap.sh

    r1e85620 r49942f24  
    6464  done 
    6565 
    66   # Get the last replicated snapshot 
    67   lastSEND=`zfs get -d 1 backup:lpreserver ${LDATA} | grep LATEST | awk '{$1=$1}1' OFS=" " | tail -1 | cut -d '@' -f 2 | cut -d ' ' -f 1` 
    68   if [ -n "$lastSEND" ] ; then 
    69      sec="`echo $lastSEND | cut -d '-' -f 7`" 
    70      min="`echo $lastSEND | cut -d '-' -f 6`" 
    71      hour="`echo $lastSEND | cut -d '-' -f 5`" 
    72      day="`echo $lastSEND | cut -d '-' -f 4`" 
    73      mon="`echo $lastSEND | cut -d '-' -f 3`" 
    74      year="`echo $lastSEND | cut -d '-' -f 2`" 
    75      sendEpoc=`date -j -f "%Y %m %d %H %M %S" "$year $mon $day $hour $min $sec" "+%s"` 
    76      # Check that this replication target is still active 
    77      if [ -e "$REPCONF" ] ; then 
    78        cat ${REPCONF} | grep -q "^${LDATA}:" 
    79        if [ $? -ne 0 ] ; then 
    80           unset lastSEND 
    81           unset sendEpoc 
     66 
     67  # Figure out the oldest snapshot we can prune up to 
     68  for repLine in `cat ${REPCONF} 2>/dev/null | grep "^${LDATA}:"` 
     69  do 
     70    REPHOST=`echo $repLine | cut -d ':' -f 3` 
     71 
     72    # Get the last replicated snapshot 
     73    lastSEND=`zfs get -d 1 lpreserver:${REPHOST} ${LDATA} | grep LATEST | awk '{$1=$1}1' OFS=" " | tail -1 | cut -d '@' -f 2 | cut -d ' ' -f 1` 
     74    if [ -n "$lastSEND" ] ; then 
     75       sec="`echo $lastSEND | cut -d '-' -f 7`" 
     76       min="`echo $lastSEND | cut -d '-' -f 6`" 
     77       hour="`echo $lastSEND | cut -d '-' -f 5`" 
     78       day="`echo $lastSEND | cut -d '-' -f 4`" 
     79       mon="`echo $lastSEND | cut -d '-' -f 3`" 
     80       year="`echo $lastSEND | cut -d '-' -f 2`" 
     81       newEpoc=`date -j -f "%Y %m %d %H %M %S" "$year $mon $day $hour $min $sec" "+%s"` 
     82       if [ -z "$sendEpoc" ] ; then 
     83          sendEpoc="$newEpoc" 
     84          oldestSEND="$lastSEND" 
     85          continue 
    8286       fi 
    83      fi 
    84   fi 
     87 
     88       # Is this replication older? 
     89       if [ $newEpoc -lt $sendEpoc ] ; then 
     90          sendEpoc="$newEpoc" 
     91          oldestSEND="$lastSEND" 
     92       fi 
     93    fi 
     94  done 
    8595 
    8696  num=0 
     
    92102 
    93103     # If this snapshot is the last one replicated, lets skip pruning it for now 
    94      if [ "$cur" = "$lastSEND" ]; then continue; fi 
     104     if [ "$cur" = "$oldestSEND" ]; then continue; fi 
    95105 
    96106     sec="`echo $snap | cut -d '-' -f 7`" 
  • src-sh/lpreserver/lpreserver

    ra3560cd r49942f24  
    173173Init Options: 
    174174 
    175         init <localdataset/zpool>  
     175        init <localdataset/zpool> <target host> 
    176176 
    177177        Will re-init the remote side of the replication. This can be useful 
     
    181181Remove Options: 
    182182 
    183         remove <dataset> 
     183        remove <dataset> <target host> 
    184184         
    185185        Remove a replication task indicated by <dataset> 
     
    405405}; 
    406406 
     407check_migrate() 
     408{ 
     409   # Check if we need to update the flags on replication to new format 
     410   if [ ! -e "${DBDIR}/.replicationng" -a -e "${REPCONF}" ] ; then 
     411     echo "Updating replication tag system..." 
     412     echo "Please be patient, this is only done once..." 
     413     while read repLine 
     414     do 
     415       local LDATA=`echo $repLine | cut -d ':' -f 1` 
     416       local REPHOST=`echo $repLine | cut -d ':' -f 3` 
     417 
     418       local lastSEND=`zfs get -d 1 backup:lpreserver ${LDATA} | grep LATEST | awk '{$1=$1}1' OFS=" " | tail -1 | cut -d '@' -f 2 | cut -d ' ' -f 1` 
     419 
     420       if [ -z "$lastSEND" ] ; then continue ; fi 
     421 
     422       # Remove the old flag format and set the new one 
     423       zfs set backup:lpreserver=' ' ${LDATA}@${lastSEND} 
     424       zfs set lpreserver:${REPHOST}=LATEST ${LDATA}@${lastSEND} 
     425 
     426     done < ${REPCONF} 
     427 
     428     # Touch our marker so we don't need to do this again 
     429     touch "${DBDIR}/.replicationng" 
     430   fi 
     431 
     432   # Put other migration functionality as needed here 
     433} 
     434 
    407435# Check if we need to enable the zfs monitor 
    408436enable_watcher 
     437 
     438# See if we need to upgrade flags on replication 
     439check_migrate 
    409440 
    410441# Check what the user wants to do 
     
    506537            case ${1} in 
    507538                add) require_root ; add_rep_task "$2" "$3" "$4" "$5" "$6" "$7" ;; 
    508                 init) require_root ; init_rep_task "$2" ;; 
     539                init) require_root ; init_rep_task "$2" "$3" ;; 
    509540                list) list_rep_task ;; 
    510541                remove) require_root 
  • src-sh/port-files/Makefile

    r1d3e9af r5619366  
    1111COMMENT=        PC-BSD Command-Line Utilities 
    1212 
    13 RUN_DEPENDS=    pkg-static:${PORTSDIR}/ports-mgmt/pkg \ 
    14                 svn:${PORTSDIR}/devel/subversion \ 
    15                 mksquashfs:${PORTSDIR}/sysutils/squashfs-tools \ 
    16                 debootstrap:${PORTSDIR}/sysutils/debootstrap \ 
    17                 sipcalc:${PORTSDIR}/net-mgmt/sipcalc \ 
     13RUN_DEPENDS=    sipcalc:${PORTSDIR}/net-mgmt/sipcalc \ 
    1814                eject:${PORTSDIR}/sysutils/eject \ 
    1915                unzip:${PORTSDIR}/archivers/unzip \ 
Note: See TracChangeset for help on using the changeset viewer.