source: overlays/install-overlay/root/PCBSDStart.sh

Last change on this file was 6cb4b4c, checked in by Kris Moore <kris@…>, 9 days ago

Fix issue with some ifconfig detected NICS not having dhclient run
on them

  • Property mode set to 100755
File size: 2.8 KB
Line 
1#!/bin/sh
2# Copyright 2014 PC-BSD Software
3# http://www.pcbsd.org
4# Author: Kris Moore
5###########################################################################
6MM_CHARSET="UTF-8" ; export MM_CHARSET
7LANG="en_US.UTF-8" ; export LANG
8LC_CTYPE="en_US.UTF-8" ; export LC_CTYPE     
9LC_COLLATE="POSIX" ; export LC_COLLATE
10
11# Make sure this is only executed on the first login, in order for other ctrl-fX screens to work
12if [ -f "/tmp/1stRun" ] 
13then
14  exit
15fi
16
17touch /tmp/1stRun
18
19# Make /var/tmp link
20mv /var/tmp /tmp/vartmp
21ln -s /tmp/vartmp /var/tmp
22
23# Check ZFS tmpdir
24if [ ! -d "/tmp/zfs" ] ; then
25  mkdir /tmp/zfs
26  if [ $? -ne 0 ] ; then
27     echo "Error creating /tmp/zfs, ZFS installs will not work!"
28     echo "Press ENTER to continue"
29     read tmp
30  fi
31fi
32
33# Check if we have FreeBSD dist files on this media
34if [ ! -d "/dist-fbsd" ] ; then
35   touch /tmp/no-fbsd-release
36fi
37
38# Enable the debug version of pc-sysinstall
39/root/debugpcsysinstall.sh
40
41# Check if we are running in a VM and enable guest services
42if [ -e "/usr/local/etc/rc.d/vboxguest" ] ; then
43  /usr/local/etc/rc.d/vboxguest onestart
44fi
45
46# Set all NICS to DHCP
47NICS=`ifconfig -l`
48for i in $NICS
49do
50  if [ "$i" = "lo0" ] ; then continue ; fi
51
52  echo "Enabling networking on ${i}..."
53  echo "ifconfig_${i}_ipv6=\"inet6 accept_rtadv\"" >> /etc/rc.conf
54  echo "ifconfig_${i}=\"DHCP\"" >> /etc/rc.conf
55  (dhclient ${i} >/dev/null 2>/dev/null ) &
56done
57
58# Check if we are booting in LIVE or INSTALL mode
59if [ -e "/usr/pcbsd-live" ]; then
60
61  # Check if we should be going to the console instead of X directly
62  /sbin/sysctl kern.module_path | /usr/bin/grep "CONSOLE" >/dev/null 2>/dev/null
63  FOUND="$?"
64  if [ "$FOUND" = "0" ]
65  then
66    /root/PCBSDtext.sh
67    reboot -q
68    exit
69  fi
70
71  # We are running LIVE mode, start that script now
72  sh /root/PCBSDStartLive.sh
73  exit 0
74fi
75
76# Source our functions
77. /root/functions.sh
78
79# Check if we have an auto-install directive
80if [ -e "/tmp/pc-autoinstall.conf" ]
81then
82  # Start the parser on this directive and begin the install
83  /usr/sbin/pc-sysinstall start-autoinstall /tmp/pc-autoinstall.conf
84fi
85
86# Run the intial sorting of directories
87mv /root/.fluxbox /memfs/
88ln -s /memfs/.fluxbox /root/.fluxbox
89
90# Create the .qt directory
91mkdir /tmp/.qt
92mkdir /tmp/xkb
93
94# Check if we should be going to the console instead of X directly
95kenv xconsole 2>/dev/null | grep -q "YES"
96if [ $? -eq 0 -o -e "/root/trueos-installonly" ]; then
97  /root/PCBSDtext.sh
98  reboot -q
99  exit
100fi
101
102# Now start xorg
103start_xorg
104
105# Check if we had a successful SysInstaller exit
106if [ -e "/root/.exitStatus" ] ; then
107  STATUS="`cat /root/.exitStatus`"
108  if [ "$STATUS" = "0" ] ; then
109    reboot -q
110  else
111    echo "Installation failed! Press any key to drop to shell or type 'reboot' to restart the system"
112    read tmp
113    if [ "$tmp" = "reboot" ] ; then
114      reboot -q
115    else
116      /bin/sh
117    fi
118  fi
119fi
Note: See TracBrowser for help on using the repository browser.