[c5c522c] | 1 | #!/bin/sh |
---|
| 2 | #(C)2005 DatuX, used examples/concepts of knoppix and gentoo live cd's. |
---|
| 3 | |
---|
| 4 | cat /etc/syn3.txt |
---|
| 5 | |
---|
| 6 | ################################################## script initiation |
---|
| 7 | |
---|
| 8 | source /etc/initrd.defaults |
---|
| 9 | source /etc/initrd.scripts |
---|
| 10 | |
---|
| 11 | |
---|
| 12 | echo -e "\n${NORMAL}${BOLD} [ Welcome to the Syn-3 boot ramdisk ] ${NORMAL}\n" |
---|
| 13 | |
---|
| 14 | |
---|
| 15 | |
---|
| 16 | #bare system basics |
---|
| 17 | SHELL=0 |
---|
| 18 | export PATH=/sbin:/bin:/usr/sbin:/usr/bin |
---|
| 19 | |
---|
| 20 | mount -n -t devtmpfs devtmpfs /dev |
---|
| 21 | mkdir /dev/pts |
---|
| 22 | mount -n -t devpts devpts /dev/pts |
---|
| 23 | mount -n -t proc proc /proc |
---|
| 24 | mount -n -t sysfs sysfs /sys |
---|
| 25 | |
---|
| 26 | echo '4' > /proc/sys/kernel/printk |
---|
| 27 | |
---|
| 28 | |
---|
| 29 | #WORKAROUND: for issue http://fhackts.wordpress.com/2014/03/10/very-slow-disk-write-performance-linux/ |
---|
| 30 | #(needed on 32bits systems with 3.4+ kernel and >8G mem.) |
---|
| 31 | echo 1 > /proc/sys/vm/highmem_is_dirtyable |
---|
| 32 | |
---|
| 33 | |
---|
| 34 | #start device management |
---|
| 35 | udevd --daemon --resolve-names=late 2>/dev/null >/dev/null |
---|
| 36 | udevadm trigger |
---|
| 37 | # udevadm settle #slow and not neccesary |
---|
| 38 | ln -s /proc/self/fd /dev/fd |
---|
| 39 | |
---|
| 40 | echo -en "$NOBLANK" |
---|
| 41 | |
---|
| 42 | #usb keyboard/mouse support while inside initrd |
---|
| 43 | modprobe usbhid |
---|
| 44 | |
---|
| 45 | |
---|
| 46 | |
---|
| 47 | #determine kernel parameters that are interesting for us |
---|
| 48 | CMDLINE=`cat /proc/cmdline` |
---|
| 49 | SPLASH=1 |
---|
| 50 | FSCHECK=1 |
---|
| 51 | NET_USER=guest |
---|
| 52 | NET_PASS=guest |
---|
| 53 | for x in ${CMDLINE} |
---|
| 54 | do |
---|
| 55 | case "${x}" in |
---|
| 56 | # real_root\=*) |
---|
| 57 | # REAL_ROOT=`parse_opt "${x}"` |
---|
| 58 | # ;; |
---|
| 59 | #primary node ip |
---|
| 60 | local_ip\=*) |
---|
| 61 | LOCAL_IP=`parse_opt "${x}"` |
---|
| 62 | DRBD=1 |
---|
| 63 | ;; |
---|
| 64 | #secondary node ip |
---|
| 65 | remote_ip\=*) |
---|
| 66 | REMOTE_IP=`parse_opt "${x}"` |
---|
| 67 | ;; |
---|
| 68 | #ethernet device |
---|
| 69 | eth\=*) |
---|
| 70 | ETH=`parse_opt "${x}"` |
---|
| 71 | ;; |
---|
| 72 | #sync rate |
---|
| 73 | rate\=*) |
---|
| 74 | RATE=`parse_opt "${x}"` |
---|
| 75 | ;; |
---|
| 76 | #rebuild local side and discard metadata |
---|
| 77 | rebuild) |
---|
| 78 | REBUILD=1 |
---|
| 79 | ;; |
---|
| 80 | #force local side to be primary and discard metadata |
---|
| 81 | forceprimary) |
---|
| 82 | FORCEPRIMARY=1 |
---|
| 83 | ;; |
---|
| 84 | #step by step debugging mode, enter shell after every step |
---|
| 85 | debug) |
---|
| 86 | DEBUG=1 |
---|
| 87 | ;; |
---|
| 88 | #very verbose output (show all shell commands) |
---|
| 89 | verbose) |
---|
| 90 | set -x |
---|
| 91 | ;; |
---|
| 92 | #enters a shell two times: before doing all the initrd stuff, and after it. |
---|
| 93 | shell) |
---|
| 94 | SHELL=1 |
---|
| 95 | ;; |
---|
| 96 | #disables splashscreen |
---|
| 97 | text) |
---|
| 98 | SPLASH= |
---|
| 99 | ;; |
---|
| 100 | #disables filesystem checks |
---|
| 101 | nofscheck) |
---|
| 102 | FSCHECK= |
---|
| 103 | ;; |
---|
| 104 | |
---|
| 105 | #start network + telnet deamon for support shell |
---|
| 106 | sup) |
---|
| 107 | SUP=1 |
---|
| 108 | ;; |
---|
| 109 | |
---|
| 110 | #network device to configure |
---|
| 111 | net_dev\=*) |
---|
| 112 | NET_DEV=`parse_opt "${x}"` |
---|
| 113 | ;; |
---|
| 114 | |
---|
| 115 | #network IP to apply (omit for dhcp) |
---|
| 116 | net_ip\=*) |
---|
| 117 | NET_IP=`parse_opt "${x}"` |
---|
| 118 | ;; |
---|
| 119 | |
---|
| 120 | #network install server. Should be a CIFS share with guest/guest access. |
---|
| 121 | #For example: //192.168.13.2/tftp/normal |
---|
| 122 | net_server\=*) |
---|
| 123 | NET_SERVER=`parse_opt "${x}"` |
---|
| 124 | ;; |
---|
| 125 | |
---|
| 126 | #user and password for this share, default is guest/guest. |
---|
| 127 | net_user\=*) |
---|
| 128 | NET_USER=`parse_opt "${x}"` |
---|
| 129 | ;; |
---|
| 130 | |
---|
| 131 | net_pass\=*) |
---|
| 132 | NET_PASS=`parse_opt "${x}"` |
---|
| 133 | ;; |
---|
| 134 | |
---|
| 135 | #ask for password (usefull for admins to configure permanent stuff) |
---|
| 136 | net_pass_ask) |
---|
| 137 | NET_PASS_ASK=1 |
---|
| 138 | ;; |
---|
| 139 | |
---|
| 140 | #boots this live image |
---|
| 141 | #Autodetects installer CDrom or USB stick. |
---|
| 142 | #If NET_SERVER is specified, it assumes that has the cdrom-contents |
---|
| 143 | bootimage\=*) |
---|
| 144 | BOOTIMAGE=`parse_opt "${x}"` |
---|
| 145 | ;; |
---|
| 146 | |
---|
| 147 | #pivot to the image instead of chrooting to it. |
---|
| 148 | #this lets you unmount the initrd and regain memory, but you cant turn back to the initrd. |
---|
| 149 | pivotimage) |
---|
| 150 | PIVOTIMAGE=1 |
---|
| 151 | ;; |
---|
| 152 | |
---|
| 153 | #DANGEROUS: does not boot the image, but instead gunzips BOOTIMAGE and writes it to block-device INSTALL_DEVICE |
---|
| 154 | #This is used to "flash" embedded systems like Alix boards. |
---|
| 155 | install_device\=*) |
---|
| 156 | INSTALL_DEVICE=`parse_opt "${x}"` |
---|
| 157 | ;; |
---|
| 158 | |
---|
| 159 | driver\=*) |
---|
| 160 | D=`parse_opt "${x}"` |
---|
| 161 | EXTRA_MODS="${EXTRA_MODS} ${D}" |
---|
| 162 | ;; |
---|
| 163 | *) |
---|
| 164 | ;; |
---|
| 165 | esac |
---|
| 166 | done |
---|
| 167 | |
---|
| 168 | |
---|
| 169 | ############################################# do we want a splashscreen? |
---|
| 170 | |
---|
| 171 | if [ "$SPLASH" ]; then |
---|
| 172 | modprobe uvesafb mode_option=800x600-16 |
---|
| 173 | splashreset boot & |
---|
| 174 | sleep 1 |
---|
| 175 | fi |
---|
| 176 | |
---|
| 177 | ############################################## init initrd filesystem |
---|
| 178 | |
---|
| 179 | |
---|
| 180 | #debuggin hack :) |
---|
| 181 | if [ "${DEBUG}" == "1" ]; then |
---|
| 182 | splashmode verbose 2>/dev/null |
---|
| 183 | splashstep () |
---|
| 184 | { |
---|
| 185 | debug_shell "$*" |
---|
| 186 | /bin/splashstep "$*" |
---|
| 187 | } |
---|
| 188 | splashinfo () |
---|
| 189 | { |
---|
| 190 | debug_shell "$*" |
---|
| 191 | /bin/splashinfo "$*" |
---|
| 192 | } |
---|
| 193 | splasherror () |
---|
| 194 | { |
---|
| 195 | debug_shell "$*" |
---|
| 196 | /bin/splasherror "$*" |
---|
| 197 | } |
---|
| 198 | splashwarn () |
---|
| 199 | { |
---|
| 200 | debug_shell "$*" |
---|
| 201 | /bin/splashwarn "$*" |
---|
| 202 | } |
---|
| 203 | fi |
---|
| 204 | |
---|
| 205 | if [ "${SHELL}" -eq '1' ]; then |
---|
| 206 | splashmode verbose 2>/dev/null |
---|
| 207 | error_shell "Entered pre-boot shell" |
---|
| 208 | fi |
---|
| 209 | |
---|
| 210 | |
---|
| 211 | ############################################## LOAD MODULES |
---|
| 212 | |
---|
| 213 | echo '4' > /proc/sys/kernel/printk |
---|
| 214 | |
---|
| 215 | #When we're in a virtual machine, autoload open_vm_modules: |
---|
| 216 | echo -en "Checking if we're a vmware guest..." |
---|
| 217 | if vmware-checkvm 2>/dev/null ; then |
---|
| 218 | echo "YES" |
---|
| 219 | splashinfo "Loading vmware guest modules" |
---|
| 220 | modprobe vmhgfs |
---|
| 221 | modprobe vmblock |
---|
| 222 | #unresovled symbols: modprobe vsock |
---|
| 223 | modprobe pvscsi |
---|
| 224 | modprobe vmxnet |
---|
| 225 | modprobe vmci |
---|
| 226 | modprobe vmsync |
---|
| 227 | modprobe vmmemctl |
---|
| 228 | else |
---|
| 229 | echo "NO" |
---|
| 230 | fi |
---|
| 231 | |
---|
| 232 | |
---|
| 233 | splashstep "Detecting hardware" |
---|
| 234 | |
---|
| 235 | #make absolutely sure that we cant load any framebuffer drivers in the hardware detection routines: |
---|
| 236 | rm -r /lib/modules/*/kernel/drivers/video/ 2>/dev/null |
---|
| 237 | |
---|
| 238 | #WORKAROUND: voor cqparray, deze MOET eerst geladen worden, indien |
---|
| 239 | #er bepaalde andere scsi controllers zijn. (sym5xxx) |
---|
| 240 | #OBSOLETE in 2.6.27?: modprobe cpqarray |
---|
| 241 | |
---|
| 242 | |
---|
| 243 | #Autoload all modules for the detected modaliases in /sys: |
---|
| 244 | echo -en "${GOOD}* ${NORMAL}${BOLD} Detecting devices: ${NORMAL}" |
---|
| 245 | for D in `find /sys -name modalias`; do |
---|
| 246 | echo -en "." |
---|
| 247 | modprobe `cat $D` 2>/dev/null; |
---|
| 248 | done |
---|
| 249 | echo |
---|
| 250 | |
---|
| 251 | #load extra modules |
---|
| 252 | for D in ${EXTRA_MODS}; do |
---|
| 253 | echo -en "${GOOD}* ${NORMAL}${BOLD} Loading extra driver ${D}:${NORMAL}" |
---|
| 254 | modprobe ${D} |
---|
| 255 | backup |
---|
| 256 | done |
---|
| 257 | |
---|
| 258 | |
---|
| 259 | #echo -e "${GOOD} DONE ${NORMAL}" |
---|
| 260 | #echo '0' > /proc/sys/kernel/printk |
---|
| 261 | cd / |
---|
| 262 | |
---|
| 263 | splashstep "Loading modules" |
---|
| 264 | # Load appropriate kernel modules |
---|
| 265 | for modules in $MY_HWOPTS |
---|
| 266 | do |
---|
| 267 | modules_scan $modules |
---|
| 268 | eval DO_`echo $modules | sed 's/-//'`=1 |
---|
| 269 | splashstep |
---|
| 270 | done |
---|
| 271 | |
---|
| 272 | |
---|
| 273 | ########################################## START SUPPORT SHELL? |
---|
| 274 | if [ "$SUP" ]; then |
---|
| 275 | sup |
---|
| 276 | fi |
---|
| 277 | |
---|
| 278 | ########################################## CONFIGURE NETWORK? |
---|
| 279 | # Used for network installs and images |
---|
| 280 | if [ "$NET_DEV" ]; then |
---|
| 281 | splashstep "Getting network address" |
---|
| 282 | ifconfig $NET_DEV up |
---|
| 283 | if [ "$NET_IP" ]; then |
---|
| 284 | ifconfig $NET_DEV $NET_IP |
---|
| 285 | else |
---|
| 286 | udhcpc -i $NET_DEV |
---|
| 287 | fi |
---|
| 288 | fi |
---|
| 289 | |
---|
| 290 | |
---|
| 291 | ########################################## BOOT an image instead of the harddisks? |
---|
| 292 | if [ "$BOOTIMAGE" ]; then |
---|
| 293 | #Because we have no config yet, this will assign network cards in order of mac-adress. |
---|
| 294 | #This is to give the user a nice consistent order in case of redundancy installation. |
---|
| 295 | source /etc/if-assign.boot |
---|
| 296 | |
---|
| 297 | boot_image |
---|
| 298 | #after the image we will just continue the normal boot procedure |
---|
| 299 | fi |
---|
| 300 | |
---|
| 301 | ############################################## RAID DETECTION |
---|
| 302 | |
---|
| 303 | #Activate software raid |
---|
| 304 | splashstep "Activating raid" |
---|
| 305 | |
---|
| 306 | #mknod /dev/md0 b 9 0 2>/dev/null |
---|
| 307 | #mknod /dev/md1 b 9 1 2>/dev/null |
---|
| 308 | |
---|
| 309 | #mdadm -Ac partitions -m dev /dev/md0 2>/dev/null |
---|
| 310 | #mdadm -Ac partitions -m dev /dev/md1 2>/dev/null |
---|
| 311 | echo "Assembling md0 (legacy 0.9 mode only)..." |
---|
| 312 | mdadm --assemble --scan --super-minor=0 --run |
---|
| 313 | |
---|
| 314 | echo "Assembling md1 (legacy 0.9 mode only)..." |
---|
| 315 | mdadm --assemble --scan --super-minor=1 --run |
---|
| 316 | |
---|
| 317 | echo "Assembling md0 and md1 (1.0+ mode only)..." |
---|
| 318 | #speed up creation, because we have no udev rules for this: |
---|
| 319 | mkdir /dev/md |
---|
| 320 | mknod /dev/md/0 b 9 0 |
---|
| 321 | mknod /dev/md/1 b 9 1 |
---|
| 322 | mdadm --assemble --scan |
---|
| 323 | |
---|
| 324 | #wait for device nodes to be created. |
---|
| 325 | udevadm settle |
---|
| 326 | |
---|
| 327 | echo -ne "${BOLD} ::${NORMAL} Checking boot RAID status (/dev/md0)..." |
---|
| 328 | mdadm --detail --test /dev/md0 >/dev/null 2>&1 |
---|
| 329 | STATUS=$? |
---|
| 330 | if [ "$STATUS" = "0" ] || [ "$STATUS" = "1" ]; then |
---|
| 331 | echo -e "${GOOD} OK ${NORMAL}" |
---|
| 332 | else |
---|
| 333 | echo -e "${BAD} FAILED! ${NORMAL}" |
---|
| 334 | error_shell "Problem with boot RAID partition!" |
---|
| 335 | fi |
---|
| 336 | |
---|
| 337 | echo -ne "${BOLD} ::${NORMAL} Checking system RAID status (/dev/md1)..." |
---|
| 338 | mdadm --detail --test /dev/md1 >/dev/null 2>&1 |
---|
| 339 | STATUS=$? |
---|
| 340 | if [ "$STATUS" = "0" ]; then |
---|
| 341 | echo -e "${GOOD} RAID OK ${NORMAL}" |
---|
| 342 | elif [ "$STATUS" = "1" ]; then |
---|
| 343 | echo -e "${WARN} RAID DEGRADED, PLEASE CHECK STATUS AFTER BOOTING. ${NORMAL}" |
---|
| 344 | elif [ "$STATUS" = "2" ]; then |
---|
| 345 | echo -e "${BAD} RAID FAILED! ${NORMAL}" |
---|
| 346 | error_shell "Problem with RAID system!" |
---|
| 347 | elif [ "$STATUS" = "4" ]; then |
---|
| 348 | echo -e "not used" |
---|
| 349 | fi |
---|
| 350 | |
---|
| 351 | |
---|
| 352 | |
---|
| 353 | ############################################## LVM DETECTION |
---|
| 354 | splashstep "Activating volume groups" |
---|
| 355 | if vgscan ; then |
---|
| 356 | echo -e "${GOOD} Scan OK ${NORMAL}" |
---|
| 357 | else |
---|
| 358 | echo -e "${BAD} Scan FAILED! ${NORMAL}" |
---|
| 359 | error_shell "Can't find volume groups!" |
---|
| 360 | fi |
---|
| 361 | |
---|
| 362 | splashstep |
---|
| 363 | if vgchange --sysinit -ay syn3; then |
---|
| 364 | echo -e "${GOOD} Activation OK ${NORMAL}" |
---|
| 365 | else |
---|
| 366 | echo -e "${BAD} Activation FAILED! ${NORMAL}" |
---|
| 367 | error_shell "Can't activate volume groups!" |
---|
| 368 | fi |
---|
| 369 | |
---|
| 370 | if [ `vgs --noheadings | grep ' syn3 '| wc -l` != "1" ]; then |
---|
| 371 | error_shell "Multiple SYN-3 installations found. Please remove or clean old SYN-3 installations from other discs and reboot." |
---|
| 372 | fi |
---|
| 373 | |
---|
| 374 | ############################################ Mount /boot (/dev/md0) under /mnt |
---|
| 375 | # This is neccesary for BOOTCONFIG stuff below. |
---|
| 376 | splashinfo "Loading boottime configuration" |
---|
| 377 | mkdir /mnt 2>/dev/null |
---|
| 378 | if ! mount -o ro,norecovery /dev/md0 /mnt ; then |
---|
| 379 | error_shell "Error: Reading of boottime configuration failed. Only continue booting if you dont have redundancy. If you DO have redundancy and the other node still works, then reinitalize this node." |
---|
| 380 | fi |
---|
| 381 | |
---|
| 382 | ############################################ BOOTCONFIG: Restore a backup? |
---|
| 383 | source /etc/restore.boot |
---|
| 384 | |
---|
| 385 | ############################################ BOOTCONFIG: Network interface assigning section |
---|
| 386 | splashinfo "Assigning network interfaces" |
---|
| 387 | #if-assign reads config from /mnt: |
---|
| 388 | source /etc/if-assign.boot |
---|
| 389 | |
---|
| 390 | |
---|
| 391 | ############################################# BOOTCONFIG: Linux HA and blockdevice symlinks |
---|
| 392 | |
---|
| 393 | #try to load the drbd configuration |
---|
| 394 | #(this file will overwrite the bootparameters) |
---|
| 395 | splashinfo "Loading redundancy configuration" |
---|
| 396 | if [ -r "/mnt/drbd.conf" ]; then |
---|
| 397 | source /mnt/drbd.conf |
---|
| 398 | fi |
---|
| 399 | #force our node to be primary? (used for first time initialisation) |
---|
| 400 | if [ -r "/mnt/drbd.primary" ]; then |
---|
| 401 | FORCEPRIMARY=1 |
---|
| 402 | fi |
---|
| 403 | |
---|
| 404 | #last BOOTCONFIG step, now unmount mnt so that we can do drbd syncing stuff: |
---|
| 405 | umount /mnt |
---|
| 406 | |
---|
| 407 | if [ "$DRBD" == "1" ]; then |
---|
| 408 | #use drbd |
---|
| 409 | echo "Using drbd" |
---|
| 410 | ln -s drbd0 /dev/boot |
---|
| 411 | ln -s drbd1 /dev/home |
---|
| 412 | ln -s drbd2 /dev/root |
---|
| 413 | ln -s syn3/swap /dev/swap |
---|
| 414 | source /etc/drbd.boot || error_shell |
---|
| 415 | else |
---|
| 416 | #dont use drbd |
---|
| 417 | echo "Not using drbd" |
---|
| 418 | ln -s md0 /dev/boot |
---|
| 419 | ln -s syn3/home /dev/home |
---|
| 420 | ln -s syn3/root /dev/root |
---|
| 421 | ln -s syn3/swap /dev/swap |
---|
| 422 | fi |
---|
| 423 | |
---|
| 424 | #make rebuild slow, to speedup boot and diskchecks |
---|
| 425 | echo 1000 > /proc/sys/dev/raid/speed_limit_max |
---|
| 426 | #(return to normal after boot at end of rc.M) |
---|
| 427 | |
---|
| 428 | #wait for device nodes to be created. |
---|
| 429 | udevadm settle |
---|
| 430 | |
---|
| 431 | ############################################## FS CHECK & REPAIR |
---|
| 432 | if [ "$FSCHECK" ]; then |
---|
| 433 | splashstep "Checking filesystems..." |
---|
| 434 | |
---|
| 435 | #big discs use a lot of memory (150mb was not enough for my 250gig disc!), try to use swap |
---|
| 436 | #try to use swap during disccheck |
---|
| 437 | swapon /dev/swap 2>/dev/null |
---|
| 438 | |
---|
| 439 | #Check the home and the root partition |
---|
| 440 | check_xfs "/dev/home" |
---|
| 441 | splashstep |
---|
| 442 | |
---|
| 443 | check_xfs "/dev/root" |
---|
| 444 | splashstep |
---|
| 445 | |
---|
| 446 | if blkid /dev/boot | grep xfs >/dev/null; then |
---|
| 447 | #we changed to ext4 because thats better supported in syslinux |
---|
| 448 | check_xfs "/dev/boot" |
---|
| 449 | fi |
---|
| 450 | splashstep |
---|
| 451 | |
---|
| 452 | swapoff /dev/swap 2>/dev/null |
---|
| 453 | else |
---|
| 454 | splashstep |
---|
| 455 | splashstep |
---|
| 456 | splashstep |
---|
| 457 | splashstep |
---|
| 458 | fi |
---|
| 459 | |
---|
| 460 | ############################################## Try to mount root |
---|
| 461 | splashstep "Mounting root filesystem" |
---|
| 462 | |
---|
| 463 | mkdir /newroot >/dev/null 2>&1 |
---|
| 464 | if ! mount -o inode32,rw "/dev/root" /newroot; then |
---|
| 465 | error_shell "Can't mount root filesystem!" |
---|
| 466 | fi |
---|
| 467 | |
---|
| 468 | if [ "${SHELL}" -eq '1' ]; then |
---|
| 469 | error_shell "Entering post-boot shell" |
---|
| 470 | fi |
---|
| 471 | |
---|
| 472 | ##################################################### BOOT our mounted /newroot |
---|
| 473 | |
---|
| 474 | |
---|
| 475 | #re-activate kernel messages on console |
---|
| 476 | echo '4' > /proc/sys/kernel/printk |
---|
| 477 | |
---|
| 478 | #update mtab in /newroot |
---|
| 479 | cat /proc/mounts > /newroot/etc/mtab |
---|
| 480 | |
---|
| 481 | splashstep "Starting Syn-3" |
---|
| 482 | |
---|
| 483 | |
---|
| 484 | #populate the dev directory of the new system |
---|
| 485 | #(it should be on a tmpfs to allow lvm snapshots) |
---|
| 486 | #echo "Copying dev directory..." |
---|
| 487 | #mkdir /newroot/dev 2>/dev/null |
---|
| 488 | #mount -t tmpfs -o size=2M udev /newroot/dev |
---|
| 489 | #cp -a /dev /newroot |
---|
| 490 | |
---|
| 491 | #cleanup some initrd stuff, like udevd |
---|
| 492 | cleanupinitrd |
---|
| 493 | |
---|
| 494 | #move over the splash stuff |
---|
| 495 | cp /var/lib/splash/* /newroot/var/lib/splash 2>/dev/null |
---|
| 496 | |
---|
| 497 | #finally do the big /-swap :) |
---|
| 498 | #cd /newroot |
---|
| 499 | #mkdir -p /newroot/initrd >/dev/null 2>&1 |
---|
| 500 | #swap system root to newroot |
---|
| 501 | #pivot_root . initrd |
---|
| 502 | |
---|
| 503 | #everything prepared, it's time to handover control to the 'real' system |
---|
| 504 | export CONSOLE=/dev/tty1 |
---|
| 505 | exec switch_root /newroot /sbin/init |
---|
| 506 | #exec switch_root /newroot /bin/bash |
---|
| 507 | |
---|
| 508 | #fallback |
---|
| 509 | error_shell "Can't start the init system!" |
---|
| 510 | echo "Can't start the init system!" |
---|
| 511 | /bin/bash |
---|
| 512 | /bin/sh |
---|
| 513 | /bin/ash |
---|