Changeset b9679c0


Ignore:
Timestamp:
07/29/14 14:32:42 (5 months ago)
Author:
Ken Moore <ken@…>
Branches:
master, releng/10.0.3, releng/10.1
Children:
8ec92d9, c47b0b91
Parents:
578b2b9 (diff), 54d2124 (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:
3 added
15 edited

Legend:

Unmodified
Added
Removed
  • src-sh/libsh/functions.sh

    r04aeb2a r54d2124  
    807807     echo "$disk" | grep -q "gptid" 
    808808     if [ $? -eq 0 ] ; then 
     809        GRUBFLAGS="--modules='zfs part_gpt part_bsd geli'" 
    809810        # Just a GPTID, resolve it down to real device 
    810811        disk="$(map_gptid_to_dev ${i})" 
     
    824825     # Re-install GRUB on this disk 
    825826     echo "Installing GRUB to $disk" >&2 
    826      grub-install --modules='zfs part_gpt part_bsd geli' /dev/${disk} 
     827     grub-install $GRUBFLAGS /dev/${disk} 
    827828  done 
    828829  return 0 
  • src-sh/lpreserver/backend/functions.sh

    r04aeb2a r54d2124  
    504504   else 
    505505      # Creating a GPT disk 
     506      GRUBFLAGS="--modules='zfs part_gpt part_bsd geli'" 
    506507      rc_halt_s "gpart create -s GPT $disk" 
    507508      rc_halt_s "gpart add -b 34 -s 1M -t bios-boot $disk" 
     
    519520   # Lastly we need to stamp GRUB 
    520521   echo "Stamping GRUB on: $disk" 
    521    rc_halt_s "grub-install --modules='zfs part_gpt part_bsd geli' --force /dev/${disk}" 
     522   rc_halt_s "grub-install $GRUBFLAGS --force /dev/${disk}" 
    522523 
    523524   echo "Added $disk ($aDev) to zpool $pool. Resilver will begin automatically." 
  • src-sh/pc-installdialog/pc-installdialog.sh

    r13ccd816 r5b45227  
    642642get_user_realname() 
    643643{ 
     644  while : 
     645  do 
     646    #ask for user's real name 
    644647    get_dlg_ans "--inputbox \"Enter the real name for $USERNAME\" 8 40" 
    645648    if [ -z "$ANS" ] ; then 
    646         ANS="$USERNAME" 
    647     fi 
    648     USERREALNAME="$ANS" 
     649       echo "Real name can not be blank"  >> /tmp/.vartemp.$$ 
     650       dialog --tailbox /tmp/.vartemp.$$ 8 35 
     651       rm /tmp/.vartemp.$$ 
     652       continue 
     653    fi 
     654    #check for invalid characters 
     655    echo "$ANS" | grep -q '^[a-zA-Z]*$' 
     656    if [ $? -eq 1 ] ; then 
     657       echo "Name contains invalid characters!" >> /tmp/.vartemp.$$ 
     658       dialog --tailbox /tmp/.vartemp.$$ 8 35 
     659       rm /tmp/.vartemp.$$ 
     660       continue   
     661    else  
     662       break 
     663    fi 
     664  done   
     665  USERREALNAME="$ANS" 
    649666} 
    650667 
  • src-sh/pc-sysinstall/backend/functions-unmount.sh

    r04aeb2a r54d2124  
    249249  if [ -e "${TMPDIR}/.grub-install-geli" ] ; then 
    250250     echo "GRUB_ENABLE_CRYPTODISK=y" >> ${FSMNT}/usr/local/etc/default/grub 
     251     GRUBFLAGS="--modules='zfs part_gpt part_bsd geli'" 
    251252  fi 
    252253 
     
    263264 
    264265    # Stamp GRUB now 
    265     rc_halt "chroot ${FSMNT} grub-install --modules='zfs part_gpt part_bsd geli' --force $gDisk" 
     266    rc_halt "chroot ${FSMNT} grub-install $GRUBFLAGS --force $gDisk" 
    266267  done < ${TMPDIR}/.grub-install 
    267268 
  • src-sh/warden/scripts/backend/createjail.sh

    r63aed4d rdab326c  
    331331fi 
    332332 
     333# Send notification of jail changes 
     334pc-systemflag WARDENUPDATE SUCCESS 
     335 
    333336exit 0 
  • src-sh/warden/scripts/backend/deletejail.sh

    r698a249 rdab326c  
    8181 
    8282echo "Done" 
     83 
     84# Send notification of jail changes 
     85pc-systemflag WARDENUPDATE SUCCESS 
  • src-sh/warden/scripts/backend/importjail.sh

    r698a249 rdab326c  
    112112 
    113113echo "Done" 
     114 
     115# Send notification of jail changes 
     116pc-systemflag WARDENUPDATE SUCCESS 
  • src-sh/warden/scripts/backend/startjail.sh

    re4da50e rdab326c  
    483483fi 
    484484 
     485# Send notification of jail changes 
     486pc-systemflag WARDENUPDATE SUCCESS 
  • src-sh/warden/scripts/backend/stopjail.sh

    re4da50e rdab326c  
    239239 
    240240echo -e "Done" 
     241 
     242# Send notification of jail changes 
     243pc-systemflag WARDENUPDATE SUCCESS 
  • src-webui/appweb/dispatcher

    r4c6c433 r3da6dccc  
    1111case $1 in 
    1212    warden) $@;; 
     13    pbi) $@;; 
    1314         *) echo "Invalid command run!" ; exit 1 ;; 
    1415esac 
  • src-webui/appweb/share/html/include/functions.php

    r1857094 r3da6dccc  
    11<? 
    22 
    3 function hideurl() 
     3function hideurl($newurl) 
    44{ 
    5    $p = ($_GET['p']); 
     5   if (empty($newurl) ) 
     6     $p = "/?p=" . $_GET['p']; 
     7   else 
     8     $p = "$newurl"; 
    69   ?> 
    710   <script> 
    8         window.history.pushState('AppWeb', 'AppWeb', '/?p=<? echo $p; ?>'); 
     11        window.history.pushState('AppWeb', 'AppWeb', '<? echo $p; ?>'); 
    912   </script> 
    1013   <? 
  • src-webui/port-files/Makefile

    rba45e1a r3da6dccc  
    1212 
    1313RUN_DEPENDS=    pc-updatemanager:${PORTSDIR}/sysutils/pcbsd-utils \ 
    14                 nginx:${PORTSDIR}/www/nginx \ 
    15                 php-config:${PORTSDIR}/lang/php5 
     14                nginx:${PORTSDIR}/www/nginx 
    1615 
     16USE_PHP=        gd 
    1717WRKSRC=         ${WRKDIR}/src-webui 
    1818USES=           pkgconfig 
  • src-webui/port-files/pkg-plist

    r44d05f93 r3da6dccc  
    77share/appweb/html/css/_reset.css 
    88share/appweb/html/css/main.css 
     9share/appweb/html/images/pbiicon.php 
    910share/appweb/html/include/header.html 
    1011share/appweb/html/include/error.html 
     
    1415share/appweb/html/include/main.php 
    1516share/appweb/html/include/nav.html 
     17share/appweb/html/include/sysapp.php 
     18share/appweb/html/include/sysappinfo.php 
    1619share/appweb/html/js/doubletaptogo.js 
    1720share/appweb/html/js/main.js 
     
    1922@dirrmtry etc/sudoers.d 
    2023@dirrm share/appweb/html/css 
     24@dirrm share/appweb/html/images 
    2125@dirrm share/appweb/html/include 
    2226@dirrm share/appweb/html/js 
  • src-sh/syscache/daemon/DB.cpp

    r2ca866a r578b2b9  
    33/* === Representation of Database ==== 
    44  HASH -> Info: [JailList, RepoList]  
    5                Categories: [Jail/<jail name>/, Repo/<repoID>] 
     5               Categories: [Jails/<jail name>/, Repos/<repoID>] 
    66   
    7   Jail Info Category -> Info: [JID, jailIP, jailPath, repoID, isUpdates, updateMessage, pkgList, lastSyncTimeStamp (internal)] 
     7  Jail Info Category -> Info: [JID, jailIP, jailPath, repoID, hasUpdates, updateLog, pkgList, lastSyncTimeStamp (internal)] 
    88                                Categories: [pkg/<local pkg origin>/] 
    99                                 
     
    3434DB::DB(QObject *parent) : QObject(parent){ 
    3535  HASH = new QHash<QString, QString>; 
     36  chkTime = new QTimer(this); 
     37        chkTime->setInterval(1000); 
     38        chkTime->setSingleShot(true); 
     39        connect(chkTime, SIGNAL(timeout()), this, SLOT(initialSync()) ); 
     40  watcher = new QFileSystemWatcher(this); 
     41    connect(watcher, SIGNAL(directoryChanged(QString)), this, SLOT(watcherChange()) ); 
     42    connect(watcher, SIGNAL(fileChanged(QString)), this, SLOT(watcherChange()) ); 
     43  //Setup the watcher to look for the pc-systemflag flags 
     44  if(!QFile::exists("/tmp/.pcbsdflags")){ directSysCmd("pc-systemflag CHECKDIR"); } 
    3645  stopping = false; 
     46  syncing = false; 
    3747} 
    3848 
     
    125135//Internal Hash maintenance functions 
    126136void DB::clearRepo(QString repo){ 
    127          
     137  //Remove All Repo specific info 
     138  QStringList pkeys = HASH->keys(); 
     139    pkeys = pkeys.filter("Repos/"+repo+"/"); 
     140  for(int i=0; i<pkeys.length(); i++){ HASH->remove(pkeys[i]); }         
    128141} 
    129142 
     
    135148} 
    136149 
    137 void DB::clearRemotePkg(QString pkgprefix){ 
    138          
    139 } 
    140  
    141150void DB::clearLocalPkg(QString pkgprefix){ 
    142151  QStringList pkeys = HASH->keys(); 
     
    145154} 
    146155 
     156bool DB::needsLocalSync(QString jail){ 
     157  //Checks the pkg database file for modification since the last sync 
     158  if(!HASH->contains("Jails/"+jail+"/lastSyncTimeStamp")){ return true; } 
     159  else{ 
     160    //Previously synced - look at the DB modification time 
     161    QString path = "/var/db/pkg/local.sqlite"; 
     162    if(jail!=LOCALSYSTEM){ path.prepend( HASH->value("Jails/"+jail+"/jailPath","") ); } 
     163    qint64 mod = QFileInfo(path).lastModified().toMSecsSinceEpoch(); 
     164    qint64 stamp = HASH->value("Jails/"+jail+"/lastSyncTimeStamp","").toLongLong(); 
     165    return (mod > stamp); //was it modified after the last sync? 
     166  } 
     167} 
     168 
     169bool DB::needsRemoteSync(QString jail){ 
     170  //Checks the pkg repo files for changes since the last sync 
     171  if(!HASH->contains("Jails/"+jail+"/repoID")){ return true; } //no repoID yet 
     172  else if(HASH->value("Jails/"+jail+"/repoID") != generateRepoID(jail) ){ return true; } 
     173  else if( !HASH->contains("Repos/"+HASH->value("Jails/"+jail+"/repoID")+"/lastSyncTimeStamp") ){ return true; } 
     174  else{ 
     175    QDir pkgdb( HASH->value("Jails/"+jail+"/jailPath","")+"/var/db/pkg" ); 
     176    QFileInfoList repos = pkgdb.entryInfoList(QStringList() << "repo-*.sqlite"); 
     177    qint64 stamp = HASH->value("Repos/"+HASH->value("Jails/"+jail+"/repoID")+"/lastSyncTimeStamp").toLongLong(); 
     178    for(int i=0; i<repos.length(); i++){ 
     179      //check each repo database for recent changes 
     180      if(repos[i].lastModified().toMSecsSinceEpoch() > stamp){ return true; } 
     181    } 
     182    return false; 
     183  } 
     184} 
     185 
     186QString DB::generateRepoID(QString jail){ 
     187  QString cmd = "pkg -v -v"; 
     188  if(jail!=LOCALSYSTEM){ cmd = "pkg -j "+HASH->value("Jails/"+jail+"/JID")+" -v -v"; } 
     189  QStringList urls = directSysCmd(cmd).filter(" url "); 
     190  QString ID; 
     191  for(int i=0; i<urls.length(); i++){ 
     192    ID.append( urls[i].section(" : ",1,50).simplified() ); 
     193  } 
     194  //qDebug() << "RepoID: "<< jail << ID; 
     195  return ID; 
     196} 
     197 
    147198//=============== 
    148199//  PRIVATE SLOTS 
    149200//=============== 
     201void DB::watcherChange(){ 
     202  if(syncing){ return; } //tons of these signals while syncing 
     203  //qDebug() << "Watcher found change:" <<      dir; 
     204  if(chkTime->isActive()){ chkTime->stop(); } 
     205  chkTime->start(); 
     206} 
     207 
    150208//General Sync Functions 
    151209void DB::initialSync(){ 
     210  //just in case multiple sync calls in quick succession - check again in a few seconds 
     211  if(syncing){ return; } 
     212    /*qDebug() << "Sync Request"; 
     213    if(chkTime->isActive()){ qDebug() << " - stop timer"; chkTime->stop(); } 
     214    chkTime->start();  
     215    return;  
     216  }*/ 
     217  syncing = true; 
     218  //qDebug() << "Syncing system information"; 
    152219  //First do the operations that can potentially lock the pkg database first, but are fast 
     220  if(stopping){ return; } 
    153221  syncJailInfo(); 
     222  if(stopping){ return; } 
    154223  syncPkgLocal(); 
     224  if(stopping){ return; } 
    155225  //Now do all the remote pkg info retrieval (won't lock the pkg database in 1.3.x?) 
    156226  syncPkgRemote(); 
     227  if(stopping){ return; } 
    157228  //Now Load the PBI database (more useful, but will not lock system usage) 
    158229  syncPbi(); 
    159230  //Now check for overall system updates 
     231   
     232  //qDebug() << " - Finished data sync"; 
     233  syncing = false; //done syncing 
    160234} 
    161235 
    162236void DB::syncJailInfo(){ 
    163237  //Get the internal list of jails 
     238  // --clear watched directories 
     239  if(!watcher->directories().isEmpty()){ watcher->removePaths( watcher->directories() ); } 
     240    watcher->addPath("/var/db/pkg"); //local system pkg database should always be watched 
     241    watcher->addPath("/tmp/.pcbsdflags"); //local PC-BSD system flags 
    164242  QStringList jails = HASH->value("JailList","").split(LISTDELIMITER); 
    165243  //Now get the current list of running jails and insert individual jail info 
     
    174252    HASH->insert("Jails/"+name+"/jailIP", info[i].section(" ",1,1)); 
    175253    HASH->insert("Jails/"+name+"/jailPath", info[i].section(" ",3,3)); 
     254    watcher->addPath(info[i].section(" ",3,3)+"/var/db/pkg"); //watch this jail's pkg database 
    176255  } 
    177256  HASH->insert("JailList", found.join(LISTDELIMITER)); 
     
    186265void DB::syncPkgLocalJail(QString jail){ 
    187266  if(jail.isEmpty()){ return; } 
     267 //Sync the local pkg information 
     268 if(needsLocalSync(jail)){ 
     269  //qDebug() << "Sync local jail info:" << jail; 
    188270  QString prefix = "Jails/"+jail+"/pkg/"; 
    189271  clearLocalPkg(prefix); //clear the old info from the hash 
     
    194276    cmd.replace("pkg ", "pkg -j "+HASH->value("Jails/"+jail+"/JID")+" "); 
    195277  } 
     278  if(stopping){ return; } 
    196279  QStringList info = directSysCmd(cmd+opt).join("").split("PKG::"); 
    197280  QStringList installed; 
     
    221304  //Now go through the pkgs and get the more complicated/detailed info 
    222305  // -- dependency list 
     306  if(stopping){ return; } 
    223307  info = directSysCmd(cmd+" %o::::%do"); 
    224308  installed.clear(); 
     
    234318  HASH->insert(prefix+orig+"/dependencies", installed.join(LISTDELIMITER)); //make sure to save the last one too 
    235319  // -- reverse dependency list 
     320  if(stopping){ return; } 
    236321  info = directSysCmd(cmd+" %o::::%ro"); 
    237322  installed.clear(); 
     
    247332  HASH->insert(prefix+orig+"/rdependencies", installed.join(LISTDELIMITER)); //make sure to save the last one too 
    248333  // -- categories 
     334  if(stopping){ return; } 
    249335  info = directSysCmd(cmd+" %o::::%C"); 
    250336  installed.clear(); 
     
    260346  HASH->insert(prefix+orig+"/categories", installed.join(LISTDELIMITER)); //make sure to save the last one too 
    261347  // -- files 
     348  if(stopping){ return; } 
    262349  info = directSysCmd(cmd+" %o::::%Fp"); 
    263350  installed.clear(); 
     
    273360  HASH->insert(prefix+orig+"/files", installed.join(LISTDELIMITER)); //make sure to save the last one too 
    274361  // -- options 
     362  if(stopping){ return; } 
    275363  info = directSysCmd(cmd+" %o::::%Ok=%Ov"); 
    276364  installed.clear(); 
     
    286374  HASH->insert(prefix+orig+"/options", installed.join(LISTDELIMITER)); //make sure to save the last one too   
    287375  // -- licenses 
     376  if(stopping){ return; } 
    288377  info = directSysCmd(cmd+" %o::::%L"); 
    289378  installed.clear(); 
     
    299388  HASH->insert(prefix+orig+"/license", installed.join(LISTDELIMITER)); //make sure to save the last one too  
    300389  // -- users 
     390  if(stopping){ return; } 
    301391  info = directSysCmd(cmd+" %o::::%U"); 
    302392  installed.clear(); 
     
    312402  HASH->insert(prefix+orig+"/users", installed.join(LISTDELIMITER)); //make sure to save the last one too 
    313403  // -- groups 
     404  if(stopping){ return; } 
    314405  info = directSysCmd(cmd+" %o::::%G"); 
    315406  installed.clear(); 
     
    324415  } 
    325416  HASH->insert(prefix+orig+"/groups", installed.join(LISTDELIMITER)); //make sure to save the last one too 
     417 } //done with local pkg sync 
     418 if(needsRemoteSync(jail) || needsLocalSync(jail)){ 
     419  //qDebug() << "Sync jail pkg update availability:" << jail; 
    326420  //Now Get jail update status/info 
    327   cmd = "pc-updatemanager pkgcheck"; 
     421  if(stopping){ return; } 
     422  QString cmd = "pc-updatemanager pkgcheck"; 
    328423  if(jail!=LOCALSYSTEM){ cmd = "pc-updatemanager -j "+jail+" pkgcheck"; } 
    329424  QString log = directSysCmd(cmd).join("\n"); 
     
    331426  if(log.contains("To start the upgrade run ")){ HASH->insert("Jails/"+jail+"/hasUpdates", "true"); } 
    332427  else{ HASH->insert("Jails/"+jail+"/hasUpdates", "false"); } 
    333 } 
     428 } 
     429  //Now stamp the current time this jail was checked 
     430  HASH->insert("Jails/"+jail+"/lastSyncTimeStamp", QString::number(QDateTime::currentMSecsSinceEpoch())); 
     431} 
     432 
    334433 
    335434void DB::syncPkgLocal(){ 
    336435  QStringList jails = HASH->value("JailList","").split(LISTDELIMITER); 
    337436  //Do the Local system first 
     437  if(stopping){ return; } 
    338438  syncPkgLocalJail(LOCALSYSTEM); 
    339439  //Now do any running jails 
    340440  for(int i=0; i<jails.length(); i++){ 
     441    if(stopping){ return; } 
    341442    syncPkgLocalJail(jails[i]); 
    342443  } 
    343444} 
    344445 
     446void DB::syncPkgRemoteJail(QString jail){ 
     447  if(jail.isEmpty()){ return; } 
     448  //Sync the local pkg information 
     449  if(needsRemoteSync(jail)){ 
     450    QString repoID = generateRepoID(jail); 
     451    HASH->insert("Jails/"+jail+"/repoID", repoID); 
     452    //Now get all the remote pkg info for this repoID/jail 
     453    clearRepo(repoID); 
     454    //Remote pkg info not retrieved yet 
     455           
     456  } 
     457  //Update the timestamp for this repo 
     458  HASH->insert("Repos/"+HASH->value("Jails/"+jail+"/repoID")+"/lastSyncTimeStamp", QString::number(QDateTime::currentMSecsSinceEpoch())); 
     459} 
     460 
    345461void DB::syncPkgRemote(){ 
    346          
     462  QStringList jails = HASH->value("JailList","").split(LISTDELIMITER); 
     463  //Do the Local system first 
     464  if(stopping){ return; } 
     465  syncPkgRemoteJail(LOCALSYSTEM); 
     466  //Now do any running jails 
     467  for(int i=0; i<jails.length(); i++){ 
     468    if(stopping){ return; } 
     469    syncPkgRemoteJail(jails[i]); 
     470  } 
    347471} 
    348472 
  • src-sh/syscache/daemon/DB.h

    rc1fbd79 r578b2b9  
    1212#include <QTimer> 
    1313#include <QDebug> 
     14#include <QFileSystemWatcher> 
     15#include <QFileInfo> 
     16#include <QDateTime> 
     17#include <QDir> 
    1418 
    1519class DB : public QObject{ 
     
    2731private: 
    2832        QHash<QString, QString> *HASH; 
    29         bool cmdRunning, stopping; 
     33        QFileSystemWatcher *watcher; 
     34        QTimer *chkTime; 
     35        bool cmdRunning, stopping, syncing; 
    3036 
    3137        //System Command functions  
     
    3642        void clearRepo(QString repo); 
    3743        void clearJail(QString jail); 
    38         void clearRemotePkg(QString pkgprefix); 
    3944        void clearLocalPkg(QString pkgprefix); 
    4045 
     46        //Internal sync checks 
     47        bool needsLocalSync(QString jail); 
     48        bool needsRemoteSync(QString jail); 
     49 
     50        //Simplification functions 
     51        QString generateRepoID(QString jail); 
     52 
    4153private slots: 
     54        void watcherChange(); //watcher found something change 
    4255        //General Sync Functions 
    4356        void initialSync(); 
     
    4558        void syncPkgLocalJail(QString jail); 
    4659        void syncPkgLocal(); 
     60        void syncPkgRemoteJail(QString jail); 
    4761        void syncPkgRemote(); 
    4862        void syncSysStatus(); 
Note: See TracChangeset for help on using the changeset viewer.