[PC-BSD Commits] r21266 - in pcbsd/current/src-sh: pc-extractoverlay xtrafiles/local/share/pcbsd/scripts

svn at pcbsd.org svn at pcbsd.org
Thu Jan 31 10:46:34 PST 2013


Author: kris
Date: 2013-01-31 18:46:34 +0000 (Thu, 31 Jan 2013)
New Revision: 21266

Modified:
   pcbsd/current/src-sh/pc-extractoverlay/pc-extractoverlay
   pcbsd/current/src-sh/xtrafiles/local/share/pcbsd/scripts/sys-init.sh
Log:

Add some initial sys-init code, so we can extract the desktop / server
overlay files, and setup some first time defaults



Modified: pcbsd/current/src-sh/pc-extractoverlay/pc-extractoverlay
===================================================================
--- pcbsd/current/src-sh/pc-extractoverlay/pc-extractoverlay	2013-01-31 17:53:00 UTC (rev 21265)
+++ pcbsd/current/src-sh/pc-extractoverlay/pc-extractoverlay	2013-01-31 18:46:34 UTC (rev 21266)
@@ -33,11 +33,11 @@
   tar xvmf ${distFile} ${excludeOpt} . 2>/dev/null
   if [ $? -eq 0 ] ; then
     echo -e "DONE"
-    exit 0
   else
     echo -e "FAILED"
-    exit 1
+    status="1"
   fi
+  post_extract_setup
 }
 
 do_server_overlay()
@@ -52,13 +52,46 @@
   tar xvmf ${distFile} ${excludeOpt} . 2>/dev/null
   if [ $? -eq 0 ] ; then
     echo -e "DONE"
-    exit 0
   else
     echo -e "FAILED"
-    exit 1
+    status="1"
   fi
+  post_extract_setup
 }
 
+
+# Files we need to touch or change after an upgrade
+post_extract_setup()
+{
+  grep -q 'rc.conf.pcbsd' /etc/defaults/rc.conf
+  if [ $? -ne 0 ] ; then
+    # Setup /etc/defaults/rc.conf
+    sed -i '' 's|/etc/rc.conf /etc/rc.conf.local|/etc/rc.conf.pcbsd /etc/rc.conf /etc/rc.conf.local|g' /etc/defaults/rc.conf 2>/dev/null
+    grep -q "rc.conf.pcbsd" ${PDESTDIR4}/etc/defaults/rc.conf
+    if [ $? -ne 0 ] ; then
+      echo "WARNING: rc.conf.pcbsd not enabled in /etc/defaults/rc.conf"
+      status="1"
+    fi
+  fi
+
+  # See if we need to adjust pkg.conf
+  grep -q "ARCH" /usr/local/etc/pkg.conf
+  if [ $? -eq 0 ] ; then
+    ARCH=`uname -m`
+    FBSDVER=`uname -r`
+    sed -i '' "s|VERSION|$FBSDVER|g" /usr/local/etc/pkg.conf
+    if [ $? -ne 0 ] ; then
+       echo "WARNING: Failed setting VERSION in pkg.conf"
+       status="1"
+    fi
+    sed -i '' "s|ARCH|$ARCH|g" /usr/local/etc/pkg.conf
+    if [ $? -ne 0 ] ; then
+       echo "WARNING: Failed setting ARCH in pkg.conf"
+       status="1"
+    fi
+  fi
+}
+
 show_opts()
 {
    cat << EOF
@@ -77,6 +110,7 @@
 
 # Set some defaults
 sysinit="no"
+status="0"
 
 # Parse CLI flags
 while [ $# -gt 0 ]; do
@@ -101,4 +135,4 @@
           *) show_opts ;;
 esac
 
-exit 0
+exit $status

Modified: pcbsd/current/src-sh/xtrafiles/local/share/pcbsd/scripts/sys-init.sh
===================================================================
--- pcbsd/current/src-sh/xtrafiles/local/share/pcbsd/scripts/sys-init.sh	2013-01-31 17:53:00 UTC (rev 21265)
+++ pcbsd/current/src-sh/xtrafiles/local/share/pcbsd/scripts/sys-init.sh	2013-01-31 18:46:34 UTC (rev 21266)
@@ -26,11 +26,26 @@
     su ${i} -c "flashpluginctl off"
     su ${i} -c "flashpluginctl on"
   done
+
+  # Enable the system updater tray
+  pbreg set /PC-BSD/SystemUpdater/runAtStartup true
+
+  # Set running desktop
+  pbreg set /PC-BSD/SysType PCBSD
+
+  # Init the desktop
+  /usr/local/bin/pc-extractoverlay desktop --sysinit
+  exit $?
 fi
 
 ################################################
 # Do server specific init
 ################################################
 if [ "$1" = "server" ] ; then
+  # Set running a server
+  pbreg set /PC-BSD/SysType TRUEOS
 
+  # Init the server
+  /usr/local/bin/pc-extractoverlay server --sysinit
+  exit $?
 fi



More information about the Commits mailing list