├── .gitmodules ├── CHANGELOG ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── jaks.ks └── tools ├── README.md ├── jaks2iso └── templates ├── BOOTX64.conf ├── BOOTX64.conf.7 ├── grub.conf ├── grub.conf.7 ├── isolinux.cfg └── isolinux.cfg.7 /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "tools/templates/jaks-post-config"] 2 | path = tools/templates/jaks-post-config 3 | url = https://github.com/jas-/jaks-post-config 4 | -------------------------------------------------------------------------------- /CHANGELOG: -------------------------------------------------------------------------------- 1 | commit ff0378ead4dce737c00f49dc9da200b78f7843fe 2 | Author: Jas- 3 | Date: Sat Jun 25 09:30:36 2016 -0600 4 | 5 | Additional readme info 6 | 7 | commit b54922ee93414bb53cb6ebf7faa0888de2cdca8f 8 | Author: Jas- 9 | Date: Sat Jun 25 09:26:02 2016 -0600 10 | 11 | Version bump; v0.0.25 12 | 13 | Removed NFS references from post configuraton report 14 | Updated argument list in README 15 | 16 | commit fcb344112feaf61bc7bd972b35c6f9ba0c88a80f 17 | Author: Jas- 18 | Date: Thu Jun 23 02:39:39 2016 +0000 19 | 20 | Added submodule to handle %post process dependencies 21 | 22 | commit bc3aece541a37cc5d6e40273ec9ae4e80a27718b 23 | Author: Jas- 24 | Date: Thu Jun 23 02:22:00 2016 +0000 25 | 26 | Italics for variable 27 | 28 | commit f6ef2ba8858b0ff2c34d701c85443fe8b08b878f 29 | Author: Jas- 30 | Date: Thu Jun 23 02:19:31 2016 +0000 31 | 32 | Italics for variable 33 | 34 | commit d29f25afe2a9aa6a2c358ab6a9b0e6eeed542772 35 | Author: Jas- 36 | Date: Thu Jun 23 01:44:19 2016 +0000 37 | 38 | Fixing broken ISO builder 39 | 40 | commit e558dce660febe461072e7102c18e17538dd7227 41 | Author: Jas- 42 | Date: Thu Jun 23 01:36:58 2016 +0000 43 | 44 | Permissions fix 45 | 46 | commit 7b7bd243e2b3a286f2b4bc38baf1ba7642dec71e 47 | Author: Jas- 48 | Date: Thu Jun 23 01:22:01 2016 +0000 49 | 50 | Version bump: v0.0.24 51 | 52 | commit de31c9b2e8ea234064d3ed014b22a667136ea628 53 | Author: Jas- 54 | Date: Thu Jun 23 01:21:28 2016 +0000 55 | 56 | Added contributing document 57 | 58 | commit bcc03a60689b9a8f396c5c40dc94b1da1c5d8c74 59 | Author: Jas- 60 | Date: Tue Jun 21 11:19:13 2016 +0000 61 | 62 | Removed RHN registration functions 63 | 64 | commit cdf8a690cdc4833d76720634e26bfdee53368ba4 65 | Author: Jas- 66 | Date: Sun Jun 19 14:53:22 2016 +0000 67 | 68 | Removed RHN registration args & post config calls 69 | 70 | commit 88fcdbd440bceb87e12182b16502a77806944077 71 | Author: Jas- 72 | Date: Sun Jun 19 14:29:00 2016 +0000 73 | 74 | Updated CHANGELOG 75 | 76 | commit b06585d29554e228c35e6a167e126c9d275274d5 77 | Author: Jas- 78 | Date: Sun Jun 19 14:24:56 2016 +0000 79 | 80 | Version bump; v0.0.23. JAKS is born 81 | - Renamed project 82 | - Removing NFS dependencies 83 | - Migrated ISO build tools to seperate folder 84 | - Rewriting timezone & locale functionality 85 | wq 86 | 87 | commit b748c766012ae2f05ecd5b6c9e626ee84949c072 88 | Author: Jason Gerfen 89 | Date: Sun May 29 22:25:18 2016 -0600 90 | 91 | Renamed templates; grub.cfg to grub.conf 92 | 93 | commit 10af05484a080fee0b0d617ed146eb563bde946c 94 | Author: Jason Gerfen 95 | Date: Sun May 29 22:00:13 2016 -0600 96 | 97 | Fix for buildiso regarding EFI grub.conf path 98 | 99 | commit 11abde739ad305941dfe12c139ae80a8cbe0e9cb 100 | Author: Jason Gerfen 101 | Date: Sun May 29 20:31:00 2016 -0600 102 | 103 | Fix for missing DNS in chroot; required for RHSM registration 104 | 105 | commit 9694cfe5c75948e40960d61a57838d5708848df2 106 | Author: Jason Gerfen 107 | Date: Sat May 28 21:52:54 2016 -0600 108 | 109 | Version bump; v0.2.22 - Fix for VM vs. Physical disk allocation" 110 | 111 | commit 1d1e6196bf1e0263310bd76d3fab8e7f3a95d8d0 112 | Author: Jason Gerfen 113 | Date: Sat May 28 19:22:54 2016 -0600 114 | 115 | Fix for paths when determining templates 116 | 117 | commit a8bf8aa8b8e516add4b028fad8552753e7d165c2 118 | Author: Jason Gerfen 119 | Date: Sat May 28 18:03:08 2016 -0600 120 | 121 | Removed affinity controls 122 | 123 | commit 9bf61593fb840f5c8b442c49565c93dfb81d1983 124 | Author: Jason Gerfen 125 | Date: Sat May 28 17:25:27 2016 -0600 126 | 127 | Fix for auto-registration tool call for RHSM 128 | 129 | commit e20a68acfefe241fd8ad9e739854280bc24eec55 130 | Author: Jason Gerfen 131 | Date: Sat May 28 17:17:29 2016 -0600 132 | 133 | Formatting for buildiso tool 134 | 135 | commit ffe45c0a376973a44100bf13532b1bc3708bb0e8 136 | Author: Jason Gerfen 137 | Date: Wed May 25 01:36:52 2016 -0600 138 | 139 | Fix for isohybrid & USB devices not having uEFI capabilities 140 | 141 | commit 1c1adb08f73e4b3f9a045d7184d1c62c86f27ad8 142 | Author: Jason Gerfen 143 | Date: Tue May 24 20:34:21 2016 -0600 144 | 145 | Fix for RHSM registration procudure argument list 146 | 147 | commit 4710c17856cef5dd2e75feb17bbc988078a3887d 148 | Author: Jason Gerfen 149 | Date: Mon May 23 22:17:01 2016 -0600 150 | 151 | Fix regarding location of /boot/efi (was /boot/EFI) 152 | 153 | commit c84c60e4401f3026c5d7b8e88c322c31b054ee7c 154 | Author: Jason Gerfen 155 | Date: Mon May 23 20:12:34 2016 -0600 156 | 157 | Fix for grub installation; specifiy disk order; part tres 158 | 159 | commit 0041a146781c139df829fb88a07055a9061bf96d 160 | Author: Jason Gerfen 161 | Date: Mon May 23 18:27:58 2016 -0600 162 | 163 | Fix for grub installation; specifiy disk order; part duex 164 | 165 | commit d97e620e338d92a4cb36888a13ac8ab6549c2b76 166 | Author: Jason Gerfen 167 | Date: Mon May 23 18:22:57 2016 -0600 168 | 169 | Fix for grub installation; specifiy disk order 170 | 171 | commit 19dcd303a392e2724d52d6839f6fc432aca9fa64 172 | Author: Jason Gerfen 173 | Date: Sun May 22 21:27:12 2016 -0600 174 | 175 | Fix for --location option (mbr vs. partition) 176 | 177 | commit 444d09f19909b0374388ce8608e6fa254eac1d68 178 | Author: Jason Gerfen 179 | Date: Sun May 22 21:15:16 2016 -0600 180 | 181 | Fixes for EFI grub installation location (MBR vs. EFI partition) 182 | 183 | commit b4ff1778eb3e8409041182d1db41d75f6d783387 184 | Author: Jason Gerfen 185 | Date: Sun May 22 20:37:07 2016 -0600 186 | 187 | Version bump - v0.0.19 188 | 189 | commit c62e892fe231dfb2494ec113a14866751ed2ad2b 190 | Author: Jason Gerfen 191 | Date: Wed May 4 00:53:43 2016 -0600 192 | 193 | Version bump to v0.0.18 194 | 195 | commit 30428d949f93bb0059b2da65a80fe8e0d3576662 196 | Author: Jason Gerfen 197 | Date: Tue May 3 03:09:53 2016 -0600 198 | 199 | One more password in the report 200 | 201 | commit ab3a1825770e7b8455b78ce171fd0a392e0f2033 202 | Author: Jason Gerfen 203 | Date: Tue May 3 02:36:26 2016 -0600 204 | 205 | Removed ks-arguments from provided kickstart configs to clean passwords 206 | 207 | commit 8e5f18c4953152c89810c36c01d076b9b953e150 208 | Author: Jason Gerfen 209 | Date: Tue May 3 00:14:37 2016 -0600 210 | 211 | Added some affiinity handling for various functionality 212 | 213 | commit 44168b92368330d3dd107c59749002d597fd38c5 214 | Author: Jason Gerfen 215 | Date: Mon May 2 04:47:01 2016 -0600 216 | 217 | Status message regarding disk provisioning part tre 218 | 219 | commit 62a1d1f80899b10286ccd17b68a483491d858ff0 220 | Author: Jason Gerfen 221 | Date: Mon May 2 04:45:02 2016 -0600 222 | 223 | Status message regarding disk provisioning part duex 224 | 225 | commit 9550ddd9de79e6fb9c0fb88de3a7d5bc7fc25331 226 | Author: Jason Gerfen 227 | Date: Mon May 2 04:39:16 2016 -0600 228 | 229 | Status message regarding disk provisioning 230 | 231 | commit aff96e976fedab81d257da4a2bdfc76828f9c491 232 | Author: Jason Gerfen 233 | Date: Sat Apr 30 02:59:53 2016 -0600 234 | 235 | Fixes for odds & sods 236 | 237 | commit e93816e9df88b12fe0fed34ae21243ed5e0b8085 238 | Author: Jason Gerfen 239 | Date: Tue Apr 26 05:26:25 2016 -0600 240 | 241 | Fix for %post chroot summary report regarding logs of build tools 242 | 243 | commit 32aa518632ec0ef00b9dec58914c2fa4b1dd899a 244 | Author: Jason Gerfen 245 | Date: Mon Apr 25 23:54:03 2016 -0600 246 | 247 | Reverted back to @base & included nfs-utils to help facilitate %post chroot RPM installer 248 | 249 | commit b4fed93571ff1438dbc81263d92096e6e16ac2cd 250 | Author: Jason Gerfen 251 | Date: Mon Apr 25 23:32:14 2016 -0600 252 | 253 | Fix for nfs-utils by using @Core vs. @base for %packages specification 254 | 255 | commit bc5b4a84f46dd0efe687634071cd9c38f1623d1a 256 | Author: Jason Gerfen 257 | Date: Mon Apr 25 01:06:44 2016 -0600 258 | 259 | %post chroot fix for path part deux 260 | 261 | commit 9ee5795511914f4af1325b635470f5f338a89ad1 262 | Author: Jason Gerfen 263 | Date: Mon Apr 25 00:52:05 2016 -0600 264 | 265 | %post chroot fix for path 266 | 267 | commit 41b323899283cee09141c6195d6dcf3251544d79 268 | Author: Jason Gerfen 269 | Date: Mon Apr 25 00:33:32 2016 -0600 270 | 271 | Fix for hardcoded path for build tools during %post chroot 272 | 273 | commit c8038576ca33b84024fb712d81bf59a496595856 274 | Author: Jason Gerfen 275 | Date: Mon Apr 25 00:26:53 2016 -0600 276 | 277 | Due to failures with BSM auditing perl script location this fix addresses the NFS mount point for to ensure the tool can be located and installed during %post chroot 278 | 279 | commit 23f8a69e49cc55c7f3d23860bd42c0defe043751 280 | Author: Jason Gerfen 281 | Date: Sun Apr 24 22:51:30 2016 -0600 282 | 283 | Added CHANGELOG to help facilitate good record keeping 284 | 285 | commit 0f73c52aa1015a6bab085b7aefaab208f91805a1 286 | Author: Jason Gerfen 287 | Date: Sat Apr 23 23:23:20 2016 -0600 288 | 289 | Fix for DHCP based network configuration with regards to invalid NETMASK param 290 | 291 | commit 0f91d43c29d0bf2a7acf17c4d6cf5f0b4ddcc2f2 292 | Author: Jason Gerfen 293 | Date: Sat Apr 23 06:42:25 2016 -0600 294 | 295 | Fix for proxy argm to config-rhsm 296 | 297 | commit 84813fb5a36d5e62886c5e3762acdf6abb57e11f 298 | Author: Jason Gerfen 299 | Date: Sat Apr 23 06:39:59 2016 -0600 300 | 301 | Removed temporary report; fix for failed array of tool names 302 | 303 | commit bdddf8075e8ad92dd0a2aa26e028bbbfebe370c6 304 | Author: Jason Gerfen 305 | Date: Sat Apr 23 06:34:11 2016 -0600 306 | 307 | Fix for substring of failed job list 308 | 309 | commit 6d34aa0adaa4a23c9dafb4d0a73687e8ee184855 310 | Author: Jason Gerfen 311 | Date: Sat Apr 23 06:20:04 2016 -0600 312 | 313 | Temporary report on tool run 314 | 315 | commit cb663ed0af587e2900e58bc4ff3f2bb1e726b5e5 316 | Author: Jason Gerfen 317 | Date: Sat Apr 23 06:16:52 2016 -0600 318 | 319 | Fixes for RHSM registration 320 | 321 | commit ec2418c95d380219ff9609beeb0d2e1b51a9bcc9 322 | Author: Jason Gerfen 323 | Date: Sat Apr 23 02:35:51 2016 -0600 324 | 325 | Fix for DHCP vs. empty network settings 326 | 327 | commit 6ec05f84d87fc1f3d86f09b7ba9fbc1d590567af 328 | Author: Jason Gerfen 329 | Date: Sat Apr 23 00:54:16 2016 -0600 330 | 331 | Revised network configuration function to elimiate DVD conditional & added conditional to handle missing network params 332 | 333 | commit ed388ea687d0ed3da33a89eca9bcfbccaf813a0d 334 | Author: Jason Gerfen 335 | Date: Sat Apr 23 00:49:01 2016 -0600 336 | 337 | Re-enabled cdrom installation method, disabled DVD network setup 338 | 339 | commit c2020c7541c55b7e300ebbe48b1b28e98290804c 340 | Author: Jason Gerfen 341 | Date: Sat Apr 23 00:41:08 2016 -0600 342 | 343 | Disabled CDROM installtion method temp 344 | 345 | commit 81e37a2766013506061be056a7a961a2e896b418 346 | Author: Jason Gerfen 347 | Date: Sat Apr 23 00:28:03 2016 -0600 348 | 349 | Removed unused ks file 350 | 351 | commit aaa59137d66bd90fc158e15e321b877b1fae2fda 352 | Author: Jason Gerfen 353 | Date: Sat Apr 23 00:09:36 2016 -0600 354 | 355 | Status messages 356 | 357 | commit 8b7cf1b10e17f2970788b8bcfa164e54f737dbef 358 | Author: Jason Gerfen 359 | Date: Mon Apr 18 22:41:45 2016 -0600 360 | 361 | Revisions to handle searches for build-tools & disk handling 362 | 363 | 1. Build tool copy from local media now implemented during %post (non-chroot) phase 364 | 2. Disk provisioning now more accurately deals with errors for non LVM systems; 365 | a. Conditionals for PV, VG & LV counts are accounted for 366 | b. Removed unnecessary disk labeling method 367 | c. Squashed stderr for all disk handling (LVM removal & physical partition removals) 368 | 3. Post (non-chroot) report now accounts for status messages for both local 369 | build tool use &/or NFS share build tool accessibility 370 | 371 | commit 2048abba8732df662f82eddc4ba2559c6344590e 372 | Author: Jason Gerfen 373 | Date: Mon Apr 18 07:05:32 2016 -0600 374 | 375 | Fixes & more robust handling for LVM physical volumes, volume groups & logical volume removals 376 | 377 | commit da27828495960cda81799489b0076e2483261a6f 378 | Author: Jason Gerfen 379 | Date: Sun Apr 17 04:18:07 2016 -0600 380 | 381 | Version bump: v0.0.10 382 | 383 | Addressed the following bugs 384 | 1. Unable to fdisk mounted primary disk due to build-tools issue 385 | 2. Unable to locate build-tools issue 386 | 387 | commit d139bf7f25b6e72454514d0890063681ca6f865f 388 | Author: Jason Gerfen 389 | Date: Sun Apr 17 04:08:37 2016 -0600 390 | 391 | Moved copytools to %post pre chroot 392 | 393 | commit 9fafd31e16be2b3233ef4df6dd693d6257823488 394 | Author: Jason Gerfen 395 | Date: Sun Apr 17 00:02:26 2016 -0600 396 | 397 | Modified devinodes() to search cdrom devices 398 | 399 | commit 3980314652fe186c25643f63c97602975eea27ee 400 | Author: Jason Gerfen 401 | Date: Sat Apr 16 04:10:00 2016 -0600 402 | 403 | Fix for disk mounting issue 404 | 405 | commit 003b921c4139090eec5d253c1012764d47caa753 406 | Author: Jason Gerfen 407 | Date: Sat Apr 16 04:02:19 2016 -0600 408 | 409 | Fix for sub process regarding partition table removal causing a race condition when making the disk label 410 | 411 | commit 4a2b12c75482af5f56cf224b538d586bdb67ff4b 412 | Author: Jason Gerfen 413 | Date: Mon Apr 11 09:10:26 2016 -0600 414 | 415 | Fixes for local build tools 416 | 417 | commit 4c34886bbea2c30820d4d9b7051f68f89aa9687d 418 | Author: Jason Gerfen 419 | Date: Mon Apr 11 05:54:28 2016 -0600 420 | 421 | Fix for NFS share path getting changed 422 | 423 | commit f0a736bd9013da7d3cdf80aa33572f02a6ed521d 424 | Author: Jason Gerfen 425 | Date: Mon Apr 11 03:59:26 2016 -0600 426 | 427 | Removed nested conditional 428 | 429 | commit 3d33631645d626bf1ded104c849d8c4fba543335 430 | Author: Jason Gerfen 431 | Date: Mon Apr 11 03:32:34 2016 -0600 432 | 433 | Fix for multiple found locations for build-tools 434 | 435 | commit 93d11dc3186627420ffff9e63af9a6f2c87bf614 436 | Author: Jason Gerfen 437 | Date: Mon Apr 11 02:18:27 2016 -0600 438 | 439 | Fix for USB local disk installation & missing paths for build-tools 440 | 441 | commit 60f7c8917f04b522abb02163be967badff47cf13 442 | Author: Jason Gerfen 443 | Date: Sun Apr 10 08:08:34 2016 -0600 444 | 445 | fix for build-tools variable value 446 | 447 | commit 50f5924d4aa7a96667b44adae1ad894b045a675c 448 | Author: Jason Gerfen 449 | Date: Sun Apr 10 08:05:18 2016 -0600 450 | 451 | Removed some debugging 452 | 453 | commit 863bb1f750a5fe3d8e5d5dbb7f7ee259d3433c2f 454 | Author: Jason Gerfen 455 | Date: Sun Apr 10 08:03:39 2016 -0600 456 | 457 | buildiso verbage 458 | 459 | commit 75ebcfafc86c6eda7de1f328f5f11fa3ca6e4e3a 460 | Author: Jason Gerfen 461 | Date: Sun Apr 10 07:58:19 2016 -0600 462 | 463 | Debugging output 464 | 465 | commit 87a16705e44eb0d02ee32e19cc170d5d214d9525 466 | Author: Jason Gerfen 467 | Date: Sun Apr 10 07:57:26 2016 -0600 468 | 469 | Conditional for findtools() 470 | 471 | commit 055742c9e9895f2aab022013cb5736eca4acb7c2 472 | Author: Jason Gerfen 473 | Date: Sun Apr 10 07:54:55 2016 -0600 474 | 475 | fix for end function block 476 | 477 | commit 360ba8ba80ab2ea43d24b68f243ebcfb3b20fc39 478 | Author: Jason Gerfen 479 | Date: Sun Apr 10 07:53:13 2016 -0600 480 | 481 | Fixes for missing build-tools on %post chroot env 482 | 483 | commit a4728dcdd94d37a94d6793790b49145ad9934d21 484 | Author: Jason Gerfen 485 | Date: Sun Apr 10 05:51:40 2016 -0600 486 | 487 | Verbosity for buildiso tool 488 | 489 | commit 84382b54f30edfde138e55158673069a9b5de615 490 | Author: Jason Gerfen 491 | Date: Sun Apr 10 05:45:53 2016 -0600 492 | 493 | Version bump; fixes for disk labels 494 | 495 | commit ab1a5119785fe302e7fa8c63c805a0039ada8775 496 | Author: Jason Gerfen 497 | Date: Wed Apr 6 09:19:03 2016 -0600 498 | 499 | Fixes for partition removal and kernel reloading of missing partition table data 500 | 501 | commit 23621d30e414cc98409acc3d5569bb3c5bfdba26 502 | Author: Jason Gerfen 503 | Date: Wed Apr 6 07:34:43 2016 -0600 504 | 505 | Added value to general report 506 | 507 | commit 44c93c9f47a7d3dae665f27f4e82fe48c41d3ee6 508 | Author: Jason Gerfen 509 | Date: Wed Apr 6 07:03:04 2016 -0600 510 | 511 | Added conditional to proxy for register flag 512 | 513 | commit 2c970024d0524e140196385a01034ed3e4151d2c 514 | Author: Jason Gerfen 515 | Date: Tue Apr 5 09:04:17 2016 -0600 516 | 517 | Fix for 518 | 519 | commit b89b745be2980f9c8f571a61e7b88d85accd674e 520 | Author: Jason Gerfen 521 | Date: Tue Apr 5 08:48:23 2016 -0600 522 | 523 | Fix for build-tools path search in buildiso 524 | 525 | commit b7aa1beead8667b29060d87dcc905d248978e228 526 | Author: Jason Gerfen 527 | Date: Tue Apr 5 08:07:55 2016 -0600 528 | 529 | Fix for changes in config-register tool (now config-rhsm) 530 | 531 | commit b9173ab09128af2051a267fcc48616d7f5da92a9 532 | Author: Jason Gerfen 533 | Date: Sun Apr 3 08:35:34 2016 -0600 534 | 535 | Fixed log output for registration & change in API 536 | 537 | commit 6f14c1a09df09b9b1588f2b74d950e05b4774128 538 | Author: Jason Gerfen 539 | Date: Sun Apr 3 02:56:22 2016 -0600 540 | 541 | Fix for log name during config-register 542 | 543 | commit ab3f15c42c80a3b17e47edd3b442ec1d28dc2066 544 | Author: Jason Gerfen 545 | Date: Sun Apr 3 02:17:56 2016 -0600 546 | 547 | Added functionality for handling RHN automation 548 | 549 | commit 52f92275bb5d7dfa9c313eebd5daf10b41187b66 550 | Author: Jason Gerfen 551 | Date: Sat Apr 2 09:06:13 2016 -0600 552 | 553 | Added options for RHN registration & references to build tool to facilitate differences in RHN registration processes post installation & build 554 | 555 | commit 508d0647951d6b51a4e9a16e3ddcf690d36795b0 556 | Author: Jason Gerfen 557 | Date: Sat Apr 2 07:34:43 2016 -0600 558 | 559 | Moved back to tty3 as tty2 seems to be reservered 560 | 561 | commit b953e6e18c4256fe33843e0a2714cb793d4a1b08 562 | Author: Jason Gerfen 563 | Date: Sat Apr 2 07:25:09 2016 -0600 564 | 565 | Reversed changes for %pre & added 500 check to buildiso 566 | 567 | commit 97b7ed26a4effe16906c18c33f0d94e0e31994d1 568 | Author: Jason Gerfen 569 | Date: Sat Apr 2 06:00:40 2016 -0600 570 | 571 | Refactored to accomodate for 7.2 %pre manual & moved from tty3 to tty2 572 | 573 | commit b00d1e6c260d271a2c4708cfac15e497f5cd66b3 574 | Author: Jason Gerfen 575 | Date: Mon Mar 28 09:27:35 2016 -0600 576 | 577 | Removed errorneous hostname toupper items 578 | 579 | commit ec6ea98fb77f9d3a9c1f3dedbd57fffc253f207d 580 | Author: Jason Gerfen 581 | Date: Mon Mar 28 09:04:04 2016 -0600 582 | 583 | Force conforming to non-loud hostnames; because yelling is rude 584 | 585 | commit d1b1345d62aacffb21fe82f6650b0865d861c781 586 | Author: Jason Gerfen 587 | Date: Sat Mar 26 03:51:59 2016 -0600 588 | 589 | Fixes for disk labels where multiple disks exist using > 7.x 590 | 591 | commit b656ff42fc76bc9d5d3b6a2b7a569a564088d159 592 | Author: Jason Gerfen 593 | Date: Tue Mar 22 11:04:14 2016 -0600 594 | 595 | Fix for > vs. >= test operator for multiple disk systems 596 | 597 | commit acc897ccc12524e8aaea358c27344c1cf54cf6e1 598 | Author: Jason Gerfen 599 | Date: Tue Mar 22 04:42:12 2016 -0600 600 | 601 | Removed old LVM template relics 602 | 603 | commit 6e5d4f9101984ad8406c99c4ac1c45bef07f044c 604 | Author: Jason Gerfen 605 | Date: Mon Mar 21 16:35:11 2016 -0600 606 | 607 | Fixes for DHCP network configuration parsing 608 | 609 | commit d4a91df14e65052d80c9d15f4da9b8c23a6311dc 610 | Author: Jason Gerfen 611 | Date: Mon Mar 21 15:16:27 2016 -0600 612 | 613 | Fixes for RHEL > 7 and LVM's 614 | 615 | commit 6338dfa0ae4e8402634c411332918c66cc87fb4f 616 | Author: Jason Gerfen 617 | Date: Mon Mar 21 14:43:48 2016 -0600 618 | 619 | Fixes for 75% of total disk remainders for /opt/app provisioning 620 | 621 | commit c6d62665eb9d80ec5620aa98d4e4c9cd041d390f 622 | Author: Jason Gerfen 623 | Date: Mon Mar 21 13:16:09 2016 -0600 624 | 625 | Fixes & verbage for IPv4, subnet etc 626 | 627 | commit c61e00e831fa3cb118411323566f2e44e3b0ec9c 628 | Author: Jason Gerfen 629 | Date: Sun Mar 20 15:17:02 2016 -0600 630 | 631 | Templates & buildiso: 632 | 633 | Templates: 634 | - Added templates for booting RHEL distributions > 7 635 | 636 | buildiso: 637 | - Fixes for paths 638 | - Additional fixes for determining boot configuration files 639 | - Output formatting for readability 640 | 641 | commit 4bfc3a8fee371c10250c4863c6b50613e6c495b9 642 | Author: Jason Gerfen 643 | Date: Sat Mar 19 11:11:29 2016 -0600 644 | 645 | Added splash.xpm.gz to handle EFI Grub menu 646 | 647 | commit 4e1e5dc7f4e4832574a183c90e3f04307b419860 648 | Author: Jason Gerfen 649 | Date: Sat Mar 19 11:11:04 2016 -0600 650 | 651 | Added splash.xpm.gz to handle EFI Grub menu 652 | 653 | commit 21b493472e965548763a8709412a906fcd505227 654 | Author: Jason Gerfen 655 | Date: Sat Mar 19 10:16:53 2016 -0600 656 | 657 | buildiso bug fixes 658 | 659 | commit 1eb58d9a3b488f2be93641cb648a9145639208ff 660 | Author: Jason Gerfen 661 | Date: Sat Mar 19 09:47:05 2016 -0600 662 | 663 | buildiso 20160319: 664 | 665 | - Fixes for configuration file paths 666 | - Customization of configuration environment (bootloader menus) 667 | - Build tools & customized bootloader configuration now automated 668 | - Added support for grub.cfg 669 | 670 | commit bc7190ecfc74e878f47b4614cbafb322ced78586 671 | Author: Jason Gerfen 672 | Date: Tue Mar 15 13:15:20 2016 -0600 673 | 674 | Revised buildiso 675 | 676 | commit c0d79557d09eba5b3c1862a6fe2d2ddd298bf2d1 677 | Author: Jason Gerfen 678 | Date: Tue Mar 15 13:01:45 2016 -0600 679 | 680 | Removed old per distro configs to a template structure 681 | 682 | commit 4dee140d7d8f4aec2919c7df4ddbeb9e3db802ca 683 | Author: Jason Gerfen 684 | Date: Tue Mar 15 08:20:51 2016 -0600 685 | 686 | EFI boot fixes; BOOTX64.conf & buildiso tool 687 | 688 | commit 3dc0c4f2592c8cb4f34c66a801707794f4f33d2a 689 | Author: Jason Gerfen 690 | Date: Mon Mar 14 13:29:53 2016 -0600 691 | 692 | Final fix for EFI kickstart installations 693 | 694 | commit f395fff40ce6cd05292af417da8dd1e23a79dc1f 695 | Author: Jason Gerfen 696 | Date: Mon Mar 14 12:55:17 2016 -0600 697 | 698 | Fixes for EFI boot types 699 | 700 | commit eaecf411854a77250894be333321ad88003a0b4d 701 | Author: Jason Gerfen 702 | Date: Sun Mar 13 12:10:28 2016 -0600 703 | 704 | Readable syntax for valid_ip() 705 | 706 | commit 3a5637a2579edd4f8fbdf8e9e9b8f3cf306b9b53 707 | Author: Jason Gerfen 708 | Date: Sun Mar 13 12:04:43 2016 -0600 709 | 710 | Fix for configurenetwork() name 711 | 712 | commit d430e07f198add302186a1b0c0dda91a62110386 713 | Author: Jason Gerfen 714 | Date: Sun Mar 13 12:00:27 2016 -0600 715 | 716 | Version bump; v0.0.6 717 | 718 | - Migrated network configuration functionality to a function 719 | - Fix for return value validation & associated conditionals for IPv4 validation function 720 | 721 | commit ef0ef45a04e329385c8989581b05f2375ff5e52c 722 | Author: Jason Gerfen 723 | Date: Sun Mar 13 07:40:05 2016 -0600 724 | 725 | Version bump; v0.0.5 - Removed verbosity on tool copy 726 | 727 | commit 3ceea957c51f90f1786f393c752e34df8cafadeb 728 | Author: Jason Gerfen 729 | Date: Sun Mar 13 07:37:48 2016 -0600 730 | 731 | Reporting fix for boot & primary disk 732 | 733 | commit 55d5de1c2fa0faa5acffcc02b3d811154f142163 734 | Author: Jason Gerfen 735 | Date: Sun Mar 13 07:34:20 2016 -0600 736 | 737 | Added disk names for multiple disk reports as well as primary for /boot 738 | 739 | commit 7e4046a4aa1c723815491e06461d1258beff9b76 740 | Author: Jason Gerfen 741 | Date: Sun Mar 13 07:19:24 2016 -0600 742 | 743 | Refactoring disk reports 744 | 745 | commit 7e2b3929babc2e53a7455300999acbd1089d2f2b 746 | Author: Jason Gerfen 747 | Date: Wed Mar 9 14:35:15 2016 -0700 748 | 749 | SWAP change from physical to LVM & optapplv only uses 75% 750 | 751 | commit 757d9ddd2b1f7655df62091e2b9294cbfdca35ed 752 | Author: Jason Gerfen 753 | Date: Tue Mar 8 14:50:53 2016 -0700 754 | 755 | Fix for integer on LVM creation 756 | 757 | commit 4d469ca07d0c4843225635cf3e027af5c9509ce7 758 | Author: Jason Gerfen 759 | Date: Tue Mar 8 11:31:11 2016 -0700 760 | 761 | Fixes for space allocations math & debugging log for disk detection 762 | 763 | commit ea0cbe06a2db3096140b4037a1ed8ecd9b95af5f 764 | Author: Jason Gerfen 765 | Date: Tue Mar 8 11:06:19 2016 -0700 766 | 767 | Fix for RHEL-6.7 change to --percent LVM creation 768 | 769 | commit ffbf99f844e1bdf95ba4c93dc16f7b74c9ff9632 770 | Author: Jason Gerfen 771 | Date: Tue Mar 8 08:14:48 2016 -0700 772 | 773 | 6.7 isolinux.cfg & fix for API change regarding use of --percent for LVM 774 | 775 | commit e6861f18069e49c54086289d157494cf76841219 776 | Author: Jason Gerfen 777 | Date: Sat Mar 5 12:39:37 2016 -0700 778 | 779 | Fix for paths regarding rhel-6.6 isolinux.cfg file 780 | 781 | commit 81d720f86fd50af8d6cd7d7d096acb5870ca9fa7 782 | Author: Jason Gerfen 783 | Date: Wed Mar 2 12:09:19 2016 -0700 784 | 785 | Comments for copytools() 786 | 787 | commit 66b3992d56b3329898a2b45d1418e5da592da5d9 788 | Author: Jason Gerfen 789 | Date: Wed Mar 2 10:48:56 2016 -0700 790 | 791 | Fix for USB mounted %post build utilities 792 | 793 | commit cb58bf6125020b32708c75a1df7bbd01d3dafe2c 794 | Author: Jason Gerfen 795 | Date: Tue Mar 1 15:36:57 2016 -0700 796 | 797 | Fixes for USB based local installs 798 | 799 | commit 7dc44b1cb909be1bb49e6989336b3eec93072e82 800 | Author: Jason Gerfen 801 | Date: Tue Mar 1 11:01:26 2016 -0700 802 | 803 | Fix for isolinux USB ks source & kickstart build tools copy operation 804 | 805 | commit c465a7051a932e07fc46aee3a0ee42f8e0abe79d 806 | Author: Jason Gerfen 807 | Date: Mon Feb 29 16:08:59 2016 -0700 808 | 809 | Added isolinux.cfg files for custom RHEL 6.5 & 6.6 DVD ISO & fixes for DVD only builds 810 | 811 | commit ed508a218adbc1f06adaa81aa0b0dd58d7b84bb6 812 | Author: Jason Gerfen 813 | Date: Mon Feb 29 08:51:15 2016 -0700 814 | 815 | Bug fixes & features 816 | 817 | - Fix for disk report output for opt/app when working on single disks 818 | - Now handles swath of applicable hostnames to location conversions 819 | 820 | commit 5f92435298bd00164025d0c9d6abb959e5cc89c4 821 | Author: Jason Gerfen 822 | Date: Sat Feb 27 14:19:11 2016 -0700 823 | 824 | Expanded location to handle all available locations 825 | 826 | commit e61f5731cf5b2e03e4e29b89f05134b811be4ec7 827 | Author: Jason Gerfen 828 | Date: Sat Feb 27 11:37:13 2016 -0700 829 | 830 | Fix for DVD build tools 831 | 832 | commit 7ecb8801cf2e4b1127ceb6e3fc9bbc5841f4c7d5 833 | Author: Jason Gerfen 834 | Date: Tue Feb 23 15:38:49 2016 -0700 835 | 836 | Fix for ext4 2% LVM overhead 837 | 838 | commit c139fe8e19088eb7c35087cb1d4897cda0ecc746 839 | Author: Jason Gerfen 840 | Date: Tue Feb 23 15:31:40 2016 -0700 841 | 842 | Fixes for multiple disks; 843 | 844 | Fix for ordering of multiple disks prior to iteration & trimming 845 | Fix for physical volume creation (must define each LVM partition) 846 | Fix for sizing between iterations 847 | Fix for report size for optapp LVM for multiple disks 848 | 849 | commit e3d58c2a07a74c30ad51911db0323be2ef2aafd7 850 | Author: Jason Gerfen 851 | Date: Sun Feb 21 17:41:00 2016 -0700 852 | 853 | Errors occuring with 2GB allocated for overhead of extra disk LVM 854 | 855 | commit 652536df57d1398501e0440efee662a759878c15 856 | Author: Jason Gerfen 857 | Date: Sun Feb 21 16:30:56 2016 -0700 858 | 859 | Fix for volume group when creating optapp logical volume 860 | 861 | commit 4ca2e10e6ff4b5abef10c46d000ef7647d7127f9 862 | Author: Jason Gerfen 863 | Date: Sun Feb 21 16:25:25 2016 -0700 864 | 865 | Removed debug=true default 866 | 867 | commit b4b7088ed139541a10d7430b9dba85b6b8608ff4 868 | Author: Jason Gerfen 869 | Date: Sun Feb 21 16:06:34 2016 -0700 870 | 871 | Fix for process 872 | 873 | commit eed2507f7007462f897952cf292b7d3ff7131261 874 | Author: Jason Gerfen 875 | Date: Sun Feb 21 15:52:19 2016 -0700 876 | 877 | Order of operations (left right evaluation) fix for previous fix 878 | 879 | commit 96aceb8f64e78440e5380f978218b4d55ce1eafd 880 | Author: Jason Gerfen 881 | Date: Sun Feb 21 15:30:34 2016 -0700 882 | 883 | Fix for physical extent overhead on extended disks 884 | 885 | commit e357a01985902ff1a9afcb4f3c34efbc00c41bdf 886 | Author: Jason Gerfen 887 | Date: Sun Feb 21 14:59:06 2016 -0700 888 | 889 | Fix for multiple disks size calculations 890 | 891 | commit 1b983f06e1b667de28c76f3ce8ee5ffb9f413dc9 892 | Author: Jason Gerfen 893 | Date: Sun Feb 21 13:09:14 2016 -0700 894 | 895 | Added sorting filter to ensure accuracy in positions 896 | 897 | commit 7b1a5de25aec4e91e3fa0815cd7f216cbbbedb67 898 | Author: Jason Gerfen 899 | Date: Sun Feb 21 12:30:48 2016 -0700 900 | 901 | Fix for halt if partition sizes cannot be determined 902 | 903 | commit d5baa0e51b8f85d0c00ba9a47be73d563a8a64f0 904 | Author: Jason Gerfen 905 | Date: Sun Feb 21 12:26:39 2016 -0700 906 | 907 | Fix for dynamic size allocated for /tmp LVM 908 | 909 | commit f0257113dd108dc9bae3342223bcb74ef9f99f8c 910 | Author: Jason Gerfen 911 | Date: Sun Feb 21 12:13:32 2016 -0700 912 | 913 | Fixes for extra disks; reports & configs 914 | 915 | commit 060ed32a23a632a291fee527dff1641f9b826d80 916 | Author: Jason Gerfen 917 | Date: Sat Feb 20 17:59:01 2016 -0700 918 | 919 | Fix for Physical volume size on primary 920 | 921 | commit 3746292ebb96212d69db0c4bd5ff7dc60ca42632 922 | Author: Jason Gerfen 923 | Date: Sat Feb 20 17:12:41 2016 -0700 924 | 925 | Fix for filter when obtaining route parameter 926 | 927 | commit a07182c8de6776644e5d50dcf2f42819f3a37dcb 928 | Author: Jason Gerfen 929 | Date: Sat Feb 20 16:54:22 2016 -0700 930 | 931 | Fix for numerical representation of gateway 932 | 933 | commit 49f05488ecf873e03ba52db116ed8c0c74e62ed4 934 | Author: Jason Gerfen 935 | Date: Tue Feb 16 17:46:19 2016 -0700 936 | 937 | Fix for mv arg 938 | 939 | commit 2c4b645b1319b37a9a3dc4a297e675d12c1e9b44 940 | Author: Jason Gerfen 941 | Date: Tue Feb 16 17:24:02 2016 -0700 942 | 943 | Reporting changes 944 | 945 | commit cde4b0cd3d5b5afa39fb268df8df9b8e1656f33d 946 | Author: Jason Gerfen 947 | Date: Mon Feb 15 11:25:04 2016 -0700 948 | 949 | Fix for kickstart configuration path 950 | 951 | commit b8bbc34176be985ae87a6784ab4a5484f4558e32 952 | Author: Jason Gerfen 953 | Date: Mon Feb 15 11:13:45 2016 -0700 954 | 955 | Fix for report path 956 | 957 | commit 5213d72422e51187d2cbe0c8b10683abafa80e46 958 | Author: Jason Gerfen 959 | Date: Sun Feb 14 17:03:44 2016 -0700 960 | 961 | Housekeeping on configuration & reports generated 962 | 963 | commit 725a46bdf2deb711d1feac3500a8dc1b3bb2897b 964 | Author: Jason Gerfen 965 | Date: Sun Feb 14 16:31:15 2016 -0700 966 | 967 | Removed percentages from reporting 968 | 969 | commit 5a663a852e0361353fee821295ee7eacc95a0acc 970 | Author: Jason Gerfen 971 | Date: Sun Feb 14 15:57:30 2016 -0700 972 | 973 | Some debugging for totals 1 974 | 975 | commit f6e8c00d5140e19a9cd7b7010b0d46315d8ebf54 976 | Author: Jason Gerfen 977 | Date: Sun Feb 14 15:34:39 2016 -0700 978 | 979 | Some debugging for totals 980 | 981 | commit 9685e1d02eda3e7b5f981b32109ca9d3a227c165 982 | Author: Jason Gerfen 983 | Date: Sun Feb 14 15:23:47 2016 -0700 984 | 985 | Syntax error fix for awk 986 | 987 | commit d4cc31c7cf452b150d66655c9d150c1461183999 988 | Author: Jason Gerfen 989 | Date: Sun Feb 14 15:12:51 2016 -0700 990 | 991 | Fix for reporting percentages 992 | 993 | commit fbfed953843006c9111935a310f793cb1e6aa1af 994 | Author: Jason Gerfen 995 | Date: Sun Feb 14 15:04:56 2016 -0700 996 | 997 | Fix for handling EFI boot vs. legacy BIOS boot; allocates additional 200MB for RHEL /boot/efi partition 998 | 999 | commit ca9c28dfcc96cba6945f06bc6b73f5f8128839be 1000 | Author: Jason Gerfen 1001 | Date: Sun Feb 14 12:43:32 2016 -0700 1002 | 1003 | Fixes for multi-disks reports & processing; 1004 | filters for USB block devices; Fix for negative numbers when calculating optapp 1005 | 1006 | commit 84e1e497c709529dea18725571aba46259941618 1007 | Author: Jason Gerfen 1008 | Date: Sat Feb 13 15:23:11 2016 -0700 1009 | 1010 | Fix for total_size variable 1011 | 1012 | commit 1f0ed97ccfe6cc9f45258eee914c90741c2957f3 1013 | Author: Jason Gerfen 1014 | Date: Sat Feb 13 15:19:24 2016 -0700 1015 | 1016 | reversed optapp calculation 1017 | 1018 | commit cd80c9bc112e5d1a2067efaebc691af833acee98 1019 | Author: Jason Gerfen 1020 | Date: Sat Feb 13 15:13:36 2016 -0700 1021 | 1022 | Fixes for bytes vs. mb calculations 1023 | 1024 | commit dfc6260c47da3ad0c2fe1732376eb58c555454a1 1025 | Author: Jason Gerfen 1026 | Date: Sat Feb 13 11:09:09 2016 -0700 1027 | 1028 | Final for vm &/or physical deployments 1029 | 1030 | commit 78835df0519dde7847df864f0b0c49abfcf53bc1 1031 | Author: Jason Gerfen 1032 | Date: Sat Feb 13 11:04:18 2016 -0700 1033 | 1034 | Debugging for size allocations 1035 | 1036 | commit 4607d3ad31b865c36a81d06817bca4ea2d61df44 1037 | Author: Jason Gerfen 1038 | Date: Sat Feb 13 10:58:04 2016 -0700 1039 | 1040 | Moved away from b2mb conversion for non-standard vm 1041 | 1042 | commit 63e865acc59b6b58f87a8d9b93adee70e59da5ef 1043 | Author: Jason Gerfen 1044 | Date: Sat Feb 13 10:52:09 2016 -0700 1045 | 1046 | Problem with gb to b 1047 | 1048 | commit 0fbb3e7494cfd1b26a7f4b2287550d7ef5036b0e 1049 | Author: Jason Gerfen 1050 | Date: Sat Feb 13 10:21:03 2016 -0700 1051 | 1052 | Debugging & fix for ip, netmask & subnet: 1053 | 1054 | - Networking: 1055 | Added functionality to make use of internal variables for ip, netmask & gateway when 1056 | specified on the command line as boot params. 1057 | 1058 | IPADDR, NETMASK & GATEWAY will ONLY get set from ip, netmask & gateway if one or the 1059 | other boot params exists. If BOTH sets exist we will make use of the IPADDR, NETMASK 1060 | & GATEWAY params as it is assumed the build is being completed on a build network with 1061 | DHCP & (possibly) BOOTP available 1062 | 1063 | commit cc5e0224cd1351021150ca58b7185619e22249b7 1064 | Author: Jason Gerfen 1065 | Date: Wed Feb 10 14:53:45 2016 -0700 1066 | 1067 | Added new function to handle non uniform numbers 1068 | 1069 | commit 3b7082c376493b31ef7a4775e2c0da272a84f190 1070 | Author: Jason Gerfen 1071 | Date: Wed Feb 10 13:22:34 2016 -0700 1072 | 1073 | Added percentages to final report for failed/successful jobs 1074 | 1075 | commit 395f5f7513182f980a3df6ce6c9e8b1c3629444d 1076 | Author: Jason Gerfen 1077 | Date: Wed Feb 10 12:51:50 2016 -0700 1078 | 1079 | Fix for bootparams() 1080 | 1081 | commit cfc7606927c69a80108a1f7829ae4b4d1946486b 1082 | Author: Jason Gerfen 1083 | Date: Wed Feb 10 12:48:33 2016 -0700 1084 | 1085 | Disabled error on fail 1086 | 1087 | commit 3718279f035b46dc707a99f1ef5e15f8577eeb08 1088 | Author: Jason Gerfen 1089 | Date: Wed Feb 10 12:43:25 2016 -0700 1090 | 1091 | Global variables for hostname & location 1092 | 1093 | commit e34b920122fe47ce7d7aa0e0121cff46170139ef 1094 | Author: Jason Gerfen 1095 | Date: Wed Feb 10 12:23:54 2016 -0700 1096 | 1097 | Migrated nfs & timezone to functions 1098 | 1099 | commit a80ca9ec08f5334f59c2cf4ed8017ecbb5266a5a 1100 | Author: Jason Gerfen 1101 | Date: Wed Feb 10 11:21:46 2016 -0700 1102 | 1103 | Migrated location, hostname, rootpw to functions 1104 | 1105 | commit 2a25a045eaaecc280089a29836ec293d88476361 1106 | Author: Jason Gerfen 1107 | Date: Wed Feb 10 10:08:31 2016 -0700 1108 | 1109 | Reverted back to static banner; pos 1110 | 1111 | commit e36de33e1ff017a4417687687d8322f057748de4 1112 | Author: Jason Gerfen 1113 | Date: Wed Feb 10 10:06:08 2016 -0700 1114 | 1115 | printf? 2 1116 | 1117 | commit e0298012ed1bdcef0a876c2e683f5162eaeecaee 1118 | Author: Jason Gerfen 1119 | Date: Wed Feb 10 10:04:06 2016 -0700 1120 | 1121 | printf? 1122 | 1123 | commit 0ffd3ddd96a67941db5c1cdecad1a349aed01171 1124 | Author: Jason Gerfen 1125 | Date: Wed Feb 10 10:01:23 2016 -0700 1126 | 1127 | echo fix? 1128 | 1129 | commit 77457417ab437e56ac7fe23c90837cf755f80874 1130 | Author: Jason Gerfen 1131 | Date: Wed Feb 10 09:53:59 2016 -0700 1132 | 1133 | Removed apostrophies from banner variable 1134 | 1135 | commit 3de2ff0f3c7e8a66c0ada700649720403bb94bb5 1136 | Author: Jason Gerfen 1137 | Date: Wed Feb 10 09:52:25 2016 -0700 1138 | 1139 | Fix for printing confirmation banner 1140 | 1141 | commit bc67bab4cbe80b495d7cd53b9170d211ad596fd2 1142 | Author: Jason Gerfen 1143 | Date: Wed Feb 10 09:50:43 2016 -0700 1144 | 1145 | Migrated confirmation dialog to function confirminstall() 1146 | 1147 | commit 28465a4be12c4104e5eb7cc155d36671e30ce2c2 1148 | Author: Jason Gerfen 1149 | Date: Wed Feb 10 09:37:15 2016 -0700 1150 | 1151 | Migrated away from inline argument parsing to function; bootparams() 1152 | 1153 | commit 3be97a393e2188bb2cec5c921bbfefb7e92f6fe8 1154 | Author: Jason Gerfen 1155 | Date: Wed Feb 10 09:32:11 2016 -0700 1156 | 1157 | Version bump; v0.0.1. Defined API defaults for brevity 1158 | 1159 | commit 28b4ac8af237a2e62bc147ea4af4f29245f59197 1160 | Author: Jason Gerfen 1161 | Date: Wed Feb 10 09:18:59 2016 -0700 1162 | 1163 | Changes to ordering of configuration output 1164 | 1165 | commit 25be88bb31cc592d701e48f8e8155ab4dec39dc9 1166 | Author: Jason Gerfen 1167 | Date: Tue Feb 9 18:10:04 2016 -0700 1168 | 1169 | Added nodev, noexec & nosuid options to /tmp LVM 1170 | 1171 | commit 615caf09d584385a6f56c8d52bd63362da93a65f 1172 | Author: Jason Gerfen 1173 | Date: Mon Feb 8 17:29:47 2016 -0700 1174 | 1175 | RHEL kickstart 1176 | 1177 | Reporting: 1178 | - Generates report for the following sections of process 1179 | - General: root password, command line arguments, location 1180 | nfs shares etc. 1181 | - Disks: Swap, primary partition, logical volumes & possible 1182 | extra disks/volume groups 1183 | - Network: IPv4, Netmask, Gateway etc. 1184 | - Auto-build: NFS mount information, statistical information 1185 | regarding build tools failed, success etc. 1186 | 1187 | Disks: 1188 | - Disks are auto assembled based on Pacificorp UNIX team 1189 | build standards for physical vs. virtual builds. 1190 | - If system disk specifications fall outside the range 1191 | outlined in the build guide a dynamic configuration is 1192 | used based on percentages of the total space available. 1193 | 1194 | commit caa8f4cb9d369cb4c0a351b4d07c5054d4a5e999 1195 | Author: Jason Gerfen 1196 | Date: Mon Feb 8 17:28:59 2016 -0700 1197 | 1198 | Debugging output 1199 | 1200 | commit 58da46f441ee913a71b576aa8d9eb433386f55ff 1201 | Author: Jason Gerfen 1202 | Date: Mon Feb 8 17:28:25 2016 -0700 1203 | 1204 | Fix for human readable bytes to GB values 1205 | 1206 | commit 74d49b3558d3de97f8150495363414daf5cd24d9 1207 | Author: Jason Gerfen 1208 | Date: Mon Feb 8 17:25:08 2016 -0700 1209 | 1210 | Fix for 21474836480 in templates2output() 1211 | 1212 | commit e0893b1e01dd3dead0079104256fe5364e8f4f6d 1213 | Author: Jason Gerfen 1214 | Date: Mon Feb 8 17:19:13 2016 -0700 1215 | 1216 | Worked on non-conforming disk types (like my vm) 1217 | 1218 | commit 4f1df6426b4b42732b34ca63d88776522d8b6887 1219 | Author: Jason Gerfen 1220 | Date: Mon Feb 8 15:06:26 2016 -0700 1221 | 1222 | Disk configuration: 1223 | 1224 | - Created template to handle primary physical volume, primary volume group & standard logical volumes 1225 | - Three additional templates to handle extra disks to be auto-assembled for /opt/app (if more than one disk found) 1226 | - Function for writing primary and if needed extra LVM disk configurations 1227 | 1228 | commit 558253cb5c69e154cf54ebe02b642fe4ade7aaee 1229 | Author: Jason Gerfen 1230 | Date: Mon Feb 8 11:42:02 2016 -0700 1231 | 1232 | Disk templates: 1233 | - VM Disk template details: 1234 | 1. Assumes 1 physical disk 1235 | 2. Clears all disk(s) discovered 1236 | 3. Sets {SWAP} to size of of memory x 1 1237 | 4. Creates physical volume & volume group 1238 | 5. Assembles /, /var, /export/home, /tmp & /opt/app sizes 1239 | based on static or divided sizes for non-comforming disks 1240 | - Physical Disk template details: 1241 | 1. Assumes more than 1 physical disk 1242 | 2. Clears all disks discovered 1243 | 3. Sets {SWAP} to size of memory x 1 1244 | 4. Creates physical volume & volume groups 1245 | 5. Assembles /, /var/, /export/home, /tmp & /opt/app sizes 1246 | based on disk sizes 1247 | 1248 | commit 15065c88d683ec74dd73746969c7c548985a5ad7 1249 | Author: Jason Gerfen 1250 | Date: Mon Feb 8 10:38:40 2016 -0700 1251 | 1252 | Added human readable swap space output 1253 | 1254 | commit f959a36e065d23e9fe36c9cfca76ab69ea725041 1255 | Author: Jason Gerfen 1256 | Date: Mon Feb 8 10:35:47 2016 -0700 1257 | 1258 | Fix for bytes to GB expr 1259 | 1260 | commit bee569615964d09351e364699e074a140506fcef 1261 | Author: Jason Gerfen 1262 | Date: Mon Feb 8 10:34:05 2016 -0700 1263 | 1264 | Converted bytes to GB for disk size output 1265 | 1266 | commit 393236d6abd299d4fc99154af82e830f573ac64b 1267 | Author: Jason Gerfen 1268 | Date: Mon Feb 8 10:27:20 2016 -0700 1269 | 1270 | Fix for conditional w/ disk count found & physical build type 1271 | 1272 | commit 3005ffd481b42d1f8c1d8f507cdaa230fb9afa45 1273 | Author: Jason Gerfen 1274 | Date: Mon Feb 8 10:25:12 2016 -0700 1275 | 1276 | DEBUG pauses & informational messaging for disk processing 1277 | 1278 | commit d12276049ab9491ab2894bd8e9c1c894baaeff91 1279 | Author: Jason Gerfen 1280 | Date: Mon Feb 8 10:19:58 2016 -0700 1281 | 1282 | Fix for awk regex for determine swap size 1283 | 1284 | commit d97bfbd6f900357d4604ec1c994f9e37899e482c 1285 | Author: Jason Gerfen 1286 | Date: Mon Feb 8 10:19:10 2016 -0700 1287 | 1288 | Fix for conditional on count of disks present 1289 | 1290 | commit 3b9488c6e6356b2172f8ce5fb49b4c092caa6c66 1291 | Author: Jason Gerfen 1292 | Date: Sun Feb 7 19:01:37 2016 -0700 1293 | 1294 | Thought placement 1295 | 1296 | commit fbc284bb26dcdb447ec9078af7ef025b1e7829f5 1297 | Author: Jason Gerfen 1298 | Date: Sun Feb 7 18:59:59 2016 -0700 1299 | 1300 | Iteration of & conditional to validate bytes < 100GB 1301 | 1302 | commit 60243880549ea83f89b7d12ed6cb21c78a9e0a15 1303 | Author: Jason Gerfen 1304 | Date: Sun Feb 7 18:44:20 2016 -0700 1305 | 1306 | More commenting to break sections up 1307 | 1308 | commit ac03dcd57d731cf037004cdcf4f8f85210397178 1309 | Author: Jason Gerfen 1310 | Date: Sun Feb 7 18:40:17 2016 -0700 1311 | 1312 | Added some verbose in-line comments for future maintainability 1313 | 1314 | commit b6a586a6ca484e1cda88b4ae84379abf5fd9d41f 1315 | Author: Jason Gerfen 1316 | Date: Sun Feb 7 18:18:42 2016 -0700 1317 | 1318 | %pre: Working on disk assembly 1319 | 1320 | commit b4ea5f71dccf33d51d7d0a9e97b73b1498ca5e27 1321 | Author: Jason Gerfen 1322 | Date: Sun Feb 7 17:18:57 2016 -0700 1323 | 1324 | Set some permissions for build logs 1325 | 1326 | commit d5c2219a5da3c1f6b31e3ea1ded0a979aa887ea9 1327 | Author: Jason Gerfen 1328 | Date: Sun Feb 7 16:45:50 2016 -0700 1329 | 1330 | pause/break 1331 | 1332 | commit a31b02c4162070e192fa75bab8ff03ab7cd320c9 1333 | Author: Jason Gerfen 1334 | Date: Sun Feb 7 16:36:22 2016 -0700 1335 | 1336 | Grrrr 1337 | 1338 | commit 010a7ce5448700ebf735115a89db4eee1773a78a 1339 | Author: Jason Gerfen 1340 | Date: Sun Feb 7 16:34:24 2016 -0700 1341 | 1342 | Fix for setting to /tmp/ks-arguemnts 1343 | 1344 | commit 4127658ca83e584163cee08ca91d634589e807c1 1345 | Author: Jason Gerfen 1346 | Date: Sun Feb 7 16:31:29 2016 -0700 1347 | 1348 | Removed arglist write to logs 1349 | 1350 | commit 03b09216ef3b32fc6918eeceacb07949fd68a748 1351 | Author: Jason Gerfen 1352 | Date: Sun Feb 7 16:30:54 2016 -0700 1353 | 1354 | Remvoed ROOTPW from second %post (we don't store that) 1355 | 1356 | commit 73f9eb997cf656a47691403338ed7a985227cbb7 1357 | Author: Jason Gerfen 1358 | Date: Sun Feb 7 16:27:36 2016 -0700 1359 | 1360 | Fix for second %post and env arguments 1361 | 1362 | commit 7e75656ede34e7263334b69b61d44d7ba688495a 1363 | Author: Jason Gerfen 1364 | Date: Sun Feb 7 16:18:50 2016 -0700 1365 | 1366 | Formatting for maintainability 1367 | 1368 | commit 70cbe9ea50a282813ad18b9283e720ec37709441 1369 | Author: Jason Gerfen 1370 | Date: Sun Feb 7 16:11:50 2016 -0700 1371 | 1372 | Migrated DEBUG to %pre & %post; applied fix for config-network tool 1373 | 1374 | commit be718d4ee8e8e3bb5e834fe68fc67b59f1d97b02 1375 | Author: Jason Gerfen 1376 | Date: Sun Feb 7 15:57:01 2016 -0700 1377 | 1378 | Fix for conditional for new DEBUG arg 1379 | 1380 | commit 71d6390d2b8545f396832e8aa3e0099233443bd8 1381 | Author: Jason Gerfen 1382 | Date: Sun Feb 7 15:55:01 2016 -0700 1383 | 1384 | DEBUG option & fixes: 1385 | 1386 | - Added new bootable param; DEBUG for those times when you need to pause 1387 | every nth second 1388 | - Fix for %post (chroot) regarding build-tools directory 1389 | 1390 | commit 601f24b623895cd7dadec990542295dc105b7d87 1391 | Author: Jason Gerfen 1392 | Date: Sun Feb 7 14:47:58 2016 -0700 1393 | 1394 | Removed symbol in comment 1395 | 1396 | commit dd09f74081417ed4096abd66ed4df300bc4d3a00 1397 | Author: Jason Gerfen 1398 | Date: Sun Feb 7 14:42:18 2016 -0700 1399 | 1400 | Added some path info 1401 | 1402 | commit b379f9d0c89dfd9a954848f3db5f03ff88dac6df 1403 | Author: Jason Gerfen 1404 | Date: Sun Feb 7 14:35:24 2016 -0700 1405 | 1406 | Added the stdout handling back in 1407 | 1408 | commit 9d8ebcc02fe1fe65dab6335290c1abb90b84dbdf 1409 | Author: Jason Gerfen 1410 | Date: Sun Feb 7 14:30:16 2016 -0700 1411 | 1412 | Fix for pauses on loop, doh 1413 | 1414 | commit ce21d4f4c1d103089bf10366c5d5f91da8e1a9f1 1415 | Author: Jason Gerfen 1416 | Date: Sun Feb 7 14:22:25 2016 -0700 1417 | 1418 | Moved copy of configuration files to end 1419 | 1420 | commit 64b2ff4aef17bd7d309ca7ab0084470255acaaaa 1421 | Author: Jason Gerfen 1422 | Date: Sun Feb 7 14:17:20 2016 -0700 1423 | 1424 | Added breaks to each tool run 1425 | 1426 | commit 35b44284d364c2e32dd42ad87b01f97a3ccd9916 1427 | Author: Jason Gerfen 1428 | Date: Sun Feb 7 14:11:50 2016 -0700 1429 | 1430 | Added break prior to restart 1431 | 1432 | commit 7225ec71062bbb6472fdd47cf906a71c56d889c2 1433 | Author: Jason Gerfen 1434 | Date: Sun Feb 7 14:10:26 2016 -0700 1435 | 1436 | Increased timeout after each builder tool run 1437 | 1438 | commit 0280c7a52bf81463a8e83556bc56a71754084342 1439 | Author: Jason Gerfen 1440 | Date: Sun Feb 7 14:09:38 2016 -0700 1441 | 1442 | Fix for ks.cfg getting backed up 1443 | 1444 | commit 7833d3630dc251b80adcce22d44d16151e40322e 1445 | Author: Jason Gerfen 1446 | Date: Sun Feb 7 14:02:34 2016 -0700 1447 | 1448 | Disabled stdout to /dev/null 1449 | 1450 | commit 10c10aee5637d1eded0ae8ae844390dc2e1b217c 1451 | Author: Jason Gerfen 1452 | Date: Sun Feb 7 13:56:54 2016 -0700 1453 | 1454 | Debug timeout 1455 | 1456 | commit fd4d00b9ac41bbcfd6eb17b014e5f367949a8556 1457 | Author: Jason Gerfen 1458 | Date: Sun Feb 7 13:55:52 2016 -0700 1459 | 1460 | Fix for clear partitions of all vs. sda disks 1461 | 1462 | commit 3b689b5cf27c2c538a56345f50b0006168c1ccf9 1463 | Author: Jason Gerfen 1464 | Date: Sun Feb 7 13:51:37 2016 -0700 1465 | 1466 | Forced stdout to /dev/null & fix for config-network tool 1467 | 1468 | commit 6b3eaaa276c34f23a659dca1896eba704cf97ea5 1469 | Author: Jason Gerfen 1470 | Date: Sun Feb 7 13:42:53 2016 -0700 1471 | 1472 | Added config-network to %post (chroot) section 1473 | 1474 | commit e050a7ff418ad104d9b351f6ab9d75919364904c 1475 | Author: Jason Gerfen 1476 | Date: Sun Feb 7 12:51:52 2016 -0700 1477 | 1478 | Re-ordered disk configuration bits 1479 | 1480 | commit f58f0344bb42f67ccb751f391924339654ec374b 1481 | Author: Jason Gerfen 1482 | Date: Sat Feb 6 11:56:44 2016 -0700 1483 | 1484 | rhel.custom.ks: 1485 | - Sections: 1486 | - %pre: 1487 | 1. Handles passed arguments by converting to referenced variables; i.e. INSTALL = ${INSTALL} etc. 1488 | 2. Automates or prompts user for the following data sets: 1489 | a. ROOTPW: Root password for the installed operating system 1490 | b. INSTALL: Facilitates automation (disabled user prompts if required arguments present) 1491 | c. HOSTNAME: System hostname per RFC-1123 1492 | d. IPADDR: IPv4 address for installed system. If not specified attempts to query DHCP assigned address 1493 | e. NETMASK: Subnet for installed system. If none specified attempts to query DHCP assigned subnet 1494 | f. GATEWAY: Gateway for installed system. If none specified attempts to query DHCP assigned route 1495 | g. LOCATION: Physical location used for timezone. If none specified attempts to use ${HOSTNAME} and 1496 | defaults to PDX 1497 | - build: 1498 | 1. Uses templates created during %pre to customize installation 1499 | a. /tmp/ks-timezone: Used for timezone and location specific settings. Defaults to America/Los_Angeles. 1500 | b. /tmp/ks-rootpw: Used for root password information. Uses ${ROOTPW) arguement. If none specified during 1501 | kick start; the user is prompted for this information. 1502 | c. /tmp/ks-nfsshare: This is determined by the ${HOSTNAME} &/or ${LOCATION} argument passed during kick 1503 | start. 1504 | d. /tmp/ks-diskconfig: NOT YET COMPLETED. Will facilitate disk configuration. 1505 | e. /tmp/ks-networking: Uses DHCP provided information if ${IPADDR}, ${NETMASK} & ${GATEWAY} not provided 1506 | during the kick start process. 1507 | - %post (step 1) 1508 | 1. Uses location specific information from ${location} to mount NFS share in chroot env located at 1509 | /mnt/sysimage/var/tmp/unixbuild 1510 | 2. Makes copies of configuration files (including ks.cfg used) to chroot environment 1511 | - %post (step 2; chroot env) 1512 | 1. Validates NFS share mounted & RHEL build tools available 1513 | 2. Creates logs of build @ /root/-/pre,build,post 1514 | 3. Executes pre-validation of OS env., build of OS env. to conform to latest UNIX RHEL build document & 1515 | post-validation of OS env. 1516 | 1517 | commit 015b6012428ddf52deb4444090f0d67b694e0309 1518 | Author: Jason Gerfen 1519 | Date: Sat Feb 6 11:40:14 2016 -0700 1520 | 1521 | Verbsoe steps through run 1522 | 1523 | commit afd94ee244cbb335ff6fe6b774dcf130597edd0c 1524 | Author: Jason Gerfen 1525 | Date: Wed Feb 3 19:25:15 2016 -0700 1526 | 1527 | Fix for location variable assignment 1528 | 1529 | commit 52430d967069e5e92a76e68195ee2961d0bdae22 1530 | Author: Jason Gerfen 1531 | Date: Wed Feb 3 19:23:33 2016 -0700 1532 | 1533 | Fix for location conditional 1534 | 1535 | commit d2a026babc0aebda2ca85638d105c3df0d7bd9b4 1536 | Author: Jason Gerfen 1537 | Date: Wed Feb 3 19:19:41 2016 -0700 1538 | 1539 | Debugging pauses 1540 | 1541 | commit 0bf849b59fc96048210da5b80ac8a9adedac646a 1542 | Author: Jason Gerfen 1543 | Date: Wed Feb 3 19:15:42 2016 -0700 1544 | 1545 | Removed call to env & replaced 'tr' with 'awk tolower()' 1546 | 1547 | commit c5d5b03313e704ba32ab2ff9f8c440cecebb8b9d 1548 | Author: Jason Gerfen 1549 | Date: Wed Feb 3 19:05:13 2016 -0700 1550 | 1551 | Added call to env 1552 | 1553 | commit 50103e03705827bf2b70c6caa17429610dd1edca 1554 | Author: Jason Gerfen 1555 | Date: Wed Feb 3 19:02:42 2016 -0700 1556 | 1557 | Migrating older code base using associtive arrays to compatible variable based syntax 1558 | 1559 | commit 12efb9d96dcb751b74118591471a2bbfd3165692 1560 | Author: Jason Gerfen 1561 | Date: Wed Feb 3 18:44:12 2016 -0700 1562 | 1563 | Test for from cat < 1567 | Date: Wed Feb 3 18:39:54 2016 -0700 1568 | 1569 | Fix for 'gateway' networking arguement 1570 | 1571 | commit 5e32efeeae0e97ea3a9222f2bda758d68261ad9c 1572 | Author: Jason Gerfen 1573 | Date: Wed Feb 3 18:38:46 2016 -0700 1574 | 1575 | Some debugging info to ensure options passed are parsed correctly 1576 | 1577 | commit 231c19cfc6779e3d64adc697f629dc464437c71c 1578 | Author: Jason Gerfen 1579 | Date: Wed Feb 3 18:31:06 2016 -0700 1580 | 1581 | Fix for iteration & assignment of key -> value of command line args 1582 | 1583 | commit 74666639032f787b38c8762688d0b2b7022c28b9 1584 | Author: Jason Gerfen 1585 | Date: Wed Feb 3 16:59:25 2016 -0700 1586 | 1587 | Enabled logginf for %pre & inluded longer sleep time 1588 | 1589 | commit fe1e54b42f80c89d015010b9b6a5adcdc8754fb0 1590 | Author: Jason Gerfen 1591 | Date: Wed Feb 3 16:45:42 2016 -0700 1592 | 1593 | Removed TUX, damn shame 1594 | 1595 | commit 6b4a82a8d6dfff8785be1103e67d2b749d96efd6 1596 | Author: Jason Gerfen 1597 | Date: Wed Feb 3 16:38:55 2016 -0700 1598 | 1599 | Added some verbose comments for handling arguments 1600 | 1601 | commit 44dbdd8087626285478b747428462ee58782b756 1602 | Author: Jason Gerfen 1603 | Date: Wed Feb 3 16:36:43 2016 -0700 1604 | 1605 | Commented out root pw prompt or argument passing 1606 | 1607 | commit 5ed68a9c4a2c510d6ffade682dfeb7bd2faf2919 1608 | Author: Jason Gerfen 1609 | Date: Wed Feb 3 16:28:25 2016 -0700 1610 | 1611 | Fix for using uname when expecting DHCP option 12 1612 | 1613 | commit f02f691b2d1be0549ba17b4760d2cbd80b97ba34 1614 | Author: Jason Gerfen 1615 | Date: Wed Feb 3 16:27:31 2016 -0700 1616 | 1617 | Commented out frivilous bit 1618 | 1619 | commit db856ae4ef5ef511b6009c78e911d31ee4f708eb 1620 | Author: Jason Gerfen 1621 | Date: Wed Feb 3 15:26:12 2016 -0700 1622 | 1623 | Initial commit 1624 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing to jaks 2 | 3 | ## Code Contributions 4 | 5 | This document will guide you through the contribution process. 6 | 7 | ### Step 1: Fork 8 | 9 | Fork the project [on GitHub](https://github.com/jas-/jaks) and check out your 10 | copy locally. 11 | 12 | ```text 13 | $ git clone git@github.com:username/jaks.git 14 | $ cd node 15 | $ git remote add upstream git://github.com/jas-/jaks.git 16 | ``` 17 | 18 | Keep your local fork update to date using the `upstream` branch indicated in 19 | the above commands. 20 | 21 | #### Which branch? 22 | 23 | For developing new features and bug fixes, the `master` branch should be pulled 24 | and built upon. 25 | 26 | ### Step 2: Branch 27 | 28 | Create a feature branch using a format similar to `v0.0.23-myfeature-branch` 29 | ensuring to track the `v0.0.23-myfeature-branch` branch and start hacking: 30 | 31 | ```text 32 | $ git checkout -b v0.0.23-myfeature-branch -t origin/master 33 | ``` 34 | 35 | The branch name should be descriptive about the fixes/features it will 36 | address. 37 | 38 | ### Step 3: Commit 39 | 40 | Make sure git knows your name and email address: 41 | 42 | ```text 43 | $ git config --global user.name "J. Random User" 44 | $ git config --global user.email "j.random.user@example.com" 45 | ``` 46 | 47 | Writing good commit logs is important. A commit log should describe what 48 | changed and why. Follow these guidelines when writing one: 49 | 50 | 1. The first line should be 50 characters or less and contain a short 51 | description of the change prefixed with the name of the changed 52 | subsystem (e.g. "net: add localAddress and localPort to Socket"). 53 | 2. Keep the second line blank. 54 | 3. Wrap all other lines at 72 columns. 55 | 56 | A good commit log can look something like this: 57 | 58 | ``` 59 | subsystem: explaining the commit in one line 60 | 61 | Body of commit message is a few lines of text, explaining things 62 | in more detail, possibly giving some background about the issue 63 | being fixed, etc. etc. 64 | 65 | The body of the commit message can be several paragraphs, and 66 | please do proper word-wrap and keep columns shorter than about 67 | 72 characters or so. That way `git log` will show things 68 | nicely even when it is indented. 69 | ``` 70 | 71 | The header line should be meaningful; it is what other people see when they 72 | run `git shortlog` or `git log --oneline`. 73 | 74 | Check the output of `git log --oneline files_that_you_changed` to find out 75 | what subsystem (or subsystems) your changes touch. 76 | 77 | 78 | ### Step 4: Rebase 79 | 80 | Use `git rebase` (not `git merge`) to sync your work from time to time (as 81 | mentioned in 'Step 1'). 82 | 83 | ```text 84 | $ git fetch upstream 85 | $ git rebase upstream/master 86 | ``` 87 | 88 | ### Step 5: Test 89 | 90 | Bug fixes and features **should come with tests**. Add your tests in the 91 | test directory. Look at other tests to see how they should be 92 | structured. 93 | 94 | ```text 95 | $ cd test; 96 | $ ./harness 97 | ``` 98 | 99 | ### Step 6: Push 100 | 101 | ```text 102 | $ git push origin my-feature-branch 103 | ``` 104 | 105 | Go to https://github.com/yourusername/jaks and select your feature 106 | branch. Click the 'Pull Request' button and fill out the form. 107 | 108 | Pull requests are usually reviewed within a few days. If there are comments 109 | to address, apply your changes in a separate commit and push that to your 110 | feature branch. Post a comment in the pull request afterwards; GitHub does 111 | not send out notifications when you add commits. -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 - 2016 Jason Gerfen 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software is furnished to do so, 10 | subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # jaks - Just Another Kickstart Script 2 | 3 | Facilitates automation of any `Anaconda` based 4 | [distribution](http://fedoraproject.org/wiki/Anaconda/Distros) 5 | 6 | ```text 7 | ____. _____ ____ __. _________ 8 | | | / _ \ | |/ _| / _____/ 9 | | |/ /_\ \| < \_____ \ 10 | /\__| / | \ | \ / \ 11 | \________\____|__ /____|__ \/_______ / 12 | \/ \/ \/ 13 | Just Another Kickstart Script 14 | ``` 15 | 16 | ## Options ## 17 | The options listed below are custom arguments which supercede those provided 18 | from the [installer](https://rhinstaller.github.io/anaconda/boot-options.html). 19 | 20 | ### General ### 21 | The options provided here allow for configuration of the `grub` boot options. 22 | 23 | | Option | Type | Default | Description | 24 | |:-|:-:|:-:|:-| 25 | | `INSTALL` | *boolean* | false | If specified will skip the safety check regarding installation | 26 | | `DEBUG` | *boolean* | false | Used to display reports for each category of `%pre` & `%post` script execution | 27 | | `LANG` | *string* | en_US.UTF-8 | Correlates to the language options found @ `/usr/share/system-config-language/locale-list` | 28 | | `LOCATION` | *string* | America/Denver | Must be a valid timezone specified by the [IANA timezone database](https://www.iana.org/time-zones) | 29 | | `ROOTPW` | *string* | NULL | If not specified will prompt user for input | 30 | 31 | 32 | ### Networking ### 33 | While the `anaconda` API does contain [networking](https://rhinstaller.github.io/anaconda/boot-options.html#network-options), the `jaks` networking options can be used to supplement them which allows for a temporary build environment. 34 | 35 | | Option | Type | Default | Description | 36 | |:-|:-:|:-:|:-| 37 | | `IP` | *string* | NULL | If specified, this option will set the default IP address of the system and will superceede the default `ip` option when both are provided. This allows for a possible temporary build environment network configuration. | 38 | | `NETMASK` | *string* | NULL | If specified, this option will set the default subnet of the system and will superceede the default `netmask` option when both are provided. | 39 | | `GATEWAY` | *string* | NULL | If specified, this option will set the default route of the system and will superceede the default `gateway` option when both are provided. | 40 | 41 | 42 | ### Disk(s) configuration ### 43 | The `JAKS` LVM disk configuration is based on a configurable template 44 | variable. It will detect all non-usb & non-network storage devices and 45 | assemble them into the following partition schema. 46 | 47 | | Path | Type | Size | Filesystem | 48 | |:-|:-:|:-|:-| 49 | | `/boot` | *Physical* | 500MB | ext4 | 50 | | `/boot/efi` | *Physical* | 500MB | vfat | 51 | | `swap` | *LVM* | Physical Memory x 2 | swap | 52 | | `/` | *LVM* | See [Disk sizing](#disk-sizing) | ext4 | 53 | | `/export/home` | *LVM* | See [Disk sizing](#disk-sizing) | ext4 | 54 | | `/var` | *LVM* | See [Disk sizing](#disk-sizing) | ext4 | 55 | | `/tmp` | *LVM* | See [Disk sizing](#disk-sizing) | ext4 | 56 | | `/opt` | *LVM* | See [Disk sizing](#disk-sizing) | ext4 | 57 | 58 | 59 | #### Disk sizing #### 60 | To accomodate for disks of varying size the following conditionals are 61 | used to determine how to assemble the disk(s). 62 | 63 | *All sizes are represented in bytes* 64 | ```text 65 | d^n = Number of Physical disks (d=disks, n=number of disks) 66 | m = Physical System Memory 67 | b = 500MB 68 | f = 100GB 69 | pp = 100GB + 40GB + 10GB + 2GB 70 | vp = 40GB + 20GB + 10GB + 20GB 71 | op = 40% + 20% + 10% + 2% (Less than 100GB in size. Allocates by percentages of disk size) 72 | ``` 73 | 74 | And the decision tree that auto-assembles the disks is shown here. The final 75 | result will depend on the size and the number of disk(s) found on the host. 76 | 77 | ```text 78 | (d^n = 1) ? d0 – (b + m x 1) – 79 | (d0 > f) && (d0 < pp) ? d0 – (pp + d0 (75%)) 80 | (d0 = f) && (d0 > pp) ? d0 – (vp + d0(75%)) 81 | (d0 < f) ? d0 – (op + d0(75%)) 82 | (d^n > 1) ? d0 – (b + m x 1) – (pp + d^n - d0(75%)) 83 | ``` 84 | 85 | ## Contributing ## 86 | Contributions are welcome & appreciated. Refer to the 87 | [contributing document](https://github.com/jas-/jaks/blob/master/CONTRIBUTING.md) 88 | to help facilitate pull requests. 89 | 90 | ## License ## 91 | This software is licensed under the 92 | [MIT License](https://github.com/jas-/jaks/blob/master/LICENSE). 93 | 94 | Copyright Jason Gerfen, 2015 - 2017. 95 | -------------------------------------------------------------------------------- /jaks.ks: -------------------------------------------------------------------------------- 1 | ############################################### 2 | # Begin %pre configuration script # 3 | ############################################### 4 | %pre --interpreter=/bin/bash --log=/dev/tty3 5 | 6 | 7 | ############################################### 8 | # Environment variables & settings # 9 | ############################################### 10 | 11 | # Setup the env (setting /dev/tty3 as default IO) 12 | chvt 3 13 | exec < /dev/tty3 > /dev/tty3 2>/dev/tty3 14 | 15 | # Set $PATH to something robust 16 | PATH=$PATH:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin 17 | 18 | 19 | ############################################### 20 | # Default API arguments # 21 | ############################################### 22 | 23 | # Set DEBUG = false, pauses occur at each report 24 | DEBUG=false 25 | 26 | # Set INSTALL = false; if not user is prompted to wipe system 27 | # This will not prevent prompts if ROOTPW &/or LOCATION cannot be determined 28 | INSTALL=false 29 | 30 | # ROOTPW is empty but should be provided as command line arg to facilitate 31 | # automation (no user interaction) 32 | ROOTPW= 33 | 34 | # LOCATION defaults to 'America/Denver' but can be provided at boot 35 | LOCATION="America/Denver" 36 | 37 | # LANG defaults to 'en_US.UTF-8' but can be provided at boot 38 | LANG="en_US.UTF-8" 39 | 40 | # HOSTNAME is empty but if provided & conforms to naming standard will be used 41 | # to set LOCATION. Also, if HOSTNAME is not provided every attempt is made to 42 | # use a DHCP provided hostname 43 | HOSTNAME= 44 | 45 | # IPADDR can be used to setup the network. If it is not provided the tool will 46 | # attempt to obtain the value from anything provided by DHCP. It will take 47 | # precedence over anything provided by DHCP as well 48 | IPADDR= 49 | 50 | # NETMASK like IPADDR can be used to setup the network. DHCP settings will be 51 | # used in the event is not present. 52 | NETMASK= 53 | 54 | # GATEWAY can also be specified or the DHCP provided gateway will be used 55 | GATEWAY= 56 | 57 | # DVD is used for DVD or no network based installations 58 | DVD=false 59 | 60 | # Proxy server for RHN registration 61 | PROXY=false 62 | 63 | # Proxy username 64 | PROXYUSER= 65 | 66 | # Proxy password 67 | PROXYPASS= 68 | 69 | 70 | ############################################### 71 | # General configuration variables # 72 | ############################################### 73 | 74 | # Global variable for hostname 75 | hostname= 76 | 77 | # Global variable for location 78 | location= 79 | 80 | # Disk debugging log 81 | dlog=/tmp/disks.log 82 | 83 | # Name of %post configuration scripts 84 | buildtools="jaks-post-config" 85 | 86 | # Build-tools execution directory (chroot env) 87 | buildenv=/mnt/sysimage/var/tmp/${buildtools}/ 88 | 89 | 90 | ############################################### 91 | # Disk specific variables & templates # 92 | ############################################### 93 | 94 | # 100GB in bytes; definitively determines vm or physical installation 95 | gbytes=107374182400 96 | 97 | # Physical group creation variable 98 | pv_tmpl="part {ID} --size={SIZE} --grow --ondisk={DISK}" 99 | 100 | # 'optappvg' volgroup variable; used when phsyical disks > 1 101 | vg_tmpl="volgroup optappvg {ID} --pesize=4096" 102 | 103 | # 'optlv' variable for logical volume creation 104 | lv_tmpl="logvol /opt --fstype=ext4 --name=optlv --vgname={VOLGROUP} \ 105 | --size={SIZE}" 106 | 107 | # '/boot/efi' partition template 108 | efi_tmpl="part /boot/efi --size={SIZE} --fstype="efi" --ondisk={PRIMARY}" 109 | 110 | # Grub installation template 111 | grub_tmpl="bootloader --location={GRUB} --driveorder={DISK} --append=\"rhgb quiet crashkernel=512M audit=1\"" 112 | 113 | # Define a template for disk configurations 114 | read -d '' disk_template <<"EOF" 115 | # Zero the MBR 116 | zerombr 117 | 118 | # Clear out partitions for {DISKS} 119 | clearpart --all --initlabel --drives={DISKS} 120 | 121 | # Create a /boot partition on {PRIMARY} of 500MB 122 | part /boot --size=500 --fstype="ext4" --ondisk={PRIMARY} 123 | 124 | # If EFI is used, ensure we have a /boot/EFI partition 125 | {EFI} 126 | 127 | # Create an LVM partition of {SIZE}MB on {PRIMARY} 128 | part pv.root --size={SIZE} --ondisk={PRIMARY} --grow --asprimary 129 | 130 | # Create the root volume group 131 | volgroup rootvg --pesize=4096 pv.root 132 | 133 | # Create a memory partition of {SWAP}MB 134 | logvol swap --fstype="swap" --name="swaplv" --vgname="rootvg" --size={SWAP} 135 | 136 | # Create logical volume for the / mount point 137 | logvol / --fstype="ext4" --name="rootlv" --vgname="rootvg" --size={ROOTLVSIZE} 138 | 139 | # Create logical volume for the /var mount point 140 | logvol /var --fstype="ext4" --name="varlv" --vgname="rootvg" --size={VARLVSIZE} 141 | 142 | # Create logical volume for the /export/home mount point 143 | logvol /export/home --fstype="ext4" --name="homelv" --vgname="rootvg" \ 144 | --size={HOMELVSIZE} 145 | 146 | # Create logical volume for the /tmp mount point 147 | logvol /tmp --fstype="ext4" --name="tmplv" --vgname="rootvg" --size={TMPLVSIZE} 148 | 149 | EOF 150 | 151 | # 'Extra' disk report 152 | read -d '' extra_disk_report <<"EOF" 153 | Extended: 154 | Logical Volume Configuration: 155 | |_ optapppv {disks} 156 | | |_ optappvg {size}MB 157 | |___|_ optlv: /opt {opt_size}MB 158 | EOF 159 | 160 | # 'VM' disk report 161 | vm_disk_report=" |___|_ optlv: /opt {opt_size}MB" 162 | 163 | # Final disk report 164 | read -d '' disk_report <<"EOF" 165 | Disk configuration: 166 | 167 | Primary: 168 | Physical Partitions: 169 | |_ {disk}1: /boot 500MB 170 | Logical Volume Configuration: 171 | |_ rootpv {disk} 172 | | |_ rootvg {size}MB 173 | | |_ swaplv: swap {swap}MB 174 | | |_ rootlv: / {root_size}MB 175 | | |_ varlv: /var {var_size}MB 176 | | |_ homelv: /export/home {home_size}MB 177 | | |_ tmplv: /tmp {tmp_size}MB 178 | EOF 179 | 180 | # Set the -x flag for debugging if ${DEBUG} = true 181 | if [ "${DEBUG}" == "true" ]; then 182 | set -x 183 | fi 184 | 185 | 186 | ############################################### 187 | # Function definitions - general # 188 | ############################################### 189 | 190 | # Pause function handle pausing if ${DEBUG} = true 191 | function pause() 192 | { 193 | local continue= 194 | while [ "${continue}" != "yes" ]; do 195 | read -p "Paused; Continue? " continue 196 | echo "" 197 | done 198 | } 199 | 200 | # Search array 201 | function in_array() 202 | { 203 | local args=("${@}") 204 | local needle="${args[0]}" 205 | local haystack=("${args[@]:1}") 206 | 207 | for i in ${haystack[@]}; do 208 | if [[ ${i} == ${needle} ]]; then 209 | return 0 210 | fi 211 | done 212 | 213 | return 1 214 | } 215 | 216 | 217 | # Function to handle API boot params 218 | function bootparams() 219 | { 220 | # Capture array of arguments 221 | local opts=($(cat /proc/cmdline)) 222 | 223 | # Iterate ${opts[@]} & extract args key/values 224 | if [ ${#opts[@]} -gt 1 ]; then 225 | for opt in "${opts[@]}"; do 226 | i=$((i+1)) 227 | key="$(echo "${opt}"|awk '{split($0, obj, "=");print obj[1]}')" 228 | value="$(echo "${opt}"|awk '{split($0, obj, "=");print obj[2]}')" 229 | eval ${key}=${value} 230 | done 231 | fi 232 | } 233 | 234 | 235 | # Confirmation of installation function 236 | function confirminstall() 237 | { 238 | # Force prompt if ${INSTALL} not present 239 | if [ "${INSTALL}" != "true" ]; then 240 | install="no" 241 | else 242 | install="yes" 243 | fi 244 | 245 | # Ensure user knows they are going to wipe out the machine 246 | while [ "${install}" != "yes" ]; do 247 | clear 248 | echo '********************************************************************' 249 | echo '* ____. _____ ____ __. _________ *' 250 | echo '* | | / _ \ | |/ _| / _____/ *' 251 | echo '* | |/ /_\ \| < \_____ \ *' 252 | echo '* /\__| / | \ | \ / \ *' 253 | echo '* \________\____|__ /____|__ \/_______ / *' 254 | echo '* \/ \/ \/ *' 255 | echo '* Just Another Kickstart Script *' 256 | echo '* *' 257 | echo '* W A R N I N G *' 258 | echo '* *' 259 | echo '* This process will install a completely new operating system *' 260 | echo '* while destroying all data on all non-usb & non-network storage *' 261 | echo '* *' 262 | echo '* Do you wish to continue? Type "yes" to proceed *' 263 | echo '* *' 264 | echo '********************************************************************' 265 | echo 266 | 267 | # Get input from user 268 | read -p "Proceed with install? " install 269 | 270 | # If 'no' proceed to shut down system 271 | if [ "${install}" == "no" ]; then 272 | echo "Shuting down ... " 273 | shutdown -h now 274 | fi 275 | done 276 | } 277 | 278 | 279 | # Configures the root user 280 | function configureroot() 281 | { 282 | 283 | # If ${ROOTPW} preset copy to ${pass} 284 | if [ "${ROOTPW}" != "" ]; then 285 | pass="${ROOTPW}" 286 | fi 287 | 288 | # Prompt for root password, hash and write it out 289 | while [ "${pass}" == "" ]; do 290 | echo "No root password specified; use ROOTPW= as boot arg to skip" 291 | read -sp "Enter root user password: " pass 292 | echo "" 293 | done 294 | 295 | # Write ${pass} to rootpw 296 | echo "rootpw ${pass}" > /tmp/ks-rootpw 297 | } 298 | 299 | 300 | # Configure the hostname (either arg or dhcp) 301 | function configurehostname() 302 | { 303 | local hname= 304 | 305 | # Set ${hostname}: ${args[HOSTNAME]} or value of `uname -n` 306 | if [ "${HOSTNAME}" == "" ]; then 307 | 308 | # Get the current hostname 309 | hname="$(uname -n)" 310 | 311 | # If static DHCP enabled option 12 *might* contain the appropriate hostname 312 | if [[ ! "${hname}" =~ localhost ]]; then 313 | hostname="${hname}" 314 | fi 315 | else 316 | # Set ${hostname} to global ${HOSTNAME} 317 | hostname="${HOSTNAME}" 318 | 319 | # Set the current OS hostname to ${hostname} 320 | hostname "${hostname}" 321 | fi 322 | } 323 | 324 | 325 | # Configures the proxy if required 326 | function configureproxy() 327 | { 328 | 329 | # If ${PROXY} & ${REGISTER} == true make sure we have ${PROXY}, ${PROXYUSER} & ${PROXYPASS} 330 | if [[ "${PROXY}" != "false" ]] && [[ "${REGISTER}" == "true" ]]; then 331 | 332 | # Handle ${PROXY} if missing 333 | if [[ "${PROXY}" == "" ]]; then 334 | while [ "${PROXY}" == "" ]; do 335 | echo "No proxy URI specified; use PROXYU= as boot arg to skip" 336 | read -p "Enter proxy URI: " PROXY 337 | echo "" 338 | done 339 | fi 340 | 341 | # Handle ${PROXYUSER} if missing 342 | if [[ "${PROXYUSER}" == "" ]]; then 343 | while [ "${PROXYUSER}" == "" ]; do 344 | echo "No proxy username specified; use PROXYUSER= as boot arg to skip" 345 | read -p "Enter proxy username: " PROXYUSER 346 | echo "" 347 | done 348 | fi 349 | 350 | # Handle ${PROXYPASS} if missing 351 | if [[ "${PROXYPASS}" == "" ]]; then 352 | while [ "${PROXYPASS}" == "" ]; do 353 | echo "No proxy password specified; use PROXYPASS= as boot arg to skip" 354 | read -sp "Enter proxy password: " PROXYPASS 355 | echo "" 356 | done 357 | fi 358 | fi 359 | } 360 | 361 | 362 | # Setup timezone configurations 363 | function configuretimezone() 364 | { 365 | # Write out /tmp/timezone 366 | echo "timezone ${LOCATION} --isUtc" > /tmp/ks-timezone 367 | } 368 | 369 | 370 | ############################################### 371 | # Function definitions - math # 372 | ############################################### 373 | 374 | # Calculate kilobytes to bytes 375 | function kb2b() 376 | { 377 | echo $(expr ${1} \* 1024) 378 | } 379 | 380 | 381 | # Calculate mb2bytes to bytes 382 | function mb2b() 383 | { 384 | echo $(expr ${1} \* 1024 \* 1024) 385 | } 386 | 387 | 388 | # Calculate gigabytes to MB 389 | function gb2mb() 390 | { 391 | echo $(expr ${1} \* 1024) 392 | } 393 | 394 | 395 | # Calculate gigabytes to KB 396 | function gb2kb() 397 | { 398 | echo $(expr ${1} \* 1024 \* 1024) 399 | } 400 | 401 | 402 | # Calculate gigabytes to bytes 403 | function gb2b() 404 | { 405 | echo $(expr ${1} \* 1024 \* 1024 \* 1024) 406 | } 407 | 408 | 409 | # Calculate kilobytes to MB 410 | function kb2mb() 411 | { 412 | echo $(expr ${1} / 1024) 413 | } 414 | 415 | 416 | # Calculate bytes to MB 417 | function b2mb() 418 | { 419 | echo $(expr ${1} / 1024 / 1024) 420 | } 421 | 422 | 423 | # Return bytes based on % of total 424 | function percent() 425 | { 426 | total=${1} 427 | percent=${2} 428 | 429 | echo $((${total} / 100 * ${percent})) 430 | } 431 | 432 | 433 | ############################################### 434 | # Function definitions - disks # 435 | ############################################### 436 | 437 | # Function to handle disk template creation for dynamic disks 438 | function configuredisks() 439 | { 440 | local disk="${1}" # comma seperated list; i.e. sda:size,sdb:size etc 441 | local swap="${2}" # swap disk space (physical memory x 1) 442 | 443 | local optapp=0 # Is set to 1 when multiple disks are used for /opt 444 | 445 | # Set ${efi} to empty 446 | local efi= 447 | 448 | # Set ${partitions} to empty 449 | local partitions= 450 | 451 | # Convert ${disks} into an array (${disks[@]}) 452 | IFS=',' read -a disks <<< "${disk}" 453 | 454 | # If ${#disks[@]} > 1 send to 'multipledisks()' function 455 | if [ ${#disks[@]} -gt 1 ]; then 456 | 457 | # Call multipledisks() which creates a complex entry to handle /opt 458 | multipledisks "${disk}" 459 | 460 | # Set ${optapp} = 1 to prevent duplication on primary disk 461 | optapp=1 462 | fi 463 | 464 | # Create string of disks to clear out partitons on 465 | for dsk in ${disks[@]}; do 466 | 467 | # Get the disk name 468 | prt="$(echo "${dsk}"|awk '{split($0, obj, ":");print obj[1]}')" 469 | 470 | # If ${partitons} is empty use ${prt} 471 | if [ "${partitions}" == "" ]; then 472 | partitions="${prt}" 473 | else 474 | partitions="${partitions},${prt}" 475 | fi 476 | done 477 | 478 | # Copy ${disks[0]} to ${disk} 479 | local disk="$(echo "${disks[0]}"|awk '{split($0, obj, ":");print obj[1]}')" 480 | 481 | # Copy ${disks[0]} to ${size} 482 | local size=$(echo "${disks[0]}"|awk '{split($0, obj, ":");print obj[2]}') 483 | 484 | # Make a copy of ${size} for evaluating paritition scheme 485 | local evalsize=${size} 486 | 487 | # First remove 500 (/boot) & ${swap} from ${size} 488 | size=$(expr ${size} - $(expr $(mb2b 500) + ${swap})) 489 | 490 | # If EFI boot used create a 500MB partition for /boot/efi 491 | if [ -d /sys/firmware/efi ]; then 492 | 493 | # Remove 500MB from ${size} 494 | size=$(expr ${size} - $(mb2b 500)) 495 | 496 | # Re-write ${efi_tmpl} with the correct ${disk} & size 497 | efi=$(echo "${efi_tmpl}" | 498 | sed -e "s|{SIZE}|500|g" -e "s|{PRIMARY}|${disk}|g") 499 | 500 | # Use ${bid} to rewrite ${grub_tmpl} 501 | echo "${grub_tmpl}" | 502 | sed -e "s|{GRUB}|partition|g" \ 503 | -e "s|{DISK}|${disk}|g" > /tmp/ks-grubinstall 504 | else 505 | 506 | # Use MBR to rewrite ${grub_tmpl} because it isn't an EFI installation 507 | echo "${grub_tmpl}" | 508 | sed -e "s|{GRUB}|mbr|g" \ 509 | -e "s|{DISK}|${disk}|g" > /tmp/ks-grubinstall 510 | fi 511 | 512 | # Build physical system size in bytes 513 | pssize=$(expr $(gb2b 100) + $(gb2b 40) + $(gb2b 10) + $(gb2b 2)) 514 | 515 | # If ${evaldisk} size > 100GB & > ${pssize}; assume physical 516 | if [[ ${evalsize} -gt ${gbytes} ]] && [[ ${evalsize} -ge ${pssize} ]]; then 517 | 518 | # 100GB / LVM 519 | root_size=$(gb2b 100) 520 | 521 | # 40GB /var LVM 522 | var_size=$(gb2b 40) 523 | 524 | # 10GB /export/home LVM 525 | home_size=$(gb2b 10) 526 | 527 | # 2GB /tmp LVM 528 | tmp_size=$(gb2b 2) 529 | fi 530 | 531 | # If ${evalsize} size == 100GB && < ${pssize}; assume vm 532 | if [[ ${evalsize} -ge ${gbytes} ]] && [[ ${evalsize} -le ${pssize} ]]; then 533 | 534 | # 40GB / LVM 535 | root_size=$(gb2b 40) 536 | 537 | # 20GB /var LVM 538 | var_size=$(gb2b 20) 539 | 540 | # 10GB /export/home LVM 541 | home_size=$(gb2b 10) 542 | 543 | # 2GB /tmp LVM 544 | tmp_size=$(gb2b 2) 545 | fi 546 | 547 | # If ${evaldisk} size < 100GB; split disk 548 | if [ ${evalsize} -lt ${gbytes} ]; then 549 | 550 | # Allocate 40% of ${size} for /root (rootlv) 551 | root_size=$(percent ${size} 40) 552 | 553 | # Allocate 20% of ${size} for /var (varlv) 554 | var_size=$(percent ${size} 20) 555 | 556 | # Allocate 10% of ${size} for /export/home (homelv) 557 | home_size=$(percent ${size} 10) 558 | 559 | # Allocate 2% of ${size} for /tmp (tmplv) 560 | tmp_size=$(percent ${size} 2) 561 | fi 562 | 563 | # Validate that we have some partition sizes 564 | if [[ -z ${root_size} ]] || [[ -z ${var_size} ]] || [[ -z ${home_size} ]] || \ 565 | [[ -z ${tmp_size} ]]; then 566 | echo "Partition sizes were not determined, exiting" 567 | exit 1 568 | fi 569 | 570 | # Add ${root_size}, ${var_size}, ${home_size} & ${tmp_size} 571 | total_parts=$(expr ${root_size} + ${var_size} + ${home_size} + ${tmp_size}) 572 | 573 | # Calculate ${opt_size} based on ${size} - ${total_parts} 574 | total_size=$(expr ${size} - ${total_parts}) 575 | 576 | # Remove 2% overhead from ${opt_size} 577 | #opt_size=$(expr ${total_size} - $(percent ${total_size} 2)) 578 | 579 | # Remove 75% and use as ${opt_size} because RHEL keeps changing the LVM API 580 | remove=$(expr ${total_size} - $(percent ${total_size} 75)) 581 | opt_size=$(expr ${total_size} - ${remove}) 582 | 583 | # If /opt isn't defined create it in /tmp/ks-diskconfig-extra 584 | if [ ${optapp} -eq 0 ]; then 585 | echo "$(echo "${lv_tmpl}" | 586 | sed -e "s|{VOLGROUP}|rootvg|g" \ 587 | -e "s|{SIZE}|$(b2mb ${opt_size})|g")" >> /tmp/ks-diskconfig-extra 588 | 589 | # Also generate a report 590 | echo "${vm_disk_report}" | 591 | sed -e "s|{opt_size}|$(b2mb ${opt_size})|g" \ 592 | > /tmp/ks-report-disks-extra 593 | fi 594 | 595 | # If ${DEBUG} is true log 596 | if [ "${DEBUG}" == "true" ]; then 597 | echo "" >> ${dlog} 598 | echo "COND: ${pssize}" >> ${dlog} 599 | echo "" >> ${dlog} 600 | echo "PV: pv.root ${disk} $(b2mb ${size})MB (${size} bytes)" >> ${dlog} 601 | echo "VG Total: $(b2mb ${size})MB (${size} bytes)" >> ${dlog} 602 | echo "" >> ${dlog} 603 | echo "LV Total: $(b2mb ${total_parts})MB (${total_parts} bytes)" >> ${dlog} 604 | echo " LV root: $(b2mb ${root_size})MB (${root_size} bytes)" >> ${dlog} 605 | echo " LV var: $(b2mb ${var_size})MB (${var_size} bytes)" >> ${dlog} 606 | echo " LV home: $(b2mb ${home_size})MB (${home_size} bytes)" >> ${dlog} 607 | echo " LV tmp: $(b2mb ${tmp_size})MB (${tmp_size} bytes)" >> ${dlog} 608 | if [ ${optapp} -eq 0 ]; then 609 | echo " LV optapp: $(b2mb ${opt_size})MB (${opt_size} bytes)" >> ${dlog} 610 | fi 611 | fi 612 | 613 | # Write out /tmp/ks-diskconfig using ${disk_template} 614 | echo "${disk_template}" | 615 | sed -e "s|{DISKS}|${partitions}|g" \ 616 | -e "s|{EFI}|${efi}|g" \ 617 | -e "s|{SWAP}|$(b2mb ${swap})|g" \ 618 | -e "s|{SIZE}|$(b2mb ${size})|g" \ 619 | -e "s|{PRIMARY}|${disk}|g" \ 620 | -e "s|{ROOTLVSIZE}|$(b2mb ${root_size})|g" \ 621 | -e "s|{VARLVSIZE}|$(b2mb ${var_size})|g" \ 622 | -e "s|{HOMELVSIZE}|$(b2mb ${home_size})|g" \ 623 | -e "s|{TMPLVSIZE}|$(b2mb ${tmp_size})|g" >> /tmp/ks-diskconfig 624 | 625 | # Write a report of the disk configuration 626 | echo "${disk_report}" | 627 | sed -e "s|{disk}|${disk}|g" \ 628 | -e "s|{swap}|$(b2mb ${swap})|g" \ 629 | -e "s|{size}|$(b2mb ${size})|g" \ 630 | -e "s|{root_size}|$(b2mb ${root_size})|g" \ 631 | -e "s|{var_size}|$(b2mb ${var_size})|g" \ 632 | -e "s|{home_size}|$(b2mb ${home_size})|g" \ 633 | -e "s|{tmp_size}|$(b2mb ${tmp_size})|g" >> /tmp/ks-report-disks 634 | 635 | } 636 | 637 | 638 | # Function to handle extending /opt with multiple disks 639 | function multipledisks() 640 | { 641 | local disk="${1}" 642 | 643 | # Convert ${disks} into an array (${disks[@]}) 644 | disks=($(echo "${disk}"|awk 'BEGIN{RS=","}{print $1}'|sort -t: -k1)) 645 | 646 | # Make copy of ${disks[@]:1}yes 647 | local copy=(${disks[@]:1}) 648 | 649 | # If ${DEBUG} is true log 650 | if [ "${DEBUG}" == "true" ]; then 651 | echo "Disk(s): ${copy[*]}" >> ${dlog} 652 | fi 653 | 654 | # Get rid of this ${primary} & ${size} are not used here 655 | 656 | # Get the first element as our primary volumegroup 657 | local primary="$(echo "${disks[0]}"|awk '{split($0, o, ":");print o[1]}')" 658 | 659 | # Get the size (in bytes) of our primary volumegroup 660 | local size=$(echo "${disks[0]}"|awk '{split($0, o, ":");print o[2]}') 661 | 662 | # If ${#copy[@]} > 1 then split & iterate extending the optappvg volume group 663 | if [ ${#copy[@]} -ge 1 ]; then 664 | 665 | # Set our counter to 0 666 | local i=0 667 | 668 | # Set iteration disk size to 0 669 | local msize=0 670 | 671 | # Set total volume group size to 0 672 | local vsize=0 673 | 674 | # Placeholder for the volume group list 675 | local vgrplst= 676 | 677 | # Iterate ${copy[@]} & split into disk & size 678 | for dsk in ${copy[@]}; do 679 | 680 | # Increment each iteration 681 | i=$((i+1)) 682 | 683 | # Create a new physical group name 684 | local dname="pv.optapp.${i}" 685 | 686 | # Concatinate ${dname} for the volume group creation 687 | if [ "${vgrplst}" == "" ]; then 688 | vgrplst="${dname}" 689 | else 690 | vgrplst="${vgrplst} ${dname}" 691 | fi 692 | 693 | # Get the disk name from ${dsk} 694 | dskname="$(echo "${dsk}"|awk '{split($0, obj, ":");print obj[1]}')" 695 | 696 | # Get the ${msize} 697 | msize=$(echo "${dsk}"|awk '{split($0, obj, ":");print obj[2]}') 698 | 699 | # Remove 2% overhead from ${msize} 700 | tsize=$(expr ${msize} - $(percent ${msize} 2)) 701 | 702 | # If ${DEBUG} is true log 703 | if [ "${DEBUG}" == "true" ]; then 704 | echo "PV: ${dname} [${dskname} $(b2mb ${msize})MB (${msize} bytes)] ${tsize}" >> ${dlog} 705 | fi 706 | 707 | # Add ${tsize} to ${vsize} 708 | vsize=$(expr ${tsize} + ${vsize}) 709 | 710 | # Combine ${dskname} to ${rdn} create value of disks for disk report 711 | if [ "${rdn}" != "" ]; then 712 | rdn="${rdn}, ${dskname}" 713 | else 714 | rdn="${dskname}" 715 | fi 716 | 717 | # Make ks-diskconfig-extra with comment 718 | echo "" >> /tmp/ks-diskconfig-extra 719 | echo "# Create new physical volume on ${dskname} as ${dname}" \ 720 | >> /tmp/ks-diskconfig-extra 721 | 722 | # Generate changes for ${pv_tmpl} and write to /tmp/ks-diskconfig-extra 723 | echo "$(echo "${pv_tmpl}" | 724 | sed -e "s|{ID}|${dname}|g" \ 725 | -e "s|{SIZE}|$(b2mb ${tsize})|g" \ 726 | -e "s|{DISK}|${dskname}|g")" >> /tmp/ks-diskconfig-extra 727 | 728 | done 729 | fi 730 | 731 | # Create a header for our volume group 732 | echo "" >> /tmp/ks-diskconfig-extra 733 | echo "# Create new volume group with all physical volumes" \ 734 | >> /tmp/ks-diskconfig-extra 735 | 736 | # Generate changes for ${vg_tmpl} and write to /tmp/ks-diskconfig-extra 737 | echo "$(echo "${vg_tmpl}" | 738 | sed -e "s|{ID}|${vgrplst}|g")" >> /tmp/ks-diskconfig-extra 739 | 740 | # Create a header for our the logical volume 741 | echo "" >> /tmp/ks-diskconfig-extra 742 | echo "# Create new logical volume for optapp" \ 743 | >> /tmp/ks-diskconfig-extra 744 | 745 | # Remove 75% and use as ${vsize} because RHEL keeps changing the LVM API 746 | remove=$(expr ${vsize} - $(percent ${vsize} 75)) 747 | vsize=$(expr ${vsize} - ${remove}) 748 | 749 | # Generate changes for ${lv_tmpl} and write to /tmp/ks-diskconfig-extra 750 | echo "$(echo "${lv_tmpl}" | 751 | sed -e "s|{VOLGROUP}|optappvg|g" \ 752 | -e "s|{SIZE}|$(b2mb ${vsize})|g")" >> /tmp/ks-diskconfig-extra 753 | 754 | # Generate report for 'extra' disks 755 | echo "${extra_disk_report}" | 756 | sed -e "s|{size}|$(b2mb ${vsize})|g" \ 757 | -e "s|{disks}|${rdn}|g" \ 758 | -e "s|{opt_size}|$(b2mb ${vsize})|g" > /tmp/ks-report-disks-extra 759 | } 760 | 761 | 762 | ############################################### 763 | # Network configuration functions # 764 | ############################################### 765 | 766 | # IPv4 validation function 767 | function valid_ip() 768 | { 769 | local ip=${1} 770 | local stat=1 771 | 772 | # Exit if ${ip} is empty 773 | if [ "${ip}" == "" ]; then 774 | return 0 775 | fi 776 | 777 | if [[ ${ip} =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then 778 | OIFS=$IFS 779 | IFS='.' 780 | ip=(${ip}) 781 | IFS=$OIFS 782 | if [[ ${ip[0]} -le 255 ]] && [[ ${ip[1]} -le 255 ]] && \ 783 | [[ ${ip[2]} -le 255 ]] && [[ ${ip[3]} -le 255 ]]; then 784 | stat=0 785 | fi 786 | fi 787 | 788 | echo $stat 789 | } 790 | 791 | # Configure the network based on argument list 792 | function configurenetwork() 793 | { 794 | # Set /tmp/ks-networking to prevent failures 795 | echo "" > /tmp/ks-networking 796 | 797 | # Use ${ip}, ${netmask} & ${gateway} if present from command line args 798 | # Only copy these values if ${IPADDR}, ${NETMASK} & ${GATEWAY} don't exist 799 | # to ensure ability to set network to something other than possible build net 800 | if [[ "${ip}" != "" ]] && [[ "${netmask}" != "" ]] && \ 801 | [[ "${gateway}" != "" ]] && [[ "${IPADDR}" == "" ]] && \ 802 | [[ "${NETMASK}" == "" ]] && [[ "${GATEWAY}" == "" ]]; then 803 | 804 | IPADDR=${ip} 805 | NETMASK=${netmask} 806 | GATEWAY=${gateway} 807 | fi 808 | 809 | # Is ${IPADDR}, ${NETMASK} & ${GATEWAY} present from args list? 810 | if [[ "${IPADDR}" != "" ]] && [[ "${NETMASK}" != "" ]] && \ 811 | [[ "${GATEWAY}" != "" ]]; then 812 | 813 | # Validate IPv4 addresses for ${IPADDR}, ${NETMASK} & ${GATEWAY} 814 | if [[ $(valid_ip "${IPADDR}") -ne 0 ]] || \ 815 | [[ $(valid_ip "${NETMASK}") -ne 0 ]] || \ 816 | [[ $(valid_ip "${GATEWAY}") -ne 0 ]]; then 817 | 818 | # Be informative about the failure 819 | [[ $(valid_ip "${IPADDR}") -ne 0 ]] && echo "IPv4 (user-supplied): ${IPADDR} is invalid" 820 | [[ $(valid_ip "${NETMASK}") -ne 0 ]] && echo "Netmask (user-supplied): ${NETMASK} is invalid" 821 | [[ $(valid_ip "${GATEWAY}") -ne 0 ]] && echo "Gateway (user-supplied): ${GATEWAY} is invalid" 822 | fi 823 | else 824 | 825 | # Check to see if anything was applied via DHCP 826 | 827 | # Figure out our structure as 'ifconfig' output changed from 6.7 - 7.0 828 | if [ "$(ifconfig|grep inet|grep "inet addr:")" == "" ]; then 829 | IPADDR="$(ifconfig|grep inet|grep -v 127.0.0.1|awk '{print $2}'|head -1)" 830 | NETMASK="$(ifconfig|grep inet|grep -v 127.0.0.1|awk '{print $4}'|head -1)" 831 | else 832 | IPADDR="$(ifconfig|grep inet|grep -v 127.0.0.1|cut -d : -f 2|cut -d " " -f 1|head -1)" 833 | NETMASK="$(ifconfig|grep inet|grep -v 127.0.0.1|cut -d : -f 4|head -1)" 834 | fi 835 | GATEWAY="$(route -n|grep ^0.0.0.0|cut -b 17-32|cut -d " " -f 1|head -1)" 836 | 837 | # Is ${IPADDR}, ${NETMASK} & ${GATEWAY} present? 838 | if [[ "${IPADDR}" != "" ]] && [[ "${NETMASK}" != "" ]] && \ 839 | [[ "${GATEWAY}" != "" ]]; then 840 | 841 | # Validate IPv4 addresses for ${IPADDR}, ${NETMASK} & ${GATEWAY} 842 | if [[ $(valid_ip "${IPADDR}") -ne 0 ]] || \ 843 | [[ $(valid_ip "${NETMASK}") -ne 0 ]] || \ 844 | [[ $(valid_ip "${GATEWAY}") -ne 0 ]]; then 845 | 846 | # Be informative about the failure 847 | [[ $(valid_ip "${IPADDR}") -ne 0 ]] && echo "IPv4 (dhcp): ${IPADDR} is invalid" 848 | [[ $(valid_ip "${NETMASK}") -ne 0 ]] && echo "Netmask (dhcp): ${NETMASK} is invalid" 849 | [[ $(valid_ip "${GATEWAY}") -ne 0 ]] && echo "Gateway (dhcp): ${GATEWAY} is invalid" 850 | fi 851 | fi 852 | fi 853 | 854 | # Update /tmp/ks-arguments with network information 855 | sed -i "s/^IPADDR.*/IPADDR ${IPADDR}/g" /tmp/ks-arguments 856 | sed -i "s/^NETMASK.*/NETMASK ${NETMASK}/g" /tmp/ks-arguments 857 | sed -i "s/^GATEWAY.*/GATEWAY ${GATEWAY}/g" /tmp/ks-arguments 858 | 859 | # Use supplied ${IPADDR}, ${NETMASK} & ${GATEWAY} to write network config 860 | if [[ "${hostname}" != "" ]] && [[ "${IPADDR}" =~ "" ]] && 861 | [[ "${NETMASK}" != "" ]] && [[ "${GATEWAY}" != "" ]]; then 862 | echo "network --bootproto=static --hostname=${hostname} --ip=${IPADDR} \ 863 | --netmask=${NETMASK} --gateway=${GATEWAY}" > /tmp/ks-networking 864 | fi 865 | 866 | } 867 | 868 | 869 | ############################################### 870 | # Handling boot parameters # 871 | ############################################### 872 | 873 | # Set up the API defaults provided from /proc/cmdline 874 | bootparams 875 | 876 | # Clear the terminal 877 | clear 878 | 879 | 880 | ############################################### 881 | # If ${INSTALL} != true, require confirmation # 882 | ############################################### 883 | 884 | # Make sure user knows it will wipe out the system 885 | confirminstall 886 | 887 | # Clear the terminal 888 | clear 889 | 890 | 891 | ############################################### 892 | # Configuration for the root password # 893 | ############################################### 894 | 895 | # Handle root password 896 | configureroot 897 | 898 | # Clear the terminal 899 | clear 900 | 901 | 902 | ############################################### 903 | # Configuration for the hostname # 904 | ############################################### 905 | 906 | # Configure the hostname 907 | configurehostname 908 | 909 | # Clear the terminal 910 | clear 911 | 912 | 913 | ############################################### 914 | # Configuration for location/timezone # 915 | ############################################### 916 | 917 | # Configure the physical location 918 | configuretimezone 919 | 920 | # Clear the terminal 921 | clear 922 | 923 | 924 | ############################################### 925 | # Configuration for the proxy # 926 | ############################################### 927 | 928 | # Setup proxy 929 | configureproxy 930 | 931 | # Clear the terminal 932 | clear 933 | 934 | 935 | ############################################### 936 | # Create a simple to parse file of options # 937 | ############################################### 938 | 939 | # Write arguments to /tmp/ks-arguments 940 | cat < /tmp/ks-arguments 941 | DEBUG ${DEBUG} 942 | INSTALL ${INSTALL} 943 | DVD ${DVD} 944 | LANG ${LANG} 945 | LOCATION ${LOCATION} 946 | HOSTNAME ${HOSTNAME} 947 | IPADDR ${IPADDR} 948 | NETMASK ${NETMASK} 949 | GATEWAY ${GATEWAY} 950 | PROXY ${PROXY} 951 | PROXYUSER ${PROXYUSER} 952 | PROXYPASS ${PROXYPASS} 953 | nfspath ${nfspath} 954 | buildtools ${buildtools} 955 | buildenv ${buildenv} 956 | EOF 957 | 958 | 959 | ############################################### 960 | # Print out a general configuration report # 961 | ############################################### 962 | 963 | # Generate a report of general configuration 964 | cat < /tmp/ks-report-general 965 | General options: 966 | DEBUG: ${DEBUG} 967 | INSTALL: ${INSTALL} 968 | ROOTPW: ************* 969 | 970 | Language option: 971 | LANGUAGE: ${LANG} 972 | 973 | Location option: 974 | LOCATION: ${LOCATION} 975 | 976 | EOF 977 | 978 | # Clear the terminal 979 | clear 980 | cat /tmp/ks-report-general 981 | 982 | # If ${DEBUG} is set to true; pause 983 | if [ "${DEBUG}" == "true" ]; then 984 | pause 985 | fi 986 | 987 | 988 | ############################################### 989 | # Configuration for DVD installations # 990 | ############################################### 991 | 992 | # If ${DVD} set to true write out a config 993 | if [ "${DVD}" == "true" ]; then 994 | echo "cdrom" > /tmp/ks-installation 995 | else 996 | touch /tmp/ks-installation 997 | fi 998 | 999 | 1000 | ############################################### 1001 | # Configuration for the networking # 1002 | ############################################### 1003 | 1004 | # Generate networking configuration 1005 | configurenetwork 1006 | 1007 | # Clear the terminal 1008 | clear 1009 | 1010 | ############################################### 1011 | # Print out the network configuration report # 1012 | ############################################### 1013 | 1014 | # Generate a report of general configuration 1015 | cat < /tmp/ks-report-network 1016 | Network configuration: 1017 | HOSTNAME: ${hostname} 1018 | IPADDR: ${IPADDR} 1019 | NETMASK: ${NETMASK} 1020 | GATEWAY: ${GATEWAY} 1021 | 1022 | Proxy settings: 1023 | PROXY: ${PROXY} 1024 | PROXY USER: ${PROXYUSER} 1025 | PROXY PASS: ************* 1026 | 1027 | EOF 1028 | 1029 | # Print the report 1030 | cat /tmp/ks-report-network 1031 | 1032 | # If ${DEBUG} is set to true; pause 1033 | if [ "${DEBUG}" == "true" ]; then 1034 | pause 1035 | fi 1036 | 1037 | 1038 | ############################################### 1039 | # Configuration for physical disks # 1040 | ############################################### 1041 | 1042 | # Clear the TTY 1043 | clear 1044 | 1045 | # Provide a status regarding disk provisioning 1046 | echo "Provisioning disk(s), please wait ... " 1047 | 1048 | # Fix for errors handling primary disk on mklabel 1049 | if [ "$(mount|grep /tmp/tfs)" != "" ]; then 1050 | umount /tmp/tfs 1051 | fi 1052 | 1053 | # Determine the amount of memory on the system, used for our swap partition 1054 | swap=$(kb2b $(cat /proc/meminfo|awk '$0 ~ /^MemTotal/{print $2}')) 1055 | 1056 | # If ${DEBUG} is true log 1057 | if [ "${DEBUG}" == "true" ]; then 1058 | echo "Boot: 500MB ($(mb2b 500) bytes)" >> ${dlog} 1059 | echo "Swap: $(b2mb ${swap})MB (${swap} bytes)" >> ${dlog} 1060 | fi 1061 | 1062 | # Get a collection of physical disks 1063 | # Filters disk partitions & converts blocks to bytes 1064 | dsks=($(cat -n /proc/partitions | 1065 | awk '$1 > 1 && $5 ~ /^s[a-z]+$/{print $5":"$4 * 1024}'|sort -t: -k1)) 1066 | 1067 | # If ${DEBUG} is true log 1068 | if [ "${DEBUG}" == "true" ]; then 1069 | echo "Disk(s): ${dsks}" >> ${dlog} 1070 | echo "" >> ${dlog} 1071 | fi 1072 | 1073 | # Make sure ${disks[@]} is > 0 1074 | if [ ! ${#dsks[@]} -gt 0 ]; then 1075 | echo "No physical disks present! Cannot create necessary disk configuration" 1076 | exit 1 1077 | fi 1078 | 1079 | # Iterate ${disks[@]} & remove USB devices 1080 | for item in ${dsks[@]}; do 1081 | 1082 | # Extract the disk 1083 | disk="$(echo "${item}"|awk '{split($0, o, ":");print o[1]}')" 1084 | 1085 | # Extract the disk size 1086 | size="$(echo "${item}"|awk '{split($0, o, ":");print o[2]}')" 1087 | 1088 | # Skip ${disk} if it is a USB device 1089 | usb="$(readlink -f /sys/class/block/${disk}/device|grep usb)" 1090 | 1091 | if [ "${usb}" == "" ]; then 1092 | 1093 | # Obtain array of logical volumes from LVM as ${lvol[@]} 1094 | lvol=$(lvscan|awk '{print $2}'|sed -e "s|^'||" -e "s|'$||") 1095 | 1096 | # If ${#lvol[@]} -gt 0 then remove them all 1097 | if [ ${#lvol[@]} -gt 0 ]; then 1098 | for lv in ${lvol[@]}; do 1099 | lvremove -f $(basename ${lv}) &>/dev/null 1100 | 1101 | # If ${DEBUG} is true log 1102 | if [ "${DEBUG}" == "true" ]; then 1103 | echo "LVM: Removed LV '${lv}'" >> ${dlog} 1104 | fi 1105 | done 1106 | fi 1107 | 1108 | # Obtain array of volume groups from LVM as ${vvol[@]} 1109 | vvol=$(vgscan|awk '$0 ~ /Found volume group/{print $4}'|sed -e 's/^"//' -e 's/"$//') 1110 | 1111 | # If ${#vvol[@]} -gt 0 then remove them all 1112 | if [ ${#vvol[@]} -gt 0 ]; then 1113 | for vg in ${vvol[@]}; do 1114 | vgremove -f ${vg} &>/dev/null 1115 | 1116 | # If ${DEBUG} is true log 1117 | if [ "${DEBUG}" == "true" ]; then 1118 | echo "LVM: Removed VG '${vg}'" >> ${dlog} 1119 | fi 1120 | done 1121 | fi 1122 | 1123 | # Obtain array of volume groups from LVM as ${vvol[@]} 1124 | pvol=$(pvscan|awk '$0 ~ /PV/{print $2}') 1125 | 1126 | # If ${#pvol[@]} -gt 0 then remove them all 1127 | if [ ${#pvol[@]} -gt 0 ]; then 1128 | for pv in ${pvol[@]}; do 1129 | pvremove -f ${pv} &>/dev/null 1130 | 1131 | # If ${DEBUG} is true log 1132 | if [ "${DEBUG}" == "true" ]; then 1133 | echo "LVM: Removed PV '${pv}'" >> ${dlog} 1134 | fi 1135 | done 1136 | fi 1137 | 1138 | # Iterate each disk & remove partition tables 1139 | part=($(fdisk -l ${disk}|awk 'BEGIN{OFS=" "}{if ($0 ~ /^\/dev/){print $1}}'|sort -r)) 1140 | if [ ${#part[@]} -gt 0 ]; then 1141 | for prt in ${part[@]}; do 1142 | echo -e "$(printf 'd\n%d\nw' "${prt: -1}")"|fdisk ${disk} 1143 | 1144 | # If ${DEBUG} is true log 1145 | if [ "${DEBUG}" == "true" ]; then 1146 | echo "PT: Removed patition '${prt}' on '${disk}'" >> ${dlog} 1147 | fi 1148 | done 1149 | fi 1150 | 1151 | # Wipe the MBR of each disk to account for 'clearpart' deficiencies 1152 | dd if=/dev/zero of=/dev/${disk} bs=1 count=512 &>/dev/null 1153 | 1154 | # If ${DEBUG} is true log 1155 | if [ "${DEBUG}" == "true" ]; then 1156 | echo "PT: Removed first 512 bytes on '${disk}'" >> ${dlog} 1157 | fi 1158 | 1159 | disks+=("${disk}:${size}") 1160 | 1161 | # If ${DEBUG} is true log 1162 | if [ "${DEBUG}" == "true" ]; then 1163 | echo "Wiped: ${disk} $(b2mb ${size})MB (${size} bytes)" >> ${dlog} 1164 | fi 1165 | 1166 | fi 1167 | done 1168 | 1169 | # If ${#disks[@]} > 1 combine as a comma seperated list 1170 | if [ ${#disks[@]} -gt 1 ]; then 1171 | dsk="${disks[@]}" 1172 | disks="${dsk// /,}" 1173 | fi 1174 | 1175 | # Create disk configuration files /tmp/ks-diskconfig & /tmp/ks-diskconfig-extra 1176 | configuredisks "${disks}" "${swap}" 1177 | 1178 | 1179 | ############################################### 1180 | # Print out the disk configuration report # 1181 | ############################################### 1182 | 1183 | # Make sure our disk configuration file exist 1184 | if [[ ! -f /tmp/ks-diskconfig ]] || [[ ! -f /tmp/ks-diskconfig-extra ]]; then 1185 | echo "Disk configuration files were not created" 1186 | exit 1 1187 | fi 1188 | 1189 | # Combine disk configuration files & remove temporary 1190 | cat /tmp/ks-diskconfig-extra >> /tmp/ks-diskconfig 1191 | 1192 | # Remove the combined disk configuration 1193 | rm /tmp/ks-diskconfig-extra 1194 | 1195 | # Make sure our disk report files exist 1196 | if [[ ! -f /tmp/ks-report-disks ]] || \ 1197 | [[ ! -f /tmp/ks-report-disks-extra ]]; then 1198 | echo "Disk report files were not created" 1199 | exit 1 1200 | fi 1201 | 1202 | # Combine disk report files & remove temporary 1203 | cat /tmp/ks-report-disks-extra >> /tmp/ks-report-disks 1204 | rm /tmp/ks-report-disks-extra 1205 | 1206 | # Clear the terminal 1207 | clear 1208 | 1209 | # Print the disk configuration report 1210 | cat /tmp/ks-report-disks 1211 | echo "" 1212 | 1213 | # If ${DEBUG} is set to true; pause 1214 | if [ "${DEBUG}" == "true" ]; then 1215 | pause 1216 | fi 1217 | 1218 | 1219 | %end 1220 | ############################################### 1221 | # End %pre configuration script # 1222 | ############################################### 1223 | 1224 | 1225 | ############################################### 1226 | # Begin kick start automation procedures # 1227 | ############################################### 1228 | 1229 | # Disable selinux 1230 | selinux --disabled 1231 | 1232 | # Setup the installation media (if any) 1233 | %include /tmp/ks-installation 1234 | 1235 | # Default language 1236 | lang en_US 1237 | 1238 | # Default keyboard layout 1239 | keyboard us 1240 | 1241 | # Include timezone 1242 | %include /tmp/ks-timezone 1243 | 1244 | # Include root password configuration 1245 | %include /tmp/ks-rootpw 1246 | 1247 | #platform x86, AMD64, or Intel EM64T 1248 | 1249 | # Restart system after kicked 1250 | reboot 1251 | 1252 | # Use NFS or DVD for installation media 1253 | #%include /tmp/ks-nfsshare 1254 | 1255 | # Include disk configuration 1256 | %include /tmp/ks-diskconfig 1257 | 1258 | # Install GRUB 1259 | %include /tmp/ks-grubinstall 1260 | 1261 | # Include networking configuration 1262 | %include /tmp/ks-networking 1263 | 1264 | # Specify authentication hashing algorithm 1265 | # (why is 'useshadow' even an option anymore?) 1266 | auth --passalgo=sha512 --useshadow 1267 | 1268 | # Disable selinux policies 1269 | selinux --disabled 1270 | 1271 | # Disable firewall 1272 | firewall --disabled 1273 | 1274 | # Don't install X, riddled with vulns 1275 | skipx 1276 | 1277 | firstboot --disable 1278 | 1279 | # Handle package installation 1280 | %packages --ignoremissing 1281 | @Base 1282 | @Core 1283 | %end 1284 | ############################################### 1285 | # End kick start automation procedures # 1286 | ############################################### 1287 | 1288 | 1289 | ############################################### 1290 | # Begin %post non-chroot configuration # 1291 | ############################################### 1292 | %post --nochroot --interpreter=/bin/bash --erroronfail --log=/dev/tty3 1293 | 1294 | 1295 | ############################################### 1296 | # Environment variables, functions & settings # 1297 | ############################################### 1298 | 1299 | # Setup the env (setting /dev/tty3 as default IO) 1300 | chvt 3 1301 | exec < /dev/tty3 > /dev/tty3 2>/dev/tty3 1302 | 1303 | clear 1304 | 1305 | # Set $PATH to something robust 1306 | PATH=$PATH:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin 1307 | 1308 | # Set our env variables from /tmp/ks-arguments 1309 | DEBUG="$(cat /tmp/ks-arguments|awk '$0 ~ /^DEBUG/{print $2}')" 1310 | INSTALL="$(cat /tmp/ks-arguments|awk '$0 ~ /^INSTALL/{print $2}')" 1311 | DVD="$(cat /tmp/ks-arguments|awk '$0 ~ /^DVD/{print $2}')" 1312 | HOSTNAME="$(cat /tmp/ks-arguments|awk '$0 ~ /^HOSTNAME/{print $2}')" 1313 | IPADDR="$(cat /tmp/ks-arguments|awk '$0 ~ /^IPADDR/{print $2}')" 1314 | NETMASK="$(cat /tmp/ks-arguments|awk '$0 ~ /^NETMASK/{print $2}')" 1315 | GATEWAY="$(cat /tmp/ks-arguments|awk '$0 ~ /^GATEWAY/{print $2}')" 1316 | nfspath="$(cat /tmp/ks-arguments|awk '$0 ~ /^nfspath/{print $2}')" 1317 | buildtools="$(cat /tmp/ks-arguments|awk '$0 ~ /^buildtools/{print $2}')" 1318 | buildenv="$(cat /tmp/ks-arguments|awk '$0 ~ /^buildenv/{print $2}')" 1319 | 1320 | 1321 | # Pause function handle pausing if ${DEBUG} = true 1322 | function pause() { 1323 | local continue= 1324 | while [ "${continue}" != "yes" ]; do 1325 | read -p "Paused; continue? " continue 1326 | echo "" 1327 | done 1328 | } 1329 | 1330 | 1331 | # Mount all block inodes searching for '${buildtools}' 1332 | function devinodes() 1333 | { 1334 | # Obtain an array of block devices as ${blockdevs[@]} 1335 | local blockdevs=($(ls -la /dev/ | sort -k 4 | 1336 | awk '$10 ~ /[0-9]$/ && ($4 ~ /^cdrom$/ || $4 ~ /^disk$/){print "/dev/"$10}')) 1337 | 1338 | # Error if ${#blockdevs[@]} -lt 1 1339 | if [ ${#blockdevs[@]} -lt 1 ]; then 1340 | return 1 1341 | fi 1342 | 1343 | # Make our mount point if it doesn't exist 1344 | if [ ! -d /tmp/tfs ]; then 1345 | mkdir -p /tmp/tfs 1346 | fi 1347 | 1348 | # Iterate ${blockdevs[@]} and mount to find the ${buildtools} 1349 | for dev in ${blockdevs[@]}; do 1350 | 1351 | # Skip loop, rawct, dm-* & ram device inodes 1352 | if [[ "${dev}" =~ loop ]] || [[ "${dev}" =~ ram ]] || 1353 | [[ "${dev}" =~ rawctl ]] || [[ "${dev}" =~ dm- ]]; then 1354 | continue 1355 | fi 1356 | 1357 | # Look to see if ${dev} is currently mounted & unmount if it is 1358 | local mnt=$(mount|grep ^${dev}|grep -v /mnt/sysimage/|awk '{print $3}') 1359 | if [ "${mnt}" != "" ]; then 1360 | umount ${mnt} 1361 | fi 1362 | 1363 | # Mount & search for '${buildtools}', skip if mount fails 1364 | local bogus=$(mount ${dev} /tmp/tfs &>/dev/null) 1365 | if [[ $? -ne 0 ]] || [[ "$(ls ${mnt_path})" == "" ]]; then 1366 | continue 1367 | fi 1368 | 1369 | # Check for the ${buildtools} folder 1370 | local needle="$(find /tmp/tfs -type d -name "${buildtools}" -print -quit)" 1371 | if [ "${needle}" != "" ]; then 1372 | if [ -d ${needle} ]; then 1373 | echo "${needle}" 1374 | return 0 1375 | fi 1376 | fi 1377 | 1378 | # Remove the mount while discarding errors 1379 | umount /tmp/tfs &>/dev/null 1380 | done 1381 | 1382 | return 1 1383 | } 1384 | 1385 | 1386 | # Function to recursively mount & search for '${buildtools}' 1387 | function findtools() 1388 | { 1389 | # Search for build tools already existing on any mounted filesystems 1390 | local haystack=$(find / -type d -name ${buildtools}|head -1) 1391 | 1392 | # If it exists return 0 and echo the path 1393 | if [[ -d ${haystack} ]] && [[ -f ${haystack}/jaks-post-config ]]; then 1394 | echo "${haystack}" && return 0 1395 | fi 1396 | 1397 | return 1 1398 | } 1399 | 1400 | 1401 | # Function to handle moving build tools in %pre 1402 | # This might be best served as a recursive function 1403 | # to ensure we get the tools copied over 1404 | function copytools() 1405 | { 1406 | # Setup the ${buildtools} location from ${buildenv} 1407 | local buildloc="${buildenv}/linux/" 1408 | 1409 | # Make our mount point if it doesn't exist 1410 | if [ ! -d /tmp/tfs ]; then 1411 | mkdir -p /tmp/tfs 1412 | fi 1413 | 1414 | # Check locally for ${buildtools} first 1415 | local path="$(findtools)" 1416 | 1417 | # If the return code isn't 0 or ${path} is still empty call devinodes() 1418 | if [[ $? -ne 0 ]] || [[ "${path}" == "" ]]; then 1419 | 1420 | # Check return from devinodes() 1421 | path=$(devinodes) 1422 | if [[ $? -eq 1 ]] || [[ "${path}" == "" ]]; then 1423 | echo "Could not locate '${buildtools}' on any disk inodes" 1424 | fi 1425 | fi 1426 | 1427 | # If it mounts try to get our build tools 1428 | if [[ -d ${path} ]] && [[ "${path}" != "" ]]; then 1429 | 1430 | # Make ${buildloc} exists in the right location 1431 | if [ ! -d ${buildloc} ]; then 1432 | mkdir -p ${buildloc} 1433 | fi 1434 | 1435 | cp -fr ${path} ${buildloc} 1436 | else 1437 | echo "Could not locate '${buildtools}', exiting..." 1438 | fi 1439 | 1440 | # Unmount /tmp/tfs if it is mounted 1441 | local mounted="$(mount|grep /tmp/tfs)" 1442 | if [ "${mounted}" != "" ]; then 1443 | umount /tmp/tfs 1444 | fi 1445 | 1446 | # Remove the /tmp/tfs folder 1447 | if [ -d /tmp/tfs ]; then 1448 | rm -fr /tmp/tfs 1449 | fi 1450 | } 1451 | 1452 | ############################################### 1453 | # Copy DNS settings to chroot env # 1454 | ############################################### 1455 | 1456 | # If /etc/resolv.conf exists do work 1457 | if [ -f /etc/resolv.conf ]; then 1458 | cp -f /etc/resolv.conf /mnt/sysimage/etc/ 1459 | fi 1460 | 1461 | # Clear the terminal 1462 | clear 1463 | 1464 | 1465 | ############################################### 1466 | # Copy build tools to temporary memory fs # 1467 | ############################################### 1468 | 1469 | # Find and copy tools 1470 | echo "Searching for '${buildtools}', please wait ..." 1471 | copytools 1472 | 1473 | # Clear the terminal 1474 | clear 1475 | 1476 | 1477 | ############################################### 1478 | # If ${DVD} is true copy tools from DVD # 1479 | ############################################### 1480 | 1481 | # If ${DVD} set is false get NFS mounts ready 1482 | if [ "${DVD}" == "true" ]; then 1483 | 1484 | # Generate a %pre (non-chroot) configuration report 1485 | cat < /tmp/ks-report-post 1486 | Post installation: (pre-chroot) 1487 | ENV: 1488 | - Copied configurations to chroot environment 1489 | - Copied RHEL build tools to chroot environment 1490 | 1491 | EOF 1492 | fi 1493 | 1494 | 1495 | ############################################### 1496 | # Expose /tmp/ks* files to chroot env # 1497 | ############################################### 1498 | 1499 | # Copy all of our configuration files from %pre to /mnt/sysimage/tmp 1500 | cp /tmp/ks* /mnt/sysimage/tmp 1501 | 1502 | 1503 | ############################################### 1504 | # Print %post (non-chroot) report # 1505 | ############################################### 1506 | 1507 | # Clear the terminal 1508 | clear 1509 | cat /tmp/ks-report-post | 1510 | sed -e "s|{NFSICMP}|${nfsicmp}|g" \ 1511 | -e "s|{NFSMT}|${nfsmt}|g" \ 1512 | -e "s|{LCLBUILD}|${lclbuild}|g" 1513 | 1514 | # If ${DEBUG} is set to true; pause 1515 | if [ "${DEBUG}" == "true" ]; then 1516 | pause 1517 | fi 1518 | 1519 | 1520 | %end 1521 | ############################################### 1522 | # End %post non-chroot configuration # 1523 | ############################################### 1524 | 1525 | 1526 | ############################################### 1527 | # Begin %post chroot configuration # 1528 | ############################################### 1529 | %post --interpreter=/bin/bash --erroronfail --log=/dev/tty3 1530 | 1531 | 1532 | ############################################### 1533 | # Environment variables, functions & settings # 1534 | ############################################### 1535 | 1536 | # Setup the env (setting /dev/tty3 as default IO) 1537 | chvt 3 1538 | exec < /dev/tty3 > /dev/tty3 2>/dev/tty3 1539 | 1540 | # Set $PATH to something robust 1541 | PATH=$PATH:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin 1542 | 1543 | clear 1544 | 1545 | # Pause function handle pausing if ${DEBUG} = true 1546 | function pause() { 1547 | local continue= 1548 | while [ "${continue}" != "yes" ]; do 1549 | read -p "Paused; continue? " continue 1550 | echo "" 1551 | done 1552 | } 1553 | 1554 | # Set our env variables from /tmp/ks-arguments 1555 | DEBUG="$(cat /tmp/ks-arguments|awk '$0 ~ /^DEBUG/{print $2}')" 1556 | INSTALL="$(cat /tmp/ks-arguments|awk '$0 ~ /^INSTALL/{print $2}')" 1557 | HOSTNAME="$(cat /tmp/ks-arguments|awk '$0 ~ /^HOSTNAME/{print $2}')" 1558 | IPADDR="$(cat /tmp/ks-arguments|awk '$0 ~ /^IPADDR/{print $2}')" 1559 | NETMASK="$(cat /tmp/ks-arguments|awk '$0 ~ /^NETMASK/{print $2}')" 1560 | GATEWAY="$(cat /tmp/ks-arguments|awk '$0 ~ /^GATEWAY/{print $2}')" 1561 | PROXY="$(cat /tmp/ks-arguments|awk '$0 ~ /^PROXY/{print $2}')" 1562 | PROXYUSER="$(cat /tmp/ks-arguments|awk '$0 ~ /^PROXYUSER/{print $2}')" 1563 | PROXYPASS="$(cat /tmp/ks-arguments|awk '$0 ~ /^PROXYPASS/{print $2}')" 1564 | buildtools="$(cat /tmp/ks-arguments|awk '$0 ~ /^buildtools/{print $2}')" 1565 | buildenv="$(cat /tmp/ks-arguments|awk '$0 ~ /^buildenv/{print $2}')" 1566 | 1567 | 1568 | # Strip off /mnt/sysimage from ${buildenv} 1569 | buildenv="$(echo "${buildenv}"|sed -e "s|/mnt/sysimage||g")" 1570 | 1571 | # Define a location for the RHEL build tool 1572 | build_tools="${buildenv}/linux/${buildtools}" 1573 | 1574 | 1575 | ############################################### 1576 | # Validate ${buildtools} location (NFS mount) # 1577 | ############################################### 1578 | 1579 | # Make sure the NFS mount provided the directory 1580 | if [ ! -d "${build_tools}" ]; then 1581 | echo "Unable to open ${build_tools}" 1582 | exit 1 1583 | fi 1584 | 1585 | 1586 | ############################################### 1587 | # Validate ${buildtools} exist (actual file) # 1588 | ############################################### 1589 | 1590 | # Does our build tool exist? 1591 | if [ ! -f "${build_tools}/jaks-post-config" ]; then 1592 | echo "RHEL build tool doesn't seem to exist @ ${build_tools}/jaks-post-config" 1593 | exit 1 1594 | fi 1595 | 1596 | 1597 | ############################################### 1598 | # Create build audit folder structure # 1599 | ############################################### 1600 | 1601 | # Record a timestamped hostname string for build logs 1602 | folder=/root/${HOSTNAME:=localhost}-$(date +%Y%m%d-%H%M) 1603 | 1604 | # Create a folder structure for operational logging 1605 | if [ ! -d "${folder}" ]; then 1606 | mkdir -p ${folder}/ 1607 | mkdir -p ${folder}/kickstart 1608 | mkdir -p ${folder}/pre 1609 | mkdir -p ${folder}/build 1610 | mkdir -p ${folder}/post 1611 | fi 1612 | 1613 | # Go to ${build_tools} 1614 | cd ${build_tools} 1615 | 1616 | echo "Please wait; auto-configuring system according to build standards" 1617 | 1618 | 1619 | ############################################### 1620 | # Run ${buildtools} to validate current env. # 1621 | ############################################### 1622 | 1623 | # Run ${build_tools} to validate current configuration with logging 1624 | ./jaks-post-config -vc \ 1625 | > ${folder}/pre/${HOSTNAME}-$(date +%Y%m%d-%H%M).log 2>/dev/null 1626 | 1627 | 1628 | ############################################### 1629 | # Configure according to RHEL build standard # 1630 | ############################################### 1631 | 1632 | # Run ${build_tools} to make changes according to RHEL build guide standards 1633 | ./jaks-post-config -va kickstart \ 1634 | > ${folder}/build/${HOSTNAME}-$(date +%Y%m%d-%H%M).log 2>/dev/null 1635 | 1636 | 1637 | ############################################### 1638 | # Check for config-network tool # 1639 | ############################################### 1640 | 1641 | # Run the $(dirname ${build_tools})/scripts/config-network tool by itself 1642 | # because the argument requirements differ from all the other tools 1643 | 1644 | # Exit if config-network tool doesn't exist 1645 | if [ ! -f ${build_tools}/scripts/config-network ]; then 1646 | echo "${build_tools}/scripts/config-network missing" 1647 | exit 1 1648 | fi 1649 | 1650 | # Change into scripts/ subfolder if scripts/config-network exists 1651 | cd ${build_tools}/scripts/ 1652 | 1653 | # Make sure our configuration data exists 1654 | if [ ! -f /tmp/ks-networking ]; then 1655 | echo "/tmp/ks-networking file is missing, exiting" 1656 | exit 1 1657 | fi 1658 | 1659 | 1660 | ############################################### 1661 | # Configure network (802.1 or single) adapter # 1662 | ############################################### 1663 | 1664 | # Run ./config-network with network params to auto-configure bonded interfaces 1665 | # for physical servers & non-bonded interfaces for virtual machine guests 1666 | ./config-network -va kickstart -n "${IPADDR}" -s "${NETMASK}" -g "${GATEWAY}" \ 1667 | > ${folder}/build/${HOSTNAME}-$(date +%Y%m%d-%H%M)-config-network.log 2>/dev/null 1668 | 1669 | 1670 | ############################################### 1671 | # Run ${buildtools} to validate build # 1672 | ############################################### 1673 | 1674 | # Change into into parent folder and validate 1675 | cd ../ 1676 | 1677 | # Run ${build_tools} to validate changes 1678 | ./jaks-post-config -vc \ 1679 | > ${folder}/post/${HOSTNAME}-$(date +%Y%m%d-%H%M).log 2>/dev/null 1680 | 1681 | 1682 | ############################################### 1683 | # Examine post build log for errors # 1684 | ############################################### 1685 | 1686 | # log file name 1687 | log_file="${folder}/build/${HOSTNAME}-*.log" 1688 | 1689 | # Get total number of tools configured to run 1690 | total=$(awk '$0 ~ /^\[/{print}' jaks-post-config|wc -l) 1691 | 1692 | # Get an array of configuration scripts that were run 1693 | tools=($(awk '$0 ~ /^Executing:/{print $2}' ${log_file})) 1694 | 1695 | # Provide the total number of scripts run 1696 | total_tools=${#tools[@]} 1697 | 1698 | # Get an array of configuration scripts that failed 1699 | failed_tools=($(awk '{if (match($0, /.*An error.*\.(.*);.*/, obj)){print "."substr(obj[1], 1, length(obj[1])-1)}}' ${log_file})) 1700 | 1701 | # Provide the total number of failed scripts run 1702 | total_failed_tools=${#failed_tools[@]} 1703 | 1704 | # Get an array of configuration scripts that succeeded 1705 | successful_tools=($(awk '{if (match($0, /.*\.(.*)'\''.*successfully.*/, obj)){print "."obj[1]}}' ${log_file})) 1706 | 1707 | # Provide the total number of failed scripts run 1708 | total_successful_tools=${#successful_tools[@]} 1709 | 1710 | 1711 | ############################################### 1712 | # Re-run failed jobs individually # 1713 | ############################################### 1714 | 1715 | # Should this be implemented? Or just force review of the logs? 1716 | 1717 | 1718 | ############################################### 1719 | # Generate a %post (chroot) report # 1720 | ############################################### 1721 | 1722 | # Generate a %post (chroot) configuration report 1723 | cat < /tmp/ks-report-post-chroot 1724 | Post installation: (chroot) 1725 | ENV: 1726 | - Validation of build tool existence 1727 | - Creation of reporting structure for build process 1728 | BUILD: 1729 | - Logs for each stage of configuration created 1730 | - Statistical information for build: 1731 | - Total tools run: ${total_tools} 1732 | - Total successful tools: ${total_successful_tools} 1733 | - Total failed tools: ${total_failed_tools} 1734 | BACKUP: 1735 | - Backup of kickstart configurations: 1736 | - Location & timezone configuration 1737 | - Default root user configuration 1738 | - Physical disk configuration 1739 | - Backup of build logs: 1740 | - Pre build configuration validation 1741 | - Build configuration results 1742 | - Post build configuration validation 1743 | - Secured reports & configurations @ /root/${HOSTNAME}-$(date +%Y%m%d) 1744 | 1745 | EOF 1746 | 1747 | 1748 | ############################################### 1749 | # Create backup of build configuration files # 1750 | ############################################### 1751 | 1752 | # Make a backup of /tmp/ks* to ${folder}/kickstart 1753 | rm /tmp/ks-script-* 1754 | cp /tmp/ks* ${folder}/kickstart 1755 | 1756 | # Organize the files 1757 | mkdir ${folder}/kickstart/configs 1758 | 1759 | # Create a timestamped filename 1760 | filename=${folder}/${HOSTNAME}-$(date +%Y%m%d).log 1761 | 1762 | # Combine the reports 1763 | cat ${folder}/kickstart/ks-report-general > ${filename} 1764 | cat ${folder}/kickstart/ks-report-network >> ${filename} 1765 | cat ${folder}/kickstart/ks-report-disks >> ${filename} 1766 | cat ${folder}/kickstart/ks-report-post >> ${filename} 1767 | cat ${folder}/kickstart/ks-report-post-chroot >> ${filename} 1768 | 1769 | # Remove the old reports 1770 | rm ${folder}/kickstart/ks-report* 1771 | 1772 | # Move the configuration files used 1773 | mv ${folder}/kickstart/ks-* ${folder}/kickstart/configs 1774 | 1775 | # Wipe out the ks-arguments file to clean up any provided credentials 1776 | rm ${folder}/kickstart/configs/ks-arguments 1777 | 1778 | # Move the ks.cfg to the current hostname.ks 1779 | mv ${folder}/kickstart/ks.cfg ${folder}/kickstart/${HOSTNAME}.ks 1780 | 1781 | # Remove everything else 1782 | rm ${folder}/ks-* 1783 | 1784 | # Move build logs into their own folder 1785 | mkdir -p ${folder}/build-logs 1786 | mv -f ${folder}/pre ${folder}/build-logs 1787 | mv -f ${folder}/build ${folder}/build-logs 1788 | mv -f ${folder}/post ${folder}/build-logs 1789 | 1790 | 1791 | ############################################### 1792 | # Setup appropriate permissions on backup # 1793 | ############################################### 1794 | 1795 | # Set some permissions to account for root pw 1796 | chown -R root:root ${folder} 1797 | chmod -R 600 ${folder} 1798 | 1799 | 1800 | ############################################### 1801 | # Print %post (non-chroot) report # 1802 | ############################################### 1803 | 1804 | # Clear the terminal 1805 | clear 1806 | cat /tmp/ks-report-post-chroot 1807 | 1808 | # If ${DEBUG} is set to true; pause 1809 | if [ "${DEBUG}" == "true" ]; then 1810 | pause 1811 | fi 1812 | 1813 | 1814 | %end 1815 | ############################################### 1816 | # End %post chroot configuration # 1817 | ############################################### 1818 | 1819 | #fin 1820 | -------------------------------------------------------------------------------- /tools/README.md: -------------------------------------------------------------------------------- 1 | # jaks2iso - Assists with building an ISO image 2 | The `jaks2iso` tool accompanying this project facilitates customizing any 3 | `Anaconda` based [distribution](http://fedoraproject.org/wiki/Anaconda/Distros). 4 | 5 | It requires the following binaries; `mkisofs` & `isohybrid`. 6 | 7 | ## jaks-post-config; OS hardening & customization tool(s) ## 8 | While optional; the [jaks-post-config](https://github.com/jas-/jaks-post-config) 9 | toolkit assists in every facet of configuring the system in the pre-boot 10 | (chroot) environment. 11 | 12 | It is exendable and provides a wide range of `%post` configuration 13 | tools for things like [network](https://github.com/jas-/jaks-post-config/blob/master/scripts/config-network), 14 | [DNS](https://github.com/jas-/jaks-post-config/blob/master/scripts/config-dns), 15 | [login defaults](https://github.com/jas-/jaks-post-config/blob/master/scripts/config-acct-defaults), 16 | [auditing](https://github.com/jas-/jaks-post-config/blob/master/scripts/config-audit-rules), 17 | [PAM](https://github.com/jas-/jaks-post-config/blob/master/scripts/config-pam-cracklib), 18 | [services](https://github.com/jas-/jaks-post-config/blob/master/scripts/config-services-disable) & 19 | [user account creation](https://github.com/jas-/jaks-post-config/blob/master/scripts/config-user-admin). 20 | 21 | This tool is currently configured as a sub-module of this repository making it 22 | easy to include it as a dependency when cloned with the `--recursive` option. 23 | 24 | ## Contributing ## 25 | Contributions are welcome & appreciated. Refer to the 26 | [contributing document](https://github.com/jas-/jaks/blob/master/CONTRIBUTING.md) 27 | to help facilitate pull requests. 28 | 29 | ## License ## 30 | This software is licensed under the 31 | [MIT License](https://github.com/jas-/jaks/blob/master/LICENSE). 32 | 33 | Copyright Jason Gerfen, 2015-2016. 34 | -------------------------------------------------------------------------------- /tools/jaks2iso: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Tool to assist in creating customized ISO's (EFI bootable) 4 | 5 | # Global options 6 | label="JAKS" 7 | verbose=0 8 | version=6 9 | prog="$(basename $0)" 10 | 11 | # Array of files as the keys w/ the value as the location in the customized build 12 | declare -A files 13 | files[jaks-post-config/]="/jaks-post-config/" 14 | files[jaks.ks]="/ks.cfg" 15 | files[isolinux.cfg]="/isolinux/isolinux.cfg" 16 | files[BOOTX64.conf]="/EFI/BOOT/BOOTX64.conf" 17 | files[grub.conf]="/EFI/BOOT/grub.conf" 18 | 19 | # An empty array to handle locations of each required ${files} 20 | declare -A buildenv 21 | 22 | # A final folder for the customized build(s) 23 | isodir="builds" 24 | 25 | 26 | # Displays available arg list 27 | usage() 28 | { 29 | cat </dev/null)) 157 | 158 | 159 | # Error & exit if ${#iso[@]} = 0 160 | if [ ${#iso[@]} -eq 0 ]; then 161 | echo "Could not locate any ISO file(s)" 162 | exit 1 163 | fi 164 | 165 | 166 | echo "" 167 | echo "[Base ISO]" 168 | echo "Found a total of ${#iso[@]} ISO file(s)" 169 | echo "" 170 | 171 | 172 | echo "[Customizing ISO]" 173 | 174 | 175 | # Iterate ${iso[@]} and do work 176 | for img in ${iso[@]}; do 177 | 178 | # Start a counter 179 | i=$((${i} + 1)) 180 | 181 | 182 | echo "Customizing build for '${img}'" 183 | 184 | 185 | # Make sure we are working with a valid ISO 186 | tiso="$(file ${img})" 187 | if [[ ! "${tiso}" =~ 9660 ]]; then 188 | echo "'${img}' is not a valid ISO 9660 file" 189 | continue 190 | fi 191 | 192 | 193 | # Re-assign the name 194 | filename="${img}" 195 | 196 | 197 | # Create a friendly date for the local installation method 198 | date="$(date +%m-%d-%Y)" 199 | 200 | 201 | # Concatinate as buildnme 202 | buildnme="${filename}-iso" 203 | 204 | 205 | # Build a loop back mount point 206 | mdir "${filename}-loop" 207 | 208 | 209 | # Mount ${img} @ ${filename}-loop 210 | mtloop "${img}" "${filename}-loop" 211 | if [ $? -ne 0 ]; then 212 | echo "Count not mount '${img}' @ '${filename}-loop'" 213 | continue 214 | fi 215 | 216 | 217 | echo "Mounted '${img}' @ '${filename}-loop'" 218 | 219 | 220 | # Create a working directory to customize the ISO in 221 | mdir "${buildnme}" 222 | 223 | 224 | echo -n "Copying ISO contents to '${buildnme}' folder ... " 225 | 226 | 227 | # Copy contents of ${filename}-loop to ${buildnme} 228 | copy "${filename}-loop/*" "${buildnme}/" 229 | if [ $? -ne 0 ]; then 230 | echo "error" 231 | continue 232 | fi 233 | 234 | 235 | echo "done" 236 | 237 | 238 | # Unmount the ISO 239 | umtloop "${filename}-loop" 240 | if [ $? -ne 0 ]; then 241 | echo "Count not un-mount ${filename}-loop" 242 | continue 243 | fi 244 | 245 | 246 | # Remove the loopback mount point 247 | rm -fr ${filename}-loop/ 248 | 249 | 250 | # Iterate ${buildenv} for customization of ${buildnme} 251 | for item in ${!buildenv[@]}; do 252 | 253 | 254 | # Used to skip non configuration files 255 | img=0 256 | 257 | 258 | # If ${item} is a folder assume 'build-tools' and copy 259 | if [ -d ${item} ]; then 260 | echo -n "Copying build tools to build environment ... " 261 | cp -pfr ${item} ${buildnme}/${buildenv[${item}]} 262 | echo "done" 263 | fi 264 | 265 | 266 | # Preserve associative array ${buildenv[${item}]} value as ${path} 267 | path="${buildnme}/${buildenv[${item}]}" 268 | 269 | 270 | # If ${version} <= 7x set the version of our editable ${item} to 7 271 | if [[ ${version} -ge 7 ]] && [[ "${item}" != "jaks.ks" ]]; then 272 | 273 | # If ${item}.7 exists (only configuration files should), use it as ${file} 274 | if [ -f "${item}.7" ]; then 275 | item="${item}.7" 276 | fi 277 | fi 278 | 279 | 280 | # If ${item} is a file edit and/or copy into location 281 | if [ -f ${item} ]; then 282 | 283 | 284 | # If our .ks script just copy it 285 | if [ "$(basename ${item})" == "jaks.ks" ]; then 286 | echo -n "Copying '$(basename ${item})' to build environment ... " 287 | cp -vp ${item} ${buildnme}/${buildenv[${item}]} 288 | echo "done" 289 | continue 290 | fi 291 | 292 | 293 | echo -n "Customizing '$(basename ${item})' for build environment ... " 294 | 295 | 296 | # Get the type of file 297 | type=$(file ${item}) 298 | 299 | 300 | # If is an image just copy it 301 | if [ $(echo "${type}" | egrep -ic 'JPEG|GIF|PNG') -gt 0 ]; then 302 | cp -p ${item} ${path} 303 | img=1 304 | echo "done" 305 | continue 306 | fi 307 | 308 | # If ${img} != 1 then make modifications to the template 309 | if [ ${img} -ne 1 ]; then 310 | 311 | # Edit the template based on the version etc 312 | cat ${item} | 313 | sed -e "s|{LABEL}|${label}|g" \ 314 | -e "s|{DATE}|${date}|g" \ 315 | -e "s|{ALTVER}|${altver}|g" > ${path} 316 | 317 | 318 | echo "done" 319 | fi 320 | fi 321 | 322 | 323 | done 324 | 325 | 326 | # Now that the ${buildnme} is customized go ahead and make the ISO 327 | mdir ${isodir} 328 | 329 | 330 | # Change into the directory 331 | cwd=$(pwd) 332 | cd ${buildnme}/ 333 | 334 | 335 | echo -n "Building customized EFI bootable ISO file ... " 336 | 337 | 338 | # Begin the build 339 | mkisofs -U -A "${label}" -V "${label}" \ 340 | -volset "${label}" -J -joliet-long \ 341 | -o ../${isodir}/jaks-${date}-${filename} \ 342 | -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot \ 343 | -boot-load-size 4 -boot-info-table -eltorito-alt-boot \ 344 | -e images/efiboot.img -no-emul-boot . &>/dev/null 345 | 346 | # mkisofs -o ../${isodir}/jaks-${date}-${filename} \ 347 | # -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot \ 348 | # -boot-load-size 4 -boot-info-table -eltorito-alt-boot \ 349 | # -e images/efiboot.img -no-emul-boot . &>/dev/null 350 | 351 | echo "done" 352 | 353 | 354 | # Change back to ${cwd} 355 | cd ${cwd} 356 | 357 | 358 | echo -n "Ensuring ISO can be bootable by USB devices ... " 359 | 360 | 361 | # Ensure it is bootable by USB & DVD media types 362 | isohybrid -u ${isodir}/jaks-${date}-${filename} &>/dev/null 363 | 364 | 365 | echo "done" 366 | 367 | 368 | # Clean up 369 | rm -fr ${buildnme} 370 | 371 | 372 | echo "Build complete @ '${isodir}/jaks-${date}-${filename}'" 373 | echo "" 374 | 375 | done 376 | -------------------------------------------------------------------------------- /tools/templates/BOOTX64.conf: -------------------------------------------------------------------------------- 1 | #debug --graphics 2 | default=0 3 | splashimage=/EFI/BOOT/splash.xpm.gz 4 | timeout 5 5 | hiddenmenu 6 | title {LABEL} Kickstart 7 | kernel /images/pxeboot/vmlinuz nompath lang=en_US keymap=us ks=hd:/ks.cfg method=hd:/mnt/stage2 repo=hd:/ 8 | initrd /images/pxeboot/initrd.img 9 | 10 | title Rescue Installed System 11 | kernel /images/pxeboot/vmlinuz rescue askmethod 12 | initrd /images/pxeboot/initrd.img 13 | -------------------------------------------------------------------------------- /tools/templates/BOOTX64.conf.7: -------------------------------------------------------------------------------- 1 | #debug --graphics 2 | default=0 3 | splashimage=/EFI/BOOT/splash.xpm.gz 4 | timeout 5 5 | hiddenmenu 6 | title {LABEL} Local Kickstart 7 | kernel /images/pxeboot/vmlinuz nompath inst.lang=en_US inst.keymap=us inst.ks=hd:/ks.cfg 8 | initrd /images/pxeboot/initrd.img 9 | 10 | title Rescue Installed System 11 | kernel /images/pxeboot/vmlinuz rescue askmethod 12 | initrd /images/pxeboot/initrd.img 13 | -------------------------------------------------------------------------------- /tools/templates/grub.conf: -------------------------------------------------------------------------------- 1 | set default="1" 2 | 3 | function load_video { 4 | insmod efi_gop 5 | insmod efi_uga 6 | insmod video_bochs 7 | insmod video_cirrus 8 | insmod all_video 9 | } 10 | 11 | load_video 12 | set gfxpayload=keep 13 | insmod gzio 14 | insmod part_gpt 15 | insmod ext2 16 | 17 | set timeout=60 18 | ### END /etc/grub.d/00_header ### 19 | 20 | search --no-floppy --set=root -l '{LABEL}' 21 | 22 | ### BEGIN /etc/grub.d/10_linux ### 23 | menuentry 'RHEL {LABEL} kickstart' --class fedora --class gnu-linux --class gnu --class os { 24 | linuxefi /images/pxeboot/vmlinuz inst.stage2=hd:LABEL={LABEL} nompath inst.lang=en_US inst.keymap=us inst.ks=hd:LABEL={LABEL}:/ks.cfg DVD=true 25 | initrdefi /images/pxeboot/initrd.img 26 | } 27 | 28 | menuentry 'Rescue System' --class fedora --class gnu-linux --class gnu --class os { 29 | linuxefi /images/pxeboot/vmlinuz rescue quiet 30 | initrdefi /images/pxeboot/initrd.img 31 | } 32 | -------------------------------------------------------------------------------- /tools/templates/grub.conf.7: -------------------------------------------------------------------------------- 1 | set default="1" 2 | 3 | function load_video { 4 | insmod efi_gop 5 | insmod efi_uga 6 | insmod video_bochs 7 | insmod video_cirrus 8 | insmod all_video 9 | } 10 | 11 | load_video 12 | set gfxpayload=keep 13 | insmod gzio 14 | insmod part_gpt 15 | insmod ext2 16 | 17 | set timeout=60 18 | ### END /etc/grub.d/00_header ### 19 | 20 | search --no-floppy --set=root -l '{LABEL}' 21 | 22 | ### BEGIN /etc/grub.d/10_linux ### 23 | menuentry 'RHEL {LABEL} kickstart' --class fedora --class gnu-linux --class gnu --class os { 24 | linuxefi /images/pxeboot/vmlinuz inst.stage2=hd:LABEL={LABEL} quiet nompath lang=en_US keymap=us ks=hd:LABEL={LABEL}:/ks.cfg method=hd:LABEL={LABEL}:/mnt/stage2 repo=hd:LABEL={LABEL}:/ 25 | initrdefi /images/pxeboot/initrd.img 26 | } 27 | 28 | menuentry 'Rescue System' --class fedora --class gnu-linux --class gnu --class os { 29 | linuxefi /images/pxeboot/vmlinuz rescue quiet 30 | initrdefi /images/pxeboot/initrd.img 31 | } 32 | -------------------------------------------------------------------------------- /tools/templates/isolinux.cfg: -------------------------------------------------------------------------------- 1 | default vesamenu.c32 2 | #prompt 1 3 | timeout 600 4 | 5 | display boot.msg 6 | 7 | menu background splash.jpg 8 | menu title {LABEL} 9 | menu color border 0 #ffffffff #00000000 10 | menu color sel 7 #ffffffff #ff000000 11 | menu color title 0 #ffffffff #00000000 12 | menu color tabmsg 0 #ffffffff #00000000 13 | menu color unsel 0 #ffffffff #00000000 14 | menu color hotsel 0 #ff000000 #ffffffff 15 | menu color hotkey 7 #ffffffff #ff000000 16 | menu color scrollbar 0 #ffffffff #00000000 17 | 18 | label {LABEL} 19 | menu label {LABEL} kickstart 20 | kernel vmlinuz 21 | append initrd=initrd.img nompath lang=en_US keymap=us ks=hd:LABEL={LABEL}:/ks.cfg method=hd:LABEL={LABEL}:/mnt/stage2 repo=hd:LABEL={LABEL}:/ DVD=true 22 | 23 | label local 24 | menu label Boot from ^local drive 25 | localboot 0xffff 26 | 27 | label rescue 28 | menu label ^Rescue installed system 29 | kernel vmlinuz 30 | append initrd=initrd.img rescue 31 | 32 | label memtest86 33 | menu label ^Memory test 34 | kernel memtest 35 | append - 36 | -------------------------------------------------------------------------------- /tools/templates/isolinux.cfg.7: -------------------------------------------------------------------------------- 1 | default vesamenu.c32 2 | #prompt 1 3 | timeout 600 4 | 5 | display boot.msg 6 | 7 | menu background splash.jpg 8 | menu title {LABEL} 9 | menu color border 0 #ffffffff #00000000 10 | menu color sel 7 #ffffffff #ff000000 11 | menu color title 0 #ffffffff #00000000 12 | menu color tabmsg 0 #ffffffff #00000000 13 | menu color unsel 0 #ffffffff #00000000 14 | menu color hotsel 0 #ff000000 #ffffffff 15 | menu color hotkey 7 #ffffffff #ff000000 16 | menu color scrollbar 0 #ffffffff #00000000 17 | 18 | label {LABEL} 19 | menu label {LABEL} Kickstart 20 | kernel vmlinuz 21 | append initrd=initrd.img nompath inst.lang=en_US inst.keymap=us inst.ks=hd:LABEL={LABEL}:/ks.cfg DVD=true 22 | 23 | label local 24 | menu label Boot from ^local drive 25 | localboot 0xffff 26 | 27 | label rescue 28 | menu label ^Rescue installed system 29 | kernel vmlinuz 30 | append initrd=initrd.img rescue 31 | 32 | label memtest86 33 | menu label ^Memory test 34 | kernel memtest 35 | append - 36 | --------------------------------------------------------------------------------