Browse code

Installer and image builder improvements

- Use image-builder instead of cloud-image-builder
- Remove install type from json files for images
- Clean up json files
- Add metapackage minimal
- Remove full flavor from ISO and add developer and edge
- Remove installation type from json files and use package list json

Change-Id: I6b667beb92f9f68533e48482f84139102b818342

Conflicts:
Makefile
support/package-builder/SpecData.py
Change-Id: Iff18095a5f53151d0456c694c039da720eef2398
Reviewed-on: http://photon-jenkins.eng.vmware.com:8082/6170
Reviewed-by: Anish Swaminathan <anishs@vmware.com>
Tested-by: Anish Swaminathan <anishs@vmware.com>

suezzelur authored on 2018/11/01 03:33:21
Showing 159 changed files
... ...
@@ -87,10 +87,8 @@ TOOLS_BIN := $(SRCROOT)/tools/bin
87 87
 CONTAIN := $(TOOLS_BIN)/contain
88 88
 ifeq ($(ARCH),x86_64)
89 89
 VIXDISKUTIL := $(TOOLS_BIN)/vixdiskutil
90
-IMGCONVERTER := $(TOOLS_BIN)/imgconverter
91 90
 else
92 91
 VIXDISKUTIL :=
93
-IMGCONVERTER :=
94 92
 endif
95 93
 
96 94
 $(TOOLS_BIN):
... ...
@@ -104,11 +102,7 @@ $(VIXDISKUTIL): $(TOOLS_BIN)
104 104
 	@cd $(SRCROOT)/tools/src/vixDiskUtil && \
105 105
 	make
106 106
 
107
-$(IMGCONVERTER): $(TOOLS_BIN)
108
-	@cd $(SRCROOT)/tools/src/imgconverter && \
109
-	make
110
-
111
-.PHONY : all iso clean cloud-image \
107
+.PHONY : all iso clean image all-images \
112 108
 check-tools check-docker check-bison check-g++ check-gawk check-repo-tool check-kpartx check-sanity \
113 109
 clean-install clean-chroot build-updated-packages check generate-yaml-files
114 110
 
... ...
@@ -312,7 +306,7 @@ check: packages
312 312
 
313 313
 # The targets listed under "all" are the installer built artifacts
314 314
 #===============================================================================
315
-all: iso photon-docker-image k8s-docker-images cloud-image-all src-iso
315
+all: iso photon-docker-image k8s-docker-images all-images src-iso
316 316
 
317 317
 iso: check-tools $(PHOTON_STAGE) $(PHOTON_PACKAGES)
318 318
 	@echo "Building Photon Full ISO..."
... ...
@@ -349,20 +343,56 @@ src-iso: check-tools $(PHOTON_STAGE) $(PHOTON_PACKAGES)
349 349
 		--force > \
350 350
 		$(PHOTON_LOGS_DIR)/sourceiso-installer.log 2>&1
351 351
 
352
-cloud-image: check-kpartx $(PHOTON_STAGE) $(VIXDISKUTIL) $(IMGCONVERTER) $(PHOTON_PACKAGES)
353
-	@echo "Building cloud image $(IMG_NAME)..."
354
-	@cd $(PHOTON_CLOUD_IMAGE_BUILDER_DIR)
355
-	$(PHOTON_CLOUD_IMAGE_BUILDER) $(PHOTON_CLOUD_IMAGE_BUILDER_DIR) $(IMG_NAME) $(SRCROOT) $(PHOTON_GENERATED_DATA_DIR) $(PHOTON_STAGE) $(ADDITIONAL_RPMS_PATH)
356
-
357
-
358
-cloud-image-all: check-kpartx $(PHOTON_STAGE) $(VIXDISKUTIL) $(IMGCONVERTER) $(PHOTON_PACKAGES)
359
-	@echo "Building cloud images - gce, ami, azure and ova..."
360
-	@cd $(PHOTON_CLOUD_IMAGE_BUILDER_DIR)
361
-	$(PHOTON_CLOUD_IMAGE_BUILDER) $(PHOTON_CLOUD_IMAGE_BUILDER_DIR) gce $(SRCROOT) $(PHOTON_GENERATED_DATA_DIR) $(PHOTON_STAGE) $(ADDITIONAL_RPMS_PATH)
362
-	$(PHOTON_CLOUD_IMAGE_BUILDER) $(PHOTON_CLOUD_IMAGE_BUILDER_DIR) ami $(SRCROOT) $(PHOTON_GENERATED_DATA_DIR) $(PHOTON_STAGE) $(ADDITIONAL_RPMS_PATH)
363
-	$(PHOTON_CLOUD_IMAGE_BUILDER) $(PHOTON_CLOUD_IMAGE_BUILDER_DIR) azure $(SRCROOT) $(PHOTON_GENERATED_DATA_DIR) $(PHOTON_STAGE) $(ADDITIONAL_RPMS_PATH)
364
-	$(PHOTON_CLOUD_IMAGE_BUILDER) $(PHOTON_CLOUD_IMAGE_BUILDER_DIR) ova $(SRCROOT) $(PHOTON_GENERATED_DATA_DIR) $(PHOTON_STAGE) $(ADDITIONAL_RPMS_PATH)
365
-	$(PHOTON_CLOUD_IMAGE_BUILDER) $(PHOTON_CLOUD_IMAGE_BUILDER_DIR) ova_micro $(SRCROOT) $(PHOTON_GENERATED_DATA_DIR) $(PHOTON_STAGE) $(ADDITIONAL_RPMS_PATH)
352
+image: check-kpartx $(PHOTON_STAGE) $(VIXDISKUTIL) $(PHOTON_PACKAGES)
353
+	@echo "Building image $(IMG_NAME)..."
354
+	@cd $(PHOTON_IMAGE_BUILDER_DIR)
355
+	$(PHOTON_IMAGE_BUILDER) \
356
+		--build-scripts-path=$(PHOTON_IMAGE_BUILDER_DIR) \
357
+	--img-name=$(IMG_NAME) \
358
+	--src-root=$(SRCROOT) \
359
+	--generated-data-path=$(PHOTON_GENERATED_DATA_DIR) \
360
+	--stage-path=$(PHOTON_STAGE) \
361
+	--additional-rpms-path=$(ADDITIONAL_RPMS_PATH)
362
+
363
+
364
+all-images: check-kpartx $(PHOTON_STAGE) $(VIXDISKUTIL) $(PHOTON_PACKAGES)
365
+	@echo "Building all images - gce, ami, azure, ova..."
366
+	@cd $(PHOTON_IMAGE_BUILDER_DIR)
367
+	$(PHOTON_IMAGE_BUILDER) \
368
+		--build-scripts-path=$(PHOTON_IMAGE_BUILDER_DIR) \
369
+		--img-name=ami \
370
+		--src-root=$(SRCROOT) \
371
+		--generated-data-path=$(PHOTON_GENERATED_DATA_DIR) \
372
+		--stage-path=$(PHOTON_STAGE) \
373
+		--additional-rpms-path=$(ADDITIONAL_RPMS_PATH)
374
+	$(PHOTON_IMAGE_BUILDER) \
375
+		--build-scripts-path=$(PHOTON_IMAGE_BUILDER_DIR) \
376
+		--img-name=azure \
377
+		--src-root=$(SRCROOT) \
378
+		--generated-data-path=$(PHOTON_GENERATED_DATA_DIR) \
379
+		--stage-path=$(PHOTON_STAGE) \
380
+		--additional-rpms-path=$(ADDITIONAL_RPMS_PATH)
381
+	$(PHOTON_IMAGE_BUILDER) \
382
+		--build-scripts-path=$(PHOTON_IMAGE_BUILDER_DIR) \
383
+		--img-name=gce \
384
+		--src-root=$(SRCROOT) \
385
+		--generated-data-path=$(PHOTON_GENERATED_DATA_DIR) \
386
+		--stage-path=$(PHOTON_STAGE) \
387
+		--additional-rpms-path=$(ADDITIONAL_RPMS_PATH)
388
+	$(PHOTON_IMAGE_BUILDER) \
389
+		--build-scripts-path=$(PHOTON_IMAGE_BUILDER_DIR) \
390
+		--img-name=ova \
391
+		--src-root=$(SRCROOT) \
392
+		--generated-data-path=$(PHOTON_GENERATED_DATA_DIR) \
393
+		--stage-path=$(PHOTON_STAGE) \
394
+		--additional-rpms-path=$(ADDITIONAL_RPMS_PATH)
395
+	$(PHOTON_IMAGE_BUILDER) \
396
+		--build-scripts-path=$(PHOTON_IMAGE_BUILDER_DIR) \
397
+		--img-name=ova_uefi \
398
+		--src-root=$(SRCROOT) \
399
+		--generated-data-path=$(PHOTON_GENERATED_DATA_DIR) \
400
+		--stage-path=$(PHOTON_STAGE) \
401
+		--additional-rpms-path=$(ADDITIONAL_RPMS_PATH)
366 402
 
367 403
 photon-docker-image:
368 404
 	$(PHOTON_REPO_TOOL) $(PHOTON_RPMS_DIR)
... ...
@@ -449,11 +479,11 @@ $(PHOTON_STAGE):
449 449
 	@echo "Building LOGS folder..."
450 450
 	@test -d $(PHOTON_LOGS_DIR) || $(MKDIR) -p $(PHOTON_LOGS_DIR)
451 451
 	@echo "Creating COPYING file..."
452
-	install -m 444 $(SRCROOT)/COPYING $(PHOTON_STAGE)/COPYING
452
+	@install -m 444 $(SRCROOT)/COPYING $(PHOTON_STAGE)/COPYING
453 453
 	@echo "Creating open_source_license.txt file..."
454
-	install -m 444 $(SRCROOT)/installer/open_source_license.txt $(PHOTON_STAGE)/open_source_license.txt
454
+	@install -m 444 $(SRCROOT)/installer/open_source_license.txt $(PHOTON_STAGE)/open_source_license.txt
455 455
 	@echo "Creating NOTICE file..."
456
-	install -m 444 $(SRCROOT)/NOTICE $(PHOTON_STAGE)/NOTICE
456
+	@install -m 444 $(SRCROOT)/NOTICE $(PHOTON_STAGE)/NOTICE
457 457
 #_______________________________________________________________________________
458 458
 
459 459
 # Clean build environment
... ...
@@ -542,40 +572,40 @@ generate-dep-lists:
542 542
 		--log-level $(LOGLEVEL) \
543 543
 		--pkg $(PHOTON_GENERATED_DATA_DIR) \
544 544
 		--input-type=json \
545
-		--file "$$(ls $(PHOTON_DATA_DIR)/build_install_options*.json)" \
545
+		--file "$$(ls $(PHOTON_DATA_DIR)/packages_*.json)" \
546 546
 		--display-option json \
547 547
 		--input-data-dir $(PHOTON_DATA_DIR)
548 548
 	@echo ""
549 549
 pkgtree:
550 550
 	@cd $(PHOTON_SPECDEPS_DIR) && \
551 551
 		$(PHOTON_SPECDEPS) \
552
-	--spec-path $(PHOTON_SPECS_DIR) \
553
-	--log-level $(LOGLEVEL) \
554
-	--input-type pkg \
555
-	--pkg $(pkg)
552
+			--spec-path $(PHOTON_SPECS_DIR) \
553
+			--log-level $(LOGLEVEL) \
554
+			--input-type pkg \
555
+			--pkg $(pkg)
556 556
 
557 557
 imgtree:
558 558
 	@cd $(PHOTON_SPECDEPS_DIR) && \
559 559
 		$(PHOTON_SPECDEPS) \
560
-	--spec-path $(PHOTON_SPECS_DIR) \
561
-	--log-level $(LOGLEVEL) \
562
-	--input-type json \
563
-	--file $(PHOTON_DATA_DIR)/build_install_options_$(img).json
560
+			--spec-path $(PHOTON_SPECS_DIR) \
561
+			--log-level $(LOGLEVEL) \
562
+			--input-type json \
563
+			--file $(PHOTON_DATA_DIR)/packages_$(img).json
564 564
 
565 565
 who-needs:
566 566
 	@cd $(PHOTON_SPECDEPS_DIR) && \
567 567
 		$(PHOTON_SPECDEPS) \
568
-	--spec-path $(PHOTON_SPECS_DIR) \
569
-	--log-level $(LOGLEVEL) \
570
-	--input-type who-needs \
571
-	--pkg $(pkg)
568
+			--spec-path $(PHOTON_SPECS_DIR) \
569
+			--log-level $(LOGLEVEL) \
570
+			--input-type who-needs \
571
+			--pkg $(pkg)
572 572
 
573 573
 print-upward-deps:
574 574
 	@cd $(PHOTON_SPECDEPS_DIR) && \
575 575
 		$(PHOTON_SPECDEPS) \
576
-	--spec-path $(PHOTON_SPECS_DIR) \
577
-	--input-type print-upward-deps \
578
-	--pkg $(pkg)
576
+			--spec-path $(PHOTON_SPECS_DIR) \
577
+			--input-type print-upward-deps \
578
+			--pkg $(pkg)
579 579
 
580 580
 #+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
581 581
 
582 582
new file mode 100644
... ...
@@ -0,0 +1,58 @@
0
+Name:           minimal
1
+Summary:        Metapackage to install minimal profile
2
+Version:        0.1
3
+Release:        1%{?dist}
4
+License:        Apache 2.0
5
+Group:          System Environment/Base
6
+URL:            https://vmware.github.io/photon/
7
+Vendor:         VMware, Inc.
8
+Distribution:   Photon
9
+Requires:       filesystem
10
+Requires:       pkg-config
11
+Requires:       bzip2
12
+Requires:       procps-ng
13
+Requires:       iana-etc
14
+Requires:       bc
15
+Requires:       libtool
16
+Requires:       net-tools
17
+Requires:       findutils
18
+Requires:       iproute2
19
+Requires:       iptables
20
+Requires:       iputils
21
+Requires:       dbus
22
+Requires:       file
23
+Requires:       e2fsprogs
24
+Requires:       rpm
25
+Requires:       openssh
26
+Requires:       gdbm
27
+Requires:       photon-release
28
+Requires:       photon-repos
29
+Requires:       sed
30
+Requires:       grep
31
+Requires:       util-linux
32
+Requires:       cpio
33
+Requires:       gzip
34
+Requires:       vim
35
+Requires:       tdnf
36
+Requires:       open-vm-tools
37
+Requires:       docker
38
+Requires:       bridge-utils
39
+Requires:       cloud-init
40
+Requires:       tzdata
41
+Requires:       which
42
+Requires:       motd
43
+Requires:       cracklib-dicts
44
+
45
+%description
46
+Metapackage to install minimal profile
47
+
48
+%prep
49
+
50
+%build
51
+
52
+%files
53
+%defattr(-,root,root,0755)
54
+
55
+%changelog
56
+*   Tue Oct 30 2018 Anish Swaminathan <anishs@vmware.com> 0.1-1
57
+-   Initial packaging
... ...
@@ -1,27 +1,28 @@
1 1
 {
2 2
     "iso" : {
3 3
         "title" : "ISO Packages",
4
-        "file" : "packages_iso.json",
4
+        "packagelist_file" : "packages_iso.json",
5 5
         "visible" : false,
6
-        "include" : [],
7 6
         "additional-files" : ["open_source_license.txt","NOTICE"]
8 7
     },
9 8
     "minimal" : {
10 9
         "title" : "1. Photon Minimal",
11
-        "file" : "packages_minimal.json",
12
-        "visible" : true,
13
-        "include" : []
10
+        "packagelist_file" : "packages_minimal.json",
11
+        "visible" : true
14 12
     },
15
-    "full" : {
16
-        "title" : "2. Photon Full",
17
-        "file" : "packages_full.json",
18
-        "visible" : true,
19
-        "include" : ["minimal"]
13
+    "developer" : {
14
+        "title" : "2. Photon Developer",
15
+        "packagelist_file" : "packages_developer.json",
16
+        "visible" : true
17
+    },
18
+    "edge" : {
19
+        "title" : "3. Photon Edge",
20
+        "packagelist_file" : "packages_edge.json",
21
+        "visible" : true
20 22
     },
21 23
     "appliance" : {
22 24
         "title" : "Minimal packages to support appliances.",
23
-        "file" : "packages_appliance.json",
24
-        "visible" : false,
25
-        "include" : []
25
+        "packagelist_file" : "packages_appliance.json",
26
+        "visible" : false
26 27
     }
27 28
 }
28 29
deleted file mode 100644
... ...
@@ -1,14 +0,0 @@
1
-{
2
-    "minimal" : {
3
-        "title" : "Photon Minimal",
4
-        "file" : "packages_minimal.json",
5
-        "visible" : true,
6
-        "include" : []
7
-    },
8
-    "ami" : {
9
-        "title" : "Photon AMI packages",
10
-        "file" : "packages_ami.json",
11
-        "visible" : false,
12
-        "include" : ["minimal"]
13
-    }
14
-}
15 1
deleted file mode 100644
... ...
@@ -1,14 +0,0 @@
1
-{
2
-    "minimal" : {
3
-        "title" : "Photon Minimal",
4
-        "file" : "packages_minimal.json",
5
-        "visible" : true,
6
-        "include" : []
7
-    },
8
-    "azure" : {
9
-        "title" : "Photon Azure packages",
10
-        "file" : "packages_azure.json",
11
-        "visible" : false,
12
-        "include" : ["minimal"]
13
-    }
14
-}
15 1
deleted file mode 100644
... ...
@@ -1,27 +0,0 @@
1
-{
2
-    "iso" : {
3
-        "title" : "ISO Packages",
4
-        "file" : "packages_iso.json",
5
-        "visible" : false,
6
-        "include" : [],
7
-        "additional-files" : ["open_source_license.txt","NOTICE"]
8
-    },
9
-    "minimal" : {
10
-        "title" : "1. Photon Minimal",
11
-        "file" : "packages_minimal.json",
12
-        "visible" : true,
13
-        "include" : []
14
-    },
15
-    "full" : {
16
-        "title" : "2. Photon Full",
17
-        "file" : "packages_full.json",
18
-        "visible" : true,
19
-        "include" : ["minimal"]
20
-    },
21
-    "appliance" : {
22
-        "title" : "Minimal packages to support appliances.",
23
-        "file" : "packages_appliance.json",
24
-        "visible" : false,
25
-        "include" : []
26
-    }
27
-}
28 1
deleted file mode 100644
... ...
@@ -1,14 +0,0 @@
1
-{
2
-    "minimal" : {
3
-        "title" : "Photon Minimal",
4
-        "file" : "packages_minimal.json",
5
-        "visible" : true,
6
-        "include" : []
7
-    },
8
-    "gce" : {
9
-        "title" : "Photon GCE packages",
10
-        "file" : "packages_gce.json",
11
-        "visible" : false,
12
-        "include" : ["minimal"]
13
-    }
14
-}
15 1
deleted file mode 100644
... ...
@@ -1,10 +0,0 @@
1
-{
2
-    "iso" : {
3
-        "title" : "Live CD Packages",
4
-        "file" : "packages_minimal.json",
5
-        "visible" : false,
6
-        "include" : [],
7
-        "live-cd" : true,
8
-        "additional-files" : ["open_source_license.txt","NOTICE"]
9
-    }
10
-}
11 1
deleted file mode 100644
... ...
@@ -1,15 +0,0 @@
1
-{
2
-    "iso" : {
3
-        "title" : "ISO Packages",
4
-        "file" : "packages_iso.json",
5
-        "visible" : false,
6
-        "include" : [],
7
-        "additional-files" : ["open_source_license.txt","NOTICE"]
8
-    },
9
-    "micro" : {
10
-        "title" : "Photon Micro",
11
-        "file" : "packages_micro.json",
12
-        "visible" : true,
13
-        "include" : []
14
-    }
15
-}
16 1
deleted file mode 100644
... ...
@@ -1,8 +0,0 @@
1
-{
2
-    "minimal" : {
3
-        "title" : "Photon Minimal",
4
-        "file" : "packages_minimal_ova.json",
5
-        "visible" : true,
6
-        "include" : []
7
-    }
8
-}
9 1
deleted file mode 100644
... ...
@@ -1,14 +0,0 @@
1
-{
2
-    "iso" : {
3
-        "title" : "ISO Packages",
4
-        "file" : "packages_iso.json",
5
-        "visible" : false,
6
-        "include" : []
7
-    },
8
-    "minimal" : {
9
-        "title" : "Photon Minimal",
10
-        "file" : "packages_minimal_ova.json",
11
-        "visible" : true,
12
-        "include" : []
13
-    }
14
-}
15 1
deleted file mode 100644
... ...
@@ -1,8 +0,0 @@
1
-{
2
-    "minimal" : {
3
-        "title" : "Photon Minimal",
4
-        "file" : "packages_minimal.json",
5
-        "visible" : true,
6
-        "include" : []
7
-    }
8
-}
9 1
deleted file mode 100644
... ...
@@ -1,8 +0,0 @@
1
-{
2
-    "micro" : {
3
-        "title" : "Photon Micro",
4
-        "file" : "packages_micro.json",
5
-        "visible" : true,
6
-        "include" : []
7
-    }
8
-}
9 1
deleted file mode 100644
... ...
@@ -1,14 +0,0 @@
1
-{
2
-    "minimal" : {
3
-        "title" : "Photon Minimal",
4
-        "file" : "packages_minimal_ova.json",
5
-        "visible" : true,
6
-        "include" : []
7
-    },
8
-    "ovs" : {
9
-        "title" : "Photon OVS packages",
10
-        "file" : "packages_ovs.json",
11
-        "visible" : true,
12
-        "include" : ["minimal"]
13
-    }
14
-}
15 1
deleted file mode 100644
... ...
@@ -1,14 +0,0 @@
1
-{
2
-    "minimal" : {
3
-        "title" : "Photon Minimal",
4
-        "file" : "packages_minimal_ova.json",
5
-        "visible" : true,
6
-        "include" : []
7
-    },
8
-    "uefi" : {
9
-        "title" : "Photon UEFI packages",
10
-        "file" : "packages_uefi.json",
11
-        "visible" : false,
12
-        "include" : ["minimal"]
13
-    }
14
-}
15 1
deleted file mode 100644
... ...
@@ -1,14 +0,0 @@
1
-{
2
-    "minimal" : {
3
-        "title" : "Photon Minimal raw generic uefi",
4
-        "file" : "packages_minimal_raw_uefi.json",
5
-        "visible" : true,
6
-        "include" : []
7
-    },
8
-    "uefi" : {
9
-        "title" : "Photon UEFI packages",
10
-        "file" : "packages_uefi.json",
11
-        "visible" : false,
12
-        "include" : ["minimal"]
13
-    }
14
-}
15 1
deleted file mode 100644
... ...
@@ -1,8 +0,0 @@
1
-{
2
-    "minimal" : {
3
-        "title" : "Photon Minimal",
4
-        "file" : "packages_minimal_rpi3.json",
5
-        "visible" : true,
6
-        "include" : []
7
-    }
8
-}
9 1
deleted file mode 100644
... ...
@@ -1,7 +0,0 @@
1
-{
2
-    "dracut_configuration" : {
3
-        "add_drivers" : ["tmem","xen-acpi-processor","xen-evtchn","xen-gntalloc","xen-gntdev","xen-privcmd","xen-pciback","xenfs",
4
-				"hv_ballon","hv_utils","hv_vmbus","cn"
5
-			]
6
-    }
7
-}
... ...
@@ -1,3 +1,12 @@
1 1
 {
2
-    "packages":["sudo", "gawk", "cloud-utils", "gptfdisk", "tar", "linux-aws"]
2
+    "packages":[
3
+                "minimal",
4
+                "linux-aws",
5
+                "initramfs",
6
+                "sudo",
7
+                "gawk",
8
+                "cloud-utils",
9
+                "gptfdisk",
10
+                "tar"
11
+                ]
3 12
 }
... ...
@@ -1,3 +1,13 @@
1 1
 {
2
-    "packages":["sudo", "python-pyasn1", "gawk", "cloud-utils", "gptfdisk", "WALinuxAgent"]
2
+    "packages":[
3
+                "minimal",
4
+                "linux",
5
+                "initramfs",
6
+                "sudo",
7
+                "python-pyasn1",
8
+                "gawk",
9
+                "cloud-utils",
10
+                "gptfdisk",
11
+                "WALinuxAgent"
12
+                ]
3 13
 }
4 14
new file mode 100644
... ...
@@ -0,0 +1,9 @@
0
+{
1
+    "packages": [
2
+                 "minimal",
3
+                 "linux",
4
+                 "initramfs",
5
+                 "build-essential",
6
+                 "go"
7
+                 ]
8
+}
0 9
new file mode 100644
... ...
@@ -0,0 +1,9 @@
0
+{
1
+    "packages": [
2
+                 "minimal",
3
+                 "linux",
4
+                 "initramfs",
5
+                 "edgex",
6
+                 "liota"
7
+                 ]
8
+}
0 9
deleted file mode 100644
... ...
@@ -1,183 +0,0 @@
1
-{
2
-    "packages":[
3
-        "unzip",
4
-        "sudo",
5
-        "XML-Parser",
6
-        "intltool",
7
-        "libsigc++",
8
-        "boost",
9
-        "build-essential",
10
-        "bison",
11
-        "gdb",
12
-        "libpipeline",
13
-        "python3-tools",
14
-        "check",
15
-        "libltdl",
16
-        "glibc-lang",
17
-        "gettext",
18
-        "git",
19
-        "git-lang",
20
-        "perl",
21
-        "perl-DBI",
22
-        "perl-Config-IniFiles",
23
-        "perl-File-HomeDir",
24
-        "perl-File-Which",
25
-        "perl-DBIx-Simple",
26
-        "perl-DBD-SQLite",
27
-        "perl-Exporter-Tiny",
28
-        "perl-JSON-XS",
29
-        "perl-List-MoreUtils",
30
-        "perl-Module-Install",
31
-        "perl-Module-ScanDeps",
32
-        "perl-Module-Build",
33
-        "perl-Object-Accessor",
34
-        "perl-Types-Serialiser",
35
-        "perl-WWW-Curl",
36
-        "perl-YAML-Tiny",
37
-        "perl-YAML",
38
-        "perl-common-sense",
39
-        "perl-libintl",
40
-        "perl-CGI",
41
-        "libevent",
42
-        "pgbouncer",
43
-        "perl-JSON-Any",
44
-        "perl-Net-SSLeay",
45
-        "perl-IO-Socket-SSL",
46
-        "tcsh",
47
-        "gobject-introspection",
48
-        "python3-gobject-introspection",
49
-        "bash-lang",
50
-        "kbd",
51
-        "coreutils-lang",
52
-        "libxslt",
53
-        "docbook-xml",
54
-        "docbook-xsl",
55
-        "texinfo",
56
-        "tar",
57
-        "kubernetes",
58
-        "cyrus-sasl",
59
-        "openldap",
60
-        "python3-iniparse",
61
-        "psmisc",
62
-        "etcd",
63
-        "util-linux-lang",
64
-        "mpc",
65
-        "json-glib",
66
-        "libpcap",
67
-        "tcpdump",
68
-        "elfutils",
69
-        "go",
70
-        "grub2-pc",
71
-        "grub2-efi",
72
-        "grub2-lang",
73
-        "groff",
74
-        "man-db",
75
-        "man-pages",
76
-        "python3-hawkey",
77
-        "ruby",
78
-        "wget",
79
-        "Linux-PAM-lang",
80
-        "gperf",
81
-        "less",
82
-        "cmake",
83
-        "parted",
84
-        "nano",
85
-        "ncurses-compat", 
86
-        "tzdata",
87
-        "sed-lang",
88
-        "gptfdisk",
89
-        "ntp",
90
-        "flex",
91
-        "patch",
92
-        "m4",
93
-        "dracut",
94
-        "dracut-tools",
95
-        "libarchive",
96
-        "libsoup",
97
-        "asciidoc",
98
-        "mkinitcpio",
99
-        "glibmm",
100
-        "cdrkit",
101
-        "libgsystem",
102
-        "libsepol",
103
-        "libselinux",
104
-        "device-mapper-libs",
105
-        "device-mapper",
106
-        "acl",
107
-        "btrfs-progs",
108
-        "device-mapper-event",
109
-        "device-mapper-event-libs",
110
-        "libacl",
111
-        "libselinux-utils",
112
-        "libselinux-python3",
113
-        "libaio",
114
-        "thin-provisioning-tools",
115
-        "lvm2",
116
-        "lvm2-libs",
117
-        "python3-lvm2-libs",
118
-        "lzo",
119
-        "lzo-minilzo",
120
-        "swig",
121
-        "pycurl3",
122
-        "strace",
123
-        "python3-cracklib",
124
-        "haveged",
125
-        "vim-extra",
126
-        "postgresql",
127
-        "openjdk8",
128
-        "apr",
129
-        "apr-util",
130
-        "httpd",
131
-        "openvswitch",
132
-        "openvswitch-doc",
133
-        "syslog-ng",
134
-        "zookeeper",
135
-        "fuse",
136
-        "nss-altfiles",
137
-        "apache-maven",
138
-        "subversion",
139
-        "python3",
140
-        "python3-libs",
141
-        "python3-tools",
142
-        "fakeroot-ng",
143
-        "ctags",
144
-        "libtirpc",
145
-        "lsof",
146
-        "nfs-utils",
147
-        "cve-check-tool",
148
-        "flannel",
149
-        "rpm-build",
150
-        "rpm-lang",
151
-        "dkms",
152
-        "openssl-perl",
153
-        "openssl-c_rehash",
154
-        "xinetd",
155
-        "atftp",
156
-        "atftp-client",
157
-        "audit",
158
-        "libcap-ng",
159
-        "tcp_wrappers",
160
-        "jq",
161
-        "apr-util-ldap",
162
-        "apr-util-pgsql",
163
-        "apr-util-sqlite",
164
-        "openjre8",
165
-        "sshpass",
166
-        "iputils",
167
-        "openjdk8-src",
168
-        "openjdk8-sample",
169
-        "openjdk8-doc",
170
-        "haproxy",
171
-        "cython3",
172
-        "python3-lxml",
173
-        "python3-pycparser",
174
-        "python3-cffi",
175
-        "python3-cryptography",
176
-        "cifs-utils",
177
-        "c-ares",
178
-        "dnsmasq",
179
-        "ddclient",
180
-        "netmgmt",
181
-        "motd"
182
-    ]
183
-}
... ...
@@ -1,3 +1,19 @@
1 1
 {
2
-    "packages":["sudo", "tar", "which", "google-compute-engine", "google-compute-engine-services", "kubernetes", "gawk", "cloud-utils", "gptfdisk", "perl-DBD-SQLite", "perl-DBIx-Simple", "perl", "ntp"]
2
+    "packages":[
3
+                "minimal",
4
+                "linux",
5
+                "initramfs",
6
+                "sudo",
7
+                "tar",
8
+                "google-compute-engine",
9
+                "google-compute-engine-services",
10
+                "kubernetes",
11
+                "gawk",
12
+                "cloud-utils",
13
+                "gptfdisk",
14
+                "perl-DBD-SQLite",
15
+                "perl-DBIx-Simple",
16
+                "perl",
17
+                "ntp"
18
+                ]
3 19
 }
4 20
deleted file mode 100644
... ...
@@ -1,17 +0,0 @@
1
-{
2
-    "packages":["filesystem",  
3
-                "bash",
4
-                "shadow", 
5
-                "net-tools",
6
-                "util-linux",
7
-                "linux-esx",
8
-                "dbus",
9
-                "photon-release", 
10
-                "photon-repos",
11
-                "tdnf",
12
-                "grep",
13
-                "pkg-config",
14
-                "rpm"]
15
-}
16
-
17
-
... ...
@@ -1,13 +1,7 @@
1 1
 {
2
-    "packages":["glibc", "zlib", "filesystem",  
3
-                "pkg-config", "bash", "bzip2", "shadow", "procps-ng", "iana-etc", "coreutils", "bc", "libtool", "net-tools",
4
-                "findutils", "xz", "iproute2", "util-linux", "kmod", "linux", "ca-certificates", "curl", "iptables", "Linux-PAM",
5
-                "systemd", "dbus", "file", "e2fsprogs", "rpm",
6
-                "openssh", "gdbm",
7
-                "photon-release", "photon-repos",
8
-                "sed", "grep", "cpio", "gzip", "vim", "libdb", "tdnf",
9
-                "open-vm-tools",
10
-                "docker","bridge-utils",
11
-                "cloud-init", "tzdata",
12
-                "krb5", "which", "initramfs", "motd", "cracklib-dicts"]
2
+    "packages": [
3
+                 "minimal",
4
+                 "linux",
5
+                 "initramfs"
6
+                 ]
13 7
 }
14 8
deleted file mode 100644
... ...
@@ -1,15 +0,0 @@
1
-{
2
-    "packages":["glibc", "zlib", "filesystem",  
3
-                "pkg-config", "bash", "bzip2", "shadow", "procps-ng", "iana-etc", "coreutils", "bc", "libtool", "net-tools",
4
-                "findutils", "xz", "iproute2", "util-linux", "kmod", "linux-esx", "ca-certificates", "curl", "iptables", "Linux-PAM",
5
-                "systemd", "dbus", "file", "e2fsprogs", "rpm","gawk","cloud-utils","gptfdisk",
6
-                "openssh", "gdbm",
7
-                "photon-release", "photon-repos",
8
-                "sed", "grep", "cpio", "gzip", "vim", "libdb", "tdnf",
9
-                "open-vm-tools",
10
-                "docker","bridge-utils",
11
-                "cloud-init",
12
-                "krb5", "which", "tzdata", "motd", "gdbm"]
13
-}
14
-
15
-
16 1
deleted file mode 100644
... ...
@@ -1,15 +0,0 @@
1
-{
2
-    "packages":["glibc", "zlib", "filesystem",
3
-                "pkg-config", "bash", "bzip2", "shadow", "procps-ng", "iana-etc", "coreutils", "bc", "libtool", "net-tools",
4
-                "findutils", "xz", "iproute2", "util-linux", "kmod", "linux", "ca-certificates", "curl", "iptables", "Linux-PAM",
5
-                "systemd", "dbus", "file", "e2fsprogs", "rpm","gawk","cloud-utils","gptfdisk",
6
-                "openssh", "gdbm",
7
-                "photon-release", "photon-repos",
8
-                "sed", "grep", "cpio", "gzip", "vim", "libdb", "tdnf",
9
-                "open-vm-tools",
10
-                "docker","bridge-utils",
11
-                "cloud-init",
12
-                "krb5", "which", "tzdata", "motd", "gdbm"]
13
-}
14
-
15
-
16 1
deleted file mode 100644
... ...
@@ -1,14 +0,0 @@
1
-{
2
-    "packages":["glibc", "zlib", "filesystem",
3
-                "pkg-config", "bash", "bzip2", "shadow", "procps-ng",
4
-		"coreutils", "bc", "libtool", "net-tools", "findutils", "xz",
5
-		"iproute2", "util-linux", "kmod", "linux", "linux-dtb-rpi3",
6
-		"ca-certificates", "curl", "iptables", "Linux-PAM", "systemd",
7
-		"dbus", "file", "e2fsprogs", "rpm","gawk","gptfdisk",
8
-                "openssh", "gdbm", "parted", "linux-firmware",
9
-                "photon-release", "photon-repos",
10
-                "sed", "grep", "cpio", "gzip", "vim", "libdb", "tdnf",
11
-                "which", "tzdata", "motd", "gdbm", "u-boot-rpi3" ]
12
-}
13
-
14
-
15 1
new file mode 100644
... ...
@@ -0,0 +1,6 @@
0
+{
1
+    "packages": [
2
+                 "minimal",
3
+                 "linux-esx"
4
+                 ]
5
+}
0 6
deleted file mode 100644
... ...
@@ -1,4 +0,0 @@
1
-{
2
-    "packages":["openvswitch", "gawk", "cloud-utils", "gptfdisk", "iperf"]
3
-}
4
-
5 1
new file mode 100644
... ...
@@ -0,0 +1,14 @@
0
+{
1
+    "packages":["glibc", "zlib", "filesystem",
2
+                "pkg-config", "bash", "bzip2", "shadow", "procps-ng",
3
+		"coreutils", "bc", "libtool", "net-tools", "findutils", "xz",
4
+		"iproute2", "util-linux", "kmod", "linux", "linux-dtb-rpi3",
5
+		"ca-certificates", "curl", "iptables", "Linux-PAM", "systemd",
6
+		"dbus", "file", "e2fsprogs", "rpm","gawk","gptfdisk",
7
+                "openssh", "gdbm", "parted", "linux-firmware",
8
+                "photon-release", "photon-repos",
9
+                "sed", "grep", "cpio", "gzip", "vim", "libdb", "tdnf",
10
+                "which", "tzdata", "motd", "gdbm", "u-boot-rpi3" ]
11
+}
12
+
13
+
0 14
deleted file mode 100644
... ...
@@ -1,3 +0,0 @@
1
-{
2
-    "packages":["efivar", "efibootmgr"]
3
-}
... ...
@@ -21,15 +21,13 @@ class Installer(object):
21 21
     """
22 22
     Photon installer
23 23
     """
24
-    mount_command = "./mk-mount-disk.sh"
25
-    prepare_command = "./mk-prepare-system.sh"
24
+    mount_command = os.path.dirname(__file__)+"/mk-mount-disk.sh"
26 25
     finalize_command = "./mk-finalize-system.sh"
27
-    chroot_command = "./mk-run-chroot.sh"
28
-    setup_grub_command = "./mk-setup-grub.sh"
29
-    unmount_disk_command = "./mk-unmount-disk.sh"
26
+    chroot_command = os.path.dirname(__file__)+"/mk-run-chroot.sh"
27
+    unmount_disk_command = os.path.dirname(__file__)+"/mk-unmount-disk.sh"
30 28
 
31 29
     def __init__(self, install_config, maxy=0, maxx=0, iso_installer=False,
32
-                 rpm_path="../stage/RPMS", log_path="../stage/LOGS", log_level="info"):
30
+                 rpm_path=os.path.dirname(__file__)+"/../stage/RPMS", log_path=os.path.dirname(__file__)+"/../stage/LOGS", log_level="info"):
33 31
         self.install_config = install_config
34 32
         self.install_config['iso_installer'] = iso_installer
35 33
         self.rpm_path = rpm_path
... ...
@@ -40,7 +38,15 @@ class Installer(object):
40 40
             self.working_directory = self.install_config['working_directory']
41 41
         else:
42 42
             self.working_directory = "/mnt/photon-root"
43
+        if 'prepare_script' in self.install_config:
44
+            self.prepare_command = self.install_config['prepare_script']
45
+        else:
46
+            self.prepare_command = os.path.dirname(__file__)+"/mk-prepare-system.sh"
43 47
         self.photon_root = self.working_directory + "/photon-chroot"
48
+        if 'setup_grub_script' in self.install_config:
49
+            self.setup_grub_command = self.install_config['setup_grub_script']
50
+        else:
51
+            self.setup_grub_command = os.path.dirname(__file__)+"/mk-setup-grub.sh"
44 52
         self.rpms_tobeinstalled = None
45 53
 
46 54
         if self.install_config['iso_installer']:
... ...
@@ -164,7 +170,7 @@ class Installer(object):
164 164
             self.exit_gracefully(None, None)
165 165
 
166 166
         # Copy the installer files
167
-        process = subprocess.Popen(['cp', '-r', "../installer", self.photon_root],
167
+        process = subprocess.Popen(['cp', '-r', os.path.dirname(__file__), self.photon_root],
168 168
                                    stdout=self.output)
169 169
         retval = process.wait()
170 170
         if retval != 0:
... ...
@@ -304,7 +310,7 @@ class Installer(object):
304 304
         if self.install_config['iso_installer']:
305 305
             self._bind_installer()
306 306
             self._bind_repo_dir()
307
-            process = subprocess.Popen([Installer.prepare_command, '-w',
307
+            process = subprocess.Popen([self.prepare_command, '-w',
308 308
                                         self.photon_root, 'install'],
309 309
                                        stdout=self.output)
310 310
             retval = process.wait()
... ...
@@ -315,7 +321,7 @@ class Installer(object):
315 315
         else:
316 316
             self._copy_files()
317 317
             #Setup the filesystem basics
318
-            process = subprocess.Popen([Installer.prepare_command, '-w', self.photon_root],
318
+            process = subprocess.Popen([self.prepare_command, '-w', self.photon_root],
319 319
                                        stdout=self.output)
320 320
             retval = process.wait()
321 321
             if retval != 0:
... ...
@@ -334,7 +340,7 @@ class Installer(object):
334 334
         retval = process.wait()
335 335
         if retval != 0:
336 336
             modules.commons.log(modules.commons.LOG_ERROR,
337
-                                "Fail to setup th target system after the installation")
337
+                                "Fail to setup the target system after the installation")
338 338
 
339 339
         if self.install_config['iso_installer']:
340 340
 
... ...
@@ -374,7 +380,7 @@ class Installer(object):
374 374
             try:
375 375
                 if self.install_config['boot'] == 'bios':
376 376
                     process = subprocess.Popen(
377
-                        [Installer.setup_grub_command, '-w', self.photon_root,
377
+                        [self.setup_grub_command, '-w', self.photon_root,
378 378
                          "bios", self.install_config['disk']['disk'],
379 379
                          self.install_config['disk']['root'],
380 380
                          self.install_config['disk']['boot'],
... ...
@@ -383,7 +389,7 @@ class Installer(object):
383 383
                         stdout=self.output)
384 384
                 elif self.install_config['boot'] == 'efi':
385 385
                     process = subprocess.Popen(
386
-                        [Installer.setup_grub_command, '-w', self.photon_root,
386
+                        [self.setup_grub_command, '-w', self.photon_root,
387 387
                          "efi", self.install_config['disk']['disk'],
388 388
                          self.install_config['disk']['root'],
389 389
                          self.install_config['disk']['boot'],
... ...
@@ -393,7 +399,7 @@ class Installer(object):
393 393
             except:
394 394
                 #install bios if variable is not set.
395 395
                 process = subprocess.Popen(
396
-                    [Installer.setup_grub_command, '-w', self.photon_root,
396
+                    [self.setup_grub_command, '-w', self.photon_root,
397 397
                      "bios", self.install_config['disk']['disk'],
398 398
                      self.install_config['disk']['root'],
399 399
                      self.install_config['disk']['boot'],
... ...
@@ -159,16 +159,12 @@ class IsoConfig(object):
159 159
         if self.is_vmware_virtualization() and 'install_linux_esx' not in install_config:
160 160
             install_config['install_linux_esx'] = True
161 161
 
162
-        json_wrapper_option_list = JsonWrapper("build_install_options_all.json")
163
-        option_list_json = json_wrapper_option_list.read()
164
-        options_sorted = option_list_json.items()
165
-
166 162
         base_path = os.path.dirname("build_install_options_all.json")
167 163
         package_list = []
168
-
169
-        package_list = PackageSelector.get_packages_to_install(options_sorted,
170
-                                                               install_config['type'],
164
+        if 'packagelist_file' in config:
165
+            package_list = PackageSelector.get_packages_to_install(config['packagelist_file'],
171 166
                                                                base_path)
167
+
172 168
         if 'additional_packages' in install_config:
173 169
             package_list.extend(install_config['additional_packages'])
174 170
         install_config['packages'] = package_list
... ...
@@ -250,20 +246,12 @@ class IsoConfig(object):
250 250
                 index += 1
251 251
                 if index == len(items):
252 252
                     break
253
-                #Skip linux select screen for ostree installation.
254
-                if index == select_linux_index:
255
-                    if install_config['type'] == 'ostree_server':
256
-                        index += 1
257 253
             else:
258 254
                 index -= 1
259 255
                 while index >= 0 and items[index][1] is False:
260 256
                     index -= 1
261 257
                 if index < 0:
262 258
                     index = 0
263
-                #Skip linux select screen for ostree installation.
264
-                if index == select_linux_index:
265
-                    if install_config['type'] == 'ostree_server':
266
-                        index -= 1
267 259
         return install_config
268 260
     def add_ui_pages(self, options_file, maxy, maxx, install_config):
269 261
         items = []
... ...
@@ -13,7 +13,8 @@
13 13
 set -o errexit      # exit if error...insurance ;
14 14
 set -o nounset      # exit if variable not initalized
15 15
 set +h          # disable hashall
16
-source config.inc
16
+SCRIPT_PATH=$(dirname $(realpath -s $0))
17
+source $SCRIPT_PATH/config.inc
17 18
 PRGNAME=${0##*/}    # script name minus the path
18 19
 LOGFILE=/var/log/"${PRGNAME}-${LOGFILE}"    #   set log file name
19 20
 #LOGFILE=/dev/null      #   uncomment to disable log file
... ...
@@ -12,8 +12,9 @@
12 12
 #
13 13
 
14 14
 set +x                 # disable hashall
15
-source config.inc       #   configuration parameters
16
-source function.inc     #   commonn functions
15
+SCRIPT_PATH=$(dirname $(realpath -s $0))
16
+source $SCRIPT_PATH/config.inc       #   configuration parameters
17
+source $SCRIPT_PATH/function.inc     #   commonn functions
17 18
 PRGNAME=${0##*/}    # script name minus the path
18 19
 LOGFILE=/var/log/"${PRGNAME}-${LOGFILE}"    #   set log file name
19 20
 
... ...
@@ -14,8 +14,9 @@ set -o errexit		# exit if error...insurance ;
14 14
 set -o nounset		# exit if variable not initalized
15 15
 set +h			# disable hashall
16 16
 PRGNAME=${0##*/}	# script name minus the path
17
-source config.inc		#	configuration parameters
18
-source function.inc
17
+SCRIPT_PATH=$(dirname $(realpath -s $0))
18
+source $SCRIPT_PATH/config.inc		#	configuration parameters
19
+source $SCRIPT_PATH/function.inc
19 20
 LOGFILE=/var/log/"${PRGNAME}-${LOGFILE}"	#	set log file name
20 21
 #LOGFILE=/dev/null		#	uncomment to disable log file
21 22
 [ ${EUID} -eq 0 ]	|| fail "${PRGNAME}: Need to be root user: FAILURE"
... ...
@@ -13,8 +13,9 @@
13 13
 set -o errexit      # exit if error...insurance ;
14 14
 set -o nounset      # exit if variable not initalized
15 15
 set +h          # disable hashall
16
-source config.inc
17
-source function.inc
16
+SCRIPT_PATH=$(dirname $(realpath -s $0))
17
+source $SCRIPT_PATH/config.inc
18
+source $SCRIPT_PATH/function.inc
18 19
 PRGNAME=${0##*/}    # script name minus the path
19 20
 
20 21
 LOGFILE=/var/log/"${PRGNAME}-${LOGFILE}"    #   set log file name
... ...
@@ -30,10 +31,6 @@ if mountpoint ${BUILDROOT}/dev  >/dev/null 2>&1; then umount -R ${BUILDROOT}/dev
30 30
 [ ${EUID} -eq 0 ]   || fail "${PRGNAME}: Need to be root user: FAILURE"
31 31
 
32 32
 cd ${BUILDROOT} || fail "${PRGNAME}: Change directory: ${BUILDROOT}: FAILURE"
33
-
34
-#
35
-#   Setup the filesystem for chapter 06
36
-#
37 33
 if [[   $# -gt 0 ]] && [[ $1 == 'install' ]]; then
38 34
     mkdir -p ${BUILDROOT}/var/lib/rpm
39 35
     mkdir -p ${BUILDROOT}/cache/tdnf
... ...
@@ -60,7 +57,6 @@ if [[   $# -eq 0 ]] || [[ $1 != 'install' ]]; then
60 60
     chown -R 0:0 ${BUILDROOT}/* || :
61 61
 fi
62 62
 
63
-#
64 63
 #   Mount kernel filesystem
65 64
 #
66 65
 if ! mountpoint ${BUILDROOT}/dev    >/dev/null 2>&1; then mount --rbind /dev ${BUILDROOT}/dev; mount --make-rslave ${BUILDROOT}/dev; fi
... ...
@@ -13,7 +13,8 @@
13 13
 set -o errexit      # exit if error...insurance ;
14 14
 set -o nounset      # exit if variable not initalized
15 15
 set +h          # disable hashall
16
-source config.inc
16
+SCRIPT_PATH=$(dirname $(realpath -s $0))
17
+source $SCRIPT_PATH/config.inc
17 18
 PRGNAME=${0##*/}    # script name minus the path
18 19
 LOGFILE=/var/log/"${PRGNAME}-${LOGFILE}"    #   set log file name
19 20
 #LOGFILE=/dev/null      #   uncomment to disable log file
... ...
@@ -30,16 +30,15 @@ grub_efi_install()
30 30
     fi
31 31
     mkfs.fat $BOOT_PARTITION
32 32
     mount -t vfat $BOOT_PARTITION $BUILDROOT/boot/efi
33
-    cp boot/unifont.pf2 /usr/share/grub/
34
-
33
+    cp $INSTALLER_PATH/boot/unifont.pf2 /usr/share/grub/
35 34
     mkdir -p $BUILDROOT/boot/efi/EFI/Boot/
36 35
     if [ $(uname -m) == "aarch64" ]
37 36
     then
38
-        cp EFI_aarch64/BOOT/* $BUILDROOT/boot/efi/EFI/Boot/
37
+        cp $INSTALLER_PATH/EFI_aarch64/BOOT/* $BUILDROOT/boot/efi/EFI/Boot/
39 38
         local EXE_NAME="bootaa64.efi"
40 39
     elif [ $(uname -m) == "x86_64" ]
41 40
     then
42
-        cp EFI_x86_64/BOOT/* $BUILDROOT/boot/efi/EFI/Boot/
41
+        cp $INSTALLER_PATH/EFI_x86_64/BOOT/* $BUILDROOT/boot/efi/EFI/Boot/
43 42
         local EXE_NAME="bootx64.efi"
44 43
     fi
45 44
 
... ...
@@ -57,13 +56,14 @@ grub_mbr_install()
57 57
 {
58 58
     $grubInstallCmd --target=i386-pc --force --boot-directory=$BUILDROOT/boot "$HDD"
59 59
 }
60
-
61 60
 set -o errexit        # exit if error...insurance ;)
62 61
 set -o nounset        # exit if variable not initalized
63 62
 set +h            # disable hashall
64 63
 PRGNAME=${0##*/}    # script name minus the path
65
-source config.inc        #    configuration parameters
66
-source function.inc        #    commonn functions
64
+SCRIPT_PATH=$(dirname $(realpath -s $0))
65
+INSTALLER_PATH=$SCRIPT_PATH
66
+source $SCRIPT_PATH/config.inc        #    configuration parameters
67
+source $SCRIPT_PATH/function.inc        #    commonn functions
67 68
 LOGFILE=/var/log/"${PRGNAME}-${LOGFILE}"    #    set log file name
68 69
 ARCH=$(uname -m)    # host architecture
69 70
 [ ${EUID} -eq 0 ]    || fail "${PRGNAME}: Need to be root user: FAILURE"
... ...
@@ -104,11 +104,11 @@ if [ "$BOOTMODE" == "efi" ]; then
104 104
 fi
105 105
 
106 106
 rm -rf ${BUILDROOT}/boot/grub2/fonts
107
-cp boot/ascii.pf2 ${BUILDROOT}/boot/grub2/
107
+cp $INSTALLER_PATH/boot/ascii.pf2 ${BUILDROOT}/boot/grub2/
108 108
 mkdir -p ${BUILDROOT}/boot/grub2/themes/photon
109
-cp boot/splash.png ${BUILDROOT}/boot/grub2/themes/photon/photon.png
110
-cp boot/terminal_*.tga ${BUILDROOT}/boot/grub2/themes/photon/
111
-cp boot/theme.txt ${BUILDROOT}/boot/grub2/themes/photon/
109
+cp $INSTALLER_PATH/boot/splash.png ${BUILDROOT}/boot/grub2/themes/photon/photon.png
110
+cp $INSTALLER_PATH/boot/terminal_*.tga ${BUILDROOT}/boot/grub2/themes/photon/
111
+cp $INSTALLER_PATH/boot/theme.txt ${BUILDROOT}/boot/grub2/themes/photon/
112 112
 # linux-esx tries to mount rootfs even before nvme got initialized.
113 113
 # rootwait fixes this issue
114 114
 EXTRA_PARAMS=""
... ...
@@ -13,7 +13,8 @@
13 13
 set -o errexit      # exit if error...insurance ;
14 14
 set -o nounset      # exit if variable not initalized
15 15
 set +h          # disable hashall
16
-source config.inc
16
+SCRIPT_PATH=$(dirname $(realpath -s $0))
17
+source $SCRIPT_PATH/config.inc
17 18
 PRGNAME=${0##*/}    # script name minus the path
18 19
 LOGFILE=/var/log/"${PRGNAME}-${LOGFILE}"    #   set log file name
19 20
 #LOGFILE=/dev/null      #   uncomment to disable log file
... ...
@@ -29,30 +29,17 @@ class PackageSelector(object):
29 29
                              can_go_next=True, position=1)
30 30
 
31 31
     @staticmethod
32
-    def get_packages_to_install(options, config_type, output_data_path):
33
-        package_list = []
34
-        for install_option in options:
35
-            if install_option[0] == config_type:
36
-                for include_type in install_option[1]["include"]:
37
-                    package_list = (package_list +
38
-                                    PackageSelector.get_packages_to_install(options,
39
-                                                                            include_type,
40
-                                                                            output_data_path))
41
-                json_wrapper_package_list = JsonWrapper(os.path.join(output_data_path,
42
-                                                                     install_option[1]["file"]))
43
-                package_list_json = json_wrapper_package_list.read()
44
-                package_list = package_list + package_list_json["packages"]
45
-                break
46
-        return package_list
32
+    def get_packages_to_install(packagelist_file, output_data_path):
33
+        json_wrapper_package_list = JsonWrapper(os.path.join(output_data_path,
34
+                                                packagelist_file))
35
+        package_list_json = json_wrapper_package_list.read()
36
+        return package_list_json["packages"]
47 37
 
48 38
     @staticmethod
49
-    def get_additional_files_to_copy_in_iso(options, base_path, config_type):
39
+    def get_additional_files_to_copy_in_iso(install_option, base_path):
50 40
         additional_files = []
51
-        for install_option in options:
52
-            if install_option[0] == config_type:
53
-                if "additional-files" in install_option[1]:
54
-                    additional_files = install_option[1]["additional-files"]
55
-                break
41
+        if "additional-files" in install_option[1]:
42
+            additional_files = install_option[1]["additional-files"]
56 43
         return additional_files
57 44
 
58 45
     def load_package_list(self, options_file):
... ...
@@ -68,11 +55,10 @@ class PackageSelector(object):
68 68
         visible_options_cnt = 0
69 69
         for install_option in options_sorted:
70 70
             if install_option[1]["visible"] == True:
71
-                package_list = PackageSelector.get_packages_to_install(options_sorted,
72
-                                                                       install_option[0],
71
+                package_list = PackageSelector.get_packages_to_install(install_option[1]['packagelist_file'],
73 72
                                                                        base_path)
74 73
                 additional_files = PackageSelector.get_additional_files_to_copy_in_iso(
75
-                    options_sorted, base_path, install_option[0])
74
+                    install_option, base_path)
76 75
                 self.package_menu_items.append((install_option[1]["title"],
77 76
                                                 self.exit_function,
78 77
                                                 [install_option[0],
... ...
@@ -38,14 +38,14 @@ def query_yes_no(question, default="no"):
38 38
             sys.stdout.write("Please respond with 'yes' or 'no' "
39 39
                              "(or 'y' or 'n').\n")
40 40
 
41
-def create_vmdk_and_partition(config, vmdk_path):
41
+def create_vmdk_and_partition(config, vmdk_path, disk_setup_script):
42 42
     partitions_data = {}
43 43
 
44 44
     firmware = "bios"
45 45
     if 'boot' in config and config['boot'] == 'efi':
46 46
         firmware = "efi"
47
-    process = subprocess.Popen(['./mk-setup-vmdk.sh', '-rp', config['size']['root'], '-sp',
48
-                                config['size']['swap'], '-n', vmdk_path, '-fm', firmware, '-m'],
47
+    process = subprocess.Popen([disk_setup_script, '-rp', config['size']['root'], '-sp',
48
+                                config['size']['swap'], '-n', vmdk_path, '-fm', firmware],
49 49
                                stdout=subprocess.PIPE)
50 50
     count = 0
51 51
 
... ...
@@ -71,7 +71,6 @@ def create_vmdk_and_partition(config, vmdk_path):
71 71
             partitions_data['partitions'].append({'path': partitions_data['esp'], 'mountpoint': '/boot/esp',
72 72
                                           'filesystem': 'vfat'})
73 73
             count += 1
74
-
75 74
     return partitions_data, count == 2 or count == 3
76 75
 
77 76
 def get_file_name_with_last_folder(filename):
... ...
@@ -188,21 +187,29 @@ if __name__ == '__main__':
188 188
     parser.add_argument("-w", "--working-directory", dest="working_directory",
189 189
                         default="/mnt/photon-root")
190 190
     parser.add_argument("-l", "--log-path", dest="log_path",
191
-                        default="../stage/LOGS")
191
+                        default=os.path.dirname(__file__)+"/../stage/LOGS")
192 192
     parser.add_argument("-y", "--log-level", dest="log_level")
193
-    parser.add_argument("-r", "--rpm-path", dest="rpm_path", default="../stage/RPMS")
194
-    parser.add_argument("-x", "--srpm-path", dest="srpm_path", default="../stage/SRPMS")
193
+    parser.add_argument("-r", "--rpm-path", dest="rpm_path", default=os.path.dirname(__file__)+"/../stage/RPMS")
194
+    parser.add_argument("-x", "--srpm-path", dest="srpm_path", default=os.path.dirname(__file__)+"/../stage/SRPMS")
195 195
     parser.add_argument("-o", "--output-data-path", dest="output_data_path",
196
-                        default="../stage/common/data/")
196
+                        default=os.path.dirname(__file__)+"/../stage/common/data/")
197 197
     parser.add_argument("-f", "--force", action="store_true", dest="force", default=False)
198 198
     parser.add_argument("-p", "--package-list-file", dest="package_list_file",
199
-                        default="../common/data/build_install_options_all.json")
200
-    parser.add_argument("-m", "--stage-path", dest="stage_path", default="../stage")
199
+                        default=os.path.dirname(__file__)+"/../common/data/build_install_options_all.json")
200
+    parser.add_argument("-m", "--stage-path", dest="stage_path", default=os.path.dirname(__file__)+"../stage")
201 201
     parser.add_argument("-s", "--json-data-path", dest="json_data_path",
202
-                        default="../stage/common/data/")
202
+                        default=os.path.dirname(__file__)+"/../stage/common/data/")
203 203
     parser.add_argument("-d", "--pkg-to-rpm-map-file", dest="pkg_to_rpm_map_file",
204
-                        default="../stage/pkg_info.json")
204
+                        default=os.path.dirname(__file__)+"/../stage/pkg_info.json")
205 205
     parser.add_argument("-c", "--pkg-to-be-copied-conf-file", dest="pkg_to_be_copied_conf_file")
206
+    parser.add_argument("-ds", "--disk-setup-script", dest="disk_setup_script",
207
+                        default=os.path.dirname(__file__)+"/../support/image-builder/mk-setup-vmdk.sh")
208
+    parser.add_argument("-dc", "--disk-cleanup-script", dest="disk_cleanup_script",
209
+                        default=os.path.dirname(__file__)+"/../support/image-builder/mk-clean-vmdk.sh")
210
+    parser.add_argument("-ps", "--prepare-script", dest="prepare_system_script",
211
+                        default=os.path.dirname(__file__)+"/mk-prepare-system.sh")
212
+    parser.add_argument("-sg", "--setup-grub-script", dest="setup_grub_script",
213
+                        default=os.path.dirname(__file__)+"/mk-setup-grub.sh")
206 214
     parser.add_argument('configfile', nargs='?')
207 215
     options = parser.parse_args()
208 216
     # Cleanup the working directory
... ...
@@ -235,7 +242,7 @@ if __name__ == '__main__':
235 235
 
236 236
             # Read the conf file
237 237
             config = (JsonWrapper(options.configfile)).read()
238
-            config['disk'], success = create_vmdk_and_partition(config, options.vmdk_path)
238
+            config['disk'], success = create_vmdk_and_partition(config, options.vmdk_path, options.disk_setup_script)
239 239
             if not success:
240 240
                 print("Unexpected failure, please check the logs")
241 241
                 sys.exit(1)
... ...
@@ -271,8 +278,18 @@ if __name__ == '__main__':
271 271
         options_sorted = option_list_json.items()
272 272
 
273 273
         packages = []
274
-        packages = PackageSelector.get_packages_to_install(options_sorted, config['type'],
275
-                                                           options.output_data_path)
274
+        if 'type' in config:
275
+            for install_option in options_sorted:
276
+                if install_option[0] == config['type']:
277
+                    packages = PackageSelector.get_packages_to_install(install_option[1]['packagelist_file'],
278
+                                                                   options.output_data_path)
279
+                    break
280
+        else:
281
+            if 'packagelist_file' in config:
282
+                packages = PackageSelector.get_packages_to_install(config['packagelist_file'],
283
+                                                                   options.output_data_path)
284
+            if 'additional_packages' in config:
285
+                packages = packages.extend(config['additional_packages'])
276 286
 
277 287
         config['packages'] = packages
278 288
 
... ...
@@ -285,6 +302,8 @@ if __name__ == '__main__':
285 285
         retval = process.wait()
286 286
 
287 287
         config['working_directory'] = options.working_directory
288
+        config['prepare_script'] = options.prepare_system_script
289
+        config['setup_grub_script'] = options.setup_grub_script
288 290
 
289 291
         # Run the installer
290 292
         package_installer = Installer(config, rpm_path=options.rpm_path,
... ...
@@ -317,7 +336,7 @@ if __name__ == '__main__':
317 317
 
318 318
         # Cleaning up for vmdk
319 319
         if 'vmdk_install' in config and config['vmdk_install']:
320
-            process = subprocess.Popen(['./mk-clean-vmdk.sh', config['disk']['disk']])
320
+            process = subprocess.Popen([options.disk_cleanup_script, config['disk']['disk']])
321 321
             process.wait()
322 322
 
323 323
         #Clean up the working directories
... ...
@@ -12,7 +12,7 @@
12 12
                         {"mountpoint": "/root", "size": 128, "filesystem": "ext4"},
13 13
                         {"size": 128, "filesystem": "swap"}
14 14
                     ],
15
-    "type": "minimal",
15
+    "packagelist_file": "packages_minimal.json",
16 16
     "additional_packages": ["vim"],
17 17
     "postinstall": [
18 18
                 		"#!/bin/sh",
19 19
deleted file mode 100755
... ...
@@ -1,69 +0,0 @@
1
-#!/bin/bash
2
-
3
-cd /lib/systemd/system/multi-user.target.wants/
4
-
5
-ln -s ../docker.service docker.service
6
-cd /
7
-
8
-echo "127.0.0.1 localhost" >> /etc/hosts
9
-
10
-echo "DNS=169.254.169.253" >> /etc/systemd/resolved.conf
11
-echo "Domains=ec2.internal" >> /etc/systemd/network/99-dhcp-en.network
12
-
13
-# Add a DHCP section, but comment out the MTU setting that enables
14
-# jumbo frames (9001 byte MTU) on AWS. Users who have the right
15
-# overall setup (eg: who have configured the necessary ICMP rules in
16
-# their security group to handle large MTUs correctly for
17
-# internet-bound traffic) can then choose to enable jumbo frames on
18
-# the system by simply uncommenting this line.
19
-echo -e "\n[DHCP]\n#UseMTU=true" >> /etc/systemd/network/99-dhcp-en.network
20
-
21
-# Remove ssh host keys and add script to regenerate them at boot time.
22
-rm -f /etc/ssh/ssh_host_*
23
-
24
-sudo groupadd docker
25
-sudo groupadd sudo
26
-
27
-rm /root/.ssh/authorized_keys   
28
-
29
-# ssh server config
30
-# Override old values
31
-rm /etc/ssh/sshd_config
32
-
33
-echo "AuthorizedKeysFile .ssh/authorized_keys" >> /etc/ssh/sshd_config
34
-echo "UsePrivilegeSeparation sandbox" >> /etc/ssh/sshd_config
35
-echo "PubkeyAuthentication yes" >> /etc/ssh/sshd_config
36
-echo "PasswordAuthentication no" >> /etc/ssh/sshd_config
37
-echo "PermitRootLogin without-password" >> /etc/ssh/sshd_config
38
-echo "PermitTunnel no" >> /etc/ssh/sshd_config
39
-echo "AllowTcpForwarding yes" >> /etc/ssh/sshd_config
40
-echo "X11Forwarding no" >> /etc/ssh/sshd_config
41
-echo "ClientAliveInterval 420" >> /etc/ssh/sshd_config
42
-echo "UseDNS no" >> /etc/ssh/sshd_config
43
-echo "ChallengeResponseAuthentication no" >> /etc/ssh/sshd_config
44
-echo "UsePAM yes" >> /etc/ssh/sshd_config
45
-
46
-
47
-# ssh client config
48
-# Override old values
49
-
50
-rm /etc/ssh/ssh_config
51
-
52
-echo "Host *" >> /etc/ssh/ssh_config
53
-echo "Protocol 2" >> /etc/ssh/ssh_config
54
-echo "ForwardAgent no" >> /etc/ssh/ssh_config
55
-echo "ForwardX11 no" >> /etc/ssh/ssh_config
56
-echo "HostbasedAuthentication no" >> /etc/ssh/ssh_config
57
-echo "StrictHostKeyChecking no" >> /etc/ssh/ssh_config
58
-echo "Ciphers aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc" >> /etc/ssh/ssh_config
59
-echo "Tunnel no" >> /etc/ssh/ssh_config
60
-echo "ServerAliveInterval 420" >> /etc/ssh/ssh_config
61
-
62
-sed -i 's/net.ifnames=0//' /boot/grub/grub.cfg
63
-sed -i 's/$photon_cmdline/init=\/lib\/systemd\/systemd loglevel=3 ro console=ttyS0 earlyprintk=ttyS0/' /boot/grub/grub.cfg
64
-
65
-# Disable loading/unloading of modules
66
-#echo "kernel.modules_disabled = 1" > /etc/sysctl.d/modules_disabled.conf
67
-
68
-# Remove kernel symbols
69
-rm -f /boot/System.map*
70 1
deleted file mode 100644
... ...
@@ -1,91 +0,0 @@
1
-# The top level settings are used as module
2
-# and system configuration.
3
-
4
-# A set of users which may be applied and/or used by various modules
5
-# when a 'default' entry is found it will reference the 'default_user'
6
-# from the distro configuration specified below
7
-users:
8
-   - name: root
9
-     lock-passwd: true
10
-
11
-# If this is set, 'root' will not be able to ssh in
12
-disable_root: false
13
-
14
-# This will cause the set+update hostname module to not operate (if true)
15
-preserve_hostname: false
16
-
17
-# datasources to check for cloud-config
18
-datasource_list: [ 
19
-                  Ec2
20
-                 ]
21
-
22
-# Example datasource config
23
-datasource: 
24
-   Ec2: 
25
-     metadata_urls: [ 'http://169.254.169.254' ]
26
-#      timeout: 5 # (defaults to 50 seconds)
27
-#      max_wait: 10 # (defaults to 120 seconds)
28
-
29
-# The modules that run in the 'init' stage
30
-cloud_init_modules:
31
-# - migrator
32
-# - seed_random
33
- - bootcmd
34
- - write-files
35
-# - growpart
36
-# - resizefs
37
- - set_hostname
38
- - update_hostname
39
-# - update_etc_hosts
40
-# - ca-certs
41
-# - rsyslog
42
- - users-groups
43
- - ssh
44
-
45
-# The modules that run in the 'config' stage
46
-cloud_config_modules:
47
-# Emit the cloud config ready event
48
-# this can be used by upstart jobs for 'start on cloud-config'.
49
-# - emit_upstart
50
-# - disk_setup
51
-# - mounts
52
- - ssh-import-id
53
-# - set-passwords
54
- - package-update-upgrade-install
55
-# - landscape
56
-# - timezone
57
-# - puppet
58
-# - chef
59
-# - salt-minion
60
-# - mcollective
61
-# - disable-ec2-metadata
62
- - runcmd
63
-# - byobu
64
- - yum-add-repo
65
-
66
-# The modules that run in the 'final' stage
67
-cloud_final_modules:
68
-# - rightscale_userdata
69
- - scripts-vendor
70
- - scripts-per-once
71
- - scripts-per-boot
72
- - scripts-per-instance
73
- - scripts-user
74
- - ssh-authkey-fingerprints
75
-# - keys-to-console
76
-# - phone-home
77
- - final-message
78
-# - power-state-change
79
-
80
-# System and/or distro specific settings
81
-# (not accessible to handlers/transforms)
82
-system_info:
83
-   # This will affect which distro class gets used
84
-   distro: photon
85
-   # Other config here will be given to the distro class and/or path classes
86
-   paths:
87
-      cloud_dir: /var/lib/cloud/
88
-      templates_dir: /etc/cloud/templates/
89
-      upstart_dir: /etc/init/
90
-
91
-   ssh_svcname: ssh
92 1
deleted file mode 100755
... ...
@@ -1,340 +0,0 @@
1
-#!/bin/bash
2
-
3
-set -o errexit    # exit if any command returns non true return value
4
-set -o nounset    # exit if you try to use uninitialised variable
5
-set -x
6
-PRGNAME=${0##*/}  # script name minus the path
7
-LOGFILE="${PRGNAME}-$(date +%Y-%m-%d).log"
8
-
9
-#expected number of command line argument
10
-NARGS=16
11
-ARGS_PASSED=$#
12
-VOLUME_SIZE=10
13
-COPY_VOLUME_SIZE=20
14
-DEVICE="/dev/xvdd"
15
-COPY_DEVICE="/dev/xvdc"
16
-EBS_IMAGE_ROOT_DEVICE_NAME="/dev/xvda"
17
-LOOP_WAIT=2
18
-SSH_WAIT=30
19
-SNAPSHOT_WAIT=60
20
-LOOP_TRIAL=100
21
-
22
-#AMI_IDS of different US Regions
23
-AMI_ID_US_EAST_1="ami-83614695"
24
-AMI_ID_US_EAST_2="ami-45311120"
25
-AMI_ID_US_WEST_1="ami-e04b6380"
26
-AMI_ID_US_WEST_2="ami-c0df50a0"
27
-
28
-while [[ $# > 0 ]]
29
-do
30
-        key="$1"
31
-        shift
32
-
33
-        case $key in
34
-                -g|--GN)
35
-                GROUP_NAME="$1"
36
-                shift
37
-        ;;
38
-                -ai|--AMI_ID)
39
-                AMI_ID="$1"
40
-                shift
41
-        ;;
42
-                -tf|--TAR_FILE)
43
-                TAR_FILE="$1"
44
-                shift
45
-        ;;
46
-                -kn|--KEY_NAME)
47
-                KEY_NAME="$1"
48
-                shift
49
-        ;;
50
-                -n|--IMG_NAME)
51
-                IMAGE_NAME="$1"
52
-                shift
53
-        ;;
54
-                -aki|--ACCESS_KEY_ID)
55
-                ACCESS_KEY_ID="$1"
56
-                shift
57
-        ;;
58
-                -sak|--SECRET_ACCESS_KEY)
59
-                SECRET_ACCESS_KEY="$1"
60
-                shift
61
-        ;;
62
-                -dr|--DEFAULT_REGION)
63
-                DEFAULT_REGION="$1"
64
-                shift
65
-        ;;
66
-                -h|--help)
67
-                echo 'Usage:'
68
-                echo '-g|--GN                  :security group name for the instance'
69
-                echo '-ai|--AMI_ID             :ami id for launching an instance. This is optional'
70
-                echo '-tf|--TAR_FILE           :tar filename without extension'
71
-                echo '-kn|--KEY_NAME           :pem filename without pem extension to download'
72
-                echo '-n|--IMG_NAME            :sets name of the ebs image'
73
-                echo '-aki|--ACCESS_KEY_ID     :aws access key id'
74
-                echo '-sak|--SECRET_ACCESS_KEY :aws secret access key'
75
-                echo '-dr|--DEFAULT_REEGION    :aws default region'
76
-                exit 0
77
-        ;;
78
-        *)
79
-                # unknown option
80
-        ;;
81
-        esac
82
-done
83
-
84
-if [ $ARGS_PASSED -eq $[$NARGS-2] ]; then
85
-  if [ ! -z "${AMI_ID:-}" ]; then
86
-   echo "Error in the arguments passed. Try ./create-ebs-image.sh -h for help"
87
-   exit 1
88
-  fi
89
-  key=$DEFAULT_REGION
90
-  case $key in
91
-      us-east-1)
92
-      AMI_ID=$AMI_ID_US_EAST_1
93
-  ;;
94
-      us-east-2)
95
-      AMI_ID=$AMI_ID_US_EAST_2
96
-  ;;
97
-      us-west-1)
98
-      AMI_ID=$AMI_ID_US_WEST_1
99
-  ;;
100
-      us-west-2)
101
-      AMI_ID=$AMI_ID_US_WEST_2
102
-  ;;
103
-  *)
104
-      #unkown region
105
-      exit 1
106
-  esac
107
-  ARGS_PASSED=$[$ARGS_PASSED+2]
108
-fi
109
-
110
-if [ $ARGS_PASSED -ne $NARGS ]; then
111
-   echo "Error in the arguments passed. Try ./create-ebs-image.sh -h for help"
112
-   exit 1
113
-fi
114
-
115
-#set the credential necessary to run the aws cli
116
-export AWS_ACCESS_KEY_ID=$ACCESS_KEY_ID
117
-export AWS_SECRET_ACCESS_KEY=$SECRET_ACCESS_KEY
118
-export AWS_DEFAULT_REGION=$DEFAULT_REGION
119
-KEY_FILE=$KEY_NAME.pem
120
-
121
-function cleanup {
122
-  if [ ! -z "${INSTANCE_ID:-}" ]; then
123
-   aws ec2 terminate-instances --instance-ids $INSTANCE_ID
124
-   while : ; do
125
-    INSTANCE_STATE=`aws ec2 describe-instances --instance-ids $INSTANCE_ID --output=text --query 'Reservations[0].Instances[0].State.Name'`
126
-    if [ "$INSTANCE_STATE" == "terminated" ]; then
127
-      break
128
-    fi
129
-    sleep $LOOP_WAIT
130
-   done
131
-  fi
132
-  if [ ! -z "${VOLUMEID_COPY:-}" ]; then
133
-   aws ec2 delete-volume --volume-id $VOLUMEID_COPY
134
-  fi
135
-  if [ ! -z "${GROUP_NAME:-}" ]; then
136
-   aws ec2 delete-security-group --group-name $GROUP_NAME
137
-  fi
138
-  if [ ! -z "${KEY_NAME:-}" ]; then
139
-   aws ec2 delete-key-pair --key-name $KEY_NAME
140
-  fi
141
-  rm $KEY_FILE
142
-}
143
-trap 'cleanup' EXIT
144
-
145
-function check_counter {
146
-   if [ $# -ne 3 ]; then
147
-      echo "Pass the counter,max value and the error message"
148
-      exit 1
149
-   fi
150
-   if [ $1 -ge $2 ]; then
151
-      echo "$3" >> $LOGFILE
152
-      exit
153
-   fi
154
-}
155
-
156
-#Start an AMI Instance
157
-aws ec2 create-security-group --group-name $GROUP_NAME --description "AMI Creation Sec Group"
158
-aws ec2 authorize-security-group-ingress --group-name $GROUP_NAME --protocol tcp --port 22 --cidr 0.0.0.0/0
159
-aws ec2 create-key-pair --key-name $KEY_NAME --query 'KeyMaterial' --output text > $KEY_FILE
160
-chmod 400 $KEY_FILE
161
-SECURITY_GROUP_ID=`aws ec2 describe-security-groups --group-name $GROUP_NAME --output=text --query 'SecurityGroups[0].GroupId'`
162
-INSTANCE_ID=`aws ec2 run-instances --image-id $AMI_ID --security-group-ids $SECURITY_GROUP_ID --count 1 --instance-type m3.medium --key-name $KEY_NAME --output=text --query 'Instances[0].InstanceId'`
163
-AVAILABILITY_ZONE=`aws ec2 describe-instances --instance-ids $INSTANCE_ID --output=text --query 'Reservations[0].Instances[0].Placement.AvailabilityZone'`
164
-
165
-count=0
166
-while : ; do
167
- INSTANCE_STATE=`aws ec2 describe-instances --instance-ids $INSTANCE_ID --output=text --query 'Reservations[0].Instances[0].State.Name'`
168
- if [ "$INSTANCE_STATE" == "running" ]; then
169
-   break
170
- else
171
-  count=$[$count+1]
172
- fi
173
- check_counter $count $LOOP_TRIAL "Instance $INSTANCE_ID not in running state" 
174
- sleep $LOOP_WAIT
175
-done
176
-
177
-count=0
178
-while : ; do
179
- IP=`aws ec2 describe-instances --instance-ids $INSTANCE_ID --output=text --query 'Reservations[0].Instances[0].PublicIpAddress'`
180
- if [ "$IP" == "None" ]; then
181
-   count=$[$count+1]
182
- else
183
-   break
184
- fi
185
- check_counter $count $LOOP_TRIAL "Instance $INSTANCE_ID does not have an IP yet" 
186
- sleep $LOOP_WAIT
187
-done
188
-
189
-sleep $SSH_WAIT
190
-
191
-while : ; do
192
- output=$(eval ssh -o StrictHostKeyChecking=no -i $KEY_FILE root@$IP 'tdnf install -y kpartx wget')
193
- ret=$?
194
- if [ "$ret" -eq 0 ]; then
195
-  break
196
- else
197
-  count=$[$count+1]
198
- fi
199
- check_counter $count $LOOP_TRIAL "Unable to ssh the Instance $INSTANCE_ID with IP $IP" 
200
- sleep $LOOP_WAIT
201
-done
202
-
203
-#create two volumes one to copy the tar file and another for ebs image creation
204
-VOLUMEID=`aws ec2 create-volume --size $VOLUME_SIZE --region $AWS_DEFAULT_REGION --availability-zone $AVAILABILITY_ZONE --output=text --query 'VolumeId'`
205
-VOLUMEID_COPY=`aws ec2 create-volume --size $COPY_VOLUME_SIZE --region $AWS_DEFAULT_REGION --availability-zone $AVAILABILITY_ZONE --output=text --query 'VolumeId'`
206
-
207
-#attach both the volumes
208
-count=0
209
-while : ; do
210
- STATE_1=`aws ec2 describe-volumes --volume-id $VOLUMEID_COPY --output=text --query 'Volumes[0].State'`
211
- if [ "$STATE_1" == "available" ]; then
212
-   break
213
- else
214
-  count=$[$count+1]
215
- fi
216
- check_counter $count $LOOP_TRIAL "Volume with ID $VOLUMEID_COPY is not available"
217
- sleep $LOOP_WAIT
218
-done
219
-
220
-aws ec2 attach-volume --volume-id $VOLUMEID_COPY --instance-id $INSTANCE_ID --device $COPY_DEVICE --region $AWS_DEFAULT_REGION >> $LOGFILE
221
-
222
-count=0
223
-while : ; do
224
- STATE_2=`aws ec2 describe-volumes --volume-id $VOLUMEID_COPY --output=text --query 'Volumes[0].Attachments[0].State'`
225
- if [ "$STATE_2" == "attached" ]; then
226
-   break
227
- else
228
-  count=$[$count+1]
229
- fi
230
- check_counter $count $LOOP_TRIAL "Volume with ID $VOLUMEID_COPY is not in attached state"
231
- sleep $LOOP_WAIT
232
-done
233
-
234
-count=0
235
-while : ; do
236
- STATE_3=`aws ec2 describe-volumes --volume-id $VOLUMEID --output=text --query 'Volumes[0].State'`
237
- if [ "$STATE_3" == "available" ]; then
238
-   break
239
- else
240
-  count=$[$count+1]
241
- fi
242
- check_counter $count $LOOP_TRIAL "Volume with ID $VOLUMEID is not available"
243
- sleep $LOOP_WAIT
244
-done
245
-
246
-aws ec2 attach-volume --volume-id $VOLUMEID --instance-id $INSTANCE_ID --device $DEVICE --region $AWS_DEFAULT_REGION >> $LOGFILE
247
-
248
-count=0
249
-while : ; do
250
- STATE_4=`aws ec2 describe-volumes --volume-id $VOLUMEID  --output text --query 'Volumes[0].Attachments[0].State'`
251
- if [ "$STATE_4" == "attached" ]; then
252
-   break
253
- else
254
-  count=$[$count+1]
255
- fi
256
- check_counter $count $LOOP_TRIAL "Volume with ID $VOLUMEID is not in attached state"
257
- sleep $LOOP_WAIT
258
-done
259
-
260
-#Copy the image file
261
-ssh -i $KEY_FILE root@$IP 'rm -rf /mnt/copy; rm -rf /mnt/ebs; mkdir /mnt/copy; mkdir /mnt/ebs' >> $LOGFILE
262
-ssh -i $KEY_FILE root@$IP "mkfs.ext4 $COPY_DEVICE" >> $LOGFILE
263
-ssh -i $KEY_FILE root@$IP "mount $COPY_DEVICE /mnt/copy" >> $LOGFILE
264
-scp -i $KEY_FILE $TAR_FILE.tar.gz root@$IP:/mnt/copy >> $LOGFILE
265
-ssh -i $KEY_FILE root@$IP "cd /mnt/copy; tar -xf $TAR_FILE.tar.gz; dd if=$TAR_FILE.raw of=$DEVICE bs=1M" >> $LOGFILE
266
-ssh -i $KEY_FILE root@$IP 'umount /mnt/copy'
267
-ssh -i $KEY_FILE root@$IP 'rm -rf /mnt/copy /mnt/ebs'
268
-
269
-#detach the volume
270
-aws ec2 detach-volume --volume-id $VOLUMEID --region $AWS_DEFAULT_REGION >> $LOGFILE
271
-aws ec2 detach-volume --volume-id $VOLUMEID_COPY --region $AWS_DEFAULT_REGION >> $LOGFILE
272
-
273
-#wait for the volume to detach
274
-count=0
275
-while : ; do
276
- STATE_5=`aws ec2 describe-volumes --volume-id $VOLUMEID  --output text --query 'Volumes[0].Attachments[0].State'`
277
- if [ "$STATE_5" == "detached" ] || [ "$STATE_5" == "None" ]; then
278
-   break
279
- else
280
-  count=$[$count+1]
281
- fi
282
- check_counter $count $LOOP_TRIAL "Volume with ID $VOLUMEID is not in detached state"
283
- sleep $LOOP_WAIT
284
-done
285
-
286
-#create the snapshot
287
-SNAPSHOT_ID=`aws ec2 create-snapshot --region $AWS_DEFAULT_REGION --description $TAR_FILE --volume-id $VOLUMEID --output=text --query 'SnapshotId'`
288
-
289
-#wait for the snapshot creation to succeed. This takes some time
290
-count=0
291
-while : ; do
292
- PROGRESS=`aws ec2 describe-snapshots --region $AWS_DEFAULT_REGION --snapshot-id $SNAPSHOT_ID --output=text --query 'Snapshots[0].Progress'`
293
- echo $PROGRESS
294
- if [ "$PROGRESS" == "100%" ]; then
295
-   break
296
- else
297
-  count=$[$count+1]
298
- fi
299
- check_counter $count $LOOP_TRIAL "Snapshot creation for snapshot with ID $SNAPSHOT_ID failed"
300
- sleep $SNAPSHOT_WAIT
301
-done
302
-
303
-#register the image name
304
-AMI_IMAGE_ID=`aws ec2 register-image --region $AWS_DEFAULT_REGION --name $TAR_FILE --root-device-name $EBS_IMAGE_ROOT_DEVICE_NAME --sriov-net-support simple --ena-support --block-device-mappings DeviceName=$EBS_IMAGE_ROOT_DEVICE_NAME,Ebs={SnapshotId=$SNAPSHOT_ID} --virtualization-type hvm --architecture x86_64 --output=text --query 'ImageId'`
305
-
306
-#check the status of the AMI
307
-count=0
308
-while : ; do
309
- AMI_STATE=`aws ec2 describe-images --image-ids $AMI_IMAGE_ID --output=text --query 'Images[0].State'`
310
- echo $AMI_STATE
311
- if [ "$AMI_STATE" == "available" ]; then
312
-   break
313
- else
314
-  count=$[$count+1]
315
- fi
316
- check_counter $count $LOOP_TRIAL "Registering AMI with AMI ID $AMI_IMAGE_ID and $SNAPSHOT_ID failed"
317
- sleep $SNAPSHOT_WAIT
318
-done
319
-
320
-#Make AMI Public
321
-aws ec2 modify-image-attribute --image-id $AMI_IMAGE_ID --launch-permission "{\"Add\":[{\"Group\":\"all\"}]}"
322
-
323
-#Loop till AMI is public
324
-count=0
325
-while : ; do
326
- PUBLIC=`aws ec2 describe-images --image-ids $AMI_IMAGE_ID --output=text --query 'Images[0].Public'`
327
- echo $PUBLIC
328
- if [ "$PUBLIC" == "True" ]; then
329
-   break
330
- else
331
-  count=$[$count+1]
332
- fi
333
- check_counter $count $LOOP_TRIAL "Making the AMI with AMI ID $AMI_IMAGE_ID Public failed"
334
- sleep $LOOP_WAIT
335
-done
336
-
337
-aws ec2 create-tags --resources $SNAPSHOT_ID --tags Key=Name,Value=$IMAGE_NAME
338
-aws ec2 create-tags --resources $AMI_IMAGE_ID --tags Key=Name,Value=$IMAGE_NAME
339
-
340
-echo "SUCCESS: AMI with ID $AMI_IMAGE_ID was registered and made Public"
341 1
deleted file mode 100644
... ...
@@ -1,18 +0,0 @@
1
-{
2
-    "hostname": "photon-machine",
3
-    "password": 
4
-        {
5
-            "crypted": false,
6
-            "text": "PASSWORD"
7
-        },
8
-    "type": "ami",
9
-    "size": {"root": "8", "swap": "0"},
10
-    "public_key":"<ssh-key-here>",
11
-    "postinstallscripts": [ "ami-patch.sh", "../password-expiry.sh" ],
12
-    "additionalfiles": [
13
-                            {"cloud-photon.cfg": "/etc/cloud/cloud.cfg"}
14
-                       ],
15
-    "artifacttype": "tgz",
16
-    "keeprawdisk": "false"
17
-}
18
-
19 1
deleted file mode 100755
... ...
@@ -1,58 +0,0 @@
1
-#!/bin/bash
2
-
3
-cd /lib/systemd/system/multi-user.target.wants/
4
-
5
-# Create links in multi-user.target to auto-start these scripts and services.
6
-
7
-ln -s ../docker.service docker.service
8
-ln -s ../waagent.service waagent.service
9
-ln -s ../sshd-keygen.service sshd-keygen.service
10
-
11
-# Remove ssh host keys and add script to regenerate them at boot time.
12
-
13
-rm -f /etc/ssh/ssh_host_*
14
-
15
-sudo groupadd docker
16
-sudo groupadd sudo
17
-
18
-rm /root/.ssh/authorized_keys
19
-
20
-# ssh server config
21
-# Override old values
22
-rm /etc/ssh/sshd_config
23
-
24
-echo "AuthorizedKeysFile .ssh/authorized_keys" >> /etc/ssh/sshd_config
25
-echo "UsePrivilegeSeparation sandbox" >> /etc/ssh/sshd_config
26
-echo "PasswordAuthentication no" >> /etc/ssh/sshd_config
27
-echo "PermitRootLogin without-password" >> /etc/ssh/sshd_config
28
-echo "PermitTunnel no" >> /etc/ssh/sshd_config
29
-echo "AllowTcpForwarding yes" >> /etc/ssh/sshd_config
30
-echo "X11Forwarding no" >> /etc/ssh/sshd_config
31
-echo "ClientAliveInterval 180" >> /etc/ssh/sshd_config
32
-echo "ChallengeResponseAuthentication no" >> /etc/ssh/sshd_config
33
-echo "UsePAM yes" >> /etc/ssh/sshd_config
34
-
35
-
36
-# ssh client config
37
-# Override old values
38
-
39
-rm /etc/ssh/ssh_config
40
-
41
-echo "Host *" >> /etc/ssh/ssh_config
42
-echo "Protocol 2" >> /etc/ssh/ssh_config
43
-echo "ForwardAgent no" >> /etc/ssh/ssh_config
44
-echo "ForwardX11 no" >> /etc/ssh/ssh_config
45
-echo "HostbasedAuthentication no" >> /etc/ssh/ssh_config
46
-echo "StrictHostKeyChecking no" >> /etc/ssh/ssh_config
47
-echo "Ciphers aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc" >> /etc/ssh/ssh_config
48
-echo "Tunnel no" >> /etc/ssh/ssh_config
49
-echo "ServerAliveInterval 180" >> /etc/ssh/ssh_config
50
-
51
-sed -i 's/$photon_cmdline $systemd_cmdline/init=\/lib\/systemd\/systemd loglevel=3 ro console=tty1 console=ttyS0,115200n8 earlyprintk=ttyS0,115200 fsck.repair=yes rootdelay=300/' /boot/grub/grub.cfg
52
-
53
-
54
-# Remove kernel symbols
55
-rm /boot/system.map*
56
-
57
-waagent -force -deprovision+user
58
-export HISTSIZE=0
59 1
deleted file mode 100644
... ...
@@ -1,95 +0,0 @@
1
-# The top level settings are used as module
2
-# and system configuration.
3
-
4
-# A set of users which may be applied and/or used by various modules
5
-# when a 'default' entry is found it will reference the 'default_user'
6
-# from the distro configuration specified below
7
-users:
8
-   - default
9
-
10
-# If this is set, 'root' will not be able to ssh in and they 
11
-# will get a message to login instead as a different user
12
-disable_root: true
13
-
14
-# This will cause the set+update hostname module to not operate (if true)
15
-preserve_hostname: false
16
-
17
-# datasources to check for cloud-config
18
-datasource_list: [ 
19
-                  Azure
20
-                 ]
21
-
22
-# Example datasource config
23
-#datasource: 
24
-#      timeout: 5 # (defaults to 50 seconds)
25
-#      max_wait: 10 # (defaults to 120 seconds)
26
-
27
-# The modules that run in the 'init' stage
28
-cloud_init_modules:
29
-# - migrator
30
-# - seed_random
31
- - bootcmd
32
- - write-files
33
- - growpart
34
- - resizefs
35
- - disk_setup
36
- - mounts
37
- - set_hostname
38
- - update_hostname
39
- - update_etc_hosts
40
-# - ca-certs
41
-# - rsyslog
42
- - users-groups
43
- - ssh
44
-
45
-# The modules that run in the 'config' stage
46
-cloud_config_modules:
47
-# Emit the cloud config ready event
48
-# this can be used by upstart jobs for 'start on cloud-config'.
49
-# - emit_upstart
50
- - ssh-import-id
51
-# - set-passwords
52
- - package-update-upgrade-install
53
-# - landscape
54
-# - timezone
55
-# - puppet
56
-# - chef
57
-# - salt-minion
58
-# - mcollective
59
-# - disable-ec2-metadata
60
- - runcmd
61
-# - byobu
62
- - yum-add-repo
63
-
64
-# The modules that run in the 'final' stage
65
-cloud_final_modules:
66
-# - rightscale_userdata
67
- - scripts-vendor
68
- - scripts-per-once
69
- - scripts-per-boot
70
- - scripts-per-instance
71
- - scripts-user
72
- - ssh-authkey-fingerprints
73
-# - keys-to-console
74
-# - phone-home
75
- - final-message
76
-# - power-state-change
77
-
78
-# System and/or distro specific settings
79
-# (not accessible to handlers/transforms)
80
-system_info:
81
-   default_user:
82
-      name: photon
83
-      lock_passwd: true
84
-      gecos: Azure User
85
-      groups: [wheel, adm, systemd-journal]
86
-      sudo: ["ALL=(ALL) NOPASSWD:ALL"]
87
-      shell: /bin/bash
88
-   # This will affect which distro class gets used
89
-   distro: photon
90
-   # Other config here will be given to the distro class and/or path classes
91
-   paths:
92
-      cloud_dir: /var/lib/cloud/
93
-      templates_dir: /etc/cloud/templates/
94
-
95
-   ssh_svcname: ssh
96 1
deleted file mode 100644
... ...
@@ -1,18 +0,0 @@
1
-{
2
-    "hostname": "photon-machine",
3
-    "password": 
4
-        {
5
-            "crypted": false,
6
-            "text": "PASSWORD"
7
-        },
8
-    "type": "azure",
9
-    "size": {"root": "16", "swap": "0"},
10
-    "public_key":"<ssh-key-here>",
11
-    "postinstallscripts": [ "azure-patch.sh", "../password-expiry.sh" ],
12
-    "additionalfiles": [
13
-                            {"cloud-photon.cfg": "/etc/cloud/cloud.cfg"}
14
-                       ],
15
-    "artifacttype": "vhd",
16
-    "keeprawdisk": "false"
17
-}
18
-
19 1
deleted file mode 100755
... ...
@@ -1,75 +0,0 @@
1
-#!/bin/bash
2
-
3
-#################################################
4
-#	Title:	cloud-image-build.sh		#
5
-#        Date:	2015-07-22   	 		#
6
-#     Version:	1.0				#
7
-#      Author:	anishs@vmware.com		#
8
-#################################################
9
-#	Overview
10
-#		Create cloud images
11
-#	End
12
-#
13
-set -x
14
-BUILD_SCRIPTS_PATH=$1
15
-IMG_NAME=$2
16
-SRC_ROOT=$3
17
-GENERATED_DATA_PATH=$4
18
-PHOTON_STAGE_PATH=$5
19
-ADDITIONAL_RPMS_PATH=$6
20
-WORKING_DIR=$PHOTON_STAGE_PATH/$IMG_NAME
21
-
22
-PHOTON_IMG_OUTPUT_PATH=$PHOTON_STAGE_PATH/$IMG_NAME
23
-VMDK_CONFIG_FILE=${BUILD_SCRIPTS_PATH}/$IMG_NAME/vmdk_$IMG_NAME.json
24
-VMDK_CONFIG_SAFE_FILE=${BUILD_SCRIPTS_PATH}/$IMG_NAME/vmdk_safe_$IMG_NAME.json
25
-
26
-cd $BUILD_SCRIPTS_PATH
27
-image_list=`for i in $(ls -d */); do echo ${i%%/}; done`
28
-if ! [[ $image_list =~ (^|[[:space:]])$IMG_NAME($|[[:space:]]) ]] ; then
29
-    echo "Input image name not supported. Aborting."; exit 1;
30
-fi
31
-if [[ $IMG_NAME == ova* ]] ; then
32
-    command -v ovftool >/dev/null 2>&1 || { echo "Ovftool not installed. Aborting." >&2; exit 1; }
33
-fi
34
-
35
-rm -rf $WORKING_DIR
36
-mkdir -p $WORKING_DIR/installer
37
-cp -R $SRC_ROOT/installer $WORKING_DIR/
38
-
39
-cd $WORKING_DIR/installer
40
-cp $VMDK_CONFIG_FILE $VMDK_CONFIG_SAFE_FILE
41
-cp ${BUILD_SCRIPTS_PATH}/mk-setup-vmdk.sh .
42
-cp ${BUILD_SCRIPTS_PATH}/mk-clean-vmdk.sh .
43
-
44
-cp -r ${BUILD_SCRIPTS_PATH}/${IMG_NAME}/* .
45
-
46
-PASSWORD=`date | md5sum | cut -f 1 -d ' '`
47
-sed -i "s/PASSWORD/$PASSWORD/" $VMDK_CONFIG_SAFE_FILE
48
-
49
-if [ -n "$ADDITIONAL_RPMS_PATH" ]
50
-  then
51
-    mkdir $PHOTON_STAGE_PATH/RPMS/additional
52
-    cp -f $ADDITIONAL_RPMS_PATH/* $PHOTON_STAGE_PATH/RPMS/additional/
53
-fi
54
-
55
-./photonInstaller.py -p $GENERATED_DATA_PATH/build_install_options_$IMG_NAME.json -r $PHOTON_STAGE_PATH/RPMS -v $WORKING_DIR/photon-${IMG_NAME} -o $GENERATED_DATA_PATH -d $PHOTON_STAGE_PATH/pkg_info.json -f $VMDK_CONFIG_SAFE_FILE
56
-status=$?
57
-cat $VMDK_CONFIG_SAFE_FILE
58
-rm $VMDK_CONFIG_SAFE_FILE
59
-
60
-cd $BUILD_SCRIPTS_PATH
61
-
62
-[ $status -eq 0 ] && ./customize_cloud_image.py \
63
- -r ${PHOTON_IMG_OUTPUT_PATH}/photon-${IMG_NAME}.raw \
64
- -c $VMDK_CONFIG_FILE \
65
- -w $WORKING_DIR \
66
- -m $PHOTON_IMG_OUTPUT_PATH/photon-${IMG_NAME} \
67
- -a $PHOTON_STAGE_PATH/RPMS/additional \
68
- -i $IMG_NAME \
69
- -t $SRC_ROOT/tools/bin/ \
70
- -b $BUILD_SCRIPTS_PATH \
71
- -s $SRC_ROOT
72
-
73
-rm -rf $WORKING_DIR/installer
74
-
75
-exit 0
76 1
deleted file mode 100755
... ...
@@ -1,348 +0,0 @@
1
-#!/usr/bin/python3
2
-
3
-import os
4
-import re
5
-import shutil
6
-import tarfile
7
-import fileinput
8
-from argparse import ArgumentParser
9
-import json
10
-from utils import Utils
11
-
12
-def create_ova_image(raw_image_name, tools_path, build_scripts_path, config):
13
-    output_path = os.path.dirname(os.path.realpath(raw_image_name))
14
-    utils = Utils()
15
-    # Remove older artifacts
16
-    files = os.listdir(output_path)
17
-    for file in files:
18
-        if file.endswith(".vmdk"):
19
-            os.remove(os.path.join(output_path, file))
20
-
21
-    vmx_path = output_path + '/photon-ova.vmx'
22
-    utils.replaceandsaveasnewfile(build_scripts_path + '/vmx-template',
23
-                                  vmx_path, 'VMDK_IMAGE',
24
-                                  output_path + '/photon-ova.vmdk')
25
-    vixdiskutil_path = tools_path + 'vixdiskutil'
26
-    vmdk_path = output_path + '/photon-ova.vmdk'
27
-    ovf_path = output_path + '/photon-ova.ovf'
28
-    mf_path = output_path + '/photon-ova.mf'
29
-    ovfinfo_path = build_scripts_path + '/ovfinfo.txt'
30
-    vmdk_capacity = (int(config['size']['root']) +
31
-                     int(config['size']['swap'])) * 1024
32
-    utils.runshellcommand(
33
-        "{} -convert {} -cap {} {}".format(vixdiskutil_path,
34
-                                           raw_image_name,
35
-                                           vmdk_capacity,
36
-                                           vmdk_path))
37
-    utils.runshellcommand(
38
-        "{} -wmeta toolsVersion 2147483647 {}".format(vixdiskutil_path, vmdk_path))
39
-
40
-    utils.runshellcommand("ovftool {} {}".format(vmx_path, ovf_path))
41
-    utils.replaceinfile(ovf_path, 'otherGuest', 'other3xLinux64Guest')
42
-
43
-    #Add product info
44
-    if os.path.exists(ovfinfo_path):
45
-        with open(ovfinfo_path) as f:
46
-            lines = f.readlines()
47
-            for line in fileinput.input(ovf_path, inplace=True):
48
-                if line.strip() == '</VirtualHardwareSection>':
49
-                    for ovfinfoline in lines:
50
-                        print(ovfinfoline)
51
-                else:
52
-                    print(line)
53
-
54
-    if os.path.exists(mf_path):
55
-        os.remove(mf_path)
56
-
57
-    cwd = os.getcwd()
58
-    os.chdir(output_path)
59
-    out = utils.runshellcommand("openssl sha1 photon-ova-disk1.vmdk photon-ova.ovf")
60
-    with open(mf_path, "w") as source:
61
-        source.write(out)
62
-    rawsplit = os.path.splitext(raw_image_name)
63
-    ova_name = rawsplit[0] + '.ova'
64
-
65
-    ovatar = tarfile.open(ova_name, "w", format=tarfile.USTAR_FORMAT)
66
-    for name in ["photon-ova.ovf", "photon-ova.mf", "photon-ova-disk1.vmdk"]:
67
-        ovatar.add(name, arcname=os.path.basename(name))
68
-    ovatar.close()
69
-    os.remove(vmx_path)
70
-    os.remove(mf_path)
71
-
72
-    if 'additionalhwversion' in config:
73
-        for addlversion in config['additionalhwversion']:
74
-            new_ovf_path = output_path + "/photon-ova-hw{}.ovf".format(addlversion)
75
-            mf_path = output_path + "/photon-ova-hw{}.mf".format(addlversion)
76
-            utils.replaceandsaveasnewfile(
77
-                ovf_path, new_ovf_path, "vmx-.*<", "vmx-{}<".format(addlversion))
78
-            out = utils.runshellcommand("openssl sha1 photon-ova-disk1.vmdk "
79
-                                        "photon-ova-hw{}.ovf".format(addlversion))
80
-            with open(mf_path, "w") as source:
81
-                source.write(out)
82
-            temp_name_list = os.path.basename(ova_name).split('-')
83
-            temp_name_list = temp_name_list[:2] + ["hw{}".format(addlversion)] + temp_name_list[2:]
84
-            new_ova_name = '-'.join(temp_name_list)
85
-            new_ova_path = output_path + '/' + new_ova_name
86
-            ovatar = tarfile.open(new_ova_path, "w", format=tarfile.USTAR_FORMAT)
87
-            for name in [new_ovf_path, mf_path, "photon-ova-disk1.vmdk"]:
88
-                ovatar.add(name, arcname=os.path.basename(name))
89
-            ovatar.close()
90
-
91
-            os.remove(new_ovf_path)
92
-            os.remove(mf_path)
93
-    os.chdir(cwd)
94
-    os.remove(ovf_path)
95
-    os.remove(vmdk_path)
96
-    files = os.listdir(output_path)
97
-    for file in files:
98
-        if file.endswith(".vmdk"):
99
-            os.remove(os.path.join(output_path, file))
100
-
101
-
102
-if __name__ == '__main__':
103
-    usage = "Usage: %prog [options]"
104
-    parser = ArgumentParser(usage)
105
-
106
-    parser.add_argument("-r", "--raw-image-path", dest="raw_image_path")
107
-    parser.add_argument("-c", "--vmdk-config-path", dest="vmdk_config_path")
108
-    parser.add_argument("-w", "--working-directory", dest="working_directory")
109
-    parser.add_argument("-m", "--mount-path", dest="mount_path")
110
-    parser.add_argument("-a", "--additional-rpms-path", dest="additional_rpms_path")
111
-    parser.add_argument("-i", "--image-name", dest="image_name")
112
-    parser.add_argument("-t", "--tools-bin-path", dest="tools_bin_path")
113
-    parser.add_argument("-b", "--build-scripts-path", dest="build_scripts_path")
114
-    parser.add_argument("-s", "--src-root", dest="src_root")
115
-
116
-    options = parser.parse_args()
117
-    utils = Utils()
118
-    config = utils.jsonread(options.vmdk_config_path)
119
-    print(options)
120
-
121
-    disk_device = (utils.runshellcommand(
122
-        "losetup --show -f {}".format(options.raw_image_path))).rstrip('\n')
123
-    disk_partitions = utils.runshellcommand("kpartx -as {}".format(disk_device))
124
-    device_name = disk_device.split('/')[2]
125
-
126
-    if not os.path.exists(options.mount_path):
127
-        os.mkdir(options.mount_path)
128
-    loop_device_path = "/dev/mapper/{}p2".format(device_name)
129
-
130
-    try:
131
-        print("Generating PARTUUID for the loop device ...")
132
-        partuuidval = (utils.runshellcommand(
133
-            "blkid -s PARTUUID -o value {}".format(loop_device_path))).rstrip('\n')
134
-        uuidval = (utils.runshellcommand(
135
-            "blkid -s UUID -o value {}".format(loop_device_path))).rstrip('\n')
136
-        if partuuidval == '':
137
-            sgdiskout = utils.runshellcommand(
138
-                "sgdisk -i 2 {} ".format(disk_device))
139
-            partuuidval = (re.findall(r'Partition unique GUID.*',
140
-                                      sgdiskout))[0].split(':')[1].strip(' ').lower()
141
-
142
-        if partuuidval == '':
143
-            raise RuntimeError("Cannot generate partuuid")
144
-
145
-        # Mount the loop device
146
-        print("Mounting the loop device for customization ...")
147
-        utils.runshellcommand(
148
-            "mount -t ext4 {} {}".format(loop_device_path, options.mount_path))
149
-        shutil.rmtree(options.mount_path + "/installer", ignore_errors=True)
150
-        shutil.rmtree(options.mount_path + "/LOGS", ignore_errors=True)
151
-        # Clear the root password if not set explicitly from the config file
152
-        if config['password']['text'] != 'PASSWORD':
153
-            utils.replaceinfile(options.mount_path + "/etc/shadow",
154
-                                'root:.*?:', 'root:*:')
155
-        # Clear machine-id so it gets regenerated on boot
156
-        open(options.mount_path + "/etc/machine-id", "w").close()
157
-        os.remove(options.mount_path + "/etc/fstab")
158
-
159
-        f = open(options.mount_path + "/etc/fstab", "w")
160
-        if uuidval != '':
161
-            f.write("UUID={}    /    ext4    defaults 1 1\n".format(uuidval))
162
-        else:
163
-            f.write("PARTUUID={}    /    ext4    defaults 1 1\n".format(partuuidval))
164
-        f.close()
165
-        utils.replaceinfile(options.mount_path + "/boot/grub/grub.cfg",
166
-                            "rootpartition=PARTUUID=.*$",
167
-                            "rootpartition=PARTUUID={}".format(partuuidval))
168
-
169
-        if os.path.exists(options.additional_rpms_path):
170
-            print("Installing additional rpms")
171
-            os.mkdir(options.mount_path + "/additional_rpms")
172
-            os.mkdir(options.mount_path + "/var/run")
173
-            utils.copyallfiles(options.additional_rpms_path,
174
-                               options.mount_path + "/additional_rpms")
175
-            utils.runshellcommand(
176
-                "chroot {} /bin/bash -c 'rpm -i /additional_rpms/*'".format(options.mount_path))
177
-            shutil.rmtree(options.mount_path + "/additional_rpms", ignore_errors=True)
178
-            shutil.rmtree(options.additional_rpms_path, ignore_errors=True)
179
-
180
-        utils.runshellcommand("mount -o bind /proc {}".format(options.mount_path + "/proc"))
181
-        utils.runshellcommand("mount -o bind /dev {}".format(options.mount_path + "/dev"))
182
-        utils.runshellcommand("mount -o bind /dev/pts {}".format(options.mount_path + "/dev/pts"))
183
-        utils.runshellcommand("mount -o bind /sys {}".format(options.mount_path + "/sys"))
184
-
185
-        if 'additionalfiles' in config:
186
-            print("  Copying additional files into the raw image ...")
187
-            for filetuples in config['additionalfiles']:
188
-                for src, dest in filetuples.items():
189
-                    if (os.path.isdir(options.build_scripts_path + '/' +
190
-                                      options.image_name + '/' + src)):
191
-                        shutil.copytree(options.build_scripts_path + '/' +
192
-                                        options.image_name + '/' + src,
193
-                                        options.mount_path + dest, True)
194
-                    else:
195
-                        shutil.copyfile(options.build_scripts_path + '/' +
196
-                                        options.image_name + '/' + src,
197
-                                        options.mount_path + dest)
198
-
199
-
200
-        if 'postinstallscripts' in config:
201
-            print("  Running post install scripts ...")
202
-            if not os.path.exists(options.mount_path + "/tempscripts"):
203
-                os.mkdir(options.mount_path + "/tempscripts")
204
-            for script in config['postinstallscripts']:
205
-                shutil.copy(options.build_scripts_path + '/' +
206
-                            options.image_name + '/' + script,
207
-                            options.mount_path + "/tempscripts")
208
-            for script in os.listdir(options.mount_path + "/tempscripts"):
209
-                print("     ...running script {}".format(script))
210
-                utils.runshellcommand(
211
-                    "chroot {} /bin/bash -c '/tempscripts/{}'".format(options.mount_path, script))
212
-            shutil.rmtree(options.mount_path + "/tempscripts", ignore_errors=True)
213
-
214
-    except Exception as e:
215
-        print(e)
216
-
217
-    finally:
218
-        utils.runshellcommand("umount -l {}".format(options.mount_path + "/sys"))
219
-        utils.runshellcommand("umount -l {}".format(options.mount_path + "/dev/pts"))
220
-        utils.runshellcommand("umount -l {}".format(options.mount_path + "/dev"))
221
-        utils.runshellcommand("umount -l {}".format(options.mount_path + "/proc"))
222
-
223
-        utils.runshellcommand("sync")
224
-        utils.runshellcommand("umount -l {}".format(options.mount_path))
225
-
226
-        mount_out = utils.runshellcommand("mount")
227
-        print("List of mounted devices:")
228
-        print(mount_out)
229
-
230
-        utils.runshellcommand("kpartx -d {}".format(disk_device))
231
-        utils.runshellcommand("losetup -d {}".format(disk_device))
232
-
233
-        shutil.rmtree(options.mount_path)
234
-
235
-        photon_release_ver = os.environ['PHOTON_RELEASE_VER']
236
-        photon_build_num = os.environ['PHOTON_BUILD_NUM']
237
-        raw_image = options.raw_image_path
238
-        new_name = ""
239
-        img_path = os.path.dirname(os.path.realpath(raw_image))
240
-        # Rename gce image to disk.raw
241
-        if options.image_name == "gce":
242
-            print("Renaming the raw file to disk.raw ...")
243
-            new_name = img_path + '/disk.raw'
244
-
245
-        else:
246
-            new_name = (img_path + '/photon-' + options.image_name +
247
-                        '-' + photon_release_ver + '-' +
248
-                        photon_build_num + '.raw')
249
-
250
-        shutil.move(raw_image, new_name)
251
-        raw_image = new_name
252
-
253
-        if config['artifacttype'] == 'tgz':
254
-            print("Generating the tar.gz artifact ...")
255
-            tarname = (img_path + '/photon-' + options.image_name +
256
-                       '-' + photon_release_ver + '-' +
257
-                       photon_build_num + '.tar.gz')
258
-
259
-            tgzout = tarfile.open(tarname, "w:gz")
260
-            tgzout.add(raw_image, arcname=os.path.basename(raw_image))
261
-            tgzout.close()
262
-        elif config['artifacttype'] == 'xz':
263
-            print("Generating the xz artifact ...")
264
-            utils.runshellcommand("xz -z -k {}".format(raw_image))
265
-#            tarname = img_path + '/photon-' + options.image_name +
266
-#            '-' + photon_release_ver + '-' + photon_build_num +
267
-#            '.xz'
268
-#            tgzout = tarfile.open(tarname, "w:xz")
269
-#            tgzout.add(raw_image, arcname=os.path.basename(raw_image))
270
-#            tgzout.close()
271
-        elif config['artifacttype'] == 'vhd':
272
-            relrawpath = os.path.relpath(raw_image, options.src_root)
273
-            vhdname = (os.path.dirname(relrawpath) + '/photon-' +
274
-                       options.image_name + '-' + photon_release_ver + '-' +
275
-                       photon_build_num + '.vhd')
276
-            print("Converting raw disk to vhd ...")
277
-            info_output = utils.runshellcommand(
278
-                "docker run -v {}:/mnt:rw anishs/qemu-img info -f raw --output json {}"
279
-                .format(options.src_root, '/mnt/' + relrawpath))
280
-            mbsize = 1024 * 1024
281
-            mbroundedsize = ((int(json.loads(info_output)["virtual-size"])/mbsize + 1) * mbsize)
282
-            utils.runshellcommand(
283
-                "docker run -v {}:/mnt:rw anishs/qemu-img resize -f raw {} {}"
284
-                .format(options.src_root, '/mnt/' + relrawpath, mbroundedsize))
285
-            utils.runshellcommand(
286
-                "docker run -v {}:/mnt:rw anishs/qemu-img convert {} -O "
287
-                "vpc -o subformat=fixed,force_size {}"
288
-                .format(options.src_root, '/mnt/' + relrawpath, '/mnt/' + vhdname))
289
-        elif config['artifacttype'] == 'ova':
290
-            create_ova_image(raw_image, options.tools_bin_path,
291
-                             options.build_scripts_path + '/' + options.image_name, config)
292
-            if 'customartifacts' in config:
293
-                if 'postinstallscripts' in config['customartifacts']:
294
-                    custom_path = img_path + '/photon-custom'
295
-                    if not os.path.exists(custom_path):
296
-                        os.mkdir(custom_path)
297
-                    index = 1
298
-                    for script in config['customartifacts']['postinstallscripts']:
299
-                        print("Creating custom ova {}...".format(index))
300
-                        if index > 1:
301
-                            raw_image_custom = (img_path + "/photon-custom-{}".format(index) +
302
-                                                photon_release_ver + '-' +
303
-                                                photon_build_num + '.raw')
304
-                        else:
305
-                            raw_image_custom = (img_path + "/photon-custom-" +
306
-                                                photon_release_ver + '-' +
307
-                                                photon_build_num + '.raw')
308
-                        shutil.move(raw_image, raw_image_custom)
309
-                        disk_device = (
310
-                            utils.runshellcommand(
311
-                                "losetup --show -f {}".format(raw_image_custom))).rstrip('\n')
312
-                        disk_partitions = utils.runshellcommand(
313
-                            "kpartx -as {}".format(disk_device))
314
-                        device_name = disk_device.split('/')[2]
315
-                        loop_device_path = "/dev/mapper/{}p2".format(device_name)
316
-
317
-                        print("Mounting the loop device for ova customization ...")
318
-                        utils.runshellcommand(
319
-                            "mount -t ext4 {} {}".format(loop_device_path, custom_path))
320
-                        if not os.path.exists(custom_path + "/tempscripts"):
321
-                            os.mkdir(custom_path + "/tempscripts")
322
-                        shutil.copy(options.build_scripts_path + '/' + options.image_name +
323
-                                    '/' + script, custom_path + "/tempscripts")
324
-                        print("Running custom ova script {}".format(script))
325
-                        utils.runshellcommand("chroot {} /bin/bash -c '/tempscripts/{}'"
326
-                                              .format(custom_path, script))
327
-                        shutil.rmtree(custom_path + "/tempscripts", ignore_errors=True)
328
-                        utils.runshellcommand("umount -l {}".format(custom_path))
329
-
330
-                        mount_out = utils.runshellcommand("mount")
331
-                        print("List of mounted devices:")
332
-                        print(mount_out)
333
-
334
-                        utils.runshellcommand("kpartx -d {}".format(disk_device))
335
-                        utils.runshellcommand("losetup -d {}".format(disk_device))
336
-                        create_ova_image(raw_image_custom, options.tools_bin_path,
337
-                                         options.build_scripts_path + '/' + options.image_name,
338
-                                         config)
339
-                        raw_image = raw_image_custom
340
-                        index = index + 1
341
-
342
-                    shutil.rmtree(custom_path)
343
-
344
-        else:
345
-            raise ValueError("Unknown output format")
346
-
347
-        if config['keeprawdisk'] == 'false':
348
-            os.remove(raw_image)
349 1
deleted file mode 100644
... ...
@@ -1,92 +0,0 @@
1
-# The top level settings are used as module
2
-# and system configuration.
3
-
4
-# A set of users which may be applied and/or used by various modules
5
-# when a 'default' entry is found it will reference the 'default_user'
6
-# from the distro configuration specified below
7
-users:
8
-   - name: root
9
-     lock-passwd: true
10
-
11
-# If this is set, 'root' will not be able to ssh in and they 
12
-# will get a message to login instead as a different user
13
-disable_root: true
14
-
15
-# This will cause the set+update hostname module to not operate (if true)
16
-preserve_hostname: false
17
-
18
-# datasources to check for cloud-config
19
-datasource_list: [ 
20
-                  GCE
21
-                 ]
22
-
23
-# Example datasource config
24
-datasource: 
25
-   GCE: 
26
-     metadata_urls: [ 'http://metadata.google.internal./computeMetadata/v1/' ]
27
-#      timeout: 5 # (defaults to 50 seconds)
28
-#      max_wait: 10 # (defaults to 120 seconds)
29
-
30
-# The modules that run in the 'init' stage
31
-cloud_init_modules:
32
-# - migrator
33
-# - seed_random
34
- - bootcmd
35
- - write-files
36
-# - growpart
37
-# - resizefs
38
- - set_hostname
39
- - update_hostname
40
-# - update_etc_hosts
41
-# - ca-certs
42
-# - rsyslog
43
- - users-groups
44
- - ssh
45
-
46
-# The modules that run in the 'config' stage
47
-cloud_config_modules:
48
-# Emit the cloud config ready event
49
-# this can be used by upstart jobs for 'start on cloud-config'.
50
-# - emit_upstart
51
-# - disk_setup
52
-# - mounts
53
- - ssh-import-id
54
-# - set-passwords
55
- - package-update-upgrade-install
56
-# - landscape
57
-# - timezone
58
-# - puppet
59
-# - chef
60
-# - salt-minion
61
-# - mcollective
62
-# - disable-ec2-metadata
63
- - runcmd
64
-# - byobu
65
- - yum-add-repo
66
-
67
-# The modules that run in the 'final' stage
68
-cloud_final_modules:
69
-# - rightscale_userdata
70
- - scripts-vendor
71
- - scripts-per-once
72
- - scripts-per-boot
73
- - scripts-per-instance
74
- - scripts-user
75
- - ssh-authkey-fingerprints
76
-# - keys-to-console
77
-# - phone-home
78
- - final-message
79
-# - power-state-change
80
-
81
-# System and/or distro specific settings
82
-# (not accessible to handlers/transforms)
83
-system_info:
84
-   # This will affect which distro class gets used
85
-   distro: photon
86
-   # Other config here will be given to the distro class and/or path classes
87
-   paths:
88
-      cloud_dir: /var/lib/cloud/
89
-      templates_dir: /etc/cloud/templates/
90
-      upstart_dir: /etc/init/
91
-
92
-   ssh_svcname: ssh
93 1
deleted file mode 100755
... ...
@@ -1,105 +0,0 @@
1
-#!/bin/bash
2
-
3
-cd /lib/systemd/system/multi-user.target.wants/
4
-
5
-# Create links in multi-user.target to auto-start these scripts and services.
6
-for i in ../google*; do  ln -s $i `basename $i`; done
7
-# for i in ../kube*; do  ln -s $i `basename $i`; done
8
-
9
-ln -s ../ntpd.service ntpd.service
10
-ln -s ../docker.service docker.service
11
-
12
-# Update /etc/hosts file with GCE values
13
-echo "169.254.169.254 metadata.google.internal metadata" >> /etc/hosts
14
-
15
-# Remove all servers from ntp.conf and add Google's ntp server.
16
-sed -i -e "/server/d" /etc/ntp.conf
17
-echo "server metadata.google.internal iburst" >> /etc/ntp.conf
18
-echo "server 169.254.169.254" >> /etc/ntp.conf
19
-
20
-
21
-# Set UTC timezone
22
-ln -sf /usr/share/zoneinfo/UTC /etc/localtime
23
-
24
-echo "DNS=169.254.169.254 8.8.8.8" >> /etc/systemd/resolved.conf
25
-
26
-# Remove ssh host keys and add script to regenerate them at boot time.
27
-
28
-rm -f /etc/ssh/ssh_host_*
29
-
30
-printf "GOOGLE\n" > /etc/ssh/sshd_not_to_be_run
31
-
32
-sudo groupadd docker
33
-sudo groupadd sudo
34
-
35
-rm /root/.ssh/authorized_keys   
36
-
37
-# ssh server config
38
-# Override old values
39
-rm /etc/ssh/sshd_config
40
-
41
-echo "AuthorizedKeysFile .ssh/authorized_keys" >> /etc/ssh/sshd_config
42
-echo "PubkeyAuthentication yes" >> /etc/ssh/sshd_config
43
-echo "UsePrivilegeSeparation sandbox" >> /etc/ssh/sshd_config
44
-echo "PasswordAuthentication no" >> /etc/ssh/sshd_config
45
-echo "PermitRootLogin no" >> /etc/ssh/sshd_config
46
-echo "PermitTunnel no" >> /etc/ssh/sshd_config
47
-echo "AllowTcpForwarding yes" >> /etc/ssh/sshd_config
48
-echo "X11Forwarding no" >> /etc/ssh/sshd_config
49
-echo "ClientAliveInterval 420" >> /etc/ssh/sshd_config
50
-echo "ChallengeResponseAuthentication no" >> /etc/ssh/sshd_config
51
-echo "UsePAM yes" >> /etc/ssh/sshd_config
52
-
53
-
54
-# ssh client config
55
-# Override old values
56
-
57
-rm /etc/ssh/ssh_config
58
-
59
-echo "Host *" >> /etc/ssh/ssh_config
60
-echo "Protocol 2" >> /etc/ssh/ssh_config
61
-echo "ForwardAgent no" >> /etc/ssh/ssh_config
62
-echo "ForwardX11 no" >> /etc/ssh/ssh_config
63
-echo "HostbasedAuthentication no" >> /etc/ssh/ssh_config
64
-echo "StrictHostKeyChecking no" >> /etc/ssh/ssh_config
65
-echo "Ciphers aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc" >> /etc/ssh/ssh_config
66
-echo "Tunnel no" >> /etc/ssh/ssh_config
67
-echo "ServerAliveInterval 420" >> /etc/ssh/ssh_config
68
-
69
-# Disable root login
70
-usermod -L root
71
-
72
-# Disable ipv6
73
-echo "net.ipv6.conf.all.disable_ipv6 = 1" > /etc/sysctl.d/ipv6-disable.conf
74
-
75
-# Disable loading/unloading of modules
76
-#echo "kernel.modules_disabled = 1" > /etc/sysctl.d/modules_disabled.conf
77
-
78
-# Remove kernel symbols
79
-rm -f /boot/System.map*
80
-
81
-echo "[Link]" >> /etc/systemd/network/*.network
82
-echo "MTUBytes=1460" >> /etc/systemd/network/*.network
83
-
84
-cat > /usr/bin/gcloud << "EOF"
85
-docker inspect google/cloud-sdk &> /dev/null
86
-
87
-if [ $? == 1 ]; then
88
-        docker pull google/cloud-sdk &> /dev/null
89
-fi
90
-
91
-docker run --rm -it google/cloud-sdk gcloud $*
92
-EOF
93
-
94
-cat > /usr/bin/gsutil << "EOF"
95
-docker inspect google/cloud-sdk &> /dev/null
96
-
97
-if [ $? == 1 ]; then
98
-        docker pull google/cloud-sdk &> /dev/null
99
-fi
100
-
101
-docker run --rm -it google/cloud-sdk gsutil $*
102
-EOF
103
-
104
-chmod a+x /usr/bin/gcloud
105
-chmod a+x /usr/bin/gsutil
106 1
deleted file mode 100644
... ...
@@ -1,242 +0,0 @@
1
-#!/bin/bash
2
-#################################################
3
-#       Title:  mk-setup-grub                   #
4
-#        Date:  2014-11-26                      #
5
-#     Version:  1.0                             #
6
-#      Author:  sharathg@vmware.com             #
7
-#     Options:                                  #
8
-#################################################
9
-#   Overview
10
-#       This is a precursor for the vmware build system.
11
-#       This assumes that an empty hard disk is attached to the build VM.
12
-#       The path to this empty disk is specified in the HDD variable in config.inc
13
-#   End
14
-#
15
-grub_efi_install()
16
-{
17
-    mkdir $BUILDROOT/boot/efi
18
-    #
19
-    # if it is a loop device then we should mount the dev mapped boot partition
20
-    #
21
-    if [[ $HDD == *"loop"* ]]
22
-    then
23
-         BOOT_PARTITION=/dev/mapper/`basename ${HDD}`p1
24
-    else
25
-         BOOT_PARTITION=${HDD}1
26
-    fi
27
-    mkfs.fat $BOOT_PARTITION
28
-    mount -t vfat $BOOT_PARTITION $BUILDROOT/boot/efi
29
-    cp boot/unifont.pf2 /usr/share/grub/
30
-    grub2-efi-install --target=x86_64-efi --efi-directory=$BUILDROOT/boot/efi --bootloader-id=Boot --root-directory=$BUILDROOT --recheck
31
-    rm $BUILDROOT/boot/efi/EFI/Boot/grubx64.efi
32
-    cp EFI/BOOT/* $BUILDROOT/boot/efi/EFI/Boot/
33
-    mkdir -p $BUILDROOT/boot/efi/boot/grub2    
34
-    echo "configfile (hd0,gpt${BOOT_PARTITION_NUMBER})${BOOT_DIRECTORY}grub2/grub.cfg" > $BUILDROOT/boot/efi/boot/grub2/grub.cfg
35
-    umount $BUILDROOT/boot/efi
36
-}
37
-
38
-grub_mbr_install()
39
-{
40
-    $grubInstallCmd --force --boot-directory=$BUILDROOT/boot "$HDD"
41
-}
42
-
43
-set -o errexit      # exit if error...insurance ;)
44
-set -o nounset      # exit if variable not initalized
45
-set +h          # disable hashall
46
-PRGNAME=${0##*/}    # script name minus the path
47
-source config.inc       #   configuration parameters
48
-source function.inc     #   commonn functions
49
-LOGFILE=/var/log/"${PRGNAME}-${LOGFILE}"    #   set log file name
50
-#LOGFILE=/dev/null      #   uncomment to disable log file
51
-ARCH=$(uname -m)    # host architecture
52
-[ ${EUID} -eq 0 ]   || fail "${PRGNAME}: Need to be root user: FAILURE"
53
-> ${LOGFILE}        #   clear/initialize logfile
54
-
55
-# Check if passing a HDD and partition
56
-if [ $# -eq 6 ] 
57
-    then
58
-       BOOTMODE=$1
59
-       HDD=$2
60
-       ROOT_PARTITION_PATH=$3
61
-       BOOT_PARTITION_PATH=$4
62
-       BOOT_DIRECTORY=$5
63
-       BOOT_PARTITION_NUMBER=$6
64
-fi
65
-
66
-#
67
-#	Install grub2.
68
-#
69
-UUID_VAL=$(blkid -s UUID -o value $ROOT_PARTITION_PATH)
70
-PARTUUID_VAL=$(blkid -s PARTUUID -o value $ROOT_PARTITION_PATH)
71
-BOOT_UUID=$(blkid -s UUID -o value $BOOT_PARTITION_PATH)
72
-echo "Changing boot loader to MBR type on raw disk"
73
-
74
-sgdisk -m 1:2 "$HDD"
75
-
76
-grubInstallCmd=""
77
-mkdir -p $BUILDROOT/boot/grub2
78
-ln -sfv grub2 $BUILDROOT/boot/grub
79
-command -v grub-install >/dev/null 2>&1 && grubInstallCmd="grub-install" && { echo >&2 "Found grub-install"; }
80
-command -v grub2-install >/dev/null 2>&1 && grubInstallCmd="grub2-install" && { echo >&2 "Found grub2-install"; }
81
-if [ -z $grubInstallCmd ]; then
82
-echo "Unable to find grub install command"
83
-exit 1
84
-fi
85
-echo "Current directory is"
86
-pwd
87
-rm -rf ${BUILDROOT}/boot/grub2/fonts
88
-mkdir -p ${BUILDROOT}/boot/grub2/themes/photon
89
-cp boot/splash.png ${BUILDROOT}/boot/grub2/themes/photon/photon.png
90
-cp boot/terminal_*.tga ${BUILDROOT}/boot/grub2/themes/photon/
91
-cp boot/theme.txt ${BUILDROOT}/boot/grub2/themes/photon/
92
-
93
-if [ "$BOOTMODE" == "bios" ]; then 
94
-    grub_mbr_install
95
-fi
96
-if [ "$BOOTMODE" == "efi" ]; then 
97
-    grub_efi_install
98
-fi
99
-
100
-cat > ${BUILDROOT}/boot/grub2/grub.cfg <<EOF
101
-# Begin /boot/grub2/grub.cfg
102
-#
103
-# DO NOT EDIT THIS FILE
104
-#
105
-# It is automatically generated by grub-mkconfig using templates
106
-# from /etc/grub.d and settings from /etc/default/grub
107
-#
108
-
109
-### BEGIN /etc/grub.d/00_header ###
110
-if [ -s \$prefix/grubenv ]; then
111
-  load_env
112
-fi
113
-set default="0"
114
-
115
-if [ x"\${feature_menuentry_id}" = xy ]; then
116
-  menuentry_id_option="--id"
117
-else
118
-  menuentry_id_option=""
119
-fi
120
-
121
-export menuentry_id_option
122
-load_env -f "$BOOT_DIRECTORY"photon.cfg
123
-set rootpartition=PARTUUID=$PARTUUID_VAL
124
-
125
-if [ "\${prev_saved_entry}" ]; then
126
-  set saved_entry="\${prev_saved_entry}"
127
-  save_env saved_entry
128
-  set prev_saved_entry=
129
-  save_env prev_saved_entry
130
-  set boot_once=true
131
-fi
132
-
133
-function savedefault {
134
-  if [ -z "\${boot_once}" ]; then
135
-    saved_entry="\${chosen}"
136
-    save_env saved_entry
137
-  fi
138
-}
139
-
140
-function load_video {
141
-  if [ x\$feature_all_video_module = xy ]; then
142
-    insmod all_video
143
-  else
144
-    insmod efi_gop
145
-    insmod efi_uga
146
-    insmod ieee1275_fb
147
-    insmod vbe
148
-    insmod vga
149
-    insmod video_bochs
150
-    insmod video_cirrus
151
-  fi
152
-}
153
-
154
-serial --speed=38400 --unit=0 --word=8 --parity=no --stop=1
155
-terminal_input serial
156
-terminal_output serial
157
-set timeout=5
158
-### END /etc/grub.d/00_header ###
159
-
160
-### BEGIN /etc/grub.d/10_linux ###
161
-menuentry 'GNU/Linux' --class gnu-linux --class gnu --class os \$menuentry_id_option 'gnulinux-simple-UUID_PLACEHOLDER' {
162
-    load_video
163
-    set gfxpayload=keep
164
-    insmod gzio
165
-    insmod part_msdos
166
-    insmod ext2
167
-    set root='hd0,msdos2'
168
-    if [ x\$feature_platform_search_hint = xy ]; then
169
-      search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos2 --hint-efi=hd0,msdos2 --hint-baremetal=ahci0,msdos2  UUID_PLACEHOLDER
170
-    else
171
-      search --no-floppy --fs-uuid --set=root UUID_PLACEHOLDER
172
-    fi
173
-    echo    'Loading Linux \$photon_linux ...'
174
-    linux   "$BOOT_DIRECTORY"\$photon_linux root=/dev/sda2 ro console=ttyS0,38400n8 
175
-}
176
-submenu 'Advanced options for GNU/Linux' \$menuentry_id_option 'gnulinux-advanced-UUID_PLACEHOLDER' {
177
-    menuentry 'GNU/Linux, with Linux \$photon_linux' --class gnu-linux --class gnu --class os \$menuentry_id_option 'gnulinux-\$photon_linux-advanced-UUID_PLACEHOLDER' {
178
-        load_video
179
-        set gfxpayload=keep
180
-        insmod gzio
181
-        insmod part_msdos
182
-        insmod ext2
183
-        set root='hd0,msdos2'
184
-        if [ x\$feature_platform_search_hint = xy ]; then
185
-          search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos2 --hint-efi=hd0,msdos2 --hint-baremetal=ahci0,msdos2  UUID_PLACEHOLDER
186
-        else
187
-          search --no-floppy --fs-uuid --set=root UUID_PLACEHOLDER
188
-        fi
189
-        echo    'Loading Linux \$photon_linux ...'
190
-        linux   "$BOOT_DIRECTORY"\$photon_linux root=/dev/sda2 ro console=ttyS0,38400n8 
191
-    }
192
-    menuentry 'GNU/Linux, with Linux \$photon_linux (recovery mode)' --class gnu-linux --class gnu --class os \$menuentry_id_option 'gnulinux-\$photon_linux-recovery-UUID_PLACEHOLDER' {
193
-        load_video
194
-        set gfxpayload=keep
195
-        insmod gzio
196
-        insmod part_msdos
197
-        insmod ext2
198
-        set root='hd0,msdos2'
199
-        if [ x\$feature_platform_search_hint = xy ]; then
200
-          search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos2 --hint-efi=hd0,msdos2 --hint-baremetal=ahci0,msdos2  UUID_PLACEHOLDER
201
-        else
202
-          search --no-floppy --fs-uuid --set=root UUID_PLACEHOLDER
203
-        fi
204
-        echo    'Loading Linux \$photon_linux ...'
205
-        linux   "$BOOT_DIRECTORY"\$photon_linux root=/dev/sda2 ro single console=ttyS0,38400n8
206
-    }
207
-}
208
-
209
-### END /etc/grub.d/10_linux ###
210
-
211
-### BEGIN /etc/grub.d/20_linux_xen ###
212
-
213
-### END /etc/grub.d/20_linux_xen ###
214
-
215
-### BEGIN /etc/grub.d/30_os-prober ###
216
-### END /etc/grub.d/30_os-prober ###
217
-
218
-### BEGIN /etc/grub.d/40_custom ###
219
-# This file provides an easy way to add custom menu entries.  Simply type the
220
-# menu entries you want to add after this comment.  Be careful not to change
221
-# the 'exec tail' line above.
222
-### END /etc/grub.d/40_custom ###
223
-
224
-### BEGIN /etc/grub.d/41_custom ###
225
-if [ -f  \${config_directory}/custom.cfg ]; then
226
-  source \${config_directory}/custom.cfg
227
-elif [ -z "\${config_directory}" -a -f  \$prefix/custom.cfg ]; then
228
-  source \$prefix/custom.cfg;
229
-fi
230
-### END /etc/grub.d/41_custom ###
231
-
232
-# End /boot/grub2/grub.cfg
233
-EOF
234
-
235
-sed -i "s/UUID_PLACEHOLDER/$UUID_VAL/" "$BUILDROOT"/boot/grub2/grub.cfg > ${LOGFILE} 
236
-
237
-#Cleanup the workspace directory
238
-#find "$BUILDROOT"/{,usr/}{lib,bin,sbin} -type f -exec strip --strip-debug --strip-unneeded '{}' ';' > /dev/null 2>&1
239
-rm -rf "$BUILDROOT"/tools
240
-rm -rf "$BUILDROOT"/RPMS
241
-
242
-#umount $BUILDROOT
243 1
deleted file mode 100644
... ...
@@ -1,12 +0,0 @@
1
-[Unit]
2
-Description=Network Time Service
3
-After=network.target nss-lookup.target
4
-
5
-[Service]
6
-Type=forking
7
-PrivateTmp=true
8
-ExecStart=/usr/bin/ntpd -g -u ntp:ntp
9
-Restart=always
10
-
11
-[Install]
12
-WantedBy=multi-user.target
13 1
deleted file mode 100644
... ...
@@ -1,19 +0,0 @@
1
-{
2
-    "hostname": "photon-machine",
3
-    "password": 
4
-        {
5
-            "crypted": false,
6
-            "text": "PASSWORD"
7
-        },
8
-    "type": "gce",
9
-    "size": {"root": "16", "swap": "0"},
10
-    "public_key":"<ssh-key-here>",
11
-    "postinstallscripts": [ "gce-patch.sh", "../password-expiry.sh" ],
12
-    "additionalfiles": [
13
-                            {"cloud-photon.cfg": "/etc/cloud/cloud.cfg"},
14
-                            {"ntpd.service": "/usr/lib/systemd/system/ntpd.service"}
15
-                       ],
16
-    "artifacttype": "tgz",
17
-    "keeprawdisk": "false"
18
-}
19
-
20 1
deleted file mode 100755
... ...
@@ -1,33 +0,0 @@
1
-#!/bin/bash
2
-#################################################
3
-#	Title:	mk-clean-vmdk			#
4
-#        Date:	2015-02-10   	 		#
5
-#     Version:	1.0				#
6
-#      Author:	mbassiouny@vmware.com		#
7
-#     Options:					#
8
-#################################################
9
-#	Overview
10
-#		Cleaning up vmdk creation process
11
-#	End
12
-#
13
-set -o errexit		# exit if error...insurance ;)
14
-set -o nounset		# exit if variable not initalized
15
-set +h			# disable hashall
16
-PRGNAME=${0##*/}	# script name minus the path
17
-source config.inc		#	configuration parameters
18
-source function.inc		#	commonn functions
19
-LOGFILE="/var/log/${PRGNAME}-${LOGFILE}"	#	set log file name
20
-LFS_DISK="/mnt/photon-disk"
21
-[ ${EUID} -eq 0 ]	|| die "${PRGNAME}: Need to be root user: FAILURE"
22
-> ${LOGFILE}		#	clear/initialize logfile
23
-
24
-# Check if passing DISK-DEVICE
25
-[ $# -eq 1 ] || die "Invalid arguments, you should pass disk device"
26
-DISK_DEVICE=$1
27
-
28
-echo "Deleting device map parition"
29
-kpartx -d $DISK_DEVICE >> $LOGFILE
30
-
31
-echo "Detaching loop device from vmdk"
32
-losetup -d $DISK_DEVICE
33
-
34 1
deleted file mode 100755
... ...
@@ -1,115 +0,0 @@
1
-#!/bin/bash
2
-#################################################
3
-#	Title:	mk-setup-vmdk			#
4
-#        Date:	2014-11-14   	 		#
5
-#     Version:	1.0				#
6
-#      Author:	dthaluru@vmware.com		#
7
-#     Options:					#
8
-#################################################
9
-#	Overview
10
-#		Creating hard disk with photon on it
11
-#	End
12
-#
13
-set -o errexit		# exit if error...insurance ;)
14
-set -o nounset		# exit if variable not initalized
15
-set +h			# disable hashall
16
-PRGNAME=${0##*/}	# script name minus the path
17
-source config.inc		#	configuration parameters
18
-source function.inc		#	commonn functions
19
-LOGFILE="/var/log/${PRGNAME}-${LOGFILE}"	#	set log file name
20
-LFS_DISK="/mnt/photon-disk"
21
-[ ${EUID} -eq 0 ]	|| die "${PRGNAME}: Need to be root user: FAILURE"
22
-> ${LOGFILE}		#	clear/initialize logfile
23
-
24
-echo -e "Setting up the disk...\n"
25
-set -x
26
-LFS_OPTION=""
27
-VMDK_IMAGE_NAME=mydisk.vmdk
28
-ROOT_PARTITION_SIZE=8
29
-SWAP_PARTITION_SIZE=2
30
-BOOT_FIRM_WARE="bios"
31
-
32
-while [[ $# > 0 ]]
33
-do
34
-	key="$1"
35
-	shift
36
- 
37
-	case $key in
38
-		-rp|--ROOT_PARTITION_SIZE)
39
-		ROOT_PARTITION_SIZE="$1"
40
-		shift
41
-	;;
42
-		-sp|--SWAP_PARTITION_SIZE)
43
-		SWAP_PARTITION_SIZE="$1"
44
-		shift
45
-	;;
46
-		-fm|--firmware)
47
-		BOOT_FIRM_WARE="$1"
48
-		shift
49
-
50
-	;;
51
-		-a|--all)
52
-		LFS_OPTION="all"
53
-	;;
54
-		-m|--minimal)
55
-		LFS_OPTION=""
56
-	;;
57
-		-n|--IMG_NAME)
58
-		VMDK_IMAGE_NAME="$1".raw
59
-		shift
60
-	;;
61
-		-h|--help)
62
-		echo 'Usage:'
63
-		echo '-rp|--ROOT_PARTITION_SIZE :sets root partition size'
64
-		echo '-sp|--SWAP_PARTITION_SIZE :sets swap partition size'
65
-		echo '-a|--all                  :installs all available packages'
66
-		echo '-n|--IMG_NAME             :sets name of the vmdk image'
67
-		echo '-m|--minimal              :installs basic packages'
68
-		echo '-fm|--firmware            :firmware'
69
-		exit 0
70
-	;;
71
-	*)
72
-		# unknown option
73
-	;;
74
-	esac
75
-done
76
-
77
-mkdir -p $LFS_DISK
78
-
79
-TOTAL_SIZE=` echo $ROOT_PARTITION_SIZE + $SWAP_PARTITION_SIZE | bc`
80
-
81
-echo "Creating raw disk file " $VMDK_IMAGE_NAME " of size " $TOTAL_SIZE
82
-dd if=/dev/zero of=$VMDK_IMAGE_NAME bs=1 seek=$(($TOTAL_SIZE * 1024 * 1024 * 1024)) count=0
83
-chmod 755 $VMDK_IMAGE_NAME
84
-
85
-echo "Associating loopdevice to raw disk"
86
-DISK_DEVICE=`losetup --show -f $VMDK_IMAGE_NAME`
87
-
88
-echo "Creating partition on raw disk"
89
-if [ $SWAP_PARTITION_SIZE -gt 0 ] 
90
-then
91
-      sgdisk -n 1::+8M -n 2::+${ROOT_PARTITION_SIZE}G -n 3: -p $DISK_DEVICE >> $LOGFILE
92
-else
93
-      sgdisk -n 1::+8M -n 2: -p $DISK_DEVICE >> $LOGFILE
94
-fi
95
-
96
-if [ $BOOT_FIRM_WARE = "efi" ]
97
-then
98
-    echo "EFI boot partition"
99
-    sgdisk -t1:ef00 $DISK_DEVICE >> $LOGFILE
100
-else
101
-    echo "BIOS boot partition"
102
-    sgdisk -t1:ef02 $DISK_DEVICE >> $LOGFILE
103
-fi
104
-echo "Mapping device partition to loop device"
105
-kpartx -avs $DISK_DEVICE >> $LOGFILE
106
-
107
-DEVICE_NAME=`echo $DISK_DEVICE|cut -c6- `
108
-
109
-echo "Adding file system to device partition"
110
-mkfs -t ext4 /dev/mapper/${DEVICE_NAME}p2
111
-
112
-echo "DISK_DEVICE=$DISK_DEVICE"
113
-echo "ROOT_PARTITION=/dev/mapper/${DEVICE_NAME}p2"
114
-
115
-
116 1
deleted file mode 100755
... ...
@@ -1,3 +0,0 @@
1
-#!/bin/bash
2
-echo -e "changeme\nchangeme" | passwd root
3
-chage -d 0 root
4 1
\ No newline at end of file
5 2
deleted file mode 100644
... ...
@@ -1,107 +0,0 @@
1
-        </VirtualHardwareSection>
2
- 	<ProductSection> 
3
- 		<Info>Information about the installed software</Info> 
4
- 		<Product>Photon OS</Product> 
5
- 		<Vendor>VMware Inc.</Vendor> 
6
- 		<Version>3.0</Version> 
7
- 		<FullVersion>3.0</FullVersion> 
8
- 	</ProductSection>
9
-	<EulaSection>
10
-        <Info>End User License Agreement</Info>
11
-        <License msgid="eula">
12
-	                           VMWARE, INC. 
13
-                         BETA LICENSE AGREEMENT
14
-
15
-Note: BY CLICKING “I AGREE,” ACCESSING, DOWNLOADING, INSTALLING, UPLOADING, COPYING OR USING THE BETA SOFTWARE, YOU CONCLUDE AND AGREE TO THIS BETA LICENSE AGREEMENT (“AGREEMENT”) IN A LEGALLY BINDING MANNER WITH VMWARE, INC., 3401 HILLVIEW AVENUE, PALO ALTO, CA 94304, USA (“VMware”). IF YOU HAVE SPECIFIED IN CONNECTION WITH THE REGISTRATION PROCESS FOR THIS SOFTWARE BETA TEST PROGRAM THAT YOU ARE ACTING ON BEHALF OF A COMPANY OR OTHER ORGANIZATION, YOU REPRESENT THAT YOU ARE AUTHORIZED TO LEGALLY BIND SUCH ORGANIZATION AND THAT YOU CONCLUDE THE AGREEMENT ON BEHALF OF SUCH ORGANIZATION. IN THE FOLLOWING, THE TERMS “YOU” AND “LICENSEE” SHALL REFER, JOINTLY AND SEVERALLY, TO YOU INDIVIDUALLY AND ANY ORGANIZATION ON WHOSE BEHALF YOU ACT.
16
-
17
-IF YOU DO NOT AGREE TO THE TERMS OF THIS BETA LICENSE AGREEMENT, THEN DO *NOT* CLICK “I AGREE,” ACCESS, DOWNLOAD, INSTALL, UPLOAD, COPY OR USE THE BETA SOFTWARE.
18
-
19
-1.	DEFINITIONS.
20
-
21
-       (a)  “Beta Software” shall mean the beta version of VMware’s software and the media and Documentation provided by VMware to Licensee and for which Licensee is granted a use license pursuant to this Agreement.  The Beta Software will be provided in object form only.
22
-       
23
-       (b)  “Documentation” shall mean the printed or online written reference material furnished to Licensee in conjunction with the Beta Software, including, without limitation, instructions, beta testing guidelines, and end user guides.
24
-       
25
-       (c)  “Intellectual Property Rights” shall mean all intellectual property rights, including, without limitation, patent, copyright, trademark, and trade secret, recognized in any jurisdiction worldwide, whether perfected or not, and any similar and other proprietary rights.
26
-       
27
-       (d)  “Open Source Software” means code that is provided with the Beta Software and identified as open source code or otherwise as being subject to open source license terms.
28
-       
29
-       (e)  “Updates” shall mean a modification, error correction, bug fix, new release, or other update to or for the Beta Software.
30
-
31
-2.	LICENSE GRANT, USE AND OWNERSHIP.
32
-
33
-	(a)  Limited License.  Subject to the terms and conditions of this Agreement, VMware grants to Licensee a non-exclusive, revocable (at any time and for any reason, at VMware’s sole discretion), royalty-free, non-transferable, non-assignable license (without the right to sublicense):
34
-
35
-             (i) to use the Beta Software in accordance with the Documentation solely for purposes of (A) internal testing and evaluation to determine whether or not to license generally available commercial versions of the Beta Software if such versions ever become available, and (B) internal development to create interoperability between the Beta Software and Licensee products, 
36
-            
37
-            (ii) to use the Documentation provided with the Beta Software in support of Licensee’s authorized use of the Beta Software, and
38
-           
39
-            (iii) to copy Beta Software for Licensee’s archival or backup purposes, provided that all titles and trademarks, copyright, and restricted rights notices are reproduced on such copies.
40
-       
41
-       (b)  Evaluation Feedback. The purpose of this limited license is the testing and evaluation of the Beta Software and Documentation and development by Licensee of Licensee products that interoperate with the Beta Software.  In furtherance of this purpose, Licensee shall provide feedback to VMware concerning the functionality and performance of the Beta Software from time to time as reasonably requested by VMware, including, without limitation, identifying potential errors and improvements (collectively the “Feedback”).  Licensee will provide Feedback in a manner that is mutually agreeable to the parties.  VMware may use Feedback, without restriction in any manner now known or in the future conceived, to improve or enhance its products and, accordingly, and you hereby grant to VMware a non-exclusive, perpetual, irrevocable, royalty-free, transferable, worldwide right and license, with the right to sublicense (i) to use, reproduce, disclose, distribute, modify, prepare derivative works of and otherwise exploit the Feedback and other information you provide to VMware under this Agreement, and (ii) to make, use, sell, offer to sell, import and export any product or service that incorporates the Feedback and other information you provide to VMware under this Agreement.
42
-       
43
-       (c)  Restrictions.  Licensee shall not disclose, provide, or disseminate in any manner the Beta Software (including the Documentation) or Confidential Information to any third party, including but not limited to its partners, affiliates or subsidiaries.  Except to the extent contrary to any applicable laws, Licensee will not, and will not permit any third party to, sublicense, rent, copy, modify, create derivative works of, translate, reverse engineer, decompile, disassemble, or otherwise reduce to human perceivable form any portion of the Beta Software or accompanying Documentation.  Without limiting the generality of the foregoing, Licensee shall not use the Beta Software for Licensee’s product development or any other commercial purpose, including, but not limited to sales or marketing activities, except as expressly permitted in this Agreement.  The Beta Software and all performance data and test results, including without limitation, benchmark test results (collectively “Performance Data”), relating  to the Beta Software are the Confidential Information of VMware, and will be treated in accordance with the terms of Section 4 of this Agreement.  Accordingly, Licensee shall not publish or disclose to any third party any Performance Data relating to the Beta Software.  
44
-
45
-       (d)  Ownership.  VMware shall own and retain all right, title and interest in and to the Intellectual Property Rights in the Beta Software and any derivative works thereof, subject only to the limited license expressly set forth in Section 2(a) hereof.  Licensee does not acquire any other rights, express or implied, in the Beta Software.  ALL RIGHTS NOT EXPRESSLY GRANTED HEREUNDER ARE RESERVED TO VMWARE. 
46
-       
47
-       (e)  No Support Services.  VMware is under no obligation to support the Beta Software in any manner or to provide any Updates to Licensee.  In the event VMware, in its sole discretion, supplies any Update to Licensee, the Update shall be deemed Beta Software under this Agreement and shall be subject to the terms and conditions of this Agreement.
48
-       
49
-	(f)  Third-Party Software.  The Beta Software may enable a computer to run multiple instances of third-party guest operating systems and application programs.  Licensee acknowledges that Licensee is responsible for obtaining any licenses necessary to operate any third-party software, including guest operating systems and application programs.
50
-
51
-       (g)  Open Source Software.  Except for Sections 5, 6, and 7, the terms and conditions of this Agreement shall not apply to any Open Source Software accompanying the Beta Software.  Any such Open Source Software is provided under the terms of the applicable open source license agreement or copyright notice accompanying such Open Source Software or included in the open source licenses file accompanying the Beta Software. 
52
-       
53
-3.	TERM AND TERMINATION.  Unless otherwise terminated as specified under this Agreement, Licensee’s rights with respect to the Beta Software will terminate upon the earlier of (a) the initial commercial release by VMware of a generally available version of the Beta Software or (b) automatic expiration of the Beta Software based on the system date.  Either party may terminate this Agreement at any time for any reason or no reason by providing the other party advance written notice thereof.  Licensee agrees that this Agreement will automatically terminate without notice in the event Licensee discloses the Beta Software in breach of Section 4 (Confidentiality) below. Upon any expiration or termination of this Agreement, the rights and licenses granted to Licensee under this Agreement shall immediately terminate, and Licensee shall immediately cease using, and will destroy or render practically inaccessible the Beta Software, Documentation, and all other tangible items in Licensee’s possession or control that contain Confidential Information.  The rights and obligations of the parties set forth in Sections 2(b), 2(c), 2(d), 2(e), 2(f), 2(g), 3, 4, 5, 6, 7 and 8 survive termination or expiration of this Agreement for any reason.  
54
-
55
-4.	CONFIDENTIALITY.  
56
-
57
-       (a) "Confidential Information" shall mean the Beta Software, all information regarding the Beta Software (including any trade secrets, know-how, inventions, techniques, processes, and algorithms embodied in the Beta Software), Documentation, Performance Data, any Updates, VMware products, product roadmaps, and other technical, business, financial and product development plans, forecasts and strategies, and other information provided by VMware to Licensee under this Agreement, whether disclosed orally, in writing, or by examination or inspection, other than information that Licensee can demonstrate (i) was already known to Licensee, other than under an obligation of confidentiality, at the time of disclosure; (ii) was generally available in the public domain at the time of disclosure to Licensee; (iii) became generally available in the public domain after disclosure other than through any act or omission of Licensee; (iv) was subsequently lawfully disclosed to Licensee by a third party without any obligation of confidentiality; or (v) was independently developed by Licensee without use of or reference to any information or materials disclosed by VMware or its suppliers.  If Licensee wishes to disclose to VMware any information under this Agreement that Licensee considers proprietary or confidential to Licensee (“Licensee Information”), then Licensee agrees such disclose will be governed by a separate non-disclosure agreement (“NDA”) by and between the parties.   If Licensee is required to disclose Confidential Information by applicable law or court order, Licensee shall notify VMware of the required disclosure promptly in writing and shall cooperate with VMware in any lawful action to contest or limit the scope of the required disclosure.  Licensee shall not use any Confidential Information for any purpose other than as expressly authorized under this Agreement.  In no event shall Licensee use the Beta Software or any Confidential Information to develop, manufacture, market, sell, or distribute any product or service, including any VMware products except as expressly set forth in this Agreement.  Licensee shall not disclose any Confidential Information to any third party. Without limiting the foregoing, Licensee shall use at least the same degree of care that it uses to prevent the disclosure of its own confidential information of like importance, but in no event less than reasonable care, to prevent the disclosure of such Confidential Information.
58
-       
59
-       (b)  Additional Confidentiality Restrictions for Highly Confidential Beta Software.  For certain Beta Software designated by VMware in writing as highly confidential (“Highly Confidential Beta Software”), Licensee agrees that the following, additional confidentiality obligations and restrictions will apply:
60
-       
61
-            (i)  Licensee shall limit dissemination of Highly Confidential Beta Software and related information concerning product features, future technologies and roadmaps only to Information Technology teams and/or software/solutions development teams of Licensee approved in writing by VMware, and only to individuals on such teams on a need-to-know basis and solely for purposes expressly authorized under this Agreement.  For clarity and without limiting the generality of the foregoing, Licensee shall not disseminate any Highly Confidential Beta Software to Licensee's sales and marketing field organizations.  Licensee will assign an employee who will be primarily responsible for ensuring Licensee’s full compliance with the terms described in this Section 4(b) herein. 
62
-             
63
-            (ii)  Improper Disclosure of Highly Confidential Beta Software.  Licensee acknowledges that damages due to Licensee’s improper disclosure of Highly Confidential Beta Software or related information concerning product features, future technologies and roadmaps may be irreparable and that monetary damages would be inadequate to compensate VMware for any breach of this Agreement.  In the event that VMware reasonably believes that Licensee has disseminated Highly Confidential Beta Software or related information concerning product features, future technologies and roadmaps to an unauthorized party, Licensee will be immediately removed from VMware’s Beta Software program and will not be permitted to participate in any VMware Beta Software program in the future.  Additionally, all rights and licenses granted to Licensee under this Agreement shall immediately terminate in accordance with Section 3 herein (Term and Termination), and (b) in addition to all other remedies available in law or otherwise, VMware is entitled to seek equitable relief, including injunction and preliminary injunction against the threatened breach of this Agreement or the continuation of any such breach. 
64
-       
65
-5.	LIMITATION OF LIABILITY.  IT IS UNDERSTOOD THAT THE BETA SOFTWARE IS PROVIDED WITHOUT CHARGE FOR THE PURPOSES EXPRESSLY PERMITTED UNDER THIS AGREEMENT.  ACCORDINGLY, TO THE FULLEST EXTENT PERMITTED BY LAW, BUT SUBJECT ALWAYS TO THIS SECTION 5, THE TOTAL LIABILITY OF VMWARE AND ITS LICENSORS ARISING OUT OF OR RELATED TO THIS AGREEMENT SHALL NOT EXCEED $100.00.  TO THE FULLEST EXTENT PERMITTED BY LAW, IN NO EVENT SHALL VMWARE OR ITS LICENSORS HAVE LIABILITY FOR ANY INDIRECT, INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, OR LOSS OF BUSINESS INFORMATION, HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY (INCLUDING WITHOUT LIMITATION, TORT, STATUTE, CONTRACT OR OTHER), EVEN IF VMWARE AND ITS LICENSORS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.  THESE LIMITATIONS SHALL APPLY NOTWITHSTANDING ANY FAILURE OF ESSENTIAL PURPOSE OF ANY LIMITED REMEDY.  THE PARTIES ACKNOWLEDGE THAT THE VARIOUS CONSIDERATIONS DUE TO VMWARE IN ACCORDANCE WITH THE TERMS OF THIS AGREEMENT WERE TAKEN INTO ACCOUNT IN DETERMINING THE LIMITATION OF LIABILITY SET FORTH IN THIS SECTION 5. LICENSEE ACKNOWLEDGES AND AGREES THIS LIMITATION IS AN ESSENTIAL ELEMENT OF THIS AGREEMENT AND THAT VMWARE WOULD NOT ENTER INTO THIS AGREEMENT WITHOUT THESE LIMITATIONS ON ITS LIABILITY.
66
-
67
-6.	WARRANTY DISCLAIMER.  IT IS UNDERSTOOD THAT THE BETA SOFTWARE, OPEN SOURCE SOFTWARE, DOCUMENTATION, AND ANY UPDATES MAY CONTAIN ERRORS AND ARE PROVIDED FOR THE PURPOSES EXPRESSLY PERMITTED UNDER THIS AGREEMENT.  TO THE FULLEST EXTENT PERMITTED BY LAW, AND SUBJECT TO SECTION 5, THE BETA SOFTWARE, THE OPEN SOURCE SOFTWARE, THE DOCUMENTATION, AND ANY UPDATES ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE.  TO THE FULLEST EXTENT PERMITTED BY LAW, AND SUBJECT TO SECTION 5, VMWARE AND ITS LICENSORS SPECIFICALLY DISCLAIM ALL IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE.  Licensee acknowledges that VMware has not publicly announced the availability of the Beta Software, that such Beta Software may contain features currently under development, that VMware has not promised or guaranteed to Licensee that such Beta Software will be announced or made available to anyone in the future, that VMware has no express or implied obligation to Licensee to announce or introduce the Beta Software, that VMware may not introduce a product similar to or compatible with the Beta Software, and that any version number (if any) referenced is subject to change and does not in any way represent VMware’s commitment to release any product in the future. Accordingly, Licensee acknowledges that any research or development that it performs regarding the Beta Software or any product associated with the Beta Software is done entirely at Licensee’s own risk.  Specifically, the Beta Software may contain features, functionality or modules that may not be included in the generally available commercial version of the Beta Software, if released, or that will be marketed separately for additional fees.
68
-
69
-7.	OTHER PROVISIONS.
70
-
71
-       (a)  Governing Law, Injunctive Relief and Legal Costs. 
72
-        
73
-           (aa) Choice of Law. This Agreement and any dispute arising out of or related to this Agreement or the Beta Software (“Dispute”) will be governed by California law, without regard to its choice of law principles.  The United Nations Convention for the International Sale of Goods shall not apply.
74
-           
75
-           (bb) Injunctive Relief.  Either party may, at its sole discretion, seek preliminary judicial relief in any court of competent jurisdiction (including, but not limited to, preliminary injunctive relief). Also, the provisions of this Section 7(a) may be enforced by any court of competent jurisdiction.
76
-           
77
-        (b)  Export Regulations.  The Beta Software is of United States origin and is provided subject to the U.S. Export Administration Regulations.  Diversion contrary to U.S. law is prohibited.  Without limiting the foregoing, you agree that (1) you are not, and are not acting on behalf of, any person who is a citizen, national, or resident of, or who is controlled by the government of, Cuba, Iran, North Korea, Sudan, or Syria, or any other country to which the United States has prohibited export transactions; (2) you are not, and are not acting on behalf of, any person or entity listed on the U.S. Treasury Department list of Specially Designated Nationals and Blocked Persons, or the U.S. Commerce Department Denied Persons List or Entity List; and (3) you will not use the Beta Software for, and will not permit the Beta Software to be used for, any purposes prohibited by law, including, without limitation, for any prohibited development, design, manufacture or production of missiles or nuclear, chemical or biological weapons.  U.S. Export Control Classification Numbers (ECCN’s) may be found at VMware help page: http://www.vmware.com/help/export-control.
78
-       
79
-       (c)  Modification.  This is the entire agreement between the parties relating to the subject matter hereof and to the fullest extent permitted by law, all other terms, representations, negotiations, arrangements or understandings are rejected.  This Agreement supersedes and replaces any other agreements, representations, negotiations, arrangements or understandings between the parties and Licensee hereby waives any form requirements that may be contained in previous agreements and agrees that this Agreement shall take precedent with respect to its subject matter.  No party has entered into this Agreement relying on any representations made by or on behalf of the other, other than those expressly made in this Agreement.  No waiver or modification of this Agreement shall be valid unless in writing signed by each party.  
80
-       
81
-       (d)  Language of Contract.  The parties have required that this Agreement and all documents relating thereto be drawn up in English. Les parties ont demandé que cette convention ainsi que tous les documents que s'y attachent soient rédigés en anglais.
82
-       (e) Severability.  If any provision of this Agreement is held to be illegal, invalid or unenforceable, the provision will be enforced to the maximum extent permissible so as to effect the intent of the parties, and the remaining provisions of this Agreement will remain in full force and effect.  
83
-
84
-       (f) Waivers.   Any waiver of these terms must be in writing and signed by the waiving party to be effective. 
85
-       
86
-       (g) Data Collection and Privacy.  
87
-       
88
-          (i) Consent for Collection and Use of Technical Data. You agree that VMware may periodically collect, process and store technical and related information about your device, system, application, peripherals and your use of the Beta Software, including without limitation: internet protocol address, hardware identification, operating system, application software, peripheral hardware, number of active plugins and software development kits, the successful installation and launch of Beta Software, and  Beta Software usage statistics (collectively, “Technical Data”).  VMware will use Technical Data for internal statistical and analytical purposes to facilitate support, invoicing or online services, the provisioning of updates, and the development of VMware products and services. VMware may transfer Technical Data to other companies in the VMware worldwide group of companies from time to time. 
89
-
90
-           (ii) Log Files. You acknowledge that correspondence and log files generated in conjunction with a request for support services may contain sensitive, confidential or personal information. You are solely responsible for taking the steps necessary to protect such data, including obfuscating the logs or otherwise guarding such information prior to sending it to VMware.
91
-           
92
-       (h) Independent Parties.  The parties are independent.  Nothing in this Agreement shall be construed to create a partnership, joint venture, contractor, or agency relationship between the parties.  
93
-       
94
-8.	ASSIGNMENT.  Licensee shall not and cannot assign this Agreement or any rights or obligations hereunder, directly or indirectly, by operation of law, merger, acquisition of stock or assets, or otherwise without the prior written consent of VMware.   Any attempted assignment or transfer in violation of the foregoing will be null and void.  Subject to the foregoing, this Agreement shall inure to the benefit of and be binding upon the parties and their respective successors and permitted assigns.
95
-
96
-9. 	CONTACT INFORMATION.  If you have any questions about this Agreement, please direct all correspondence to: VMware, Inc., 3401 Hillview Avenue, Palo Alto, CA 94304, United States of America.  VMware is a trademark of VMware, Inc. and is registered in the U.S. and numerous other countries. 
97
-
98
-        </License>
99
-    </EulaSection>
100
-
101
-    <AnnotationSection>
102
-        <Info>Description of the Product</Info>
103
-        <Annotation>This OVA provides a minimal installed profile of PhotonOS.
104
-   Default password for root user is changeme. However user will be prompted to change the password during first login.
105
-        </Annotation>
106
-
107
-    </AnnotationSection>
108 1
deleted file mode 100644
... ...
@@ -1,15 +0,0 @@
1
-{
2
-    "hostname": "photon-machine",
3
-    "password": 
4
-        {
5
-            "crypted": false,
6
-            "text": "PASSWORD"
7
-        },
8
-    "type": "minimal",
9
-    "size": { "root": "16", "swap": "0" },
10
-    "public_key":"<ssh-key-here>",
11
-    "customartifacts": { "postinstallscripts": ["ova-custom-patch.sh"] },
12
-    "artifacttype": "ova",
13
-    "keeprawdisk": "false"
14
-}
15
-
16 1
deleted file mode 100644
... ...
@@ -1,22 +0,0 @@
1
-.encoding = "UTF-8"
2
-virtualHW.version = "11"
3
-scsi0.present = "TRUE"
4
-scsi0.virtualDev = "pvscsi"
5
-scsi0:0.present = "TRUE"
6
-scsi0:0.fileName = "VMDK_IMAGE"
7
-ethernet0.present = "TRUE"
8
-ethernet0.virtualDev = "vmxnet3"
9
-ethernet0.wakeOnPcktRcv = "FALSE"
10
-ethernet0.addressType = "generated"
11
-ethernet0.linkStatePropagation.enable = "TRUE"
12
-ethernet0.connectionType = "None"
13
-displayName = "Photon OS"
14
-guestOS = "vmware-photon-64"
15
-memsize = "2048"
16
-ide1:0.present = "TRUE"
17
-ide1:0.autodetect = "TRUE"
18
-ide1:0.deviceType = "cdrom-raw"
19
-ide1:0.startConnected = "FALSE"
20
-pciBridge5.present = "FALSE"
21
-pciBridge6.present = "FALSE"
22
-pciBridge7.present = "FALSE"
23 1
deleted file mode 100755
... ...
@@ -1,3 +0,0 @@
1
-#!/bin/bash
2
-echo -e "changeme\nchangeme" | passwd root
3
-chage -d 0 root
4 1
\ No newline at end of file
5 2
deleted file mode 100644
... ...
@@ -1,15 +0,0 @@
1
-{
2
-	"hostname": "photon-machine",
3
-	"password": 
4
-		{
5
-			"crypted": false,
6
-			"text": "PASSWORD"
7
-		},
8
-	"type": "minimal",
9
-    "size": {"root": "16", "swap": "0"},
10
-    "public_key":"<ssh-key-here>",
11
-    "customartifacts": { "postinstallscripts": ["ova_generic-custom-patch.sh"] },
12
-    "artifacttype": "ova",
13
-    "keeprawdisk": "false"
14
-}
15
-
16 1
deleted file mode 100644
... ...
@@ -1,22 +0,0 @@
1
-.encoding = "UTF-8"
2
-virtualHW.version = "11"
3
-scsi0.present = "TRUE"
4
-scsi0.virtualDev = "pvscsi"
5
-scsi0:0.present = "TRUE"
6
-scsi0:0.fileName = "VMDK_IMAGE"
7
-ethernet0.present = "TRUE"
8
-ethernet0.virtualDev = "vmxnet3"
9
-ethernet0.wakeOnPcktRcv = "FALSE"
10
-ethernet0.addressType = "generated"
11
-ethernet0.linkStatePropagation.enable = "TRUE"
12
-ethernet0.connectionType = "None"
13
-displayName = "Photon OS"
14
-guestOS = "vmware-photon-64"
15
-memsize = "2048"
16
-ide1:0.present = "TRUE"
17
-ide1:0.autodetect = "TRUE"
18
-ide1:0.deviceType = "cdrom-raw"
19
-ide1:0.startConnected = "FALSE"
20
-
21
-
22
-
23 1
deleted file mode 100755
... ...
@@ -1,19 +0,0 @@
1
-#!/bin/bash
2
-
3
-echo -e "changeme\nchangeme" | passwd root
4
-
5
-# create empty cracklib dictionary and remove cracklib-dicts rpm
6
-echo a | cracklib-packer /root/pw_dict
7
-rpm -e cracklib-dicts --nodeps
8
-mv /root/pw_dict* /usr/share/cracklib/
9
-
10
-# removing this file is safe
11
-rm /boot/system.map*
12
-
13
-# TODO: remove it from grub rpm - not used
14
-rm -rf /boot/grub/fonts
15
-# TODO: clean up spec file
16
-rm -rf /usr/include
17
-
18
-# finally remove rpm tools, keep tdnf only
19
-rpm -e rpm --nodeps
20 1
deleted file mode 100644
... ...
@@ -1,543 +0,0 @@
1
-        </VirtualHardwareSection>
2
- 	<ProductSection> 
3
- 		<Info>Information about the installed software</Info> 
4
- 		<Product>Photon OS</Product> 
5
- 		<Vendor>VMware Inc.</Vendor> 
6
- 		<Version>2.0</Version> 
7
- 		<FullVersion>2.0</FullVersion> 
8
- 	</ProductSection>
9
-	<EulaSection>
10
-        <Info>End User License Agreement</Info>
11
-        <License msgid="eula">
12
-VMWARE END USER LICENSE AGREEMENT
13
-
14
-PLEASE NOTE THAT THE TERMS OF THIS END USER LICENSE 
15
-AGREEMENT SHALL GOVERN YOUR USE OF THE SOFTWARE, 
16
-REGARDLESS OF ANY TERMS THAT MAY APPEAR DURING THE 
17
-INSTALLATION OF THE SOFTWARE. 
18
-
19
-IMPORTANT-READ CAREFULLY:   BY DOWNLOADING, INSTALLING, 
20
-OR USING THE SOFTWARE, YOU (THE INDIVIDUAL OR LEGAL 
21
-ENTITY) AGREE TO BE BOUND BY THE TERMS OF THIS END USER 
22
-LICENSE AGREEMENT ("EULA").  IF YOU DO NOT AGREE TO THE 
23
-TERMS OF THIS EULA, YOU MUST NOT DOWNLOAD, INSTALL, OR 
24
-USE THE SOFTWARE, AND YOU MUST DELETE OR RETURN THE 
25
-UNUSED SOFTWARE TO THE VENDOR FROM WHICH YOU 
26
-ACQUIRED IT WITHIN THIRTY (30) DAYS AND REQUEST A REFUND 
27
-OF THE LICENSE FEE, IF ANY, THAT YOU PAID FOR THE 
28
-SOFTWARE.
29
-
30
-EVALUATION LICENSE.  If You are licensing the Software for evaluation 
31
-purposes, Your use of the Software is only permitted in a non-production 
32
-environment and for the period limited by the License Key.  
33
-Notwithstanding any other provision in this EULA, an Evaluation License of 
34
-the Software is provided "AS-IS" without indemnification, support or 
35
-warranty of any kind, expressed or implied.
36
-
37
-1.	DEFINITIONS.
38
- 
39
-1.1	 "Affiliate" means, with respect to a party at a given time, an entity 
40
-that then is directly or indirectly controlled by, is under common control 
41
-with, or controls that party, and here "control" means an ownership, voting 
42
-or similar interest representing fifty percent (50%) or more of the total 
43
-interests then outstanding of that entity.
44
-
45
-1.2	"Documentation" means that documentation that is generally 
46
-provided to You by VMware with the Software, as revised by VMware from 
47
-time to time, and which may include end user manuals, operation 
48
-instructions, installation guides, release notes, and on-line help files 
49
-regarding the use of the Software.
50
-
51
-1.3	"Guest Operating Systems" means instances of third-party 
52
-operating systems licensed by You, installed in a Virtual Machine and run 
53
-using the Software.
54
-
55
-1.4	"Intellectual Property Rights" means all worldwide intellectual 
56
-property rights, including without limitation, copyrights, trademarks, service 
57
-marks, trade secrets, know how, inventions, patents, patent applications, 
58
-moral rights and all other proprietary rights, whether registered or 
59
-unregistered. 
60
-
61
-1.5	"License" means a license granted under Section 2.1 (General 
62
-License Grant). 
63
-
64
-1.6    	"License Key" means a serial number that enables You to 
65
-activate and use the Software.
66
-
67
-1.7	"License Term" means the duration of a License as specified in the 
68
-Order.
69
-
70
-1.8	"License Type" means the type of License applicable to the 
71
-Software, as more fully described in the Order.
72
-
73
-1.9	"Open Source Software" or "OSS" means software components 
74
-embedded in the Software and provided under separate license terms, 
75
-which can be found either in the open_source_licenses.txt file (or similar 
76
-file) provided within the Software or at 
77
-www.vmware.com/download/open_source.html. 
78
-
79
-1.10	"Order" means a purchase order, enterprise license agreement, or 
80
-other ordering document issued by You to VMware or a VMware 
81
-authorized reseller that references and incorporates this EULA and is 
82
-accepted by VMware as set forth in Section 4 (Order). 
83
-1.11	"Product Guide" means the current version of the VMware Product 
84
-Guide at the time of Your Order, copies of which are found at 
85
-www.vmware.com/download/eula.
86
-  
87
-1.12	"Support Services Terms" means VMware's then-current support 
88
-policies, copies of which are posted at www.vmware.com/support/policies.
89
-
90
-1.13	"Software" means the VMware Tools and the VMware computer 
91
-programs listed on VMware's commercial price list to which You acquire a 
92
-license under an Order, together with any software code relating to the 
93
-foregoing that is provided to You pursuant to a support and subscription 
94
-service contract and that is not subject to a separate license agreement.
95
-
96
-1.14	"Territory" means the country or countries in which You have been 
97
-invoiced; provided, however, that if You have been invoiced within any of 
98
-the European Economic Area member states, You may deploy the 
99
-corresponding Software throughout the European Economic Area. 
100
-
101
-1.15	"Third Party Agent" means a third party delivering information 
102
-technology services to You pursuant to a written contract with You.
103
-
104
-1.16	"Virtual Machine" means a software container that can run its own 
105
-operating system and execute applications like a physical machine.   
106
-
107
-1.17	"VMware" means VMware, Inc., a Delaware corporation, if You are 
108
-purchasing Licenses or services for use in the United States and VMware 
109
-International Limited, a company organized and existing under the laws of 
110
-Ireland, for all other purchases.
111
-1.18	"VMware Tools" means the suite of utilities and drivers, Licensed 
112
-by VMware under the "VMware Tools" name, that can be installed in a 
113
-Guest Operating System to enhance the performance and functionality of 
114
-a Guest Operating System when running in a Virtual Machine.
115
-
116
-2.		LICENSE GRANT.
117
-
118
-2.1	General License Grant.  VMware grants to You a non-exclusive, 
119
-non-transferable (except as set forth in Section 12.1 (Transfers; 
120
-Assignment)) license to use the Software and the Documentation during 
121
-the period of the license and within the Territory, solely for Your internal 
122
-business operations, and subject to the provisions of the Product Guide. 
123
-Unless otherwise indicated in the Order, licenses granted to You will be 
124
-perpetual, will be for use of object code only, and will commence on either 
125
-delivery of the physical media or the date You are notified of availability for 
126
-electronic download.  
127
-
128
-2.2	Third Party Agents.  Under the License granted to You in Section 
129
-2.1 (General License Grant) above, You may permit Your Third Party 
130
-Agents to access, use and/or operate the Software on Your behalf for the 
131
-sole purpose of delivering services to You, provided that You will be fully 
132
-responsible for Your Third Party Agents' compliance with terms and 
133
-conditions of this EULA and any breach of this EULA by a Third Party 
134
-Agent shall be deemed to be a breach by You. 
135
-
136
-2.3       Copying Permitted.  You may copy the Software and 
137
-Documentation as necessary to install and run the quantity of copies 
138
-licensed, but otherwise for archival purposes only. 
139
-
140
-2.4	Benchmarking.  You may use the Software to conduct internal 
141
-performance testing and benchmarking studies. You may only publish or 
142
-otherwise distribute the results of such studies to third parties as follows:  
143
-(a) if with respect to VMware's Workstation or Fusion products, only if You 
144
-provide a copy of Your study to benchmark@vmware.com prior to 
145
-distribution;   (b) if with respect to any other Software, only if VMware has 
146
-reviewed and approved of the methodology, assumptions and other 
147
-parameters of the study  (please contact VMware at 
148
-benchmark@vmware.com to request such review and approval) prior to 
149
-such publication and distribution. 
150
-
151
-2.5	VMware Tools.  You may distribute the VMware Tools to third 
152
-parties solely when installed in a Guest Operating System within a Virtual 
153
-Machine. You are liable for compliance by those third parties with the 
154
-terms and conditions of this EULA. 
155
-
156
-2.6	Open Source Software.  Notwithstanding anything herein to the 
157
-contrary, Open Source Software is licensed to You under such OSS's own 
158
-applicable license terms, which can be found in the 
159
-open_source_licenses.txt file, the Documentation or as applicable, the 
160
-corresponding source files for the Software available at 
161
-www.vmware.com/download/open_source.html. These OSS license terms 
162
-are consistent with the license granted in Section 2 (License Grant), and 
163
-may contain additional rights benefiting You.  The OSS license terms shall 
164
-take precedence over this EULA to the extent that this EULA imposes 
165
-greater restrictions on You than the applicable OSS license terms. To the 
166
-extent the license for any Open Source Software requires VMware to 
167
-make available to You the corresponding source code and/or modifications 
168
-(the "Source Files"), You may obtain a copy of the applicable Source 
169
-Files from VMware's website at 
170
-www.vmware.com/download/open_source.html or by sending a written 
171
-request, with Your name and address to: VMware, Inc., 3401 Hillview 
172
-Avenue, Palo Alto, CA 94304, United States of America. All requests 
173
-should clearly specify:  Open Source Files Request, Attention: General 
174
-Counsel.  This offer to obtain a copy of the Source Files is valid for three 
175
-years from the date You acquired this Software.
176
-
177
-3.	RESTRICTIONS; OWNERSHIP.
178
-
179
-3.1	License Restrictions.  Without VMware's prior written consent, 
180
-You must not, and must not allow any third party to: (a) use Software in an 
181
-application services provider, service bureau, or similar capacity for third 
182
-parties, except that You may use the Software to deliver hosted services 
183
-to Your Affiliates; (b) disclose to any third party the results of any 
184
-benchmarking testing or comparative or competitive analyses of VMware's 
185
-Software done by or on behalf of You, except as specified in Section 2.4 
186
-(Benchmarking); (c) make available Software in any form to anyone other 
187
-than Your employees or contractors reasonably acceptable to VMware 
188
-and require access to use Software on behalf of You in a matter permitted 
189
-by this EULA, except as specified in Section 2.2 (Third Party Agents); (d) 
190
-transfer or sublicense Software or Documentation to an Affiliate or any 
191
-third party, except as expressly permitted in Section 12.1 (Transfers; 
192
-Assignment); (e) use Software in conflict with the terms and restrictions of 
193
-the Software's licensing model and other requirements specified in 
194
-Product Guide and/or VMware quote; (f) except to the extent permitted by 
195
-applicable mandatory law, modify, translate, enhance, or create derivative 
196
-works from the Software, or  reverse engineer, decompile, or otherwise 
197
-attempt to derive source code from the Software, except as specified in 
198
-Section 3.2 (Decompilation); (g) remove any copyright or other proprietary 
199
-notices on or in any copies of Software; or (h) violate or circumvent any 
200
-technological restrictions within the Software or specified in this EULA, 
201
-such as via software or services.  
202
-
203
-3.2	Decompilation.  Notwithstanding the foregoing, decompiling the 
204
-Software is permitted to the extent the laws of the Territory give You the 
205
-express right to do so to obtain information necessary to render the 
206
-Software interoperable with other software; provided, however, You must 
207
-first request such information from VMware, provide all reasonably 
208
-requested information to allow VMware to assess Your claim, and VMware 
209
-may, in its discretion, either provide such interoperability information to 
210
-You, impose reasonable conditions, including a reasonable fee, on such 
211
-use of the Software, or offer to provide alternatives to ensure that 
212
-VMware's proprietary rights in the Software are protected and to reduce 
213
-any adverse impact on VMware's proprietary rights.
214
-
215
-3.3	Ownership.  The Software and Documentation, all copies and 
216
-portions thereof, and all improvements, enhancements, modifications and 
217
-derivative works thereof, and all Intellectual Property Rights therein, are 
218
-and shall remain the sole and exclusive property of VMware and its 
219
-licensors. Your rights to use the Software and Documentation shall be 
220
-limited to those expressly granted in this EULA and any applicable Order.  
221
-No other rights with respect to the Software or any related Intellectual 
222
-Property Rights are implied.  You are not authorized to use (and shall not 
223
-permit any third party to use) the Software, Documentation or any portion 
224
-thereof except as expressly authorized by this EULA or the applicable 
225
-Order.  VMware reserves all rights not expressly granted to You. VMware 
226
-does not transfer any ownership rights in any Software.
227
-
228
-3.4	Guest Operating Systems.  Certain Software allows Guest 
229
-Operating Systems and application programs to run on a computer 
230
-system. You acknowledge that You are responsible for obtaining and 
231
-complying with any licenses necessary to operate any such third-party 
232
-software.
233
-
234
-4.	ORDER.  Your Order is subject to this EULA.  No Orders are 
235
-binding on VMware until accepted by VMware.  Orders for Software are 
236
-deemed to be accepted upon VMware's delivery of the Software included 
237
-in such Order. Orders issued to VMware do not have to be signed to be 
238
-valid and enforceable.
239
-
240
-5.	RECORDS AND AUDIT.  During the License Term for Software 
241
-and for two (2) years after its expiration or termination, You will maintain 
242
-accurate records of Your use of the Software sufficient to show 
243
-compliance with the terms of this EULA. During this period, VMware will 
244
-have the right to audit Your use of the Software to confirm compliance with 
245
-the terms of this EULA. That audit is subject to reasonable notice by 
246
-VMware and will not unreasonably interfere with Your business activities. 
247
-VMware may conduct no more than one (1) audit in any twelve (12) month 
248
-period, and only during normal business hours. You will reasonably 
249
-cooperate with VMware and any third party auditor and will, without 
250
-prejudice to other rights of VMware, address any non-compliance 
251
-identified by the audit by promptly paying additional fees. You will promptly 
252
-reimburse VMware for all reasonable costs of the audit if the audit reveals 
253
-either underpayment of more than five (5%) percent of the Software fees 
254
-payable by You for the period audited, or that You have materially failed to 
255
-maintain accurate records of Software use. 
256
-
257
-6.	SUPPORT AND SUBSCRIPTION SERVICES.  Except as 
258
-expressly specified in the Product Guide, VMware does not provide any 
259
-support or subscription services for the Software under this EULA.  You 
260
-have no rights to any updates, upgrades or extensions or enhancements 
261
-to the Software developed by VMware unless you separately purchase 
262
-VMware support or subscription services.  These support or subscription 
263
-services are subject to the Support Services Terms.
264
-
265
-7.	   WARRANTIES.
266
-
267
-7.1	Software Warranty, Duration and Remedy.  VMware warrants to 
268
-You that the Software will, for a period of ninety (90) days following notice 
269
-of availability for electronic download or delivery ("Warranty Period"), 
270
-substantially conform to the applicable Documentation, provided that the 
271
-Software: (a) has been properly installed and used at all times in 
272
-accordance with the applicable Documentation; and (b) has not been 
273
-modified or added to by persons other than VMware or its authorized 
274
-representative. VMware will, at its own expense and as its sole obligation 
275
-and Your exclusive remedy for any breach of this warranty, either replace 
276
-that Software or correct any reproducible error in that Software reported to 
277
-VMware by You in writing during the Warranty Period. If VMware 
278
-determines that it is unable to correct the error or replace the Software, 
279
-VMware will refund to You the amount paid by You for that Software, in 
280
-which case the License for that Software will terminate.
281
-
282
-7.2	Software Disclaimer of Warranty.  OTHER THAN THE 
283
-WARRANTY ABOVE, AND TO THE MAXIMUM EXTENT PERMITTED BY 
284
-APPLICABLE LAW, VMWARE AND ITS SUPPLIERS MAKE NO OTHER 
285
-EXPRESS WARRANTIES UNDER THIS EULA, AND DISCLAIM ALL 
286
-IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 
287
-PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT, AND ANY 
288
-WARRANTY ARISING BY STATUTE, OPERATION OF LAW, COURSE 
289
-OF DEALING OR PERFORMANCE, OR USAGE OF TRADE. VMWARE 
290
-AND ITS LICENSORS DO NOT WARRANT THAT THE SOFTWARE 
291
-WILL OPERATE UNINTERRUPTED OR THAT IT WILL BE FREE FROM 
292
-DEFECTS OR THAT IT WILL MEET YOUR REQUIREMENTS. 
293
-
294
-8.	    INTELLECTUAL PROPERTY INDEMNIFICATION. 
295
-
296
-8.1	Defense and Indemnification.  Subject to the remainder of this 
297
-Section 8 (Intellectual Property Indemnification), VMware shall defend You 
298
-against any third party claim that the Software infringes any patent, 
299
-trademark or copyright of such third party, or misappropriates a trade 
300
-secret (but only to the extent that the misappropriation is not a result of 
301
-Your actions) under the laws of: (a) the United States and Canada; (b) the 
302
-European Economic Area; (c) Australia; (d) New Zealand; (e) Japan; or (f) 
303
-the People's Republic of China, to the extent that such countries are part 
304
-of the Territory for the License ("Infringement Claim") and indemnify You 
305
-from the resulting costs and damages finally awarded against You to such 
306
-third party by a court of competent jurisdiction or agreed to in settlement. 
307
-The foregoing obligations are applicable only if You:  (i) promptly notify 
308
-VMware in writing of the Infringement Claim; (ii) allow VMware sole control 
309
-over the defense for the claim and any settlement negotiations; and (iii) 
310
-reasonably cooperate in response to VMware requests for assistance.  
311
-You may not settle or compromise any Infringement Claim without the 
312
-prior written consent of VMware.
313
-8.2	Remedies.  If the alleged infringing Software become, or in 
314
-VMware's opinion be likely to become, the subject of an Infringement 
315
-Claim, VMware will, at VMware's option and expense, do one of the 
316
-following:  (a) procure the rights necessary for You to make continued use 
317
-of the affected Software; (b) replace or modify the affected Software to 
318
-make it non-infringing; or (c) terminate the License to the affected 
319
-Software and discontinue the related support services, and, upon Your 
320
-certified deletion of the affected Software, refund: (i) the fees paid by You 
321
-for the License to the affected Software, less straight-line depreciation 
322
-over a three (3) year useful life beginning on the date such Software was 
323
-delivered; and (ii) any pre-paid service fee attributable to related support 
324
-services to be delivered after the date such service is stopped. Nothing in 
325
-this Section 8.2 (Remedies) shall limit VMware's obligation under Section 
326
-8.1 (Defense and Indemnification) to defend and indemnify You, provided 
327
-that You replace the allegedly infringing Software upon VMware's making 
328
-alternate Software available to You and/or You discontinue using the 
329
-allegedly infringing Software upon receiving VMware's notice terminating 
330
-the affected License.
331
-8.3	Exclusions.  Notwithstanding the foregoing, VMware will have no 
332
-obligation under this Section 8 (Intellectual Property Indemnification) or 
333
-otherwise with respect to any claim based on:  (a) a combination of 
334
-Software with non-VMware products (other than non-VMware products 
335
-that are listed on the Order and used in an unmodified form); (b) use for a 
336
-purpose or in a manner for which the Software was not designed; (c) use 
337
-of any older version of the Software when use of a newer VMware version 
338
-would have avoided the infringement; (d) any modification to the Software 
339
-made without VMware's express written approval; (e) any claim that 
340
-relates to open source software or freeware technology or any derivatives 
341
-or other adaptations thereof that is not embedded by VMware into 
342
-Software listed on VMware's commercial price list; or (f) any Software 
343
-provided on a no charge, beta or evaluation basis.  THIS SECTION 8 
344
-(INTELLECTUAL PROPERTY INDEMNIFICATION) STATES YOUR 
345
-SOLE AND EXCLUSIVE REMEDY AND VMWARE'S ENTIRE LIABILITY 
346
-FOR ANY INFRINGEMENT CLAIMS OR ACTIONS. 
347
-
348
-9.	LIMITATION OF LIABILITY. 
349
-
350
-9.1	Limitation of Liability.  TO THE MAXIMUM EXTENT MANDATED 
351
-BY LAW, IN NO EVENT WILL VMWARE AND ITS LICENSORS BE 
352
-LIABLE FOR ANY LOST PROFITS OR BUSINESS OPPORTUNITIES, 
353
-LOSS OF USE, LOSS OF REVENUE, LOSS OF GOODWILL, BUSINESS 
354
-INTERRUPTION, LOSS OF DATA, OR ANY INDIRECT, SPECIAL, 
355
-INCIDENTAL, OR CONSEQUENTIAL DAMAGES UNDER ANY THEORY 
356
-OF LIABILITY, WHETHER BASED IN CONTRACT, TORT, 
357
-NEGLIGENCE, PRODUCT LIABILITY, OR OTHERWISE.  BECAUSE 
358
-SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OR 
359
-LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL 
360
-DAMAGES, THE PRECEDING LIMITATION MAY NOT APPLY TO YOU.  
361
-VMWARE'S AND ITS LICENSORS' LIABILITY UNDER THIS EULA WILL 
362
-NOT, IN ANY EVENT, REGARDLESS OF WHETHER THE CLAIM IS 
363
-BASED IN CONTRACT, TORT, STRICT LIABILITY, OR OTHERWISE, 
364
-EXCEED THE GREATER OF THE LICENSE FEES YOU PAID FOR THE 
365
-SOFTWARE GIVING RISE TO THE CLAIM OR $5000. THE 
366
-FOREGOING LIMITATIONS SHALL APPLY REGARDLESS OF 
367
-WHETHER VMWARE OR ITS LICENSORS HAVE BEEN ADVISED OF 
368
-THE POSSIBILITY OF SUCH DAMAGES AND REGARDLESS OF 
369
-WHETHER ANY REMEDY FAILS OF ITS ESSENTIAL PURPOSE. 
370
-
371
-9.2	Further Limitations.  VMware's licensors shall have no liability of 
372
-any kind under this EULA and VMware's liability with respect to any third 
373
-party software embedded in the Software shall be subject to Section 9.1 
374
-(Limitation of Liability).  You may not bring a claim under this EULA more 
375
-than eighteen (18) months after the cause of action arises.
376
-
377
-10.	    TERMINATION.  
378
-10.1	EULA Term. The term of this EULA begins on the notice of 
379
-availability for electronic download or delivery of the Software and 
380
-continues until this EULA is terminated in accordance with this Section 10.
381
-10.2	Termination for Breach.  VMware may terminate this EULA 
382
-effective immediately upon written notice to You if: (a) You fail to pay any 
383
-portion of the fees under an applicable Order within ten (10) days after 
384
-receiving written notice from VMware that payment is past due; or (b) You 
385
-breach any other provision of this EULA and fail to cure within thirty (30) 
386
-days after receipt of VMware's written notice thereof. 
387
-10.3	Termination for Insolvency.  VMware may terminate this EULA 
388
-effective immediately upon written notice to You if You: (a) terminate or 
389
-suspend your business; (b) become insolvent, admit in writing Your 
390
-inability to pay Your debts as they mature, make an assignment for the 
391
-benefit of creditors; or become subject to control of a trustee, receiver or 
392
-similar authority; or (c) become subject to any bankruptcy or insolvency 
393
-proceeding.
394
-10.4	Effect of Termination.  Upon VMware's termination of this EULA: 
395
-(a) all Licensed rights to all Software granted to You under this EULA will 
396
-immediately cease; and (b) You must cease all use of all Software, and 
397
-return or certify destruction of all Software and License Keys (including 
398
-copies) to VMware, and return, or if requested by VMware, destroy, any 
399
-related VMware Confidential Information in Your possession or control and 
400
-certify in writing to VMware that You have fully complied with these 
401
-requirements. Any provision will survive any termination or expiration if by 
402
-its nature and context it is intended to survive, including Sections 1 
403
-(Definitions), 2.6 (Open Source Software), 3 (Restrictions; Ownership), 5 
404
-(Records and Audit), 7.2 (Software Disclaimer of Warranty), 9 (Limitation 
405
-of Liability), 10 (Termination), 11 (Confidential Information) and 12 
406
-(General).
407
-
408
-11.	CONFIDENTIAL INFORMATION.  
409
-
410
-11.1	Definition.  "Confidential Information"  means information or 
411
-materials provided by one party ("Discloser") to the other party 
412
-("Recipient") which are in tangible form and labelled "confidential" or the 
413
-like, or, information which a reasonable person knew or should have 
414
-known to be confidential.  The following information shall be considered 
415
-Confidential Information whether or not marked or identified as such:  (a) 
416
-License Keys; (b) information regarding VMware's pricing, product 
417
-roadmaps or strategic marketing plans; and (c) non-public materials 
418
-relating to the Software.
419
-
420
-11.2	Protection.  Recipient may use Confidential Information of 
421
-Discloser; (a) to exercise its rights and perform its obligations under this 
422
-EULA; or (b) in connection with the parties' ongoing business relationship.  
423
-Recipient will not use any Confidential Information of Discloser for any 
424
-purpose not expressly permitted by this EULA, and will disclose the 
425
-Confidential Information of Discloser only to the employees or contractors 
426
-of Recipient who have a need to know such Confidential Information for 
427
-purposes of this EULA and who are under a duty of confidentiality no less 
428
-restrictive than Recipient's duty hereunder.  Recipient will protect 
429
-Confidential Information from unauthorized use, access, or disclosure in 
430
-the same manner as Recipient protects its own confidential or proprietary 
431
-information of a similar nature but with no less than reasonable care.
432
-11.3	Exceptions.  Recipient's obligations under Section 11.2 (Protection) 
433
-with respect to any Confidential Information will terminate if Recipient can 
434
-show by written records that such information:  (a) was already known to 
435
-Recipient at the time of disclosure by Discloser; (b) was disclosed to 
436
-Recipient by a third party who had the right to make such disclosure 
437
-without any confidentiality restrictions; (c) is, or through no fault of 
438
-Recipient has become, generally available to the public; or (d) was 
439
-independently developed by Recipient without access to, or use of, 
440
-Discloser's Information.  In addition, Recipient will be allowed to disclose 
441
-Confidential Information to the extent that such disclosure is required by 
442
-law or by the order of a court of similar judicial or administrative body, 
443
-provided that Recipient notifies Discloser of such required disclosure 
444
-promptly and in writing and cooperates with Discloser, at Discloser's 
445
-request and expense, in any lawful action to contest or limit the scope of 
446
-such required disclosure.
447
-11.4	Data Privacy.  You agree that VMware may process technical and 
448
-related information about Your use of the Software which may include 
449
-internet protocol address, hardware identification, operating system, 
450
-application software, peripheral hardware, and non-personally identifiable 
451
-Software usage statistics to facilitate the provisioning of updates, support, 
452
-invoicing or online services and may transfer such information to other 
453
-companies in the VMware worldwide group of companies from time to 
454
-time. To the extent that this information constitutes personal data, VMware 
455
-shall be the controller of such personal data. To the extent that it acts as a 
456
-controller, each party shall comply at all times with its obligations under 
457
-applicable data protection legislation. 
458
-
459
-12.	GENERAL.
460
-
461
-12.1	Transfers; Assignment.  Except to the extent transfer may not 
462
-legally be restricted or as permitted by VMware's transfer and assignment 
463
-policies, in all cases following the process set forth at 
464
-www.vmware.com/support/policies/licensingpolicies.html, You will not 
465
-assign this EULA, any Order, or any right or obligation herein or delegate 
466
-any performance without VMware's prior written consent, which consent 
467
-will not be unreasonably withheld. Any other attempted assignment or 
468
-transfer by You will be void. VMware may use its Affiliates or other 
469
-sufficiently qualified subcontractors to provide services to You, provided 
470
-that VMware remains responsible to You for the performance of the 
471
-services.
472
-
473
-12.2	Notices.  Any notice delivered by VMware to You under this EULA 
474
-will be delivered via mail, email or fax. 
475
-
476
-12.3	Waiver.  Failure to enforce a provision of this EULA will not 
477
-constitute a waiver.
478
-12.4     Severability.  If any part of this EULA is held unenforceable, the 
479
-validity of all remaining parts will not be affected.
480
-12.5	Compliance with Laws; Export Control; Government 
481
-Regulations. Each party shall comply with all laws applicable to the 
482
-actions contemplated by this EULA. You acknowledge that the Software is 
483
-of United States origin, is provided subject to the U.S. Export 
484
-Administration Regulations, may be subject to the export control laws of 
485
-the applicable territory, and that diversion contrary to applicable export 
486
-control laws is prohibited. You represent that (1) you are not, and are not 
487
-acting on behalf of, (a) any person who is a citizen, national, or resident of, 
488
-or who is controlled by the government of any country to which the United 
489
-States has prohibited export transactions; or (b) any person or entity listed 
490
-on the U.S. Treasury Department list of Specially Designated Nationals 
491
-and Blocked Persons, or the U.S. Commerce Department Denied Persons 
492
-List or Entity List; and (2) you will not permit the Software to be used for, 
493
-any purposes prohibited by law, including, any prohibited development, 
494
-design, manufacture or production of missiles or nuclear, chemical or 
495
-biological weapons. The Software and accompanying documentation are 
496
-deemed to be "commercial computer software" and "commercial computer 
497
-software documentation", respectively, pursuant to DFARS Section 
498
-227.7202 and FAR Section 12.212(b), as applicable.  Any use, 
499
-modification, reproduction, release, performing, displaying or disclosing of 
500
-the Software and documentation by or for the U.S. Government shall be 
501
-governed solely by the terms and conditions of this EULA.
502
-12.6	Construction.  The headings of sections of this EULA are for 
503
-convenience and are not to be used in interpreting this EULA. As used in 
504
-this EULA, the word 'including' means "including but not limited to".
505
-12.7	Governing Law.  This EULA is governed by the laws of the State of 
506
-California, United States of America (excluding its conflict of law rules), 
507
-and the federal laws of the United States. To the extent permitted by law, 
508
-the state and federal courts located in Santa Clara County, California will 
509
-be the exclusive jurisdiction for disputes arising out of or in connection with 
510
-this EULA. The U.N. Convention on Contracts for the International Sale of 
511
-Goods does not apply. 
512
-12.8	Third Party Rights.  Other than as expressly set out in this EULA, 
513
-this EULA does not create any rights for any person who is not a party to 
514
-it, and no person who is not a party to this EULA may enforce any of its 
515
-terms or rely on any exclusion or limitation contained in it. 
516
-12.9	Order of Precedence.  In the event of conflict or inconsistency 
517
-among the Product Guide, this EULA and the Order, the following order of 
518
-precedence shall apply: (a) the Product Guide, (b) this EULA and (c) the 
519
-Order. With respect to any inconsistency between this EULA and an 
520
-Order, the terms of this EULA shall supersede and control over any 
521
-conflicting or additional terms and conditions of any Order, 
522
-acknowledgement or confirmation or other document issued by You. 
523
-12.10  Entire Agreement.  This EULA, including accepted Orders and any 
524
-amendments hereto, and the Product Guide contain the entire agreement 
525
-of the parties with respect to the subject matter of this EULA and 
526
-supersede all previous or contemporaneous communications, 
527
-representations, proposals, commitments, understandings and 
528
-agreements, whether written or oral, between the parties regarding the 
529
-subject matter hereof.  This EULA may be amended only in writing signed 
530
-by authorized representatives of both parties.
531
-12.11  Contact Information.  Please direct legal notices or other 
532
-correspondence to VMware, Inc., 3401 Hillview Avenue, Palo Alto, 
533
-California 94304, United States of America, Attention: Legal Department. 
534
-        </License>
535
-    </EulaSection>
536
-
537
-    <AnnotationSection>
538
-        <Info>Description of the Product</Info>
539
-        <Annotation>This OVA provides a micro installed profile of PhotonOS.
540
-   Default password for root user is changeme.
541
-        </Annotation>
542
-
543
-    </AnnotationSection>
544 1
deleted file mode 100644
... ...
@@ -1,15 +0,0 @@
1
-{
2
-    "hostname": "photon-machine",
3
-    "password": 
4
-        {
5
-            "crypted": false,
6
-            "text": "PASSWORD"
7
-        },
8
-    "type": "micro",
9
-    "size": { "root": "16", "swap": "0" },
10
-    "public_key":"<ssh-key-here>",
11
-    "postinstallscripts": ["ova_micro-custom-patch.sh"],
12
-    "artifacttype": "ova",
13
-    "keeprawdisk": "false"
14
-}
15
-
16 1
deleted file mode 100644
... ...
@@ -1,22 +0,0 @@
1
-.encoding = "UTF-8"
2
-virtualHW.version = "11"
3
-scsi0.present = "TRUE"
4
-scsi0.virtualDev = "pvscsi"
5
-scsi0:0.present = "TRUE"
6
-scsi0:0.fileName = "VMDK_IMAGE"
7
-ethernet0.present = "TRUE"
8
-ethernet0.virtualDev = "vmxnet3"
9
-ethernet0.wakeOnPcktRcv = "FALSE"
10
-ethernet0.addressType = "generated"
11
-ethernet0.linkStatePropagation.enable = "TRUE"
12
-ethernet0.connectionType = "None"
13
-displayName = "Photon OS"
14
-guestOS = "vmware-photon-64"
15
-memsize = "2048"
16
-ide1:0.present = "TRUE"
17
-ide1:0.autodetect = "TRUE"
18
-ide1:0.deviceType = "cdrom-raw"
19
-ide1:0.startConnected = "FALSE"
20
-pciBridge5.present = "FALSE"
21
-pciBridge6.present = "FALSE"
22
-pciBridge7.present = "FALSE"
23 1
deleted file mode 100644
... ...
@@ -1,13 +0,0 @@
1
-{
2
-    "hostname": "photon-ovs",
3
-    "password":
4
-    {
5
-        "crypted": false,
6
-        "text": "ovs"
7
-    },
8
-    "type": "ovs",
9
-    "size": {"root": "16", "swap": "0"},
10
-    "public_key":"<ssh-key-here>",
11
-    "artifacttype": "ova",
12
-    "keeprawdisk": "false"
13
-}
14 1
deleted file mode 100644
... ...
@@ -1,20 +0,0 @@
1
-.encoding = "UTF-8"
2
-virtualHW.version = "13"
3
-scsi0.present = "TRUE"
4
-scsi0.virtualDev = "pvscsi"
5
-scsi0:0.present = "TRUE"
6
-scsi0:0.fileName = "VMDK_IMAGE"
7
-ethernet0.present = "TRUE"
8
-ethernet0.virtualDev = "vmxnet3"
9
-ethernet0.wakeOnPcktRcv = "FALSE"
10
-ethernet0.addressType = "generated"
11
-ethernet0.linkStatePropagation.enable = "TRUE"
12
-ethernet0.connectionType = "None"
13
-displayName = "Photon OS"
14
-guestOS = "vmware-photon-64"
15
-memsize = "2048"
16
-ide1:0.present = "TRUE"
17
-ide1:0.autodetect = "TRUE"
18
-ide1:0.deviceType = "cdrom-raw"
19
-ide1:0.startConnected = "FALSE"
20
-vmxnet3.rev.30 = "FALSE"
21 1
deleted file mode 100755
... ...
@@ -1,3 +0,0 @@
1
-#!/bin/bash
2
-echo -e "changeme\nchangeme" | passwd root
3
-chage -d 0 root
4 1
deleted file mode 100644
... ...
@@ -1,108 +0,0 @@
1
-          <vmw:ExtraConfig ovf:required="false" vmw:key="uefi.secureBoot.enabled" vmw:value="TRUE"/>
2
-        </VirtualHardwareSection>
3
- 	<ProductSection> 
4
- 		<Info>Information about the installed software</Info> 
5
- 		<Product>Photon OS</Product> 
6
- 		<Vendor>VMware Inc.</Vendor> 
7
- 		<Version>3.0</Version> 
8
- 		<FullVersion>3.0</FullVersion> 
9
- 	</ProductSection>
10
-	<EulaSection>
11
-        <Info>End User License Agreement</Info>
12
-        <License msgid="eula">
13
-	                           VMWARE, INC. 
14
-                         BETA LICENSE AGREEMENT
15
-
16
-Note: BY CLICKING “I AGREE,” ACCESSING, DOWNLOADING, INSTALLING, UPLOADING, COPYING OR USING THE BETA SOFTWARE, YOU CONCLUDE AND AGREE TO THIS BETA LICENSE AGREEMENT (“AGREEMENT”) IN A LEGALLY BINDING MANNER WITH VMWARE, INC., 3401 HILLVIEW AVENUE, PALO ALTO, CA 94304, USA (“VMware”). IF YOU HAVE SPECIFIED IN CONNECTION WITH THE REGISTRATION PROCESS FOR THIS SOFTWARE BETA TEST PROGRAM THAT YOU ARE ACTING ON BEHALF OF A COMPANY OR OTHER ORGANIZATION, YOU REPRESENT THAT YOU ARE AUTHORIZED TO LEGALLY BIND SUCH ORGANIZATION AND THAT YOU CONCLUDE THE AGREEMENT ON BEHALF OF SUCH ORGANIZATION. IN THE FOLLOWING, THE TERMS “YOU” AND “LICENSEE” SHALL REFER, JOINTLY AND SEVERALLY, TO YOU INDIVIDUALLY AND ANY ORGANIZATION ON WHOSE BEHALF YOU ACT.
17
-
18
-IF YOU DO NOT AGREE TO THE TERMS OF THIS BETA LICENSE AGREEMENT, THEN DO *NOT* CLICK “I AGREE,” ACCESS, DOWNLOAD, INSTALL, UPLOAD, COPY OR USE THE BETA SOFTWARE.
19
-
20
-1.	DEFINITIONS.
21
-
22
-       (a)  “Beta Software” shall mean the beta version of VMware’s software and the media and Documentation provided by VMware to Licensee and for which Licensee is granted a use license pursuant to this Agreement.  The Beta Software will be provided in object form only.
23
-       
24
-       (b)  “Documentation” shall mean the printed or online written reference material furnished to Licensee in conjunction with the Beta Software, including, without limitation, instructions, beta testing guidelines, and end user guides.
25
-       
26
-       (c)  “Intellectual Property Rights” shall mean all intellectual property rights, including, without limitation, patent, copyright, trademark, and trade secret, recognized in any jurisdiction worldwide, whether perfected or not, and any similar and other proprietary rights.
27
-       
28
-       (d)  “Open Source Software” means code that is provided with the Beta Software and identified as open source code or otherwise as being subject to open source license terms.
29
-       
30
-       (e)  “Updates” shall mean a modification, error correction, bug fix, new release, or other update to or for the Beta Software.
31
-
32
-2.	LICENSE GRANT, USE AND OWNERSHIP.
33
-
34
-	(a)  Limited License.  Subject to the terms and conditions of this Agreement, VMware grants to Licensee a non-exclusive, revocable (at any time and for any reason, at VMware’s sole discretion), royalty-free, non-transferable, non-assignable license (without the right to sublicense):
35
-
36
-             (i) to use the Beta Software in accordance with the Documentation solely for purposes of (A) internal testing and evaluation to determine whether or not to license generally available commercial versions of the Beta Software if such versions ever become available, and (B) internal development to create interoperability between the Beta Software and Licensee products, 
37
-            
38
-            (ii) to use the Documentation provided with the Beta Software in support of Licensee’s authorized use of the Beta Software, and
39
-           
40
-            (iii) to copy Beta Software for Licensee’s archival or backup purposes, provided that all titles and trademarks, copyright, and restricted rights notices are reproduced on such copies.
41
-       
42
-       (b)  Evaluation Feedback. The purpose of this limited license is the testing and evaluation of the Beta Software and Documentation and development by Licensee of Licensee products that interoperate with the Beta Software.  In furtherance of this purpose, Licensee shall provide feedback to VMware concerning the functionality and performance of the Beta Software from time to time as reasonably requested by VMware, including, without limitation, identifying potential errors and improvements (collectively the “Feedback”).  Licensee will provide Feedback in a manner that is mutually agreeable to the parties.  VMware may use Feedback, without restriction in any manner now known or in the future conceived, to improve or enhance its products and, accordingly, and you hereby grant to VMware a non-exclusive, perpetual, irrevocable, royalty-free, transferable, worldwide right and license, with the right to sublicense (i) to use, reproduce, disclose, distribute, modify, prepare derivative works of and otherwise exploit the Feedback and other information you provide to VMware under this Agreement, and (ii) to make, use, sell, offer to sell, import and export any product or service that incorporates the Feedback and other information you provide to VMware under this Agreement.
43
-       
44
-       (c)  Restrictions.  Licensee shall not disclose, provide, or disseminate in any manner the Beta Software (including the Documentation) or Confidential Information to any third party, including but not limited to its partners, affiliates or subsidiaries.  Except to the extent contrary to any applicable laws, Licensee will not, and will not permit any third party to, sublicense, rent, copy, modify, create derivative works of, translate, reverse engineer, decompile, disassemble, or otherwise reduce to human perceivable form any portion of the Beta Software or accompanying Documentation.  Without limiting the generality of the foregoing, Licensee shall not use the Beta Software for Licensee’s product development or any other commercial purpose, including, but not limited to sales or marketing activities, except as expressly permitted in this Agreement.  The Beta Software and all performance data and test results, including without limitation, benchmark test results (collectively “Performance Data”), relating  to the Beta Software are the Confidential Information of VMware, and will be treated in accordance with the terms of Section 4 of this Agreement.  Accordingly, Licensee shall not publish or disclose to any third party any Performance Data relating to the Beta Software.  
45
-
46
-       (d)  Ownership.  VMware shall own and retain all right, title and interest in and to the Intellectual Property Rights in the Beta Software and any derivative works thereof, subject only to the limited license expressly set forth in Section 2(a) hereof.  Licensee does not acquire any other rights, express or implied, in the Beta Software.  ALL RIGHTS NOT EXPRESSLY GRANTED HEREUNDER ARE RESERVED TO VMWARE. 
47
-       
48
-       (e)  No Support Services.  VMware is under no obligation to support the Beta Software in any manner or to provide any Updates to Licensee.  In the event VMware, in its sole discretion, supplies any Update to Licensee, the Update shall be deemed Beta Software under this Agreement and shall be subject to the terms and conditions of this Agreement.
49
-       
50
-	(f)  Third-Party Software.  The Beta Software may enable a computer to run multiple instances of third-party guest operating systems and application programs.  Licensee acknowledges that Licensee is responsible for obtaining any licenses necessary to operate any third-party software, including guest operating systems and application programs.
51
-
52
-       (g)  Open Source Software.  Except for Sections 5, 6, and 7, the terms and conditions of this Agreement shall not apply to any Open Source Software accompanying the Beta Software.  Any such Open Source Software is provided under the terms of the applicable open source license agreement or copyright notice accompanying such Open Source Software or included in the open source licenses file accompanying the Beta Software. 
53
-       
54
-3.	TERM AND TERMINATION.  Unless otherwise terminated as specified under this Agreement, Licensee’s rights with respect to the Beta Software will terminate upon the earlier of (a) the initial commercial release by VMware of a generally available version of the Beta Software or (b) automatic expiration of the Beta Software based on the system date.  Either party may terminate this Agreement at any time for any reason or no reason by providing the other party advance written notice thereof.  Licensee agrees that this Agreement will automatically terminate without notice in the event Licensee discloses the Beta Software in breach of Section 4 (Confidentiality) below. Upon any expiration or termination of this Agreement, the rights and licenses granted to Licensee under this Agreement shall immediately terminate, and Licensee shall immediately cease using, and will destroy or render practically inaccessible the Beta Software, Documentation, and all other tangible items in Licensee’s possession or control that contain Confidential Information.  The rights and obligations of the parties set forth in Sections 2(b), 2(c), 2(d), 2(e), 2(f), 2(g), 3, 4, 5, 6, 7 and 8 survive termination or expiration of this Agreement for any reason.  
55
-
56
-4.	CONFIDENTIALITY.  
57
-
58
-       (a) "Confidential Information" shall mean the Beta Software, all information regarding the Beta Software (including any trade secrets, know-how, inventions, techniques, processes, and algorithms embodied in the Beta Software), Documentation, Performance Data, any Updates, VMware products, product roadmaps, and other technical, business, financial and product development plans, forecasts and strategies, and other information provided by VMware to Licensee under this Agreement, whether disclosed orally, in writing, or by examination or inspection, other than information that Licensee can demonstrate (i) was already known to Licensee, other than under an obligation of confidentiality, at the time of disclosure; (ii) was generally available in the public domain at the time of disclosure to Licensee; (iii) became generally available in the public domain after disclosure other than through any act or omission of Licensee; (iv) was subsequently lawfully disclosed to Licensee by a third party without any obligation of confidentiality; or (v) was independently developed by Licensee without use of or reference to any information or materials disclosed by VMware or its suppliers.  If Licensee wishes to disclose to VMware any information under this Agreement that Licensee considers proprietary or confidential to Licensee (“Licensee Information”), then Licensee agrees such disclose will be governed by a separate non-disclosure agreement (“NDA”) by and between the parties.   If Licensee is required to disclose Confidential Information by applicable law or court order, Licensee shall notify VMware of the required disclosure promptly in writing and shall cooperate with VMware in any lawful action to contest or limit the scope of the required disclosure.  Licensee shall not use any Confidential Information for any purpose other than as expressly authorized under this Agreement.  In no event shall Licensee use the Beta Software or any Confidential Information to develop, manufacture, market, sell, or distribute any product or service, including any VMware products except as expressly set forth in this Agreement.  Licensee shall not disclose any Confidential Information to any third party. Without limiting the foregoing, Licensee shall use at least the same degree of care that it uses to prevent the disclosure of its own confidential information of like importance, but in no event less than reasonable care, to prevent the disclosure of such Confidential Information.
59
-       
60
-       (b)  Additional Confidentiality Restrictions for Highly Confidential Beta Software.  For certain Beta Software designated by VMware in writing as highly confidential (“Highly Confidential Beta Software”), Licensee agrees that the following, additional confidentiality obligations and restrictions will apply:
61
-       
62
-            (i)  Licensee shall limit dissemination of Highly Confidential Beta Software and related information concerning product features, future technologies and roadmaps only to Information Technology teams and/or software/solutions development teams of Licensee approved in writing by VMware, and only to individuals on such teams on a need-to-know basis and solely for purposes expressly authorized under this Agreement.  For clarity and without limiting the generality of the foregoing, Licensee shall not disseminate any Highly Confidential Beta Software to Licensee's sales and marketing field organizations.  Licensee will assign an employee who will be primarily responsible for ensuring Licensee’s full compliance with the terms described in this Section 4(b) herein. 
63
-             
64
-            (ii)  Improper Disclosure of Highly Confidential Beta Software.  Licensee acknowledges that damages due to Licensee’s improper disclosure of Highly Confidential Beta Software or related information concerning product features, future technologies and roadmaps may be irreparable and that monetary damages would be inadequate to compensate VMware for any breach of this Agreement.  In the event that VMware reasonably believes that Licensee has disseminated Highly Confidential Beta Software or related information concerning product features, future technologies and roadmaps to an unauthorized party, Licensee will be immediately removed from VMware’s Beta Software program and will not be permitted to participate in any VMware Beta Software program in the future.  Additionally, all rights and licenses granted to Licensee under this Agreement shall immediately terminate in accordance with Section 3 herein (Term and Termination), and (b) in addition to all other remedies available in law or otherwise, VMware is entitled to seek equitable relief, including injunction and preliminary injunction against the threatened breach of this Agreement or the continuation of any such breach. 
65
-       
66
-5.	LIMITATION OF LIABILITY.  IT IS UNDERSTOOD THAT THE BETA SOFTWARE IS PROVIDED WITHOUT CHARGE FOR THE PURPOSES EXPRESSLY PERMITTED UNDER THIS AGREEMENT.  ACCORDINGLY, TO THE FULLEST EXTENT PERMITTED BY LAW, BUT SUBJECT ALWAYS TO THIS SECTION 5, THE TOTAL LIABILITY OF VMWARE AND ITS LICENSORS ARISING OUT OF OR RELATED TO THIS AGREEMENT SHALL NOT EXCEED $100.00.  TO THE FULLEST EXTENT PERMITTED BY LAW, IN NO EVENT SHALL VMWARE OR ITS LICENSORS HAVE LIABILITY FOR ANY INDIRECT, INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, OR LOSS OF BUSINESS INFORMATION, HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY (INCLUDING WITHOUT LIMITATION, TORT, STATUTE, CONTRACT OR OTHER), EVEN IF VMWARE AND ITS LICENSORS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.  THESE LIMITATIONS SHALL APPLY NOTWITHSTANDING ANY FAILURE OF ESSENTIAL PURPOSE OF ANY LIMITED REMEDY.  THE PARTIES ACKNOWLEDGE THAT THE VARIOUS CONSIDERATIONS DUE TO VMWARE IN ACCORDANCE WITH THE TERMS OF THIS AGREEMENT WERE TAKEN INTO ACCOUNT IN DETERMINING THE LIMITATION OF LIABILITY SET FORTH IN THIS SECTION 5. LICENSEE ACKNOWLEDGES AND AGREES THIS LIMITATION IS AN ESSENTIAL ELEMENT OF THIS AGREEMENT AND THAT VMWARE WOULD NOT ENTER INTO THIS AGREEMENT WITHOUT THESE LIMITATIONS ON ITS LIABILITY.
67
-
68
-6.	WARRANTY DISCLAIMER.  IT IS UNDERSTOOD THAT THE BETA SOFTWARE, OPEN SOURCE SOFTWARE, DOCUMENTATION, AND ANY UPDATES MAY CONTAIN ERRORS AND ARE PROVIDED FOR THE PURPOSES EXPRESSLY PERMITTED UNDER THIS AGREEMENT.  TO THE FULLEST EXTENT PERMITTED BY LAW, AND SUBJECT TO SECTION 5, THE BETA SOFTWARE, THE OPEN SOURCE SOFTWARE, THE DOCUMENTATION, AND ANY UPDATES ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE.  TO THE FULLEST EXTENT PERMITTED BY LAW, AND SUBJECT TO SECTION 5, VMWARE AND ITS LICENSORS SPECIFICALLY DISCLAIM ALL IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE.  Licensee acknowledges that VMware has not publicly announced the availability of the Beta Software, that such Beta Software may contain features currently under development, that VMware has not promised or guaranteed to Licensee that such Beta Software will be announced or made available to anyone in the future, that VMware has no express or implied obligation to Licensee to announce or introduce the Beta Software, that VMware may not introduce a product similar to or compatible with the Beta Software, and that any version number (if any) referenced is subject to change and does not in any way represent VMware’s commitment to release any product in the future. Accordingly, Licensee acknowledges that any research or development that it performs regarding the Beta Software or any product associated with the Beta Software is done entirely at Licensee’s own risk.  Specifically, the Beta Software may contain features, functionality or modules that may not be included in the generally available commercial version of the Beta Software, if released, or that will be marketed separately for additional fees.
69
-
70
-7.	OTHER PROVISIONS.
71
-
72
-       (a)  Governing Law, Injunctive Relief and Legal Costs. 
73
-        
74
-           (aa) Choice of Law. This Agreement and any dispute arising out of or related to this Agreement or the Beta Software (“Dispute”) will be governed by California law, without regard to its choice of law principles.  The United Nations Convention for the International Sale of Goods shall not apply.
75
-           
76
-           (bb) Injunctive Relief.  Either party may, at its sole discretion, seek preliminary judicial relief in any court of competent jurisdiction (including, but not limited to, preliminary injunctive relief). Also, the provisions of this Section 7(a) may be enforced by any court of competent jurisdiction.
77
-           
78
-        (b)  Export Regulations.  The Beta Software is of United States origin and is provided subject to the U.S. Export Administration Regulations.  Diversion contrary to U.S. law is prohibited.  Without limiting the foregoing, you agree that (1) you are not, and are not acting on behalf of, any person who is a citizen, national, or resident of, or who is controlled by the government of, Cuba, Iran, North Korea, Sudan, or Syria, or any other country to which the United States has prohibited export transactions; (2) you are not, and are not acting on behalf of, any person or entity listed on the U.S. Treasury Department list of Specially Designated Nationals and Blocked Persons, or the U.S. Commerce Department Denied Persons List or Entity List; and (3) you will not use the Beta Software for, and will not permit the Beta Software to be used for, any purposes prohibited by law, including, without limitation, for any prohibited development, design, manufacture or production of missiles or nuclear, chemical or biological weapons.  U.S. Export Control Classification Numbers (ECCN’s) may be found at VMware help page: http://www.vmware.com/help/export-control.
79
-       
80
-       (c)  Modification.  This is the entire agreement between the parties relating to the subject matter hereof and to the fullest extent permitted by law, all other terms, representations, negotiations, arrangements or understandings are rejected.  This Agreement supersedes and replaces any other agreements, representations, negotiations, arrangements or understandings between the parties and Licensee hereby waives any form requirements that may be contained in previous agreements and agrees that this Agreement shall take precedent with respect to its subject matter.  No party has entered into this Agreement relying on any representations made by or on behalf of the other, other than those expressly made in this Agreement.  No waiver or modification of this Agreement shall be valid unless in writing signed by each party.  
81
-       
82
-       (d)  Language of Contract.  The parties have required that this Agreement and all documents relating thereto be drawn up in English. Les parties ont demandé que cette convention ainsi que tous les documents que s'y attachent soient rédigés en anglais.
83
-       (e) Severability.  If any provision of this Agreement is held to be illegal, invalid or unenforceable, the provision will be enforced to the maximum extent permissible so as to effect the intent of the parties, and the remaining provisions of this Agreement will remain in full force and effect.  
84
-
85
-       (f) Waivers.   Any waiver of these terms must be in writing and signed by the waiving party to be effective. 
86
-       
87
-       (g) Data Collection and Privacy.  
88
-       
89
-          (i) Consent for Collection and Use of Technical Data. You agree that VMware may periodically collect, process and store technical and related information about your device, system, application, peripherals and your use of the Beta Software, including without limitation: internet protocol address, hardware identification, operating system, application software, peripheral hardware, number of active plugins and software development kits, the successful installation and launch of Beta Software, and  Beta Software usage statistics (collectively, “Technical Data”).  VMware will use Technical Data for internal statistical and analytical purposes to facilitate support, invoicing or online services, the provisioning of updates, and the development of VMware products and services. VMware may transfer Technical Data to other companies in the VMware worldwide group of companies from time to time. 
90
-
91
-           (ii) Log Files. You acknowledge that correspondence and log files generated in conjunction with a request for support services may contain sensitive, confidential or personal information. You are solely responsible for taking the steps necessary to protect such data, including obfuscating the logs or otherwise guarding such information prior to sending it to VMware.
92
-           
93
-       (h) Independent Parties.  The parties are independent.  Nothing in this Agreement shall be construed to create a partnership, joint venture, contractor, or agency relationship between the parties.  
94
-       
95
-8.	ASSIGNMENT.  Licensee shall not and cannot assign this Agreement or any rights or obligations hereunder, directly or indirectly, by operation of law, merger, acquisition of stock or assets, or otherwise without the prior written consent of VMware.   Any attempted assignment or transfer in violation of the foregoing will be null and void.  Subject to the foregoing, this Agreement shall inure to the benefit of and be binding upon the parties and their respective successors and permitted assigns.
96
-
97
-9. 	CONTACT INFORMATION.  If you have any questions about this Agreement, please direct all correspondence to: VMware, Inc., 3401 Hillview Avenue, Palo Alto, CA 94304, United States of America.  VMware is a trademark of VMware, Inc. and is registered in the U.S. and numerous other countries. 
98
-
99
-        </License>
100
-    </EulaSection>
101
-
102
-    <AnnotationSection>
103
-        <Info>Description of the Product</Info>
104
-        <Annotation>This OVA provides a UEFI secure boot enabled minimal installed profile of PhotonOS.
105
-   Default password for root user is changeme. However user will be prompted to change the password during first login.
106
-        </Annotation>
107
-
108
-    </AnnotationSection>
109 1
deleted file mode 100644
... ...
@@ -1,16 +0,0 @@
1
-{
2
-	"hostname": "photon-machine",
3
-	"password": 
4
-		{
5
-			"crypted": false,
6
-			"text": "PASSWORD"
7
-		},
8
-	"type": "uefi",
9
-    "size": {"root": "16", "swap": "0"},
10
-    "boot":"efi",
11
-    "public_key":"<ssh-key-here>",
12
-    "customartifacts": { "postinstallscripts": ["ova_uefi-custom-patch.sh"] },
13
-    "artifacttype": "ova",
14
-    "keeprawdisk": "false"
15
-}
16
-
17 1
deleted file mode 100644
... ...
@@ -1,22 +0,0 @@
1
-.encoding = "UTF-8"
2
-virtualHW.version = "13"
3
-scsi0.present = "TRUE"
4
-scsi0.virtualDev = "pvscsi"
5
-scsi0:0.present = "TRUE"
6
-scsi0:0.fileName = "VMDK_IMAGE"
7
-ethernet0.present = "TRUE"
8
-ethernet0.virtualDev = "vmxnet3"
9
-ethernet0.wakeOnPcktRcv = "FALSE"
10
-ethernet0.addressType = "generated"
11
-ethernet0.linkStatePropagation.enable = "TRUE"
12
-ethernet0.connectionType = "None"
13
-displayName = "Photon OS"
14
-guestOS = "vmware-photon-64"
15
-memsize = "2048"
16
-ide1:0.present = "TRUE"
17
-ide1:0.autodetect = "TRUE"
18
-ide1:0.deviceType = "cdrom-raw"
19
-ide1:0.startConnected = "FALSE"
20
-firmware = "efi"
21
-uefi.secureBoot.enabled = "TRUE"
22
-vmxnet3.rev.30 = "FALSE"
23 1
deleted file mode 100755
... ...
@@ -1,4 +0,0 @@
1
-#!/bin/bash
2
-# Change the max password days to 99999
3
-cat /etc/shadow | cut -d: -f1 | xargs -I {} chage -I -1 -m 0 -M 99999 -E -1 -W 7 {}
4
-sed -i 's/^PASS_MAX_DAYS.*/PASS_MAX_DAYS   99999/' /etc/login.defs
5 1
deleted file mode 100755
... ...
@@ -1,7 +0,0 @@
1
-#!/bin/bash
2
-
3
-echo -e "changeme\nchangeme" | passwd root
4
-chage -d 0 -M 999 root
5
-
6
-#mouting should start here to modify /etc/fstab
7
-
8 1
deleted file mode 100644
... ...
@@ -1,16 +0,0 @@
1
-{
2
-	"hostname": "photon-machine",
3
-	"password":
4
-		{
5
-			"crypted": false,
6
-			"text": "PASSWORD"
7
-		},
8
-	"type": "uefi",
9
-    "size": {"root": "16", "swap": "0"},
10
-    "boot":"efi",
11
-    "public_key":"<ssh-key-here>",
12
-    "postinstallscripts": ["raw-uefi-custom-patch.sh"],
13
-    "artifacttype": "tgz",
14
-    "keeprawdisk": "true"
15
-}
16
-
17 1
deleted file mode 100755
18 2
Binary files a/support/cloud-image-builder/rpi3/esp/bootcode.bin and /dev/null differ
19 3
deleted file mode 100755
... ...
@@ -1,27 +0,0 @@
1
-# Based on documentation: http://elinux.org/RPiconfig
2
-
3
-# Set 256 MB for the GPU and remaining for ARM CPU
4
-gpu_mem=256
5
-
6
-# Enable camera module
7
-start_x=1
8
-
9
-# Force monitor to HDMI mode
10
-hdmi_drive=2
11
-
12
-# Chainload U-Boot -> grub-efi -> Linux
13
-kernel=u-boot.bin
14
-# Without uart u-boot will not boot
15
-enable_uart=1
16
-
17
-# Speed up the boot. Use turbo mode for first 45 seconds
18
-initial_turbo=45
19
-
20
-# Enable ARMv8
21
-arm_control=0x200
22
-
23
-# Disable warning overlay and allow turbo when low-voltage is present
24
-avoid_warnings=2
25
-
26
-# Enable hardware graphic acceleration
27
-dtoverlay=vc4-kms-v3d
28 1
deleted file mode 100755
29 2
Binary files a/support/cloud-image-builder/rpi3/esp/fixup.dat and /dev/null differ
30 3
deleted file mode 100644
31 4
Binary files a/support/cloud-image-builder/rpi3/esp/fixup_x.dat and /dev/null differ
32 5
deleted file mode 100755
33 6
Binary files a/support/cloud-image-builder/rpi3/esp/start.elf and /dev/null differ
34 7
deleted file mode 100755
35 8
Binary files a/support/cloud-image-builder/rpi3/esp/start_x.elf and /dev/null differ
36 9
deleted file mode 100755
... ...
@@ -1 +0,0 @@
1
-bootaa64
2 1
deleted file mode 100755
... ...
@@ -1,60 +0,0 @@
1
-#!/bin/bash
2
-#################################################
3
-#       Title:  mk-prepare-system               #
4
-#        Date:  2014-11-26                      #
5
-#     Version:  1.0                             #
6
-#      Author:  mbassiouny@vmware.com           #
7
-#     Options:                                  #
8
-#################################################
9
-#   Overview
10
-#       Preparing the system to install photon
11
-#   End
12
-#
13
-set -o errexit      # exit if error...insurance ;
14
-set -o nounset      # exit if variable not initalized
15
-set +h          # disable hashall
16
-source config.inc
17
-source function.inc
18
-PRGNAME=${0##*/}    # script name minus the path
19
-
20
-LOGFILE=/var/log/"${PRGNAME}-${LOGFILE}"    #   set log file name
21
-#LOGFILE=/dev/null      #   uncomment to disable log file
22
-
23
-[ ${EUID} -eq 0 ]   || fail "${PRGNAME}: Need to be root user: FAILURE"
24
-[ -z ${BUILDROOT} ] && fail "${PRGNAME}: Build root not set: FAILURE"
25
-
26
-cd ${BUILDROOT} || fail "${PRGNAME}: Change directory: ${BUILDROOT}: FAILURE"
27
-
28
-#
29
-#   Setup the filesystem for chapter 06
30
-#
31
-if [[   $# -gt 0 ]] && [[ $1 == 'install' ]]; then
32
-    mkdir -p ${BUILDROOT}/var/lib/rpm
33
-    mkdir -p ${BUILDROOT}/cache/tdnf
34
-    rpm   --root ${BUILDROOT} --initdb
35
-    tdnf install filesystem --installroot ${BUILDROOT} --nogpgcheck --assumeyes
36
-else
37
-    RPMPKG="$(find RPMS -name 'filesystem-[0-9]*.rpm' -print)"
38
-    [ -z ${RPMPKG} ] && fail "  Filesystem rpm package missing: Can not continue"
39
-    run_command "   Installing filesystem" "rpm -Uvh --nodeps --root ${BUILDROOT} --dbpath /var/lib/rpm ${RPMPKG}" "${LOGFILE}"
40
-fi
41
- 
42
-#   Ommited in the filesystem.spec file - not needed for booting
43
-[ -e ${BUILDROOT}/dev/console ] || mknod -m 600 ${BUILDROOT}/dev/console c 5 1
44
-[ -e ${BUILDROOT}/dev/null ]    || mknod -m 666 ${BUILDROOT}/dev/null c 1 3
45
-[ -e ${BUILDROOT}/dev/random ]  || mknod -m 444 ${BUILDROOT}/dev/random c 1 8
46
-[ -e ${BUILDROOT}/dev/urandom ] || mknod -m 444 ${BUILDROOT}/dev/urandom c 1 9
47
-
48
-if [[   $# -eq 0 ]] || [[ $1 != 'install' ]]; then
49
-    chown -R 0:0 ${BUILDROOT}/* || :
50
-fi
51
-
52
-#
53
-#   Mount kernel filesystem
54
-#
55
-#if ! mountpoint ${BUILDROOT}/dev    >/dev/null 2>&1; then mount --rbind /dev ${BUILDROOT}/dev; mount --make-rslave ${BUILDROOT}/dev; fi
56
-#if ! mountpoint ${BUILDROOT}/proc   >/dev/null 2>&1; then mount -t proc proc ${BUILDROOT}/proc; fi
57
-#if ! mountpoint ${BUILDROOT}/sys    >/dev/null 2>&1; then mount -t sysfs sysfs ${BUILDROOT}/sys; fi
58
-#if ! mountpoint ${BUILDROOT}/run    >/dev/null 2>&1; then mount -t tmpfs tmpfs ${BUILDROOT}/run; fi
59
-#if [ -h ${BUILDROOT}/dev/shm ];          then mkdir -pv ${BUILDROOT}/$(readlink ${BUILDROOT}/dev/shm); fi
60
-exit 0
61 1
deleted file mode 100755
... ...
@@ -1,112 +0,0 @@
1
-#!/bin/bash
2
-#################################################
3
-#       Title:  mk-setup-grub                   #
4
-#        Date:  2014-11-26                      #
5
-#     Version:  1.0                             #
6
-#      Author:  sharathg@vmware.com             #
7
-#     Options:                                  #
8
-#################################################
9
-#    Overview
10
-#        This is a precursor for the vmware build system.
11
-#        This assumes that an empty hard disk is attached to the build VM.
12
-#        The path to this empty disk is specified in the HDD variable in config.inc
13
-#    End
14
-#
15
-
16
-grub_efi_install()
17
-{
18
-    BOOT_PARTITION=/dev/mapper/`basename ${HDD}`p1
19
-#    mount -t vfat $BOOT_PARTITION $BUILDROOT/boot/esp
20
-    # Raspberry prorpiaetary GPU bootloader (1st stage)
21
-    cp -r esp/* $BUILDROOT/boot/esp/
22
-    # u-boot (2nd stage) was copied earlier by installer.py
23
-    # grub efi bootloader (3rd stage)
24
-    mkdir -p $BUILDROOT/boot/esp/EFI/BOOT/
25
-    cp EFI_aarch64/BOOT/* $BUILDROOT/boot/esp/EFI/BOOT/
26
-    mkdir -p $BUILDROOT/boot/esp/boot/grub2
27
-    cat > $BUILDROOT/boot/esp/boot/grub2/grub.cfg << EOF
28
-search -n -u ${BOOT_UUID} -s
29
-configfile ${BOOT_DIRECTORY}grub2/grub.cfg
30
-EOF
31
-#    umount $BUILDROOT/boot/esp
32
-}
33
-
34
-set -o errexit        # exit if error...insurance ;)
35
-set -o nounset        # exit if variable not initalized
36
-set +h            # disable hashall
37
-PRGNAME=${0##*/}    # script name minus the path
38
-source config.inc        #    configuration parameters
39
-source function.inc        #    commonn functions
40
-LOGFILE=/var/log/"${PRGNAME}-${LOGFILE}"    #    set log file name
41
-ARCH=$(uname -m)    # host architecture
42
-[ ${EUID} -eq 0 ]    || fail "${PRGNAME}: Need to be root user: FAILURE"
43
-> ${LOGFILE}        #    clear/initialize logfile
44
-
45
-# Check if passing a HHD and partition
46
-if [ $# -eq 6 ] ; then
47
-    BOOTMODE=$1
48
-    HDD=$2
49
-    ROOT_PARTITION_PATH=$3
50
-    BOOT_PARTITION_PATH=$4
51
-    BOOT_DIRECTORY=$5
52
-    BOOT_PARTITION_NUMBER=$6
53
-fi
54
-
55
-#
56
-#    Install grub2.
57
-#
58
-BOOT_UUID=$(blkid -s UUID -o value $BOOT_PARTITION_PATH)
59
-
60
-mkdir -p $BUILDROOT/boot/grub2
61
-ln -sfv grub2 $BUILDROOT/boot/grub
62
-
63
-grub_efi_install
64
-
65
-rm -rf ${BUILDROOT}/boot/grub2/fonts
66
-cp boot/ascii.pf2 ${BUILDROOT}/boot/grub2/
67
-mkdir -p ${BUILDROOT}/boot/grub2/themes/photon
68
-cp boot/splash.png ${BUILDROOT}/boot/grub2/themes/photon/photon.png
69
-cp boot/terminal_*.tga ${BUILDROOT}/boot/grub2/themes/photon/
70
-cp boot/theme.txt ${BUILDROOT}/boot/grub2/themes/photon/
71
-
72
-EXTRA_PARAMS="rootwait rw console=ttyS0,115200n8 console=tty0 cma=256M"
73
-
74
-cat > $BUILDROOT/boot/grub2/grub.cfg << EOF
75
-# Begin /boot/grub2/grub.cfg
76
-
77
-set default=0
78
-set timeout=2
79
-loadfont ${BOOT_DIRECTORY}grub2/ascii.pf2
80
-
81
-insmod all_video
82
-insmod gfxterm
83
-insmod png
84
-insmod ext2
85
-
86
-set gfxmode="800x600"
87
-gfxpayload=keep
88
-
89
-terminal_output gfxterm
90
-
91
-set theme=${BOOT_DIRECTORY}grub2/themes/photon/theme.txt
92
-load_env -f ${BOOT_DIRECTORY}photon.cfg
93
-if [ -f  ${BOOT_DIRECTORY}systemd.cfg ]; then
94
-    load_env -f ${BOOT_DIRECTORY}systemd.cfg
95
-else
96
-    set systemd_cmdline=net.ifnames=0
97
-fi
98
-set rootpartition=/dev/mmcblk0p2
99
-
100
-menuentry "Photon" {
101
-    linux ${BOOT_DIRECTORY}\$photon_linux root=\$rootpartition \$photon_cmdline \$systemd_cmdline $EXTRA_PARAMS
102
-    if [ -f ${BOOT_DIRECTORY}\$photon_initrd ]; then
103
-        initrd ${BOOT_DIRECTORY}\$photon_initrd
104
-    fi
105
-}
106
-# End /boot/grub2/grub.cfg
107
-EOF
108
-
109
-#Cleanup the workspace directory
110
-rm -rf "$BUILDROOT"/tools
111
-rm -rf "$BUILDROOT"/RPMS
112
-
113 1
deleted file mode 100755
... ...
@@ -1,121 +0,0 @@
1
-#!/bin/bash
2
-#################################################
3
-#	Title:	mk-setup-vmdk			#
4
-#        Date:	2014-11-14   	 		#
5
-#     Version:	1.0				#
6
-#      Author:	dthaluru@vmware.com		#
7
-#     Options:					#
8
-#################################################
9
-#	Overview
10
-#		Creating hard disk with photon on it
11
-#	End
12
-#
13
-set -o errexit		# exit if error...insurance ;)
14
-set -o nounset		# exit if variable not initalized
15
-set +h			# disable hashall
16
-PRGNAME=${0##*/}	# script name minus the path
17
-source config.inc		#	configuration parameters
18
-source function.inc		#	commonn functions
19
-LOGFILE="/var/log/${PRGNAME}-${LOGFILE}"	#	set log file name
20
-LFS_DISK="/mnt/photon-disk"
21
-[ ${EUID} -eq 0 ]	|| die "${PRGNAME}: Need to be root user: FAILURE"
22
-> ${LOGFILE}		#	clear/initialize logfile
23
-
24
-echo -e "Setting up the disk...\n"
25
-set -x
26
-LFS_OPTION=""
27
-VMDK_IMAGE_NAME=mydisk.vmdk
28
-ROOT_PARTITION_SIZE=1
29
-SWAP_PARTITION_SIZE=0
30
-BOOT_FIRM_WARE="bios"
31
-
32
-while [[ $# > 0 ]]
33
-do
34
-	key="$1"
35
-	shift
36
- 
37
-	case $key in
38
-		-rp|--ROOT_PARTITION_SIZE)
39
-		ROOT_PARTITION_SIZE="$1"
40
-		shift
41
-	;;
42
-		-sp|--SWAP_PARTITION_SIZE)
43
-		SWAP_PARTITION_SIZE="$1"
44
-		shift
45
-	;;
46
-		-fm|--firmware)
47
-		BOOT_FIRM_WARE="$1"
48
-		shift
49
-
50
-	;;
51
-		-a|--all)
52
-		LFS_OPTION="all"
53
-	;;
54
-		-m|--minimal)
55
-		LFS_OPTION=""
56
-	;;
57
-		-n|--IMG_NAME)
58
-		VMDK_IMAGE_NAME="$1".raw
59
-		shift
60
-	;;
61
-		-h|--help)
62
-		echo 'Usage:'
63
-		echo '-rp|--ROOT_PARTITION_SIZE :sets root partition size'
64
-		echo '-sp|--SWAP_PARTITION_SIZE :sets swap partition size'
65
-		echo '-a|--all                  :installs all available packages'
66
-		echo '-n|--IMG_NAME             :sets name of the vmdk image'
67
-		echo '-m|--minimal              :installs basic packages'
68
-		echo '-fm|--firmware            :firmware'
69
-		exit 0
70
-	;;
71
-	*)
72
-		# unknown option
73
-	;;
74
-	esac
75
-done
76
-
77
-mkdir -p $LFS_DISK
78
-
79
-TOTAL_SIZE=` echo $ROOT_PARTITION_SIZE + $SWAP_PARTITION_SIZE | bc`
80
-
81
-echo "Creating raw disk file " $VMDK_IMAGE_NAME " of size " $TOTAL_SIZE
82
-# hack to create 512MB image instead of 1GB - use 512 instead of 1024
83
-dd if=/dev/zero of=$VMDK_IMAGE_NAME bs=1024 count=$(($TOTAL_SIZE * 1024 * 512))
84
-chmod 755 $VMDK_IMAGE_NAME
85
-
86
-parted -s $VMDK_IMAGE_NAME mklabel msdos mkpart primary fat32 1M 30M mkpart primary ext4 30M 100%
87
-
88
-echo "Associating loopdevice to raw disk"
89
-DISK_DEVICE=`losetup --show -f -P $VMDK_IMAGE_NAME`
90
-
91
-#echo "Creating partition on raw disk"
92
-#if [ $SWAP_PARTITION_SIZE -gt 0 ] 
93
-#then
94
-#      sgdisk -n 1::+8M -n 2::+${ROOT_PARTITION_SIZE}G -n 3: -p $DISK_DEVICE >> $LOGFILE
95
-#else
96
-#      sgdisk -n 1::+8M -n 2: -p $DISK_DEVICE >> $LOGFILE
97
-#fi
98
-
99
-#if [ $BOOT_FIRM_WARE = "efi" ]
100
-#then
101
-#    echo "EFI boot partition"
102
-#    sgdisk -t1:ef00 $DISK_DEVICE >> $LOGFILE
103
-#else
104
-#    echo "BIOS boot partition"
105
-#    sgdisk -t1:ef02 $DISK_DEVICE >> $LOGFILE
106
-#fi
107
-
108
-echo "Mapping device partition to loop device"
109
-kpartx -avs $DISK_DEVICE >> $LOGFILE
110
-
111
-DEVICE_NAME=`echo $DISK_DEVICE|cut -c6- `
112
-
113
-echo "Formatting partitions"
114
-mkfs.ext4 /dev/mapper/${DEVICE_NAME}p2
115
-mkfs.fat /dev/mapper/${DEVICE_NAME}p1
116
-
117
-echo "DISK_DEVICE=$DISK_DEVICE"
118
-echo "ROOT_PARTITION=/dev/mapper/${DEVICE_NAME}p2"
119
-echo "ESP_PARTITION=/dev/mapper/${DEVICE_NAME}p1"
120
-
121
-
122 1
deleted file mode 100644
... ...
@@ -1,15 +0,0 @@
1
-[Unit]
2
-Description=Resizes rootfs and creates swap partition
3
-DefaultDependencies=no
4
-Conflicts=shutdown.target
5
-After=systemd-remount-fs.service
6
-Before=systemd-sysusers.service sysinit.target shutdown.target
7
-ConditionPathExists=!/dev/mmcblk0p3
8
-
9
-[Service]
10
-Type=oneshot
11
-RemainAfterExit=yes
12
-ExecStart=/usr/local/bin/resizefs.sh
13
-
14
-[Install]
15
-WantedBy=multi-user.target
16 1
deleted file mode 100755
... ...
@@ -1,6 +0,0 @@
1
-#! /bin/bash
2
-
3
-parted /dev/mmcblk0 resizepart 2 90%
4
-parted /dev/mmcblk0 mkpart primary linux-swap 90% 100%
5
-partprobe
6
-resize2fs /dev/mmcblk0p2
7 1
deleted file mode 100755
... ...
@@ -1,12 +0,0 @@
1
-#!/bin/bash
2
-
3
-echo -e "changeme\nchangeme" | passwd root
4
-chage -d 0 -M 999 root
5
-
6
-echo "/dev/mmcblk0p3 none swap defaults 0 0" >> /etc/fstab
7
-
8
-chmod +x /usr/local/bin/resizefs.sh
9
-ln -s /lib/systemd/system/resizefs.service /etc/systemd/system/multi-user.target.wants/resizefs.service
10
-ln -s /lib/systemd/system/sshd-keygen.service /etc/systemd/system/multi-user.target.wants/sshd-keygen.service
11
-ln -s /lib/systemd/system/sshd.service /etc/systemd/system/multi-user.target.wants/sshd.service
12
-
13 1
deleted file mode 100644
... ...
@@ -1,20 +0,0 @@
1
-{
2
-	"hostname": "photon-machine",
3
-	"password":
4
-		{
5
-			"crypted": false,
6
-			"text": "PASSWORD"
7
-		},
8
-	"type": "minimal",
9
-    "size": {"root": "1", "swap": "0"},
10
-    "boot":"efi",
11
-    "public_key":"<ssh-key-here>",
12
-    "postinstallscripts": ["rpi3-custom-patch.sh"],
13
-    "additionalfiles": [
14
-                            {"resizefs.sh": "/usr/local/bin/resizefs.sh"},
15
-                            {"resizefs.service": "/lib/systemd/system/resizefs.service"}
16
-                       ],
17
-    "artifacttype": "xz",
18
-    "keeprawdisk": "true"
19
-}
20
-
21 1
deleted file mode 100644
... ...
@@ -1,82 +0,0 @@
1
-import os
2
-import ctypes
3
-import ctypes.util
4
-import json
5
-import collections
6
-import subprocess
7
-import fileinput
8
-import re
9
-import shutil
10
-
11
-class Utils(object):
12
-    def __init__(self):
13
-        self.filesystems = []
14
-        with open('/proc/filesystems') as fs:
15
-            for line in fs:
16
-                self.filesystems.append(line.rstrip('\n').split('\t')[1])
17
-
18
-        self.libcloader = ctypes.CDLL(ctypes.util.find_library('c'), use_errno=True)
19
-
20
-    def mount(self, source, destination, filesystem, flags):
21
-        if not os.access(source, os.R_OK):
22
-            raise Exception("Could not find path " + source)
23
-        if not os.access(destination, os.F_OK):
24
-            os.mkdir(destination)
25
-        if not os.access(destination, os.W_OK):
26
-            raise Exception("Could not write to path " + destination)
27
-        if filesystem not in self.filesystems:
28
-            raise ValueError("Filesystem unknown")
29
-        ret = self.libcloader.mount(ctypes.c_char_p(source),
30
-                                    ctypes.c_char_p(destination),
31
-                                    ctypes.c_char_p(filesystem),
32
-                                    ctypes.c_char_p(flags),
33
-                                    0)
34
-        if ret != 0:
35
-            raise RuntimeError(
36
-                "Cannot mount {} : {}".format(source, os.strerror(ctypes.get_errno())))
37
-
38
-    def umount(self, destination):
39
-        ret = self.libcloader.umount(ctypes.c_char_p(destination))
40
-        if ret != 0:
41
-            raise RuntimeError(
42
-                "Cannot umount {} : {}".format(destination, os.strerror(ctypes.get_errno())))
43
-    @staticmethod
44
-    def jsonread(filename):
45
-        json_data = open(filename)
46
-        data = json.load(json_data, object_pairs_hook=collections.OrderedDict)
47
-        json_data.close()
48
-        return data
49
-
50
-    @staticmethod
51
-    def runshellcommand(cmd, ignore_errors=False):
52
-        print(cmd)
53
-        command = cmd.split()
54
-        p = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
55
-        output, err = p.communicate()
56
-        rc = p.returncode
57
-        if not ignore_errors:
58
-            if rc != 0:
59
-                print(err)
60
-                raise RuntimeError("Cannot run command {}".format(cmd))
61
-        return output.decode()
62
-
63
-    @staticmethod
64
-    def replaceinfile(filename, pattern, sub):
65
-        for line in fileinput.input(filename, inplace=True):
66
-            line = re.sub(pattern, sub, line)
67
-            print(line)
68
-
69
-    @staticmethod
70
-    def replaceandsaveasnewfile(old_file, new_file, pattern, sub):
71
-        with open(old_file, "r") as old, open(new_file, "w") as new:
72
-            for line in old:
73
-                line = re.sub(pattern, sub, line)
74
-                new.write(line)
75
-
76
-    @staticmethod
77
-    def copyallfiles(src, target):
78
-        files = os.listdir(src)
79
-        for file in files:
80
-            filename = os.path.join(src, file)
81
-            if os.path.isfile(filename):
82
-                shutil.copy(filename, target)
83 1
new file mode 100755
... ...
@@ -0,0 +1,69 @@
0
+#!/bin/bash
1
+
2
+cd /lib/systemd/system/multi-user.target.wants/
3
+
4
+ln -s ../docker.service docker.service
5
+cd /
6
+
7
+echo "127.0.0.1 localhost" >> /etc/hosts
8
+
9
+echo "DNS=169.254.169.253" >> /etc/systemd/resolved.conf
10
+echo "Domains=ec2.internal" >> /etc/systemd/network/99-dhcp-en.network
11
+
12
+# Add a DHCP section, but comment out the MTU setting that enables
13
+# jumbo frames (9001 byte MTU) on AWS. Users who have the right
14
+# overall setup (eg: who have configured the necessary ICMP rules in
15
+# their security group to handle large MTUs correctly for
16
+# internet-bound traffic) can then choose to enable jumbo frames on
17
+# the system by simply uncommenting this line.
18
+echo -e "\n[DHCP]\n#UseMTU=true" >> /etc/systemd/network/99-dhcp-en.network
19
+
20
+# Remove ssh host keys and add script to regenerate them at boot time.
21
+rm -f /etc/ssh/ssh_host_*
22
+
23
+sudo groupadd docker
24
+sudo groupadd sudo
25
+
26
+rm /root/.ssh/authorized_keys   
27
+
28
+# ssh server config
29
+# Override old values
30
+rm /etc/ssh/sshd_config
31
+
32
+echo "AuthorizedKeysFile .ssh/authorized_keys" >> /etc/ssh/sshd_config
33
+echo "UsePrivilegeSeparation sandbox" >> /etc/ssh/sshd_config
34
+echo "PubkeyAuthentication yes" >> /etc/ssh/sshd_config
35
+echo "PasswordAuthentication no" >> /etc/ssh/sshd_config
36
+echo "PermitRootLogin without-password" >> /etc/ssh/sshd_config
37
+echo "PermitTunnel no" >> /etc/ssh/sshd_config
38
+echo "AllowTcpForwarding yes" >> /etc/ssh/sshd_config
39
+echo "X11Forwarding no" >> /etc/ssh/sshd_config
40
+echo "ClientAliveInterval 420" >> /etc/ssh/sshd_config
41
+echo "UseDNS no" >> /etc/ssh/sshd_config
42
+echo "ChallengeResponseAuthentication no" >> /etc/ssh/sshd_config
43
+echo "UsePAM yes" >> /etc/ssh/sshd_config
44
+
45
+
46
+# ssh client config
47
+# Override old values
48
+
49
+rm /etc/ssh/ssh_config
50
+
51
+echo "Host *" >> /etc/ssh/ssh_config
52
+echo "Protocol 2" >> /etc/ssh/ssh_config
53
+echo "ForwardAgent no" >> /etc/ssh/ssh_config
54
+echo "ForwardX11 no" >> /etc/ssh/ssh_config
55
+echo "HostbasedAuthentication no" >> /etc/ssh/ssh_config
56
+echo "StrictHostKeyChecking no" >> /etc/ssh/ssh_config
57
+echo "Ciphers aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc" >> /etc/ssh/ssh_config
58
+echo "Tunnel no" >> /etc/ssh/ssh_config
59
+echo "ServerAliveInterval 420" >> /etc/ssh/ssh_config
60
+
61
+sed -i 's/net.ifnames=0//' /boot/grub/grub.cfg
62
+sed -i 's/$photon_cmdline/init=\/lib\/systemd\/systemd loglevel=3 ro console=ttyS0 earlyprintk=ttyS0/' /boot/grub/grub.cfg
63
+
64
+# Disable loading/unloading of modules
65
+#echo "kernel.modules_disabled = 1" > /etc/sysctl.d/modules_disabled.conf
66
+
67
+# Remove kernel symbols
68
+rm -f /boot/System.map*
0 69
new file mode 100644
... ...
@@ -0,0 +1,91 @@
0
+# The top level settings are used as module
1
+# and system configuration.
2
+
3
+# A set of users which may be applied and/or used by various modules
4
+# when a 'default' entry is found it will reference the 'default_user'
5
+# from the distro configuration specified below
6
+users:
7
+   - name: root
8
+     lock-passwd: true
9
+
10
+# If this is set, 'root' will not be able to ssh in
11
+disable_root: false
12
+
13
+# This will cause the set+update hostname module to not operate (if true)
14
+preserve_hostname: false
15
+
16
+# datasources to check for cloud-config
17
+datasource_list: [ 
18
+                  Ec2
19
+                 ]
20
+
21
+# Example datasource config
22
+datasource: 
23
+   Ec2: 
24
+     metadata_urls: [ 'http://169.254.169.254' ]
25
+#      timeout: 5 # (defaults to 50 seconds)
26
+#      max_wait: 10 # (defaults to 120 seconds)
27
+
28
+# The modules that run in the 'init' stage
29
+cloud_init_modules:
30
+# - migrator
31
+# - seed_random
32
+ - bootcmd
33
+ - write-files
34
+# - growpart
35
+# - resizefs
36
+ - set_hostname
37
+ - update_hostname
38
+# - update_etc_hosts
39
+# - ca-certs
40
+# - rsyslog
41
+ - users-groups
42
+ - ssh
43
+
44
+# The modules that run in the 'config' stage
45
+cloud_config_modules:
46
+# Emit the cloud config ready event
47
+# this can be used by upstart jobs for 'start on cloud-config'.
48
+# - emit_upstart
49
+# - disk_setup
50
+# - mounts
51
+ - ssh-import-id
52
+# - set-passwords
53
+ - package-update-upgrade-install
54
+# - landscape
55
+# - timezone
56
+# - puppet
57
+# - chef
58
+# - salt-minion
59
+# - mcollective
60
+# - disable-ec2-metadata
61
+ - runcmd
62
+# - byobu
63
+ - yum-add-repo
64
+
65
+# The modules that run in the 'final' stage
66
+cloud_final_modules:
67
+# - rightscale_userdata
68
+ - scripts-vendor
69
+ - scripts-per-once
70
+ - scripts-per-boot
71
+ - scripts-per-instance
72
+ - scripts-user
73
+ - ssh-authkey-fingerprints
74
+# - keys-to-console
75
+# - phone-home
76
+ - final-message
77
+# - power-state-change
78
+
79
+# System and/or distro specific settings
80
+# (not accessible to handlers/transforms)
81
+system_info:
82
+   # This will affect which distro class gets used
83
+   distro: photon
84
+   # Other config here will be given to the distro class and/or path classes
85
+   paths:
86
+      cloud_dir: /var/lib/cloud/
87
+      templates_dir: /etc/cloud/templates/
88
+      upstart_dir: /etc/init/
89
+
90
+   ssh_svcname: ssh
0 91
new file mode 100644
... ...
@@ -0,0 +1,18 @@
0
+{
1
+    "hostname": "photon-machine",
2
+    "password": 
3
+        {
4
+            "crypted": false,
5
+            "text": "PASSWORD"
6
+        },
7
+    "packagelist_file": "packages_ami.json",
8
+    "size": {"root": "8", "swap": "0"},
9
+    "public_key":"<ssh-key-here>",
10
+    "postinstallscripts": [ "ami-patch.sh", "../password-expiry.sh" ],
11
+    "additionalfiles": [
12
+                            {"cloud-photon.cfg": "/etc/cloud/cloud.cfg"}
13
+                       ],
14
+    "artifacttype": "tgz",
15
+    "keeprawdisk": "false"
16
+}
17
+
0 18
new file mode 100755
... ...
@@ -0,0 +1,340 @@
0
+#!/bin/bash
1
+
2
+set -o errexit    # exit if any command returns non true return value
3
+set -o nounset    # exit if you try to use uninitialised variable
4
+set -x
5
+PRGNAME=${0##*/}  # script name minus the path
6
+LOGFILE="${PRGNAME}-$(date +%Y-%m-%d).log"
7
+
8
+#expected number of command line argument
9
+NARGS=16
10
+ARGS_PASSED=$#
11
+VOLUME_SIZE=10
12
+COPY_VOLUME_SIZE=20
13
+DEVICE="/dev/xvdd"
14
+COPY_DEVICE="/dev/xvdc"
15
+EBS_IMAGE_ROOT_DEVICE_NAME="/dev/xvda"
16
+LOOP_WAIT=2
17
+SSH_WAIT=30
18
+SNAPSHOT_WAIT=60
19
+LOOP_TRIAL=100
20
+
21
+#AMI_IDS of different US Regions
22
+AMI_ID_US_EAST_1="ami-83614695"
23
+AMI_ID_US_EAST_2="ami-45311120"
24
+AMI_ID_US_WEST_1="ami-e04b6380"
25
+AMI_ID_US_WEST_2="ami-c0df50a0"
26
+
27
+while [[ $# > 0 ]]
28
+do
29
+        key="$1"
30
+        shift
31
+
32
+        case $key in
33
+                -g|--GN)
34
+                GROUP_NAME="$1"
35
+                shift
36
+        ;;
37
+                -ai|--AMI_ID)
38
+                AMI_ID="$1"
39
+                shift
40
+        ;;
41
+                -tf|--TAR_FILE)
42
+                TAR_FILE="$1"
43
+                shift
44
+        ;;
45
+                -kn|--KEY_NAME)
46
+                KEY_NAME="$1"
47
+                shift
48
+        ;;
49
+                -n|--IMG_NAME)
50
+                IMAGE_NAME="$1"
51
+                shift
52
+        ;;
53
+                -aki|--ACCESS_KEY_ID)
54
+                ACCESS_KEY_ID="$1"
55
+                shift
56
+        ;;
57
+                -sak|--SECRET_ACCESS_KEY)
58
+                SECRET_ACCESS_KEY="$1"
59
+                shift
60
+        ;;
61
+                -dr|--DEFAULT_REGION)
62
+                DEFAULT_REGION="$1"
63
+                shift
64
+        ;;
65
+                -h|--help)
66
+                echo 'Usage:'
67
+                echo '-g|--GN                  :security group name for the instance'
68
+                echo '-ai|--AMI_ID             :ami id for launching an instance. This is optional'
69
+                echo '-tf|--TAR_FILE           :tar filename without extension'
70
+                echo '-kn|--KEY_NAME           :pem filename without pem extension to download'
71
+                echo '-n|--IMG_NAME            :sets name of the ebs image'
72
+                echo '-aki|--ACCESS_KEY_ID     :aws access key id'
73
+                echo '-sak|--SECRET_ACCESS_KEY :aws secret access key'
74
+                echo '-dr|--DEFAULT_REEGION    :aws default region'
75
+                exit 0
76
+        ;;
77
+        *)
78
+                # unknown option
79
+        ;;
80
+        esac
81
+done
82
+
83
+if [ $ARGS_PASSED -eq $[$NARGS-2] ]; then
84
+  if [ ! -z "${AMI_ID:-}" ]; then
85
+   echo "Error in the arguments passed. Try ./create-ebs-image.sh -h for help"
86
+   exit 1
87
+  fi
88
+  key=$DEFAULT_REGION
89
+  case $key in
90
+      us-east-1)
91
+      AMI_ID=$AMI_ID_US_EAST_1
92
+  ;;
93
+      us-east-2)
94
+      AMI_ID=$AMI_ID_US_EAST_2
95
+  ;;
96
+      us-west-1)
97
+      AMI_ID=$AMI_ID_US_WEST_1
98
+  ;;
99
+      us-west-2)
100
+      AMI_ID=$AMI_ID_US_WEST_2
101
+  ;;
102
+  *)
103
+      #unkown region
104
+      exit 1
105
+  esac
106
+  ARGS_PASSED=$[$ARGS_PASSED+2]
107
+fi
108
+
109
+if [ $ARGS_PASSED -ne $NARGS ]; then
110
+   echo "Error in the arguments passed. Try ./create-ebs-image.sh -h for help"
111
+   exit 1
112
+fi
113
+
114
+#set the credential necessary to run the aws cli
115
+export AWS_ACCESS_KEY_ID=$ACCESS_KEY_ID
116
+export AWS_SECRET_ACCESS_KEY=$SECRET_ACCESS_KEY
117
+export AWS_DEFAULT_REGION=$DEFAULT_REGION
118
+KEY_FILE=$KEY_NAME.pem
119
+
120
+function cleanup {
121
+  if [ ! -z "${INSTANCE_ID:-}" ]; then
122
+   aws ec2 terminate-instances --instance-ids $INSTANCE_ID
123
+   while : ; do
124
+    INSTANCE_STATE=`aws ec2 describe-instances --instance-ids $INSTANCE_ID --output=text --query 'Reservations[0].Instances[0].State.Name'`
125
+    if [ "$INSTANCE_STATE" == "terminated" ]; then
126
+      break
127
+    fi
128
+    sleep $LOOP_WAIT
129
+   done
130
+  fi
131
+  if [ ! -z "${VOLUMEID_COPY:-}" ]; then
132
+   aws ec2 delete-volume --volume-id $VOLUMEID_COPY
133
+  fi
134
+  if [ ! -z "${GROUP_NAME:-}" ]; then
135
+   aws ec2 delete-security-group --group-name $GROUP_NAME
136
+  fi
137
+  if [ ! -z "${KEY_NAME:-}" ]; then
138
+   aws ec2 delete-key-pair --key-name $KEY_NAME
139
+  fi
140
+  rm $KEY_FILE
141
+}
142
+trap 'cleanup' EXIT
143
+
144
+function check_counter {
145
+   if [ $# -ne 3 ]; then
146
+      echo "Pass the counter,max value and the error message"
147
+      exit 1
148
+   fi
149
+   if [ $1 -ge $2 ]; then
150
+      echo "$3" >> $LOGFILE
151
+      exit
152
+   fi
153
+}
154
+
155
+#Start an AMI Instance
156
+aws ec2 create-security-group --group-name $GROUP_NAME --description "AMI Creation Sec Group"
157
+aws ec2 authorize-security-group-ingress --group-name $GROUP_NAME --protocol tcp --port 22 --cidr 0.0.0.0/0
158
+aws ec2 create-key-pair --key-name $KEY_NAME --query 'KeyMaterial' --output text > $KEY_FILE
159
+chmod 400 $KEY_FILE
160
+SECURITY_GROUP_ID=`aws ec2 describe-security-groups --group-name $GROUP_NAME --output=text --query 'SecurityGroups[0].GroupId'`
161
+INSTANCE_ID=`aws ec2 run-instances --image-id $AMI_ID --security-group-ids $SECURITY_GROUP_ID --count 1 --instance-type m3.medium --key-name $KEY_NAME --output=text --query 'Instances[0].InstanceId'`
162
+AVAILABILITY_ZONE=`aws ec2 describe-instances --instance-ids $INSTANCE_ID --output=text --query 'Reservations[0].Instances[0].Placement.AvailabilityZone'`
163
+
164
+count=0
165
+while : ; do
166
+ INSTANCE_STATE=`aws ec2 describe-instances --instance-ids $INSTANCE_ID --output=text --query 'Reservations[0].Instances[0].State.Name'`
167
+ if [ "$INSTANCE_STATE" == "running" ]; then
168
+   break
169
+ else
170
+  count=$[$count+1]
171
+ fi
172
+ check_counter $count $LOOP_TRIAL "Instance $INSTANCE_ID not in running state" 
173
+ sleep $LOOP_WAIT
174
+done
175
+
176
+count=0
177
+while : ; do
178
+ IP=`aws ec2 describe-instances --instance-ids $INSTANCE_ID --output=text --query 'Reservations[0].Instances[0].PublicIpAddress'`
179
+ if [ "$IP" == "None" ]; then
180
+   count=$[$count+1]
181
+ else
182
+   break
183
+ fi
184
+ check_counter $count $LOOP_TRIAL "Instance $INSTANCE_ID does not have an IP yet" 
185
+ sleep $LOOP_WAIT
186
+done
187
+
188
+sleep $SSH_WAIT
189
+
190
+while : ; do
191
+ output=$(eval ssh -o StrictHostKeyChecking=no -i $KEY_FILE root@$IP 'tdnf install -y kpartx wget')
192
+ ret=$?
193
+ if [ "$ret" -eq 0 ]; then
194
+  break
195
+ else
196
+  count=$[$count+1]
197
+ fi
198
+ check_counter $count $LOOP_TRIAL "Unable to ssh the Instance $INSTANCE_ID with IP $IP" 
199
+ sleep $LOOP_WAIT
200
+done
201
+
202
+#create two volumes one to copy the tar file and another for ebs image creation
203
+VOLUMEID=`aws ec2 create-volume --size $VOLUME_SIZE --region $AWS_DEFAULT_REGION --availability-zone $AVAILABILITY_ZONE --output=text --query 'VolumeId'`
204
+VOLUMEID_COPY=`aws ec2 create-volume --size $COPY_VOLUME_SIZE --region $AWS_DEFAULT_REGION --availability-zone $AVAILABILITY_ZONE --output=text --query 'VolumeId'`
205
+
206
+#attach both the volumes
207
+count=0
208
+while : ; do
209
+ STATE_1=`aws ec2 describe-volumes --volume-id $VOLUMEID_COPY --output=text --query 'Volumes[0].State'`
210
+ if [ "$STATE_1" == "available" ]; then
211
+   break
212
+ else
213
+  count=$[$count+1]
214
+ fi
215
+ check_counter $count $LOOP_TRIAL "Volume with ID $VOLUMEID_COPY is not available"
216
+ sleep $LOOP_WAIT
217
+done
218
+
219
+aws ec2 attach-volume --volume-id $VOLUMEID_COPY --instance-id $INSTANCE_ID --device $COPY_DEVICE --region $AWS_DEFAULT_REGION >> $LOGFILE
220
+
221
+count=0
222
+while : ; do
223
+ STATE_2=`aws ec2 describe-volumes --volume-id $VOLUMEID_COPY --output=text --query 'Volumes[0].Attachments[0].State'`
224
+ if [ "$STATE_2" == "attached" ]; then
225
+   break
226
+ else
227
+  count=$[$count+1]
228
+ fi
229
+ check_counter $count $LOOP_TRIAL "Volume with ID $VOLUMEID_COPY is not in attached state"
230
+ sleep $LOOP_WAIT
231
+done
232
+
233
+count=0
234
+while : ; do
235
+ STATE_3=`aws ec2 describe-volumes --volume-id $VOLUMEID --output=text --query 'Volumes[0].State'`
236
+ if [ "$STATE_3" == "available" ]; then
237
+   break
238
+ else
239
+  count=$[$count+1]
240
+ fi
241
+ check_counter $count $LOOP_TRIAL "Volume with ID $VOLUMEID is not available"
242
+ sleep $LOOP_WAIT
243
+done
244
+
245
+aws ec2 attach-volume --volume-id $VOLUMEID --instance-id $INSTANCE_ID --device $DEVICE --region $AWS_DEFAULT_REGION >> $LOGFILE
246
+
247
+count=0
248
+while : ; do
249
+ STATE_4=`aws ec2 describe-volumes --volume-id $VOLUMEID  --output text --query 'Volumes[0].Attachments[0].State'`
250
+ if [ "$STATE_4" == "attached" ]; then
251
+   break
252
+ else
253
+  count=$[$count+1]
254
+ fi
255
+ check_counter $count $LOOP_TRIAL "Volume with ID $VOLUMEID is not in attached state"
256
+ sleep $LOOP_WAIT
257
+done
258
+
259
+#Copy the image file
260
+ssh -i $KEY_FILE root@$IP 'rm -rf /mnt/copy; rm -rf /mnt/ebs; mkdir /mnt/copy; mkdir /mnt/ebs' >> $LOGFILE
261
+ssh -i $KEY_FILE root@$IP "mkfs.ext4 $COPY_DEVICE" >> $LOGFILE
262
+ssh -i $KEY_FILE root@$IP "mount $COPY_DEVICE /mnt/copy" >> $LOGFILE
263
+scp -i $KEY_FILE $TAR_FILE.tar.gz root@$IP:/mnt/copy >> $LOGFILE
264
+ssh -i $KEY_FILE root@$IP "cd /mnt/copy; tar -xf $TAR_FILE.tar.gz; dd if=$TAR_FILE.raw of=$DEVICE bs=1M" >> $LOGFILE
265
+ssh -i $KEY_FILE root@$IP 'umount /mnt/copy'
266
+ssh -i $KEY_FILE root@$IP 'rm -rf /mnt/copy /mnt/ebs'
267
+
268
+#detach the volume
269
+aws ec2 detach-volume --volume-id $VOLUMEID --region $AWS_DEFAULT_REGION >> $LOGFILE
270
+aws ec2 detach-volume --volume-id $VOLUMEID_COPY --region $AWS_DEFAULT_REGION >> $LOGFILE
271
+
272
+#wait for the volume to detach
273
+count=0
274
+while : ; do
275
+ STATE_5=`aws ec2 describe-volumes --volume-id $VOLUMEID  --output text --query 'Volumes[0].Attachments[0].State'`
276
+ if [ "$STATE_5" == "detached" ] || [ "$STATE_5" == "None" ]; then
277
+   break
278
+ else
279
+  count=$[$count+1]
280
+ fi
281
+ check_counter $count $LOOP_TRIAL "Volume with ID $VOLUMEID is not in detached state"
282
+ sleep $LOOP_WAIT
283
+done
284
+
285
+#create the snapshot
286
+SNAPSHOT_ID=`aws ec2 create-snapshot --region $AWS_DEFAULT_REGION --description $TAR_FILE --volume-id $VOLUMEID --output=text --query 'SnapshotId'`
287
+
288
+#wait for the snapshot creation to succeed. This takes some time
289
+count=0
290
+while : ; do
291
+ PROGRESS=`aws ec2 describe-snapshots --region $AWS_DEFAULT_REGION --snapshot-id $SNAPSHOT_ID --output=text --query 'Snapshots[0].Progress'`
292
+ echo $PROGRESS
293
+ if [ "$PROGRESS" == "100%" ]; then
294
+   break
295
+ else
296
+  count=$[$count+1]
297
+ fi
298
+ check_counter $count $LOOP_TRIAL "Snapshot creation for snapshot with ID $SNAPSHOT_ID failed"
299
+ sleep $SNAPSHOT_WAIT
300
+done
301
+
302
+#register the image name
303
+AMI_IMAGE_ID=`aws ec2 register-image --region $AWS_DEFAULT_REGION --name $TAR_FILE --root-device-name $EBS_IMAGE_ROOT_DEVICE_NAME --sriov-net-support simple --ena-support --block-device-mappings DeviceName=$EBS_IMAGE_ROOT_DEVICE_NAME,Ebs={SnapshotId=$SNAPSHOT_ID} --virtualization-type hvm --architecture x86_64 --output=text --query 'ImageId'`
304
+
305
+#check the status of the AMI
306
+count=0
307
+while : ; do
308
+ AMI_STATE=`aws ec2 describe-images --image-ids $AMI_IMAGE_ID --output=text --query 'Images[0].State'`
309
+ echo $AMI_STATE
310
+ if [ "$AMI_STATE" == "available" ]; then
311
+   break
312
+ else
313
+  count=$[$count+1]
314
+ fi
315
+ check_counter $count $LOOP_TRIAL "Registering AMI with AMI ID $AMI_IMAGE_ID and $SNAPSHOT_ID failed"
316
+ sleep $SNAPSHOT_WAIT
317
+done
318
+
319
+#Make AMI Public
320
+aws ec2 modify-image-attribute --image-id $AMI_IMAGE_ID --launch-permission "{\"Add\":[{\"Group\":\"all\"}]}"
321
+
322
+#Loop till AMI is public
323
+count=0
324
+while : ; do
325
+ PUBLIC=`aws ec2 describe-images --image-ids $AMI_IMAGE_ID --output=text --query 'Images[0].Public'`
326
+ echo $PUBLIC
327
+ if [ "$PUBLIC" == "True" ]; then
328
+   break
329
+ else
330
+  count=$[$count+1]
331
+ fi
332
+ check_counter $count $LOOP_TRIAL "Making the AMI with AMI ID $AMI_IMAGE_ID Public failed"
333
+ sleep $LOOP_WAIT
334
+done
335
+
336
+aws ec2 create-tags --resources $SNAPSHOT_ID --tags Key=Name,Value=$IMAGE_NAME
337
+aws ec2 create-tags --resources $AMI_IMAGE_ID --tags Key=Name,Value=$IMAGE_NAME
338
+
339
+echo "SUCCESS: AMI with ID $AMI_IMAGE_ID was registered and made Public"
0 340
new file mode 100755
... ...
@@ -0,0 +1,58 @@
0
+#!/bin/bash
1
+
2
+cd /lib/systemd/system/multi-user.target.wants/
3
+
4
+# Create links in multi-user.target to auto-start these scripts and services.
5
+
6
+ln -s ../docker.service docker.service
7
+ln -s ../waagent.service waagent.service
8
+ln -s ../sshd-keygen.service sshd-keygen.service
9
+
10
+# Remove ssh host keys and add script to regenerate them at boot time.
11
+
12
+rm -f /etc/ssh/ssh_host_*
13
+
14
+sudo groupadd docker
15
+sudo groupadd sudo
16
+
17
+rm /root/.ssh/authorized_keys
18
+
19
+# ssh server config
20
+# Override old values
21
+rm /etc/ssh/sshd_config
22
+
23
+echo "AuthorizedKeysFile .ssh/authorized_keys" >> /etc/ssh/sshd_config
24
+echo "UsePrivilegeSeparation sandbox" >> /etc/ssh/sshd_config
25
+echo "PasswordAuthentication no" >> /etc/ssh/sshd_config
26
+echo "PermitRootLogin without-password" >> /etc/ssh/sshd_config
27
+echo "PermitTunnel no" >> /etc/ssh/sshd_config
28
+echo "AllowTcpForwarding yes" >> /etc/ssh/sshd_config
29
+echo "X11Forwarding no" >> /etc/ssh/sshd_config
30
+echo "ClientAliveInterval 180" >> /etc/ssh/sshd_config
31
+echo "ChallengeResponseAuthentication no" >> /etc/ssh/sshd_config
32
+echo "UsePAM yes" >> /etc/ssh/sshd_config
33
+
34
+
35
+# ssh client config
36
+# Override old values
37
+
38
+rm /etc/ssh/ssh_config
39
+
40
+echo "Host *" >> /etc/ssh/ssh_config
41
+echo "Protocol 2" >> /etc/ssh/ssh_config
42
+echo "ForwardAgent no" >> /etc/ssh/ssh_config
43
+echo "ForwardX11 no" >> /etc/ssh/ssh_config
44
+echo "HostbasedAuthentication no" >> /etc/ssh/ssh_config
45
+echo "StrictHostKeyChecking no" >> /etc/ssh/ssh_config
46
+echo "Ciphers aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc" >> /etc/ssh/ssh_config
47
+echo "Tunnel no" >> /etc/ssh/ssh_config
48
+echo "ServerAliveInterval 180" >> /etc/ssh/ssh_config
49
+
50
+sed -i 's/$photon_cmdline $systemd_cmdline/init=\/lib\/systemd\/systemd loglevel=3 ro console=tty1 console=ttyS0,115200n8 earlyprintk=ttyS0,115200 fsck.repair=yes rootdelay=300/' /boot/grub/grub.cfg
51
+
52
+
53
+# Remove kernel symbols
54
+rm /boot/system.map*
55
+
56
+waagent -force -deprovision+user
57
+export HISTSIZE=0
0 58
new file mode 100644
... ...
@@ -0,0 +1,95 @@
0
+# The top level settings are used as module
1
+# and system configuration.
2
+
3
+# A set of users which may be applied and/or used by various modules
4
+# when a 'default' entry is found it will reference the 'default_user'
5
+# from the distro configuration specified below
6
+users:
7
+   - default
8
+
9
+# If this is set, 'root' will not be able to ssh in and they 
10
+# will get a message to login instead as a different user
11
+disable_root: true
12
+
13
+# This will cause the set+update hostname module to not operate (if true)
14
+preserve_hostname: false
15
+
16
+# datasources to check for cloud-config
17
+datasource_list: [ 
18
+                  Azure
19
+                 ]
20
+
21
+# Example datasource config
22
+#datasource: 
23
+#      timeout: 5 # (defaults to 50 seconds)
24
+#      max_wait: 10 # (defaults to 120 seconds)
25
+
26
+# The modules that run in the 'init' stage
27
+cloud_init_modules:
28
+# - migrator
29
+# - seed_random
30
+ - bootcmd
31
+ - write-files
32
+ - growpart
33
+ - resizefs
34
+ - disk_setup
35
+ - mounts
36
+ - set_hostname
37
+ - update_hostname
38
+ - update_etc_hosts
39
+# - ca-certs
40
+# - rsyslog
41
+ - users-groups
42
+ - ssh
43
+
44
+# The modules that run in the 'config' stage
45
+cloud_config_modules:
46
+# Emit the cloud config ready event
47
+# this can be used by upstart jobs for 'start on cloud-config'.
48
+# - emit_upstart
49
+ - ssh-import-id
50
+# - set-passwords
51
+ - package-update-upgrade-install
52
+# - landscape
53
+# - timezone
54
+# - puppet
55
+# - chef
56
+# - salt-minion
57
+# - mcollective
58
+# - disable-ec2-metadata
59
+ - runcmd
60
+# - byobu
61
+ - yum-add-repo
62
+
63
+# The modules that run in the 'final' stage
64
+cloud_final_modules:
65
+# - rightscale_userdata
66
+ - scripts-vendor
67
+ - scripts-per-once
68
+ - scripts-per-boot
69
+ - scripts-per-instance
70
+ - scripts-user
71
+ - ssh-authkey-fingerprints
72
+# - keys-to-console
73
+# - phone-home
74
+ - final-message
75
+# - power-state-change
76
+
77
+# System and/or distro specific settings
78
+# (not accessible to handlers/transforms)
79
+system_info:
80
+   default_user:
81
+      name: photon
82
+      lock_passwd: true
83
+      gecos: Azure User
84
+      groups: [wheel, adm, systemd-journal]
85
+      sudo: ["ALL=(ALL) NOPASSWD:ALL"]
86
+      shell: /bin/bash
87
+   # This will affect which distro class gets used
88
+   distro: photon
89
+   # Other config here will be given to the distro class and/or path classes
90
+   paths:
91
+      cloud_dir: /var/lib/cloud/
92
+      templates_dir: /etc/cloud/templates/
93
+
94
+   ssh_svcname: ssh
0 95
new file mode 100644
... ...
@@ -0,0 +1,18 @@
0
+{
1
+    "hostname": "photon-machine",
2
+    "password": 
3
+        {
4
+            "crypted": false,
5
+            "text": "PASSWORD"
6
+        },
7
+    "packagelist_file": "packages_azure.json",
8
+    "size": {"root": "16", "swap": "0"},
9
+    "public_key":"<ssh-key-here>",
10
+    "postinstallscripts": [ "azure-patch.sh", "../password-expiry.sh" ],
11
+    "additionalfiles": [
12
+                            {"cloud-photon.cfg": "/etc/cloud/cloud.cfg"}
13
+                       ],
14
+    "artifacttype": "vhd",
15
+    "keeprawdisk": "false"
16
+}
17
+
0 18
new file mode 100755
... ...
@@ -0,0 +1,341 @@
0
+#!/usr/bin/python3
1
+
2
+import os
3
+import re
4
+import shutil
5
+import tarfile
6
+import fileinput
7
+from argparse import ArgumentParser
8
+import json
9
+from utils import Utils
10
+
11
+def create_ova_image(raw_image_name, tools_path, build_scripts_path, config):
12
+    output_path = os.path.dirname(os.path.realpath(raw_image_name))
13
+    utils = Utils()
14
+    # Remove older artifacts
15
+    files = os.listdir(output_path)
16
+    for file in files:
17
+        if file.endswith(".vmdk"):
18
+            os.remove(os.path.join(output_path, file))
19
+
20
+    vmx_path = output_path + '/photon-ova.vmx'
21
+    utils.replaceandsaveasnewfile(build_scripts_path + '/vmx-template',
22
+                                  vmx_path, 'VMDK_IMAGE',
23
+                                  output_path + '/photon-ova.vmdk')
24
+    vixdiskutil_path = tools_path + 'vixdiskutil'
25
+    vmdk_path = output_path + '/photon-ova.vmdk'
26
+    ovf_path = output_path + '/photon-ova.ovf'
27
+    mf_path = output_path + '/photon-ova.mf'
28
+    ovfinfo_path = build_scripts_path + '/ovfinfo.txt'
29
+    vmdk_capacity = (int(config['size']['root']) +
30
+                     int(config['size']['swap'])) * 1024
31
+    utils.runshellcommand(
32
+        "{} -convert {} -cap {} {}".format(vixdiskutil_path,
33
+                                           raw_image_name,
34
+                                           vmdk_capacity,
35
+                                           vmdk_path))
36
+    utils.runshellcommand(
37
+        "{} -wmeta toolsVersion 2147483647 {}".format(vixdiskutil_path, vmdk_path))
38
+
39
+    utils.runshellcommand("ovftool {} {}".format(vmx_path, ovf_path))
40
+    utils.replaceinfile(ovf_path, 'otherGuest', 'other3xLinux64Guest')
41
+
42
+    #Add product info
43
+    if os.path.exists(ovfinfo_path):
44
+        with open(ovfinfo_path) as f:
45
+            lines = f.readlines()
46
+            for line in fileinput.input(ovf_path, inplace=True):
47
+                if line.strip() == '</VirtualHardwareSection>':
48
+                    for ovfinfoline in lines:
49
+                        print(ovfinfoline)
50
+                else:
51
+                    print(line)
52
+
53
+    if os.path.exists(mf_path):
54
+        os.remove(mf_path)
55
+
56
+    cwd = os.getcwd()
57
+    os.chdir(output_path)
58
+    out = utils.runshellcommand("openssl sha1 photon-ova-disk1.vmdk photon-ova.ovf")
59
+    with open(mf_path, "w") as source:
60
+        source.write(out)
61
+    rawsplit = os.path.splitext(raw_image_name)
62
+    ova_name = rawsplit[0] + '.ova'
63
+
64
+    ovatar = tarfile.open(ova_name, "w", format=tarfile.USTAR_FORMAT)
65
+    for name in ["photon-ova.ovf", "photon-ova.mf", "photon-ova-disk1.vmdk"]:
66
+        ovatar.add(name, arcname=os.path.basename(name))
67
+    ovatar.close()
68
+    os.remove(vmx_path)
69
+    os.remove(mf_path)
70
+
71
+    if 'additionalhwversion' in config:
72
+        for addlversion in config['additionalhwversion']:
73
+            new_ovf_path = output_path + "/photon-ova-hw{}.ovf".format(addlversion)
74
+            mf_path = output_path + "/photon-ova-hw{}.mf".format(addlversion)
75
+            utils.replaceandsaveasnewfile(
76
+                ovf_path, new_ovf_path, "vmx-.*<", "vmx-{}<".format(addlversion))
77
+            out = utils.runshellcommand("openssl sha1 photon-ova-disk1.vmdk "
78
+                                        "photon-ova-hw{}.ovf".format(addlversion))
79
+            with open(mf_path, "w") as source:
80
+                source.write(out)
81
+            temp_name_list = os.path.basename(ova_name).split('-')
82
+            temp_name_list = temp_name_list[:2] + ["hw{}".format(addlversion)] + temp_name_list[2:]
83
+            new_ova_name = '-'.join(temp_name_list)
84
+            new_ova_path = output_path + '/' + new_ova_name
85
+            ovatar = tarfile.open(new_ova_path, "w", format=tarfile.USTAR_FORMAT)
86
+            for name in [new_ovf_path, mf_path, "photon-ova-disk1.vmdk"]:
87
+                ovatar.add(name, arcname=os.path.basename(name))
88
+            ovatar.close()
89
+
90
+            os.remove(new_ovf_path)
91
+            os.remove(mf_path)
92
+    os.chdir(cwd)
93
+    os.remove(ovf_path)
94
+    os.remove(vmdk_path)
95
+    files = os.listdir(output_path)
96
+    for file in files:
97
+        if file.endswith(".vmdk"):
98
+            os.remove(os.path.join(output_path, file))
99
+
100
+
101
+if __name__ == '__main__':
102
+    usage = "Usage: %prog [options]"
103
+    parser = ArgumentParser(usage)
104
+
105
+    parser.add_argument("-r", "--raw-image-path", dest="raw_image_path")
106
+    parser.add_argument("-c", "--vmdk-config-path", dest="vmdk_config_path")
107
+    parser.add_argument("-w", "--working-directory", dest="working_directory")
108
+    parser.add_argument("-m", "--mount-path", dest="mount_path")
109
+    parser.add_argument("-a", "--additional-rpms-path", dest="additional_rpms_path")
110
+    parser.add_argument("-i", "--image-name", dest="image_name")
111
+    parser.add_argument("-t", "--tools-bin-path", dest="tools_bin_path")
112
+    parser.add_argument("-b", "--build-scripts-path", dest="build_scripts_path")
113
+    parser.add_argument("-s", "--src-root", dest="src_root")
114
+
115
+    options = parser.parse_args()
116
+    utils = Utils()
117
+    config = utils.jsonread(options.vmdk_config_path)
118
+    print(options)
119
+
120
+    disk_device = (utils.runshellcommand(
121
+        "losetup --show -f {}".format(options.raw_image_path))).rstrip('\n')
122
+    disk_partitions = utils.runshellcommand("kpartx -as {}".format(disk_device))
123
+    device_name = disk_device.split('/')[2]
124
+
125
+    if not os.path.exists(options.mount_path):
126
+        os.mkdir(options.mount_path)
127
+    loop_device_path = "/dev/mapper/{}p2".format(device_name)
128
+
129
+    try:
130
+        print("Generating PARTUUID for the loop device ...")
131
+        partuuidval = (utils.runshellcommand(
132
+            "blkid -s PARTUUID -o value {}".format(loop_device_path))).rstrip('\n')
133
+        uuidval = (utils.runshellcommand(
134
+            "blkid -s UUID -o value {}".format(loop_device_path))).rstrip('\n')
135
+        if partuuidval == '':
136
+            sgdiskout = utils.runshellcommand(
137
+                "sgdisk -i 2 {} ".format(disk_device))
138
+            partuuidval = (re.findall(r'Partition unique GUID.*',
139
+                                      sgdiskout))[0].split(':')[1].strip(' ').lower()
140
+
141
+        if partuuidval == '':
142
+            raise RuntimeError("Cannot generate partuuid")
143
+
144
+        # Mount the loop device
145
+        print("Mounting the loop device for customization ...")
146
+        utils.runshellcommand(
147
+            "mount -t ext4 {} {}".format(loop_device_path, options.mount_path))
148
+        shutil.rmtree(options.mount_path + "/installer", ignore_errors=True)
149
+        shutil.rmtree(options.mount_path + "/LOGS", ignore_errors=True)
150
+        # Clear the root password if not set explicitly from the config file
151
+        if config['password']['text'] != 'PASSWORD':
152
+            utils.replaceinfile(options.mount_path + "/etc/shadow",
153
+                                'root:.*?:', 'root:*:')
154
+        # Clear machine-id so it gets regenerated on boot
155
+        open(options.mount_path + "/etc/machine-id", "w").close()
156
+        os.remove(options.mount_path + "/etc/fstab")
157
+
158
+        f = open(options.mount_path + "/etc/fstab", "w")
159
+        if uuidval != '':
160
+            f.write("UUID={}    /    ext4    defaults 1 1\n".format(uuidval))
161
+        else:
162
+            f.write("PARTUUID={}    /    ext4    defaults 1 1\n".format(partuuidval))
163
+        f.close()
164
+        utils.replaceinfile(options.mount_path + "/boot/grub/grub.cfg",
165
+                            "rootpartition=PARTUUID=.*$",
166
+                            "rootpartition=PARTUUID={}".format(partuuidval))
167
+
168
+        if os.path.exists(options.additional_rpms_path):
169
+            print("Installing additional rpms")
170
+            os.mkdir(options.mount_path + "/additional_rpms")
171
+            os.mkdir(options.mount_path + "/var/run")
172
+            utils.copyallfiles(options.additional_rpms_path,
173
+                               options.mount_path + "/additional_rpms")
174
+            utils.runshellcommand(
175
+                "chroot {} /bin/bash -c 'rpm -i /additional_rpms/*'".format(options.mount_path))
176
+            shutil.rmtree(options.mount_path + "/additional_rpms", ignore_errors=True)
177
+            shutil.rmtree(options.additional_rpms_path, ignore_errors=True)
178
+
179
+        utils.runshellcommand("mount -o bind /proc {}".format(options.mount_path + "/proc"))
180
+        utils.runshellcommand("mount -o bind /dev {}".format(options.mount_path + "/dev"))
181
+        utils.runshellcommand("mount -o bind /dev/pts {}".format(options.mount_path + "/dev/pts"))
182
+        utils.runshellcommand("mount -o bind /sys {}".format(options.mount_path + "/sys"))
183
+
184
+        if 'additionalfiles' in config:
185
+            print("  Copying additional files into the raw image ...")
186
+            for filetuples in config['additionalfiles']:
187
+                for src, dest in filetuples.items():
188
+                    if (os.path.isdir(options.build_scripts_path + '/' +
189
+                                      options.image_name + '/' + src)):
190
+                        shutil.copytree(options.build_scripts_path + '/' +
191
+                                        options.image_name + '/' + src,
192
+                                        options.mount_path + dest, True)
193
+                    else:
194
+                        shutil.copyfile(options.build_scripts_path + '/' +
195
+                                        options.image_name + '/' + src,
196
+                                        options.mount_path + dest)
197
+
198
+
199
+        if 'postinstallscripts' in config:
200
+            print("  Running post install scripts ...")
201
+            if not os.path.exists(options.mount_path + "/tempscripts"):
202
+                os.mkdir(options.mount_path + "/tempscripts")
203
+            for script in config['postinstallscripts']:
204
+                shutil.copy(options.build_scripts_path + '/' +
205
+                            options.image_name + '/' + script,
206
+                            options.mount_path + "/tempscripts")
207
+            for script in os.listdir(options.mount_path + "/tempscripts"):
208
+                print("     ...running script {}".format(script))
209
+                utils.runshellcommand(
210
+                    "chroot {} /bin/bash -c '/tempscripts/{}'".format(options.mount_path, script))
211
+            shutil.rmtree(options.mount_path + "/tempscripts", ignore_errors=True)
212
+
213
+    except Exception as e:
214
+        print(e)
215
+
216
+    finally:
217
+        utils.runshellcommand("umount -l {}".format(options.mount_path + "/sys"))
218
+        utils.runshellcommand("umount -l {}".format(options.mount_path + "/dev/pts"))
219
+        utils.runshellcommand("umount -l {}".format(options.mount_path + "/dev"))
220
+        utils.runshellcommand("umount -l {}".format(options.mount_path + "/proc"))
221
+
222
+        utils.runshellcommand("sync")
223
+        utils.runshellcommand("umount -l {}".format(options.mount_path))
224
+
225
+        utils.runshellcommand("kpartx -d {}".format(disk_device))
226
+        utils.runshellcommand("losetup -d {}".format(disk_device))
227
+
228
+        shutil.rmtree(options.mount_path)
229
+
230
+        photon_release_ver = os.environ['PHOTON_RELEASE_VER']
231
+        photon_build_num = os.environ['PHOTON_BUILD_NUM']
232
+        raw_image = options.raw_image_path
233
+        new_name = ""
234
+        img_path = os.path.dirname(os.path.realpath(raw_image))
235
+        # Rename gce image to disk.raw
236
+        if options.image_name == "gce":
237
+            print("Renaming the raw file to disk.raw ...")
238
+            new_name = img_path + '/disk.raw'
239
+
240
+        else:
241
+            new_name = (img_path + '/photon-' + options.image_name +
242
+                        '-' + photon_release_ver + '-' +
243
+                        photon_build_num + '.raw')
244
+
245
+        shutil.move(raw_image, new_name)
246
+        raw_image = new_name
247
+
248
+        if config['artifacttype'] == 'tgz':
249
+            print("Generating the tar.gz artifact ...")
250
+            tarname = (img_path + '/photon-' + options.image_name +
251
+                       '-' + photon_release_ver + '-' +
252
+                       photon_build_num + '.tar.gz')
253
+
254
+            tgzout = tarfile.open(tarname, "w:gz")
255
+            tgzout.add(raw_image, arcname=os.path.basename(raw_image))
256
+            tgzout.close()
257
+        elif config['artifacttype'] == 'xz':
258
+            print("Generating the xz artifact ...")
259
+            utils.runshellcommand("xz -z -k {}".format(raw_image))
260
+#            tarname = img_path + '/photon-' + options.image_name +
261
+#            '-' + photon_release_ver + '-' + photon_build_num +
262
+#            '.xz'
263
+#            tgzout = tarfile.open(tarname, "w:xz")
264
+#            tgzout.add(raw_image, arcname=os.path.basename(raw_image))
265
+#            tgzout.close()
266
+        elif config['artifacttype'] == 'vhd':
267
+            relrawpath = os.path.relpath(raw_image, options.src_root)
268
+            vhdname = (os.path.dirname(relrawpath) + '/photon-' +
269
+                       options.image_name + '-' + photon_release_ver + '-' +
270
+                       photon_build_num + '.vhd')
271
+            print("Converting raw disk to vhd ...")
272
+            info_output = utils.runshellcommand(
273
+                "docker run -v {}:/mnt:rw anishs/qemu-img info -f raw --output json {}"
274
+                .format(options.src_root, '/mnt/' + relrawpath))
275
+            mbsize = 1024 * 1024
276
+            mbroundedsize = ((int(json.loads(info_output)["virtual-size"])/mbsize + 1) * mbsize)
277
+            utils.runshellcommand(
278
+                "docker run -v {}:/mnt:rw anishs/qemu-img resize -f raw {} {}"
279
+                .format(options.src_root, '/mnt/' + relrawpath, mbroundedsize))
280
+            utils.runshellcommand(
281
+                "docker run -v {}:/mnt:rw anishs/qemu-img convert {} -O "
282
+                "vpc -o subformat=fixed,force_size {}"
283
+                .format(options.src_root, '/mnt/' + relrawpath, '/mnt/' + vhdname))
284
+        elif config['artifacttype'] == 'ova':
285
+            create_ova_image(raw_image, options.tools_bin_path,
286
+                             options.build_scripts_path + '/' + options.image_name, config)
287
+            if 'customartifacts' in config:
288
+                if 'postinstallscripts' in config['customartifacts']:
289
+                    custom_path = img_path + '/photon-custom'
290
+                    if not os.path.exists(custom_path):
291
+                        os.mkdir(custom_path)
292
+                    index = 1
293
+                    for script in config['customartifacts']['postinstallscripts']:
294
+                        print("Creating custom ova {}...".format(index))
295
+                        if index > 1:
296
+                            raw_image_custom = (img_path + "/photon-custom-{}".format(index) +
297
+                                                photon_release_ver + '-' +
298
+                                                photon_build_num + '.raw')
299
+                        else:
300
+                            raw_image_custom = (img_path + "/photon-custom-" +
301
+                                                photon_release_ver + '-' +
302
+                                                photon_build_num + '.raw')
303
+                        shutil.move(raw_image, raw_image_custom)
304
+                        disk_device = (
305
+                            utils.runshellcommand(
306
+                                "losetup --show -f {}".format(raw_image_custom))).rstrip('\n')
307
+                        disk_partitions = utils.runshellcommand(
308
+                            "kpartx -as {}".format(disk_device))
309
+                        device_name = disk_device.split('/')[2]
310
+                        loop_device_path = "/dev/mapper/{}p2".format(device_name)
311
+
312
+                        print("Mounting the loop device for ova customization ...")
313
+                        utils.runshellcommand(
314
+                            "mount -t ext4 {} {}".format(loop_device_path, custom_path))
315
+                        if not os.path.exists(custom_path + "/tempscripts"):
316
+                            os.mkdir(custom_path + "/tempscripts")
317
+                        shutil.copy(options.build_scripts_path + '/' + options.image_name +
318
+                                    '/' + script, custom_path + "/tempscripts")
319
+                        print("Running custom ova script {}".format(script))
320
+                        utils.runshellcommand("chroot {} /bin/bash -c '/tempscripts/{}'"
321
+                                              .format(custom_path, script))
322
+                        shutil.rmtree(custom_path + "/tempscripts", ignore_errors=True)
323
+                        utils.runshellcommand("umount -l {}".format(custom_path))
324
+
325
+                        utils.runshellcommand("sync")
326
+                        utils.runshellcommand("kpartx -d {}".format(disk_device))
327
+                        utils.runshellcommand("losetup -d {}".format(disk_device))
328
+                        create_ova_image(raw_image_custom, options.tools_bin_path,
329
+                                         options.build_scripts_path + '/' + options.image_name,
330
+                                         config)
331
+                        raw_image = raw_image_custom
332
+                        index = index + 1
333
+
334
+                    shutil.rmtree(custom_path)
335
+
336
+        else:
337
+            raise ValueError("Unknown output format")
338
+
339
+        if config['keeprawdisk'] == 'false':
340
+            os.remove(raw_image)
0 341
new file mode 100644
... ...
@@ -0,0 +1,92 @@
0
+# The top level settings are used as module
1
+# and system configuration.
2
+
3
+# A set of users which may be applied and/or used by various modules
4
+# when a 'default' entry is found it will reference the 'default_user'
5
+# from the distro configuration specified below
6
+users:
7
+   - name: root
8
+     lock-passwd: true
9
+
10
+# If this is set, 'root' will not be able to ssh in and they 
11
+# will get a message to login instead as a different user
12
+disable_root: true
13
+
14
+# This will cause the set+update hostname module to not operate (if true)
15
+preserve_hostname: false
16
+
17
+# datasources to check for cloud-config
18
+datasource_list: [ 
19
+                  GCE
20
+                 ]
21
+
22
+# Example datasource config
23
+datasource: 
24
+   GCE: 
25
+     metadata_urls: [ 'http://metadata.google.internal./computeMetadata/v1/' ]
26
+#      timeout: 5 # (defaults to 50 seconds)
27
+#      max_wait: 10 # (defaults to 120 seconds)
28
+
29
+# The modules that run in the 'init' stage
30
+cloud_init_modules:
31
+# - migrator
32
+# - seed_random
33
+ - bootcmd
34
+ - write-files
35
+# - growpart
36
+# - resizefs
37
+ - set_hostname
38
+ - update_hostname
39
+# - update_etc_hosts
40
+# - ca-certs
41
+# - rsyslog
42
+ - users-groups
43
+ - ssh
44
+
45
+# The modules that run in the 'config' stage
46
+cloud_config_modules:
47
+# Emit the cloud config ready event
48
+# this can be used by upstart jobs for 'start on cloud-config'.
49
+# - emit_upstart
50
+# - disk_setup
51
+# - mounts
52
+ - ssh-import-id
53
+# - set-passwords
54
+ - package-update-upgrade-install
55
+# - landscape
56
+# - timezone
57
+# - puppet
58
+# - chef
59
+# - salt-minion
60
+# - mcollective
61
+# - disable-ec2-metadata
62
+ - runcmd
63
+# - byobu
64
+ - yum-add-repo
65
+
66
+# The modules that run in the 'final' stage
67
+cloud_final_modules:
68
+# - rightscale_userdata
69
+ - scripts-vendor
70
+ - scripts-per-once
71
+ - scripts-per-boot
72
+ - scripts-per-instance
73
+ - scripts-user
74
+ - ssh-authkey-fingerprints
75
+# - keys-to-console
76
+# - phone-home
77
+ - final-message
78
+# - power-state-change
79
+
80
+# System and/or distro specific settings
81
+# (not accessible to handlers/transforms)
82
+system_info:
83
+   # This will affect which distro class gets used
84
+   distro: photon
85
+   # Other config here will be given to the distro class and/or path classes
86
+   paths:
87
+      cloud_dir: /var/lib/cloud/
88
+      templates_dir: /etc/cloud/templates/
89
+      upstart_dir: /etc/init/
90
+
91
+   ssh_svcname: ssh
0 92
new file mode 100644
... ...
@@ -0,0 +1,19 @@
0
+{
1
+    "hostname": "photon-machine",
2
+    "password": 
3
+        {
4
+            "crypted": false,
5
+            "text": "PASSWORD"
6
+        },
7
+    "packagelist_file": "packages_gce.json",
8
+    "size": {"root": "16", "swap": "0"},
9
+    "public_key":"<ssh-key-here>",
10
+    "postinstallscripts": [ "gce-patch.sh", "../password-expiry.sh" ],
11
+    "additionalfiles": [
12
+                            {"cloud-photon.cfg": "/etc/cloud/cloud.cfg"},
13
+                            {"ntpd.service": "/usr/lib/systemd/system/ntpd.service"}
14
+                       ],
15
+    "artifacttype": "tgz",
16
+    "keeprawdisk": "false"
17
+}
18
+
0 19
new file mode 100755
... ...
@@ -0,0 +1,105 @@
0
+#!/bin/bash
1
+
2
+cd /lib/systemd/system/multi-user.target.wants/
3
+
4
+# Create links in multi-user.target to auto-start these scripts and services.
5
+for i in ../google*; do  ln -s $i `basename $i`; done
6
+# for i in ../kube*; do  ln -s $i `basename $i`; done
7
+
8
+ln -s ../ntpd.service ntpd.service
9
+ln -s ../docker.service docker.service
10
+
11
+# Update /etc/hosts file with GCE values
12
+echo "169.254.169.254 metadata.google.internal metadata" >> /etc/hosts
13
+
14
+# Remove all servers from ntp.conf and add Google's ntp server.
15
+sed -i -e "/server/d" /etc/ntp.conf
16
+echo "server metadata.google.internal iburst" >> /etc/ntp.conf
17
+echo "server 169.254.169.254" >> /etc/ntp.conf
18
+
19
+
20
+# Set UTC timezone
21
+ln -sf /usr/share/zoneinfo/UTC /etc/localtime
22
+
23
+echo "DNS=169.254.169.254 8.8.8.8" >> /etc/systemd/resolved.conf
24
+
25
+# Remove ssh host keys and add script to regenerate them at boot time.
26
+
27
+rm -f /etc/ssh/ssh_host_*
28
+
29
+printf "GOOGLE\n" > /etc/ssh/sshd_not_to_be_run
30
+
31
+sudo groupadd docker
32
+sudo groupadd sudo
33
+
34
+rm /root/.ssh/authorized_keys   
35
+
36
+# ssh server config
37
+# Override old values
38
+rm /etc/ssh/sshd_config
39
+
40
+echo "AuthorizedKeysFile .ssh/authorized_keys" >> /etc/ssh/sshd_config
41
+echo "PubkeyAuthentication yes" >> /etc/ssh/sshd_config
42
+echo "UsePrivilegeSeparation sandbox" >> /etc/ssh/sshd_config
43
+echo "PasswordAuthentication no" >> /etc/ssh/sshd_config
44
+echo "PermitRootLogin no" >> /etc/ssh/sshd_config
45
+echo "PermitTunnel no" >> /etc/ssh/sshd_config
46
+echo "AllowTcpForwarding yes" >> /etc/ssh/sshd_config
47
+echo "X11Forwarding no" >> /etc/ssh/sshd_config
48
+echo "ClientAliveInterval 420" >> /etc/ssh/sshd_config
49
+echo "ChallengeResponseAuthentication no" >> /etc/ssh/sshd_config
50
+echo "UsePAM yes" >> /etc/ssh/sshd_config
51
+
52
+
53
+# ssh client config
54
+# Override old values
55
+
56
+rm /etc/ssh/ssh_config
57
+
58
+echo "Host *" >> /etc/ssh/ssh_config
59
+echo "Protocol 2" >> /etc/ssh/ssh_config
60
+echo "ForwardAgent no" >> /etc/ssh/ssh_config
61
+echo "ForwardX11 no" >> /etc/ssh/ssh_config
62
+echo "HostbasedAuthentication no" >> /etc/ssh/ssh_config
63
+echo "StrictHostKeyChecking no" >> /etc/ssh/ssh_config
64
+echo "Ciphers aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc" >> /etc/ssh/ssh_config
65
+echo "Tunnel no" >> /etc/ssh/ssh_config
66
+echo "ServerAliveInterval 420" >> /etc/ssh/ssh_config
67
+
68
+# Disable root login
69
+usermod -L root
70
+
71
+# Disable ipv6
72
+echo "net.ipv6.conf.all.disable_ipv6 = 1" > /etc/sysctl.d/ipv6-disable.conf
73
+
74
+# Disable loading/unloading of modules
75
+#echo "kernel.modules_disabled = 1" > /etc/sysctl.d/modules_disabled.conf
76
+
77
+# Remove kernel symbols
78
+rm -f /boot/System.map*
79
+
80
+echo "[Link]" >> /etc/systemd/network/*.network
81
+echo "MTUBytes=1460" >> /etc/systemd/network/*.network
82
+
83
+cat > /usr/bin/gcloud << "EOF"
84
+docker inspect google/cloud-sdk &> /dev/null
85
+
86
+if [ $? == 1 ]; then
87
+        docker pull google/cloud-sdk &> /dev/null
88
+fi
89
+
90
+docker run --rm -it google/cloud-sdk gcloud $*
91
+EOF
92
+
93
+cat > /usr/bin/gsutil << "EOF"
94
+docker inspect google/cloud-sdk &> /dev/null
95
+
96
+if [ $? == 1 ]; then
97
+        docker pull google/cloud-sdk &> /dev/null
98
+fi
99
+
100
+docker run --rm -it google/cloud-sdk gsutil $*
101
+EOF
102
+
103
+chmod a+x /usr/bin/gcloud
104
+chmod a+x /usr/bin/gsutil
0 105
new file mode 100755
... ...
@@ -0,0 +1,241 @@
0
+#!/bin/bash
1
+#################################################
2
+#       Title:  mk-setup-grub                   #
3
+#        Date:  2014-11-26                      #
4
+#     Version:  1.0                             #
5
+#      Author:  sharathg@vmware.com             #
6
+#     Options:                                  #
7
+#################################################
8
+#   Overview
9
+#       This is a precursor for the vmware build system.
10
+#       This assumes that an empty hard disk is attached to the build VM.
11
+#       The path to this empty disk is specified in the HDD variable in config.inc
12
+#   End
13
+#
14
+grub_efi_install()
15
+{
16
+    mkdir $BUILDROOT/boot/efi
17
+    #
18
+    # if it is a loop device then we should mount the dev mapped boot partition
19
+    #
20
+    if [[ $HDD == *"loop"* ]]
21
+    then
22
+         BOOT_PARTITION=/dev/mapper/`basename ${HDD}`p1
23
+    else
24
+         BOOT_PARTITION=${HDD}1
25
+    fi
26
+    mkfs.fat $BOOT_PARTITION
27
+    mount -t vfat $BOOT_PARTITION $BUILDROOT/boot/efi
28
+    cp $INSTALLER_PATH/boot/unifont.pf2 /usr/share/grub/
29
+    grub2-efi-install --target=x86_64-efi --efi-directory=$BUILDROOT/boot/efi --bootloader-id=Boot --root-directory=$BUILDROOT --recheck
30
+    rm $BUILDROOT/boot/efi/EFI/Boot/grubx64.efi
31
+    cp $INSTALLER_PATH/EFI_x86_64/BOOT/* $BUILDROOT/boot/efi/EFI/Boot/
32
+    mkdir -p $BUILDROOT/boot/efi/boot/grub2    
33
+    echo "configfile (hd0,gpt${BOOT_PARTITION_NUMBER})${BOOT_DIRECTORY}grub2/grub.cfg" > $BUILDROOT/boot/efi/boot/grub2/grub.cfg
34
+    umount $BUILDROOT/boot/efi
35
+}
36
+
37
+grub_mbr_install()
38
+{
39
+    $grubInstallCmd --force --boot-directory=$BUILDROOT/boot "$HDD"
40
+}
41
+
42
+set -o errexit      # exit if error...insurance ;)
43
+set -o nounset      # exit if variable not initalized
44
+set +h          # disable hashall
45
+PRGNAME=${0##*/}    # script name minus the path
46
+SCRIPT_PATH=$(dirname $(realpath -s $0))
47
+INSTALLER_PATH=$SCRIPT_PATH/../../../installer
48
+source $INSTALLER_PATH/config.inc       #   configuration parameters
49
+source $INSTALLER_PATH/function.inc     #   commonn functions
50
+LOGFILE=/var/log/"${PRGNAME}-${LOGFILE}"    #   set log file name
51
+#LOGFILE=/dev/null      #   uncomment to disable log file
52
+ARCH=$(uname -m)    # host architecture
53
+[ ${EUID} -eq 0 ]   || fail "${PRGNAME}: Need to be root user: FAILURE"
54
+> ${LOGFILE}        #   clear/initialize logfile
55
+
56
+# Check if passing a HDD and partition
57
+if [ $# -eq 6 ] 
58
+    then
59
+       BOOTMODE=$1
60
+       HDD=$2
61
+       ROOT_PARTITION_PATH=$3
62
+       BOOT_PARTITION_PATH=$4
63
+       BOOT_DIRECTORY=$5
64
+       BOOT_PARTITION_NUMBER=$6
65
+fi
66
+
67
+#
68
+#	Install grub2.
69
+#
70
+UUID_VAL=$(blkid -s UUID -o value $ROOT_PARTITION_PATH)
71
+PARTUUID_VAL=$(blkid -s PARTUUID -o value $ROOT_PARTITION_PATH)
72
+BOOT_UUID=$(blkid -s UUID -o value $BOOT_PARTITION_PATH)
73
+echo "Changing boot loader to MBR type on raw disk"
74
+
75
+sgdisk -m 1:2 "$HDD"
76
+
77
+grubInstallCmd=""
78
+mkdir -p $BUILDROOT/boot/grub2
79
+ln -sfv grub2 $BUILDROOT/boot/grub
80
+command -v grub-install >/dev/null 2>&1 && grubInstallCmd="grub-install" && { echo >&2 "Found grub-install"; }
81
+command -v grub2-install >/dev/null 2>&1 && grubInstallCmd="grub2-install" && { echo >&2 "Found grub2-install"; }
82
+if [ -z $grubInstallCmd ]; then
83
+echo "Unable to find grub install command"
84
+exit 1
85
+fi
86
+rm -rf ${BUILDROOT}/boot/grub2/fonts
87
+mkdir -p ${BUILDROOT}/boot/grub2/themes/photon
88
+cp $INSTALLER_PATH/boot/splash.png ${BUILDROOT}/boot/grub2/themes/photon/photon.png
89
+cp $INSTALLER_PATH/boot/terminal_*.tga ${BUILDROOT}/boot/grub2/themes/photon/
90
+cp $INSTALLER_PATH/boot/theme.txt ${BUILDROOT}/boot/grub2/themes/photon/
91
+
92
+if [ "$BOOTMODE" == "bios" ]; then 
93
+    grub_mbr_install
94
+fi
95
+if [ "$BOOTMODE" == "efi" ]; then 
96
+    grub_efi_install
97
+fi
98
+
99
+cat > ${BUILDROOT}/boot/grub2/grub.cfg <<EOF
100
+# Begin /boot/grub2/grub.cfg
101
+#
102
+# DO NOT EDIT THIS FILE
103
+#
104
+# It is automatically generated by grub-mkconfig using templates
105
+# from /etc/grub.d and settings from /etc/default/grub
106
+#
107
+
108
+### BEGIN /etc/grub.d/00_header ###
109
+if [ -s \$prefix/grubenv ]; then
110
+  load_env
111
+fi
112
+set default="0"
113
+
114
+if [ x"\${feature_menuentry_id}" = xy ]; then
115
+  menuentry_id_option="--id"
116
+else
117
+  menuentry_id_option=""
118
+fi
119
+
120
+export menuentry_id_option
121
+load_env -f "$BOOT_DIRECTORY"photon.cfg
122
+set rootpartition=PARTUUID=$PARTUUID_VAL
123
+
124
+if [ "\${prev_saved_entry}" ]; then
125
+  set saved_entry="\${prev_saved_entry}"
126
+  save_env saved_entry
127
+  set prev_saved_entry=
128
+  save_env prev_saved_entry
129
+  set boot_once=true
130
+fi
131
+
132
+function savedefault {
133
+  if [ -z "\${boot_once}" ]; then
134
+    saved_entry="\${chosen}"
135
+    save_env saved_entry
136
+  fi
137
+}
138
+
139
+function load_video {
140
+  if [ x\$feature_all_video_module = xy ]; then
141
+    insmod all_video
142
+  else
143
+    insmod efi_gop
144
+    insmod efi_uga
145
+    insmod ieee1275_fb
146
+    insmod vbe
147
+    insmod vga
148
+    insmod video_bochs
149
+    insmod video_cirrus
150
+  fi
151
+}
152
+
153
+serial --speed=38400 --unit=0 --word=8 --parity=no --stop=1
154
+terminal_input serial
155
+terminal_output serial
156
+set timeout=5
157
+### END /etc/grub.d/00_header ###
158
+
159
+### BEGIN /etc/grub.d/10_linux ###
160
+menuentry 'GNU/Linux' --class gnu-linux --class gnu --class os \$menuentry_id_option 'gnulinux-simple-UUID_PLACEHOLDER' {
161
+    load_video
162
+    set gfxpayload=keep
163
+    insmod gzio
164
+    insmod part_msdos
165
+    insmod ext2
166
+    set root='hd0,msdos2'
167
+    if [ x\$feature_platform_search_hint = xy ]; then
168
+      search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos2 --hint-efi=hd0,msdos2 --hint-baremetal=ahci0,msdos2  UUID_PLACEHOLDER
169
+    else
170
+      search --no-floppy --fs-uuid --set=root UUID_PLACEHOLDER
171
+    fi
172
+    echo    'Loading Linux \$photon_linux ...'
173
+    linux   "$BOOT_DIRECTORY"\$photon_linux root=/dev/sda2 ro console=ttyS0,38400n8 
174
+}
175
+submenu 'Advanced options for GNU/Linux' \$menuentry_id_option 'gnulinux-advanced-UUID_PLACEHOLDER' {
176
+    menuentry 'GNU/Linux, with Linux \$photon_linux' --class gnu-linux --class gnu --class os \$menuentry_id_option 'gnulinux-\$photon_linux-advanced-UUID_PLACEHOLDER' {
177
+        load_video
178
+        set gfxpayload=keep
179
+        insmod gzio
180
+        insmod part_msdos
181
+        insmod ext2
182
+        set root='hd0,msdos2'
183
+        if [ x\$feature_platform_search_hint = xy ]; then
184
+          search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos2 --hint-efi=hd0,msdos2 --hint-baremetal=ahci0,msdos2  UUID_PLACEHOLDER
185
+        else
186
+          search --no-floppy --fs-uuid --set=root UUID_PLACEHOLDER
187
+        fi
188
+        echo    'Loading Linux \$photon_linux ...'
189
+        linux   "$BOOT_DIRECTORY"\$photon_linux root=/dev/sda2 ro console=ttyS0,38400n8 
190
+    }
191
+    menuentry 'GNU/Linux, with Linux \$photon_linux (recovery mode)' --class gnu-linux --class gnu --class os \$menuentry_id_option 'gnulinux-\$photon_linux-recovery-UUID_PLACEHOLDER' {
192
+        load_video
193
+        set gfxpayload=keep
194
+        insmod gzio
195
+        insmod part_msdos
196
+        insmod ext2
197
+        set root='hd0,msdos2'
198
+        if [ x\$feature_platform_search_hint = xy ]; then
199
+          search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos2 --hint-efi=hd0,msdos2 --hint-baremetal=ahci0,msdos2  UUID_PLACEHOLDER
200
+        else
201
+          search --no-floppy --fs-uuid --set=root UUID_PLACEHOLDER
202
+        fi
203
+        echo    'Loading Linux \$photon_linux ...'
204
+        linux   "$BOOT_DIRECTORY"\$photon_linux root=/dev/sda2 ro single console=ttyS0,38400n8
205
+    }
206
+}
207
+
208
+### END /etc/grub.d/10_linux ###
209
+
210
+### BEGIN /etc/grub.d/20_linux_xen ###
211
+
212
+### END /etc/grub.d/20_linux_xen ###
213
+
214
+### BEGIN /etc/grub.d/30_os-prober ###
215
+### END /etc/grub.d/30_os-prober ###
216
+
217
+### BEGIN /etc/grub.d/40_custom ###
218
+# This file provides an easy way to add custom menu entries.  Simply type the
219
+# menu entries you want to add after this comment.  Be careful not to change
220
+# the 'exec tail' line above.
221
+### END /etc/grub.d/40_custom ###
222
+
223
+### BEGIN /etc/grub.d/41_custom ###
224
+if [ -f  \${config_directory}/custom.cfg ]; then
225
+  source \${config_directory}/custom.cfg
226
+elif [ -z "\${config_directory}" -a -f  \$prefix/custom.cfg ]; then
227
+  source \$prefix/custom.cfg;
228
+fi
229
+### END /etc/grub.d/41_custom ###
230
+
231
+# End /boot/grub2/grub.cfg
232
+EOF
233
+
234
+sed -i "s/UUID_PLACEHOLDER/$UUID_VAL/" "$BUILDROOT"/boot/grub2/grub.cfg > ${LOGFILE} 
235
+
236
+#Cleanup the workspace directory
237
+#find "$BUILDROOT"/{,usr/}{lib,bin,sbin} -type f -exec strip --strip-debug --strip-unneeded '{}' ';' > /dev/null 2>&1
238
+rm -rf "$BUILDROOT"/tools
239
+rm -rf "$BUILDROOT"/RPMS
240
+#umount $BUILDROOT
0 241
new file mode 100644
... ...
@@ -0,0 +1,12 @@
0
+[Unit]
1
+Description=Network Time Service
2
+After=network.target nss-lookup.target
3
+
4
+[Service]
5
+Type=forking
6
+PrivateTmp=true
7
+ExecStart=/usr/bin/ntpd -g -u ntp:ntp
8
+Restart=always
9
+
10
+[Install]
11
+WantedBy=multi-user.target
0 12
new file mode 100755
... ...
@@ -0,0 +1,114 @@
0
+#!/bin/bash
1
+
2
+#################################################
3
+#	Title:	image-builder.sh		            #
4
+#   Date:	2015-07-22        	 		        #
5
+#   Version:	1.1				                #
6
+#   Author:	anishs@vmware.com    		        #
7
+#################################################
8
+#	Overview
9
+#		Create images like ami, azure, gce, ova, rpi3
10
+#	End
11
+#
12
+
13
+for i in "$@"
14
+do
15
+    case $i in
16
+        -b=*|--build-scripts-path=*)
17
+        BUILD_SCRIPTS_PATH="${i#*=}"
18
+        shift
19
+        ;;
20
+        -i=*|--img-name=*)
21
+        IMG_NAME="${i#*=}"
22
+        shift
23
+        ;;
24
+        -s=*|--src-root=*)
25
+        SRC_ROOT="${i#*=}"
26
+        shift
27
+        ;;
28
+        -g=*|--generated-data-path=*)
29
+        GENERATED_DATA_PATH="${i#*=}"
30
+        shift
31
+        ;;
32
+        -s=*|--stage-path=*)
33
+        PHOTON_STAGE_PATH="${i#*=}"
34
+        shift
35
+        ;;
36
+        -r=*|--additional-rpms-path=*)
37
+        ADDITIONAL_RPMS_PATH="${i#*=}"
38
+        shift
39
+        ;;
40
+        *)
41
+        ;;
42
+    esac
43
+done
44
+
45
+WORKING_DIR=$PHOTON_STAGE_PATH/$IMG_NAME
46
+
47
+PHOTON_IMG_OUTPUT_PATH=$PHOTON_STAGE_PATH/$IMG_NAME
48
+IMAGE_CONFIG_FILE=${BUILD_SCRIPTS_PATH}/$IMG_NAME/config_$IMG_NAME.json
49
+IMAGE_CONFIG_SAFE_FILE=${BUILD_SCRIPTS_PATH}/$IMG_NAME/config_safe_$IMG_NAME.json
50
+
51
+cd $BUILD_SCRIPTS_PATH
52
+image_list=`for i in $(ls -d */); do echo ${i%%/}; done`
53
+if ! [[ $image_list =~ (^|[[:space:]])$IMG_NAME($|[[:space:]]) ]] ; then
54
+    echo "Input image name not supported. Aborting."; exit 1;
55
+fi
56
+if [[ $IMG_NAME == ova* ]] ; then
57
+    command -v ovftool >/dev/null 2>&1 || { echo "Ovftool not installed. Aborting." >&2; exit 1; }
58
+fi
59
+
60
+rm -rf $WORKING_DIR
61
+mkdir -p $WORKING_DIR
62
+INSTALLER_PATH=$SRC_ROOT/installer
63
+
64
+cd $WORKING_DIR
65
+cp $IMAGE_CONFIG_FILE $IMAGE_CONFIG_SAFE_FILE
66
+
67
+DISK_SETUP="--disk-setup-script ${BUILD_SCRIPTS_PATH}/mk-setup-vmdk.sh"
68
+if [ -f ${BUILD_SCRIPTS_PATH}/$IMG_NAME/mk-setup-vmdk.sh ]; then
69
+    DISK_SETUP="--disk-setup-script ${BUILD_SCRIPTS_PATH}/$IMG_NAME/mk-setup-vmdk.sh"
70
+fi
71
+
72
+DISK_CLEANUP="--disk-cleanup-script ${BUILD_SCRIPTS_PATH}/mk-clean-vmdk.sh"
73
+if [ -f ${BUILD_SCRIPTS_PATH}/$IMG_NAME/mk-clean-vmdk.sh ]; then
74
+    DISK_CLEANUP="--disk-cleanup-script ${BUILD_SCRIPTS_PATH}/$IMG_NAME/mk-clean-vmdk.sh"
75
+fi
76
+
77
+PREPARE_SYSTEM="--prepare-script ${INSTALLER_PATH}/mk-prepare-system.sh"
78
+if [ -f ${BUILD_SCRIPTS_PATH}/$IMG_NAME/mk-prepare-system.sh ]; then
79
+    PREPARE_SYSTEM="--prepare-script ${BUILD_SCRIPTS_PATH}/$IMG_NAME/mk-prepare-system.sh"
80
+fi
81
+
82
+GRUB_SCRIPT="--setup-grub-script ${INSTALLER_PATH}/mk-setup-grub.sh"
83
+if [ -f ${BUILD_SCRIPTS_PATH}/$IMG_NAME/mk-setup-grub.sh ]; then
84
+    GRUB_SCRIPT="--setup-grub-script ${BUILD_SCRIPTS_PATH}/$IMG_NAME/mk-setup-grub.sh"
85
+fi
86
+
87
+PASSWORD=`date | md5sum | cut -f 1 -d ' '`
88
+sed -i "s/PASSWORD/$PASSWORD/" $IMAGE_CONFIG_SAFE_FILE
89
+
90
+if [ -n "$ADDITIONAL_RPMS_PATH" ]
91
+  then
92
+    mkdir -p $PHOTON_STAGE_PATH/RPMS/additional
93
+    cp -f $ADDITIONAL_RPMS_PATH/* $PHOTON_STAGE_PATH/RPMS/additional/
94
+fi
95
+
96
+${INSTALLER_PATH}/photonInstaller.py -r $PHOTON_STAGE_PATH/RPMS -v $WORKING_DIR/photon-${IMG_NAME} $GRUB_SCRIPT $PREPARE_SYSTEM $DISK_CLEANUP $DISK_SETUP -o $GENERATED_DATA_PATH -d $PHOTON_STAGE_PATH/pkg_info.json -f $IMAGE_CONFIG_SAFE_FILE
97
+status=$?
98
+rm $IMAGE_CONFIG_SAFE_FILE
99
+
100
+cd $BUILD_SCRIPTS_PATH
101
+
102
+[ $status -eq 0 ] && ./customize_image.py \
103
+ -r ${PHOTON_IMG_OUTPUT_PATH}/photon-${IMG_NAME}.raw \
104
+ -c $IMAGE_CONFIG_FILE \
105
+ -w $WORKING_DIR \
106
+ -m $PHOTON_IMG_OUTPUT_PATH/photon-${IMG_NAME} \
107
+ -a $PHOTON_STAGE_PATH/RPMS/additional \
108
+ -i $IMG_NAME \
109
+ -t $SRC_ROOT/tools/bin/ \
110
+ -b $BUILD_SCRIPTS_PATH \
111
+ -s $SRC_ROOT
112
+
113
+exit 0
0 114
new file mode 100755
... ...
@@ -0,0 +1,34 @@
0
+#!/bin/bash
1
+#################################################
2
+#	Title:	mk-clean-vmdk			#
3
+#        Date:	2015-02-10   	 		#
4
+#     Version:	1.0				#
5
+#      Author:	mbassiouny@vmware.com		#
6
+#     Options:					#
7
+#################################################
8
+#	Overview
9
+#		Cleaning up vmdk creation process
10
+#	End
11
+#
12
+set -o errexit		# exit if error...insurance ;)
13
+set -o nounset		# exit if variable not initalized
14
+set +h			# disable hashall
15
+PRGNAME=${0##*/}	# script name minus the path
16
+SCRIPT_PATH=$(dirname $(realpath -s $0))
17
+INSTALLER_PATH=$SCRIPT_PATH/../../installer
18
+source ${INSTALLER_PATH}/config.inc		#	configuration parameters
19
+LOGFILE="/var/log/${PRGNAME}-${LOGFILE}"	#	set log file name
20
+LFS_DISK="/mnt/photon-disk"
21
+[ ${EUID} -eq 0 ]	|| { echo "${PRGNAME}: Need to be root user: FAILURE"; exit 1; }
22
+> ${LOGFILE}		#	clear/initialize logfile
23
+
24
+# Check if passing DISK-DEVICE
25
+[ $# -eq 1 ] || { echo "Invalid arguments, you should pass disk device"; exit 1; }
26
+DISK_DEVICE=$1
27
+
28
+echo "Deleting device map parition"
29
+kpartx -d $DISK_DEVICE >> $LOGFILE
30
+
31
+echo "Detaching loop device from vmdk"
32
+losetup -d $DISK_DEVICE
33
+
0 34
new file mode 100755
... ...
@@ -0,0 +1,103 @@
0
+#!/bin/bash
1
+#################################################
2
+#	Title:	mk-setup-vmdk			#
3
+#        Date:	2014-11-14   	 		#
4
+#     Version:	1.0				#
5
+#      Author:	dthaluru@vmware.com		#
6
+#     Options:					#
7
+#################################################
8
+#	Overview
9
+#		Creating hard disk with photon on it
10
+#	End
11
+#
12
+set -o errexit		# exit if error...insurance ;)
13
+set -o nounset		# exit if variable not initalized
14
+set +h			# disable hashall
15
+PRGNAME=${0##*/}	# script name minus the path
16
+INSTALLER_PATH=../../installer
17
+source ${INSTALLER_PATH}/config.inc		#	configuration parameters
18
+LOGFILE="/var/log/${PRGNAME}-${LOGFILE}"	#	set log file name
19
+LFS_DISK="/mnt/photon-disk"
20
+[ ${EUID} -eq 0 ]	|| die "${PRGNAME}: Need to be root user: FAILURE"
21
+> ${LOGFILE}		#	clear/initialize logfile
22
+
23
+echo -e "Setting up the disk...\n"
24
+VMDK_IMAGE_NAME=mydisk.vmdk
25
+ROOT_PARTITION_SIZE=8
26
+SWAP_PARTITION_SIZE=2
27
+BOOT_FIRM_WARE="bios"
28
+
29
+while [[ $# > 0 ]]
30
+do
31
+	key="$1"
32
+	shift
33
+ 
34
+	case $key in
35
+		-rp|--ROOT_PARTITION_SIZE)
36
+		ROOT_PARTITION_SIZE="$1"
37
+		shift
38
+	;;
39
+		-sp|--SWAP_PARTITION_SIZE)
40
+		SWAP_PARTITION_SIZE="$1"
41
+		shift
42
+	;;
43
+		-fm|--firmware)
44
+		BOOT_FIRM_WARE="$1"
45
+		shift
46
+
47
+	;;
48
+		-n|--IMG_NAME)
49
+		VMDK_IMAGE_NAME="$1".raw
50
+		shift
51
+	;;
52
+		-h|--help)
53
+		echo 'Usage:'
54
+		echo '-rp|--ROOT_PARTITION_SIZE :sets root partition size'
55
+		echo '-sp|--SWAP_PARTITION_SIZE :sets swap partition size'
56
+		echo '-n|--IMG_NAME             :sets name of the vmdk image'
57
+		echo '-fm|--firmware            :firmware'
58
+		exit 0
59
+	;;
60
+	*)
61
+		# unknown option
62
+	;;
63
+	esac
64
+done
65
+
66
+mkdir -p $LFS_DISK
67
+
68
+TOTAL_SIZE=` echo $ROOT_PARTITION_SIZE + $SWAP_PARTITION_SIZE | bc`
69
+
70
+echo "Creating raw disk file " $VMDK_IMAGE_NAME " of size " $TOTAL_SIZE
71
+dd if=/dev/zero of=$VMDK_IMAGE_NAME bs=1 seek=$(($TOTAL_SIZE * 1024 * 1024 * 1024)) count=0
72
+chmod 755 $VMDK_IMAGE_NAME
73
+
74
+echo "Associating loopdevice to raw disk"
75
+DISK_DEVICE=`losetup --show -f $VMDK_IMAGE_NAME`
76
+
77
+echo "Creating partition on raw disk"
78
+if [ $SWAP_PARTITION_SIZE -gt 0 ] 
79
+then
80
+      sgdisk -n 1::+8M -n 2::+${ROOT_PARTITION_SIZE}G -n 3: -p $DISK_DEVICE >> $LOGFILE
81
+else
82
+      sgdisk -n 1::+8M -n 2: -p $DISK_DEVICE >> $LOGFILE
83
+fi
84
+
85
+if [ $BOOT_FIRM_WARE = "efi" ]
86
+then
87
+    echo "EFI boot partition"
88
+    sgdisk -t1:ef00 $DISK_DEVICE >> $LOGFILE
89
+else
90
+    echo "BIOS boot partition"
91
+    sgdisk -t1:ef02 $DISK_DEVICE >> $LOGFILE
92
+fi
93
+echo "Mapping device partition to loop device"
94
+kpartx -avs $DISK_DEVICE >> $LOGFILE
95
+
96
+DEVICE_NAME=`echo $DISK_DEVICE|cut -c6- `
97
+
98
+echo "Adding file system to device partition"
99
+mkfs -t ext4 /dev/mapper/${DEVICE_NAME}p2
100
+
101
+echo "DISK_DEVICE=$DISK_DEVICE"
102
+echo "ROOT_PARTITION=/dev/mapper/${DEVICE_NAME}p2"
0 103
new file mode 100644
... ...
@@ -0,0 +1,15 @@
0
+{
1
+    "hostname": "photon-machine",
2
+    "password": 
3
+        {
4
+            "crypted": false,
5
+            "text": "PASSWORD"
6
+        },
7
+    "packagelist_file": "packages_ova.json",
8
+    "size": { "root": "16", "swap": "0" },
9
+    "public_key":"<ssh-key-here>",
10
+    "customartifacts": { "postinstallscripts": ["ova-custom-patch.sh"] },
11
+    "artifacttype": "ova",
12
+    "keeprawdisk": "false"
13
+}
14
+
0 15
new file mode 100755
... ...
@@ -0,0 +1,3 @@
0
+#!/bin/bash
1
+echo -e "changeme\nchangeme" | passwd root
2
+chage -d 0 root
0 3
\ No newline at end of file
1 4
new file mode 100644
... ...
@@ -0,0 +1,107 @@
0
+        </VirtualHardwareSection>
1
+ 	<ProductSection> 
2
+ 		<Info>Information about the installed software</Info> 
3
+ 		<Product>Photon OS</Product> 
4
+ 		<Vendor>VMware Inc.</Vendor> 
5
+ 		<Version>3.0</Version> 
6
+ 		<FullVersion>3.0</FullVersion> 
7
+ 	</ProductSection>
8
+	<EulaSection>
9
+        <Info>End User License Agreement</Info>
10
+        <License msgid="eula">
11
+	                           VMWARE, INC. 
12
+                         BETA LICENSE AGREEMENT
13
+
14
+Note: BY CLICKING “I AGREE,” ACCESSING, DOWNLOADING, INSTALLING, UPLOADING, COPYING OR USING THE BETA SOFTWARE, YOU CONCLUDE AND AGREE TO THIS BETA LICENSE AGREEMENT (“AGREEMENT”) IN A LEGALLY BINDING MANNER WITH VMWARE, INC., 3401 HILLVIEW AVENUE, PALO ALTO, CA 94304, USA (“VMware”). IF YOU HAVE SPECIFIED IN CONNECTION WITH THE REGISTRATION PROCESS FOR THIS SOFTWARE BETA TEST PROGRAM THAT YOU ARE ACTING ON BEHALF OF A COMPANY OR OTHER ORGANIZATION, YOU REPRESENT THAT YOU ARE AUTHORIZED TO LEGALLY BIND SUCH ORGANIZATION AND THAT YOU CONCLUDE THE AGREEMENT ON BEHALF OF SUCH ORGANIZATION. IN THE FOLLOWING, THE TERMS “YOU” AND “LICENSEE” SHALL REFER, JOINTLY AND SEVERALLY, TO YOU INDIVIDUALLY AND ANY ORGANIZATION ON WHOSE BEHALF YOU ACT.
15
+
16
+IF YOU DO NOT AGREE TO THE TERMS OF THIS BETA LICENSE AGREEMENT, THEN DO *NOT* CLICK “I AGREE,” ACCESS, DOWNLOAD, INSTALL, UPLOAD, COPY OR USE THE BETA SOFTWARE.
17
+
18
+1.	DEFINITIONS.
19
+
20
+       (a)  “Beta Software” shall mean the beta version of VMware’s software and the media and Documentation provided by VMware to Licensee and for which Licensee is granted a use license pursuant to this Agreement.  The Beta Software will be provided in object form only.
21
+       
22
+       (b)  “Documentation” shall mean the printed or online written reference material furnished to Licensee in conjunction with the Beta Software, including, without limitation, instructions, beta testing guidelines, and end user guides.
23
+       
24
+       (c)  “Intellectual Property Rights” shall mean all intellectual property rights, including, without limitation, patent, copyright, trademark, and trade secret, recognized in any jurisdiction worldwide, whether perfected or not, and any similar and other proprietary rights.
25
+       
26
+       (d)  “Open Source Software” means code that is provided with the Beta Software and identified as open source code or otherwise as being subject to open source license terms.
27
+       
28
+       (e)  “Updates” shall mean a modification, error correction, bug fix, new release, or other update to or for the Beta Software.
29
+
30
+2.	LICENSE GRANT, USE AND OWNERSHIP.
31
+
32
+	(a)  Limited License.  Subject to the terms and conditions of this Agreement, VMware grants to Licensee a non-exclusive, revocable (at any time and for any reason, at VMware’s sole discretion), royalty-free, non-transferable, non-assignable license (without the right to sublicense):
33
+
34
+             (i) to use the Beta Software in accordance with the Documentation solely for purposes of (A) internal testing and evaluation to determine whether or not to license generally available commercial versions of the Beta Software if such versions ever become available, and (B) internal development to create interoperability between the Beta Software and Licensee products, 
35
+            
36
+            (ii) to use the Documentation provided with the Beta Software in support of Licensee’s authorized use of the Beta Software, and
37
+           
38
+            (iii) to copy Beta Software for Licensee’s archival or backup purposes, provided that all titles and trademarks, copyright, and restricted rights notices are reproduced on such copies.
39
+       
40
+       (b)  Evaluation Feedback. The purpose of this limited license is the testing and evaluation of the Beta Software and Documentation and development by Licensee of Licensee products that interoperate with the Beta Software.  In furtherance of this purpose, Licensee shall provide feedback to VMware concerning the functionality and performance of the Beta Software from time to time as reasonably requested by VMware, including, without limitation, identifying potential errors and improvements (collectively the “Feedback”).  Licensee will provide Feedback in a manner that is mutually agreeable to the parties.  VMware may use Feedback, without restriction in any manner now known or in the future conceived, to improve or enhance its products and, accordingly, and you hereby grant to VMware a non-exclusive, perpetual, irrevocable, royalty-free, transferable, worldwide right and license, with the right to sublicense (i) to use, reproduce, disclose, distribute, modify, prepare derivative works of and otherwise exploit the Feedback and other information you provide to VMware under this Agreement, and (ii) to make, use, sell, offer to sell, import and export any product or service that incorporates the Feedback and other information you provide to VMware under this Agreement.
41
+       
42
+       (c)  Restrictions.  Licensee shall not disclose, provide, or disseminate in any manner the Beta Software (including the Documentation) or Confidential Information to any third party, including but not limited to its partners, affiliates or subsidiaries.  Except to the extent contrary to any applicable laws, Licensee will not, and will not permit any third party to, sublicense, rent, copy, modify, create derivative works of, translate, reverse engineer, decompile, disassemble, or otherwise reduce to human perceivable form any portion of the Beta Software or accompanying Documentation.  Without limiting the generality of the foregoing, Licensee shall not use the Beta Software for Licensee’s product development or any other commercial purpose, including, but not limited to sales or marketing activities, except as expressly permitted in this Agreement.  The Beta Software and all performance data and test results, including without limitation, benchmark test results (collectively “Performance Data”), relating  to the Beta Software are the Confidential Information of VMware, and will be treated in accordance with the terms of Section 4 of this Agreement.  Accordingly, Licensee shall not publish or disclose to any third party any Performance Data relating to the Beta Software.  
43
+
44
+       (d)  Ownership.  VMware shall own and retain all right, title and interest in and to the Intellectual Property Rights in the Beta Software and any derivative works thereof, subject only to the limited license expressly set forth in Section 2(a) hereof.  Licensee does not acquire any other rights, express or implied, in the Beta Software.  ALL RIGHTS NOT EXPRESSLY GRANTED HEREUNDER ARE RESERVED TO VMWARE. 
45
+       
46
+       (e)  No Support Services.  VMware is under no obligation to support the Beta Software in any manner or to provide any Updates to Licensee.  In the event VMware, in its sole discretion, supplies any Update to Licensee, the Update shall be deemed Beta Software under this Agreement and shall be subject to the terms and conditions of this Agreement.
47
+       
48
+	(f)  Third-Party Software.  The Beta Software may enable a computer to run multiple instances of third-party guest operating systems and application programs.  Licensee acknowledges that Licensee is responsible for obtaining any licenses necessary to operate any third-party software, including guest operating systems and application programs.
49
+
50
+       (g)  Open Source Software.  Except for Sections 5, 6, and 7, the terms and conditions of this Agreement shall not apply to any Open Source Software accompanying the Beta Software.  Any such Open Source Software is provided under the terms of the applicable open source license agreement or copyright notice accompanying such Open Source Software or included in the open source licenses file accompanying the Beta Software. 
51
+       
52
+3.	TERM AND TERMINATION.  Unless otherwise terminated as specified under this Agreement, Licensee’s rights with respect to the Beta Software will terminate upon the earlier of (a) the initial commercial release by VMware of a generally available version of the Beta Software or (b) automatic expiration of the Beta Software based on the system date.  Either party may terminate this Agreement at any time for any reason or no reason by providing the other party advance written notice thereof.  Licensee agrees that this Agreement will automatically terminate without notice in the event Licensee discloses the Beta Software in breach of Section 4 (Confidentiality) below. Upon any expiration or termination of this Agreement, the rights and licenses granted to Licensee under this Agreement shall immediately terminate, and Licensee shall immediately cease using, and will destroy or render practically inaccessible the Beta Software, Documentation, and all other tangible items in Licensee’s possession or control that contain Confidential Information.  The rights and obligations of the parties set forth in Sections 2(b), 2(c), 2(d), 2(e), 2(f), 2(g), 3, 4, 5, 6, 7 and 8 survive termination or expiration of this Agreement for any reason.  
53
+
54
+4.	CONFIDENTIALITY.  
55
+
56
+       (a) "Confidential Information" shall mean the Beta Software, all information regarding the Beta Software (including any trade secrets, know-how, inventions, techniques, processes, and algorithms embodied in the Beta Software), Documentation, Performance Data, any Updates, VMware products, product roadmaps, and other technical, business, financial and product development plans, forecasts and strategies, and other information provided by VMware to Licensee under this Agreement, whether disclosed orally, in writing, or by examination or inspection, other than information that Licensee can demonstrate (i) was already known to Licensee, other than under an obligation of confidentiality, at the time of disclosure; (ii) was generally available in the public domain at the time of disclosure to Licensee; (iii) became generally available in the public domain after disclosure other than through any act or omission of Licensee; (iv) was subsequently lawfully disclosed to Licensee by a third party without any obligation of confidentiality; or (v) was independently developed by Licensee without use of or reference to any information or materials disclosed by VMware or its suppliers.  If Licensee wishes to disclose to VMware any information under this Agreement that Licensee considers proprietary or confidential to Licensee (“Licensee Information”), then Licensee agrees such disclose will be governed by a separate non-disclosure agreement (“NDA”) by and between the parties.   If Licensee is required to disclose Confidential Information by applicable law or court order, Licensee shall notify VMware of the required disclosure promptly in writing and shall cooperate with VMware in any lawful action to contest or limit the scope of the required disclosure.  Licensee shall not use any Confidential Information for any purpose other than as expressly authorized under this Agreement.  In no event shall Licensee use the Beta Software or any Confidential Information to develop, manufacture, market, sell, or distribute any product or service, including any VMware products except as expressly set forth in this Agreement.  Licensee shall not disclose any Confidential Information to any third party. Without limiting the foregoing, Licensee shall use at least the same degree of care that it uses to prevent the disclosure of its own confidential information of like importance, but in no event less than reasonable care, to prevent the disclosure of such Confidential Information.
57
+       
58
+       (b)  Additional Confidentiality Restrictions for Highly Confidential Beta Software.  For certain Beta Software designated by VMware in writing as highly confidential (“Highly Confidential Beta Software”), Licensee agrees that the following, additional confidentiality obligations and restrictions will apply:
59
+       
60
+            (i)  Licensee shall limit dissemination of Highly Confidential Beta Software and related information concerning product features, future technologies and roadmaps only to Information Technology teams and/or software/solutions development teams of Licensee approved in writing by VMware, and only to individuals on such teams on a need-to-know basis and solely for purposes expressly authorized under this Agreement.  For clarity and without limiting the generality of the foregoing, Licensee shall not disseminate any Highly Confidential Beta Software to Licensee's sales and marketing field organizations.  Licensee will assign an employee who will be primarily responsible for ensuring Licensee’s full compliance with the terms described in this Section 4(b) herein. 
61
+             
62
+            (ii)  Improper Disclosure of Highly Confidential Beta Software.  Licensee acknowledges that damages due to Licensee’s improper disclosure of Highly Confidential Beta Software or related information concerning product features, future technologies and roadmaps may be irreparable and that monetary damages would be inadequate to compensate VMware for any breach of this Agreement.  In the event that VMware reasonably believes that Licensee has disseminated Highly Confidential Beta Software or related information concerning product features, future technologies and roadmaps to an unauthorized party, Licensee will be immediately removed from VMware’s Beta Software program and will not be permitted to participate in any VMware Beta Software program in the future.  Additionally, all rights and licenses granted to Licensee under this Agreement shall immediately terminate in accordance with Section 3 herein (Term and Termination), and (b) in addition to all other remedies available in law or otherwise, VMware is entitled to seek equitable relief, including injunction and preliminary injunction against the threatened breach of this Agreement or the continuation of any such breach. 
63
+       
64
+5.	LIMITATION OF LIABILITY.  IT IS UNDERSTOOD THAT THE BETA SOFTWARE IS PROVIDED WITHOUT CHARGE FOR THE PURPOSES EXPRESSLY PERMITTED UNDER THIS AGREEMENT.  ACCORDINGLY, TO THE FULLEST EXTENT PERMITTED BY LAW, BUT SUBJECT ALWAYS TO THIS SECTION 5, THE TOTAL LIABILITY OF VMWARE AND ITS LICENSORS ARISING OUT OF OR RELATED TO THIS AGREEMENT SHALL NOT EXCEED $100.00.  TO THE FULLEST EXTENT PERMITTED BY LAW, IN NO EVENT SHALL VMWARE OR ITS LICENSORS HAVE LIABILITY FOR ANY INDIRECT, INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, OR LOSS OF BUSINESS INFORMATION, HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY (INCLUDING WITHOUT LIMITATION, TORT, STATUTE, CONTRACT OR OTHER), EVEN IF VMWARE AND ITS LICENSORS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.  THESE LIMITATIONS SHALL APPLY NOTWITHSTANDING ANY FAILURE OF ESSENTIAL PURPOSE OF ANY LIMITED REMEDY.  THE PARTIES ACKNOWLEDGE THAT THE VARIOUS CONSIDERATIONS DUE TO VMWARE IN ACCORDANCE WITH THE TERMS OF THIS AGREEMENT WERE TAKEN INTO ACCOUNT IN DETERMINING THE LIMITATION OF LIABILITY SET FORTH IN THIS SECTION 5. LICENSEE ACKNOWLEDGES AND AGREES THIS LIMITATION IS AN ESSENTIAL ELEMENT OF THIS AGREEMENT AND THAT VMWARE WOULD NOT ENTER INTO THIS AGREEMENT WITHOUT THESE LIMITATIONS ON ITS LIABILITY.
65
+
66
+6.	WARRANTY DISCLAIMER.  IT IS UNDERSTOOD THAT THE BETA SOFTWARE, OPEN SOURCE SOFTWARE, DOCUMENTATION, AND ANY UPDATES MAY CONTAIN ERRORS AND ARE PROVIDED FOR THE PURPOSES EXPRESSLY PERMITTED UNDER THIS AGREEMENT.  TO THE FULLEST EXTENT PERMITTED BY LAW, AND SUBJECT TO SECTION 5, THE BETA SOFTWARE, THE OPEN SOURCE SOFTWARE, THE DOCUMENTATION, AND ANY UPDATES ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE.  TO THE FULLEST EXTENT PERMITTED BY LAW, AND SUBJECT TO SECTION 5, VMWARE AND ITS LICENSORS SPECIFICALLY DISCLAIM ALL IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE.  Licensee acknowledges that VMware has not publicly announced the availability of the Beta Software, that such Beta Software may contain features currently under development, that VMware has not promised or guaranteed to Licensee that such Beta Software will be announced or made available to anyone in the future, that VMware has no express or implied obligation to Licensee to announce or introduce the Beta Software, that VMware may not introduce a product similar to or compatible with the Beta Software, and that any version number (if any) referenced is subject to change and does not in any way represent VMware’s commitment to release any product in the future. Accordingly, Licensee acknowledges that any research or development that it performs regarding the Beta Software or any product associated with the Beta Software is done entirely at Licensee’s own risk.  Specifically, the Beta Software may contain features, functionality or modules that may not be included in the generally available commercial version of the Beta Software, if released, or that will be marketed separately for additional fees.
67
+
68
+7.	OTHER PROVISIONS.
69
+
70
+       (a)  Governing Law, Injunctive Relief and Legal Costs. 
71
+        
72
+           (aa) Choice of Law. This Agreement and any dispute arising out of or related to this Agreement or the Beta Software (“Dispute”) will be governed by California law, without regard to its choice of law principles.  The United Nations Convention for the International Sale of Goods shall not apply.
73
+           
74
+           (bb) Injunctive Relief.  Either party may, at its sole discretion, seek preliminary judicial relief in any court of competent jurisdiction (including, but not limited to, preliminary injunctive relief). Also, the provisions of this Section 7(a) may be enforced by any court of competent jurisdiction.
75
+           
76
+        (b)  Export Regulations.  The Beta Software is of United States origin and is provided subject to the U.S. Export Administration Regulations.  Diversion contrary to U.S. law is prohibited.  Without limiting the foregoing, you agree that (1) you are not, and are not acting on behalf of, any person who is a citizen, national, or resident of, or who is controlled by the government of, Cuba, Iran, North Korea, Sudan, or Syria, or any other country to which the United States has prohibited export transactions; (2) you are not, and are not acting on behalf of, any person or entity listed on the U.S. Treasury Department list of Specially Designated Nationals and Blocked Persons, or the U.S. Commerce Department Denied Persons List or Entity List; and (3) you will not use the Beta Software for, and will not permit the Beta Software to be used for, any purposes prohibited by law, including, without limitation, for any prohibited development, design, manufacture or production of missiles or nuclear, chemical or biological weapons.  U.S. Export Control Classification Numbers (ECCN’s) may be found at VMware help page: http://www.vmware.com/help/export-control.
77
+       
78
+       (c)  Modification.  This is the entire agreement between the parties relating to the subject matter hereof and to the fullest extent permitted by law, all other terms, representations, negotiations, arrangements or understandings are rejected.  This Agreement supersedes and replaces any other agreements, representations, negotiations, arrangements or understandings between the parties and Licensee hereby waives any form requirements that may be contained in previous agreements and agrees that this Agreement shall take precedent with respect to its subject matter.  No party has entered into this Agreement relying on any representations made by or on behalf of the other, other than those expressly made in this Agreement.  No waiver or modification of this Agreement shall be valid unless in writing signed by each party.  
79
+       
80
+       (d)  Language of Contract.  The parties have required that this Agreement and all documents relating thereto be drawn up in English. Les parties ont demandé que cette convention ainsi que tous les documents que s'y attachent soient rédigés en anglais.
81
+       (e) Severability.  If any provision of this Agreement is held to be illegal, invalid or unenforceable, the provision will be enforced to the maximum extent permissible so as to effect the intent of the parties, and the remaining provisions of this Agreement will remain in full force and effect.  
82
+
83
+       (f) Waivers.   Any waiver of these terms must be in writing and signed by the waiving party to be effective. 
84
+       
85
+       (g) Data Collection and Privacy.  
86
+       
87
+          (i) Consent for Collection and Use of Technical Data. You agree that VMware may periodically collect, process and store technical and related information about your device, system, application, peripherals and your use of the Beta Software, including without limitation: internet protocol address, hardware identification, operating system, application software, peripheral hardware, number of active plugins and software development kits, the successful installation and launch of Beta Software, and  Beta Software usage statistics (collectively, “Technical Data”).  VMware will use Technical Data for internal statistical and analytical purposes to facilitate support, invoicing or online services, the provisioning of updates, and the development of VMware products and services. VMware may transfer Technical Data to other companies in the VMware worldwide group of companies from time to time. 
88
+
89
+           (ii) Log Files. You acknowledge that correspondence and log files generated in conjunction with a request for support services may contain sensitive, confidential or personal information. You are solely responsible for taking the steps necessary to protect such data, including obfuscating the logs or otherwise guarding such information prior to sending it to VMware.
90
+           
91
+       (h) Independent Parties.  The parties are independent.  Nothing in this Agreement shall be construed to create a partnership, joint venture, contractor, or agency relationship between the parties.  
92
+       
93
+8.	ASSIGNMENT.  Licensee shall not and cannot assign this Agreement or any rights or obligations hereunder, directly or indirectly, by operation of law, merger, acquisition of stock or assets, or otherwise without the prior written consent of VMware.   Any attempted assignment or transfer in violation of the foregoing will be null and void.  Subject to the foregoing, this Agreement shall inure to the benefit of and be binding upon the parties and their respective successors and permitted assigns.
94
+
95
+9. 	CONTACT INFORMATION.  If you have any questions about this Agreement, please direct all correspondence to: VMware, Inc., 3401 Hillview Avenue, Palo Alto, CA 94304, United States of America.  VMware is a trademark of VMware, Inc. and is registered in the U.S. and numerous other countries. 
96
+
97
+        </License>
98
+    </EulaSection>
99
+
100
+    <AnnotationSection>
101
+        <Info>Description of the Product</Info>
102
+        <Annotation>This OVA provides a minimal installed profile of PhotonOS.
103
+   Default password for root user is changeme. However user will be prompted to change the password during first login.
104
+        </Annotation>
105
+
106
+    </AnnotationSection>
0 107
new file mode 100644
... ...
@@ -0,0 +1,22 @@
0
+.encoding = "UTF-8"
1
+virtualHW.version = "11"
2
+scsi0.present = "TRUE"
3
+scsi0.virtualDev = "pvscsi"
4
+scsi0:0.present = "TRUE"
5
+scsi0:0.fileName = "VMDK_IMAGE"
6
+ethernet0.present = "TRUE"
7
+ethernet0.virtualDev = "vmxnet3"
8
+ethernet0.wakeOnPcktRcv = "FALSE"
9
+ethernet0.addressType = "generated"
10
+ethernet0.linkStatePropagation.enable = "TRUE"
11
+ethernet0.connectionType = "None"
12
+displayName = "Photon OS"
13
+guestOS = "vmware-photon-64"
14
+memsize = "2048"
15
+ide1:0.present = "TRUE"
16
+ide1:0.autodetect = "TRUE"
17
+ide1:0.deviceType = "cdrom-raw"
18
+ide1:0.startConnected = "FALSE"
19
+pciBridge5.present = "FALSE"
20
+pciBridge6.present = "FALSE"
21
+pciBridge7.present = "FALSE"
0 22
new file mode 100644
... ...
@@ -0,0 +1,16 @@
0
+{
1
+	"hostname": "photon-machine",
2
+	"password": 
3
+		{
4
+			"crypted": false,
5
+			"text": "PASSWORD"
6
+		},
7
+	"packagelist_file": "packages_ova.json",
8
+    "size": {"root": "16", "swap": "0"},
9
+    "boot":"efi",
10
+    "public_key":"<ssh-key-here>",
11
+    "customartifacts": { "postinstallscripts": ["ova_uefi-custom-patch.sh"] },
12
+    "artifacttype": "ova",
13
+    "keeprawdisk": "false"
14
+}
15
+
0 16
new file mode 100755
... ...
@@ -0,0 +1,3 @@
0
+#!/bin/bash
1
+echo -e "changeme\nchangeme" | passwd root
2
+chage -d 0 root
0 3
new file mode 100644
... ...
@@ -0,0 +1,108 @@
0
+          <vmw:ExtraConfig ovf:required="false" vmw:key="uefi.secureBoot.enabled" vmw:value="TRUE"/>
1
+        </VirtualHardwareSection>
2
+ 	<ProductSection> 
3
+ 		<Info>Information about the installed software</Info> 
4
+ 		<Product>Photon OS</Product> 
5
+ 		<Vendor>VMware Inc.</Vendor> 
6
+ 		<Version>3.0</Version> 
7
+ 		<FullVersion>3.0</FullVersion> 
8
+ 	</ProductSection>
9
+	<EulaSection>
10
+        <Info>End User License Agreement</Info>
11
+        <License msgid="eula">
12
+	                           VMWARE, INC. 
13
+                         BETA LICENSE AGREEMENT
14
+
15
+Note: BY CLICKING “I AGREE,” ACCESSING, DOWNLOADING, INSTALLING, UPLOADING, COPYING OR USING THE BETA SOFTWARE, YOU CONCLUDE AND AGREE TO THIS BETA LICENSE AGREEMENT (“AGREEMENT”) IN A LEGALLY BINDING MANNER WITH VMWARE, INC., 3401 HILLVIEW AVENUE, PALO ALTO, CA 94304, USA (“VMware”). IF YOU HAVE SPECIFIED IN CONNECTION WITH THE REGISTRATION PROCESS FOR THIS SOFTWARE BETA TEST PROGRAM THAT YOU ARE ACTING ON BEHALF OF A COMPANY OR OTHER ORGANIZATION, YOU REPRESENT THAT YOU ARE AUTHORIZED TO LEGALLY BIND SUCH ORGANIZATION AND THAT YOU CONCLUDE THE AGREEMENT ON BEHALF OF SUCH ORGANIZATION. IN THE FOLLOWING, THE TERMS “YOU” AND “LICENSEE” SHALL REFER, JOINTLY AND SEVERALLY, TO YOU INDIVIDUALLY AND ANY ORGANIZATION ON WHOSE BEHALF YOU ACT.
16
+
17
+IF YOU DO NOT AGREE TO THE TERMS OF THIS BETA LICENSE AGREEMENT, THEN DO *NOT* CLICK “I AGREE,” ACCESS, DOWNLOAD, INSTALL, UPLOAD, COPY OR USE THE BETA SOFTWARE.
18
+
19
+1.	DEFINITIONS.
20
+
21
+       (a)  “Beta Software” shall mean the beta version of VMware’s software and the media and Documentation provided by VMware to Licensee and for which Licensee is granted a use license pursuant to this Agreement.  The Beta Software will be provided in object form only.
22
+       
23
+       (b)  “Documentation” shall mean the printed or online written reference material furnished to Licensee in conjunction with the Beta Software, including, without limitation, instructions, beta testing guidelines, and end user guides.
24
+       
25
+       (c)  “Intellectual Property Rights” shall mean all intellectual property rights, including, without limitation, patent, copyright, trademark, and trade secret, recognized in any jurisdiction worldwide, whether perfected or not, and any similar and other proprietary rights.
26
+       
27
+       (d)  “Open Source Software” means code that is provided with the Beta Software and identified as open source code or otherwise as being subject to open source license terms.
28
+       
29
+       (e)  “Updates” shall mean a modification, error correction, bug fix, new release, or other update to or for the Beta Software.
30
+
31
+2.	LICENSE GRANT, USE AND OWNERSHIP.
32
+
33
+	(a)  Limited License.  Subject to the terms and conditions of this Agreement, VMware grants to Licensee a non-exclusive, revocable (at any time and for any reason, at VMware’s sole discretion), royalty-free, non-transferable, non-assignable license (without the right to sublicense):
34
+
35
+             (i) to use the Beta Software in accordance with the Documentation solely for purposes of (A) internal testing and evaluation to determine whether or not to license generally available commercial versions of the Beta Software if such versions ever become available, and (B) internal development to create interoperability between the Beta Software and Licensee products, 
36
+            
37
+            (ii) to use the Documentation provided with the Beta Software in support of Licensee’s authorized use of the Beta Software, and
38
+           
39
+            (iii) to copy Beta Software for Licensee’s archival or backup purposes, provided that all titles and trademarks, copyright, and restricted rights notices are reproduced on such copies.
40
+       
41
+       (b)  Evaluation Feedback. The purpose of this limited license is the testing and evaluation of the Beta Software and Documentation and development by Licensee of Licensee products that interoperate with the Beta Software.  In furtherance of this purpose, Licensee shall provide feedback to VMware concerning the functionality and performance of the Beta Software from time to time as reasonably requested by VMware, including, without limitation, identifying potential errors and improvements (collectively the “Feedback”).  Licensee will provide Feedback in a manner that is mutually agreeable to the parties.  VMware may use Feedback, without restriction in any manner now known or in the future conceived, to improve or enhance its products and, accordingly, and you hereby grant to VMware a non-exclusive, perpetual, irrevocable, royalty-free, transferable, worldwide right and license, with the right to sublicense (i) to use, reproduce, disclose, distribute, modify, prepare derivative works of and otherwise exploit the Feedback and other information you provide to VMware under this Agreement, and (ii) to make, use, sell, offer to sell, import and export any product or service that incorporates the Feedback and other information you provide to VMware under this Agreement.
42
+       
43
+       (c)  Restrictions.  Licensee shall not disclose, provide, or disseminate in any manner the Beta Software (including the Documentation) or Confidential Information to any third party, including but not limited to its partners, affiliates or subsidiaries.  Except to the extent contrary to any applicable laws, Licensee will not, and will not permit any third party to, sublicense, rent, copy, modify, create derivative works of, translate, reverse engineer, decompile, disassemble, or otherwise reduce to human perceivable form any portion of the Beta Software or accompanying Documentation.  Without limiting the generality of the foregoing, Licensee shall not use the Beta Software for Licensee’s product development or any other commercial purpose, including, but not limited to sales or marketing activities, except as expressly permitted in this Agreement.  The Beta Software and all performance data and test results, including without limitation, benchmark test results (collectively “Performance Data”), relating  to the Beta Software are the Confidential Information of VMware, and will be treated in accordance with the terms of Section 4 of this Agreement.  Accordingly, Licensee shall not publish or disclose to any third party any Performance Data relating to the Beta Software.  
44
+
45
+       (d)  Ownership.  VMware shall own and retain all right, title and interest in and to the Intellectual Property Rights in the Beta Software and any derivative works thereof, subject only to the limited license expressly set forth in Section 2(a) hereof.  Licensee does not acquire any other rights, express or implied, in the Beta Software.  ALL RIGHTS NOT EXPRESSLY GRANTED HEREUNDER ARE RESERVED TO VMWARE. 
46
+       
47
+       (e)  No Support Services.  VMware is under no obligation to support the Beta Software in any manner or to provide any Updates to Licensee.  In the event VMware, in its sole discretion, supplies any Update to Licensee, the Update shall be deemed Beta Software under this Agreement and shall be subject to the terms and conditions of this Agreement.
48
+       
49
+	(f)  Third-Party Software.  The Beta Software may enable a computer to run multiple instances of third-party guest operating systems and application programs.  Licensee acknowledges that Licensee is responsible for obtaining any licenses necessary to operate any third-party software, including guest operating systems and application programs.
50
+
51
+       (g)  Open Source Software.  Except for Sections 5, 6, and 7, the terms and conditions of this Agreement shall not apply to any Open Source Software accompanying the Beta Software.  Any such Open Source Software is provided under the terms of the applicable open source license agreement or copyright notice accompanying such Open Source Software or included in the open source licenses file accompanying the Beta Software. 
52
+       
53
+3.	TERM AND TERMINATION.  Unless otherwise terminated as specified under this Agreement, Licensee’s rights with respect to the Beta Software will terminate upon the earlier of (a) the initial commercial release by VMware of a generally available version of the Beta Software or (b) automatic expiration of the Beta Software based on the system date.  Either party may terminate this Agreement at any time for any reason or no reason by providing the other party advance written notice thereof.  Licensee agrees that this Agreement will automatically terminate without notice in the event Licensee discloses the Beta Software in breach of Section 4 (Confidentiality) below. Upon any expiration or termination of this Agreement, the rights and licenses granted to Licensee under this Agreement shall immediately terminate, and Licensee shall immediately cease using, and will destroy or render practically inaccessible the Beta Software, Documentation, and all other tangible items in Licensee’s possession or control that contain Confidential Information.  The rights and obligations of the parties set forth in Sections 2(b), 2(c), 2(d), 2(e), 2(f), 2(g), 3, 4, 5, 6, 7 and 8 survive termination or expiration of this Agreement for any reason.  
54
+
55
+4.	CONFIDENTIALITY.  
56
+
57
+       (a) "Confidential Information" shall mean the Beta Software, all information regarding the Beta Software (including any trade secrets, know-how, inventions, techniques, processes, and algorithms embodied in the Beta Software), Documentation, Performance Data, any Updates, VMware products, product roadmaps, and other technical, business, financial and product development plans, forecasts and strategies, and other information provided by VMware to Licensee under this Agreement, whether disclosed orally, in writing, or by examination or inspection, other than information that Licensee can demonstrate (i) was already known to Licensee, other than under an obligation of confidentiality, at the time of disclosure; (ii) was generally available in the public domain at the time of disclosure to Licensee; (iii) became generally available in the public domain after disclosure other than through any act or omission of Licensee; (iv) was subsequently lawfully disclosed to Licensee by a third party without any obligation of confidentiality; or (v) was independently developed by Licensee without use of or reference to any information or materials disclosed by VMware or its suppliers.  If Licensee wishes to disclose to VMware any information under this Agreement that Licensee considers proprietary or confidential to Licensee (“Licensee Information”), then Licensee agrees such disclose will be governed by a separate non-disclosure agreement (“NDA”) by and between the parties.   If Licensee is required to disclose Confidential Information by applicable law or court order, Licensee shall notify VMware of the required disclosure promptly in writing and shall cooperate with VMware in any lawful action to contest or limit the scope of the required disclosure.  Licensee shall not use any Confidential Information for any purpose other than as expressly authorized under this Agreement.  In no event shall Licensee use the Beta Software or any Confidential Information to develop, manufacture, market, sell, or distribute any product or service, including any VMware products except as expressly set forth in this Agreement.  Licensee shall not disclose any Confidential Information to any third party. Without limiting the foregoing, Licensee shall use at least the same degree of care that it uses to prevent the disclosure of its own confidential information of like importance, but in no event less than reasonable care, to prevent the disclosure of such Confidential Information.
58
+       
59
+       (b)  Additional Confidentiality Restrictions for Highly Confidential Beta Software.  For certain Beta Software designated by VMware in writing as highly confidential (“Highly Confidential Beta Software”), Licensee agrees that the following, additional confidentiality obligations and restrictions will apply:
60
+       
61
+            (i)  Licensee shall limit dissemination of Highly Confidential Beta Software and related information concerning product features, future technologies and roadmaps only to Information Technology teams and/or software/solutions development teams of Licensee approved in writing by VMware, and only to individuals on such teams on a need-to-know basis and solely for purposes expressly authorized under this Agreement.  For clarity and without limiting the generality of the foregoing, Licensee shall not disseminate any Highly Confidential Beta Software to Licensee's sales and marketing field organizations.  Licensee will assign an employee who will be primarily responsible for ensuring Licensee’s full compliance with the terms described in this Section 4(b) herein. 
62
+             
63
+            (ii)  Improper Disclosure of Highly Confidential Beta Software.  Licensee acknowledges that damages due to Licensee’s improper disclosure of Highly Confidential Beta Software or related information concerning product features, future technologies and roadmaps may be irreparable and that monetary damages would be inadequate to compensate VMware for any breach of this Agreement.  In the event that VMware reasonably believes that Licensee has disseminated Highly Confidential Beta Software or related information concerning product features, future technologies and roadmaps to an unauthorized party, Licensee will be immediately removed from VMware’s Beta Software program and will not be permitted to participate in any VMware Beta Software program in the future.  Additionally, all rights and licenses granted to Licensee under this Agreement shall immediately terminate in accordance with Section 3 herein (Term and Termination), and (b) in addition to all other remedies available in law or otherwise, VMware is entitled to seek equitable relief, including injunction and preliminary injunction against the threatened breach of this Agreement or the continuation of any such breach. 
64
+       
65
+5.	LIMITATION OF LIABILITY.  IT IS UNDERSTOOD THAT THE BETA SOFTWARE IS PROVIDED WITHOUT CHARGE FOR THE PURPOSES EXPRESSLY PERMITTED UNDER THIS AGREEMENT.  ACCORDINGLY, TO THE FULLEST EXTENT PERMITTED BY LAW, BUT SUBJECT ALWAYS TO THIS SECTION 5, THE TOTAL LIABILITY OF VMWARE AND ITS LICENSORS ARISING OUT OF OR RELATED TO THIS AGREEMENT SHALL NOT EXCEED $100.00.  TO THE FULLEST EXTENT PERMITTED BY LAW, IN NO EVENT SHALL VMWARE OR ITS LICENSORS HAVE LIABILITY FOR ANY INDIRECT, INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, OR LOSS OF BUSINESS INFORMATION, HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY (INCLUDING WITHOUT LIMITATION, TORT, STATUTE, CONTRACT OR OTHER), EVEN IF VMWARE AND ITS LICENSORS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.  THESE LIMITATIONS SHALL APPLY NOTWITHSTANDING ANY FAILURE OF ESSENTIAL PURPOSE OF ANY LIMITED REMEDY.  THE PARTIES ACKNOWLEDGE THAT THE VARIOUS CONSIDERATIONS DUE TO VMWARE IN ACCORDANCE WITH THE TERMS OF THIS AGREEMENT WERE TAKEN INTO ACCOUNT IN DETERMINING THE LIMITATION OF LIABILITY SET FORTH IN THIS SECTION 5. LICENSEE ACKNOWLEDGES AND AGREES THIS LIMITATION IS AN ESSENTIAL ELEMENT OF THIS AGREEMENT AND THAT VMWARE WOULD NOT ENTER INTO THIS AGREEMENT WITHOUT THESE LIMITATIONS ON ITS LIABILITY.
66
+
67
+6.	WARRANTY DISCLAIMER.  IT IS UNDERSTOOD THAT THE BETA SOFTWARE, OPEN SOURCE SOFTWARE, DOCUMENTATION, AND ANY UPDATES MAY CONTAIN ERRORS AND ARE PROVIDED FOR THE PURPOSES EXPRESSLY PERMITTED UNDER THIS AGREEMENT.  TO THE FULLEST EXTENT PERMITTED BY LAW, AND SUBJECT TO SECTION 5, THE BETA SOFTWARE, THE OPEN SOURCE SOFTWARE, THE DOCUMENTATION, AND ANY UPDATES ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE.  TO THE FULLEST EXTENT PERMITTED BY LAW, AND SUBJECT TO SECTION 5, VMWARE AND ITS LICENSORS SPECIFICALLY DISCLAIM ALL IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE.  Licensee acknowledges that VMware has not publicly announced the availability of the Beta Software, that such Beta Software may contain features currently under development, that VMware has not promised or guaranteed to Licensee that such Beta Software will be announced or made available to anyone in the future, that VMware has no express or implied obligation to Licensee to announce or introduce the Beta Software, that VMware may not introduce a product similar to or compatible with the Beta Software, and that any version number (if any) referenced is subject to change and does not in any way represent VMware’s commitment to release any product in the future. Accordingly, Licensee acknowledges that any research or development that it performs regarding the Beta Software or any product associated with the Beta Software is done entirely at Licensee’s own risk.  Specifically, the Beta Software may contain features, functionality or modules that may not be included in the generally available commercial version of the Beta Software, if released, or that will be marketed separately for additional fees.
68
+
69
+7.	OTHER PROVISIONS.
70
+
71
+       (a)  Governing Law, Injunctive Relief and Legal Costs. 
72
+        
73
+           (aa) Choice of Law. This Agreement and any dispute arising out of or related to this Agreement or the Beta Software (“Dispute”) will be governed by California law, without regard to its choice of law principles.  The United Nations Convention for the International Sale of Goods shall not apply.
74
+           
75
+           (bb) Injunctive Relief.  Either party may, at its sole discretion, seek preliminary judicial relief in any court of competent jurisdiction (including, but not limited to, preliminary injunctive relief). Also, the provisions of this Section 7(a) may be enforced by any court of competent jurisdiction.
76
+           
77
+        (b)  Export Regulations.  The Beta Software is of United States origin and is provided subject to the U.S. Export Administration Regulations.  Diversion contrary to U.S. law is prohibited.  Without limiting the foregoing, you agree that (1) you are not, and are not acting on behalf of, any person who is a citizen, national, or resident of, or who is controlled by the government of, Cuba, Iran, North Korea, Sudan, or Syria, or any other country to which the United States has prohibited export transactions; (2) you are not, and are not acting on behalf of, any person or entity listed on the U.S. Treasury Department list of Specially Designated Nationals and Blocked Persons, or the U.S. Commerce Department Denied Persons List or Entity List; and (3) you will not use the Beta Software for, and will not permit the Beta Software to be used for, any purposes prohibited by law, including, without limitation, for any prohibited development, design, manufacture or production of missiles or nuclear, chemical or biological weapons.  U.S. Export Control Classification Numbers (ECCN’s) may be found at VMware help page: http://www.vmware.com/help/export-control.
78
+       
79
+       (c)  Modification.  This is the entire agreement between the parties relating to the subject matter hereof and to the fullest extent permitted by law, all other terms, representations, negotiations, arrangements or understandings are rejected.  This Agreement supersedes and replaces any other agreements, representations, negotiations, arrangements or understandings between the parties and Licensee hereby waives any form requirements that may be contained in previous agreements and agrees that this Agreement shall take precedent with respect to its subject matter.  No party has entered into this Agreement relying on any representations made by or on behalf of the other, other than those expressly made in this Agreement.  No waiver or modification of this Agreement shall be valid unless in writing signed by each party.  
80
+       
81
+       (d)  Language of Contract.  The parties have required that this Agreement and all documents relating thereto be drawn up in English. Les parties ont demandé que cette convention ainsi que tous les documents que s'y attachent soient rédigés en anglais.
82
+       (e) Severability.  If any provision of this Agreement is held to be illegal, invalid or unenforceable, the provision will be enforced to the maximum extent permissible so as to effect the intent of the parties, and the remaining provisions of this Agreement will remain in full force and effect.  
83
+
84
+       (f) Waivers.   Any waiver of these terms must be in writing and signed by the waiving party to be effective. 
85
+       
86
+       (g) Data Collection and Privacy.  
87
+       
88
+          (i) Consent for Collection and Use of Technical Data. You agree that VMware may periodically collect, process and store technical and related information about your device, system, application, peripherals and your use of the Beta Software, including without limitation: internet protocol address, hardware identification, operating system, application software, peripheral hardware, number of active plugins and software development kits, the successful installation and launch of Beta Software, and  Beta Software usage statistics (collectively, “Technical Data”).  VMware will use Technical Data for internal statistical and analytical purposes to facilitate support, invoicing or online services, the provisioning of updates, and the development of VMware products and services. VMware may transfer Technical Data to other companies in the VMware worldwide group of companies from time to time. 
89
+
90
+           (ii) Log Files. You acknowledge that correspondence and log files generated in conjunction with a request for support services may contain sensitive, confidential or personal information. You are solely responsible for taking the steps necessary to protect such data, including obfuscating the logs or otherwise guarding such information prior to sending it to VMware.
91
+           
92
+       (h) Independent Parties.  The parties are independent.  Nothing in this Agreement shall be construed to create a partnership, joint venture, contractor, or agency relationship between the parties.  
93
+       
94
+8.	ASSIGNMENT.  Licensee shall not and cannot assign this Agreement or any rights or obligations hereunder, directly or indirectly, by operation of law, merger, acquisition of stock or assets, or otherwise without the prior written consent of VMware.   Any attempted assignment or transfer in violation of the foregoing will be null and void.  Subject to the foregoing, this Agreement shall inure to the benefit of and be binding upon the parties and their respective successors and permitted assigns.
95
+
96
+9. 	CONTACT INFORMATION.  If you have any questions about this Agreement, please direct all correspondence to: VMware, Inc., 3401 Hillview Avenue, Palo Alto, CA 94304, United States of America.  VMware is a trademark of VMware, Inc. and is registered in the U.S. and numerous other countries. 
97
+
98
+        </License>
99
+    </EulaSection>
100
+
101
+    <AnnotationSection>
102
+        <Info>Description of the Product</Info>
103
+        <Annotation>This OVA provides a UEFI secure boot enabled minimal installed profile of PhotonOS.
104
+   Default password for root user is changeme. However user will be prompted to change the password during first login.
105
+        </Annotation>
106
+
107
+    </AnnotationSection>
0 108
new file mode 100644
... ...
@@ -0,0 +1,22 @@
0
+.encoding = "UTF-8"
1
+virtualHW.version = "13"
2
+scsi0.present = "TRUE"
3
+scsi0.virtualDev = "pvscsi"
4
+scsi0:0.present = "TRUE"
5
+scsi0:0.fileName = "VMDK_IMAGE"
6
+ethernet0.present = "TRUE"
7
+ethernet0.virtualDev = "vmxnet3"
8
+ethernet0.wakeOnPcktRcv = "FALSE"
9
+ethernet0.addressType = "generated"
10
+ethernet0.linkStatePropagation.enable = "TRUE"
11
+ethernet0.connectionType = "None"
12
+displayName = "Photon OS"
13
+guestOS = "vmware-photon-64"
14
+memsize = "2048"
15
+ide1:0.present = "TRUE"
16
+ide1:0.autodetect = "TRUE"
17
+ide1:0.deviceType = "cdrom-raw"
18
+ide1:0.startConnected = "FALSE"
19
+firmware = "efi"
20
+uefi.secureBoot.enabled = "TRUE"
21
+vmxnet3.rev.30 = "FALSE"
0 22
new file mode 100755
... ...
@@ -0,0 +1,4 @@
0
+#!/bin/bash
1
+# Change the max password days to 99999
2
+cat /etc/shadow | cut -d: -f1 | xargs -I {} chage -I -1 -m 0 -M 99999 -E -1 -W 7 {}
3
+sed -i 's/^PASS_MAX_DAYS.*/PASS_MAX_DAYS   99999/' /etc/login.defs
0 4
new file mode 100644
... ...
@@ -0,0 +1,20 @@
0
+{
1
+	"hostname": "photon-machine",
2
+	"password":
3
+		{
4
+			"crypted": false,
5
+			"text": "PASSWORD"
6
+		},
7
+	"packagelist_file": "packages_rpi3.json",
8
+    "size": {"root": "1", "swap": "0"},
9
+    "boot":"efi",
10
+    "public_key":"<ssh-key-here>",
11
+    "postinstallscripts": ["rpi3-custom-patch.sh"],
12
+    "additionalfiles": [
13
+                            {"resizefs.sh": "/usr/local/bin/resizefs.sh"},
14
+                            {"resizefs.service": "/lib/systemd/system/resizefs.service"}
15
+                       ],
16
+    "artifacttype": "xz",
17
+    "keeprawdisk": "true"
18
+}
19
+
0 20
new file mode 100755
1 21
Binary files /dev/null and b/support/image-builder/rpi3/esp/bootcode.bin differ
2 22
new file mode 100755
... ...
@@ -0,0 +1,27 @@
0
+# Based on documentation: http://elinux.org/RPiconfig
1
+
2
+# Set 256 MB for the GPU and remaining for ARM CPU
3
+gpu_mem=256
4
+
5
+# Enable camera module
6
+start_x=1
7
+
8
+# Force monitor to HDMI mode
9
+hdmi_drive=2
10
+
11
+# Chainload U-Boot -> grub-efi -> Linux
12
+kernel=u-boot.bin
13
+# Without uart u-boot will not boot
14
+enable_uart=1
15
+
16
+# Speed up the boot. Use turbo mode for first 45 seconds
17
+initial_turbo=45
18
+
19
+# Enable ARMv8
20
+arm_control=0x200
21
+
22
+# Disable warning overlay and allow turbo when low-voltage is present
23
+avoid_warnings=2
24
+
25
+# Enable hardware graphic acceleration
26
+dtoverlay=vc4-kms-v3d
0 27
new file mode 100755
1 28
Binary files /dev/null and b/support/image-builder/rpi3/esp/fixup.dat differ
2 29
new file mode 100644
3 30
Binary files /dev/null and b/support/image-builder/rpi3/esp/fixup_x.dat differ
4 31
new file mode 100755
5 32
Binary files /dev/null and b/support/image-builder/rpi3/esp/start.elf differ
6 33
new file mode 100755
7 34
Binary files /dev/null and b/support/image-builder/rpi3/esp/start_x.elf differ
8 35
new file mode 100755
... ...
@@ -0,0 +1 @@
0
+bootaa64
0 1
new file mode 100755
... ...
@@ -0,0 +1,62 @@
0
+#!/bin/bash
1
+#################################################
2
+#       Title:  mk-prepare-system               #
3
+#        Date:  2014-11-26                      #
4
+#     Version:  1.0                             #
5
+#      Author:  mbassiouny@vmware.com           #
6
+#     Options:                                  #
7
+#################################################
8
+#   Overview
9
+#       Preparing the system to install photon
10
+#   End
11
+#
12
+set -o errexit      # exit if error...insurance ;
13
+set -o nounset      # exit if variable not initalized
14
+set +h          # disable hashall
15
+SCRIPT_PATH=$(dirname $(realpath -s $0))
16
+INSTALLER_PATH=$SCRIPT_PATH/../../../installer
17
+source $INSTALLER_PATH/config.inc
18
+source $INSTALLER_PATH/function.inc
19
+PRGNAME=${0##*/}    # script name minus the path
20
+
21
+LOGFILE=/var/log/"${PRGNAME}-${LOGFILE}"    #   set log file name
22
+#LOGFILE=/dev/null      #   uncomment to disable log file
23
+
24
+[ ${EUID} -eq 0 ]   || fail "${PRGNAME}: Need to be root user: FAILURE"
25
+[ -z ${BUILDROOT} ] && fail "${PRGNAME}: Build root not set: FAILURE"
26
+
27
+cd ${BUILDROOT} || fail "${PRGNAME}: Change directory: ${BUILDROOT}: FAILURE"
28
+
29
+#
30
+#   Setup the filesystem for chapter 06
31
+#
32
+if [[   $# -gt 0 ]] && [[ $1 == 'install' ]]; then
33
+    mkdir -p ${BUILDROOT}/var/lib/rpm
34
+    mkdir -p ${BUILDROOT}/cache/tdnf
35
+    rpm   --root ${BUILDROOT} --initdb
36
+    tdnf install filesystem --installroot ${BUILDROOT} --nogpgcheck --assumeyes
37
+else
38
+    RPMPKG="$(find RPMS -name 'filesystem-[0-9]*.rpm' -print)"
39
+    [ -z ${RPMPKG} ] && fail "  Filesystem rpm package missing: Can not continue"
40
+    run_command "   Installing filesystem" "rpm -Uvh --nodeps --root ${BUILDROOT} --dbpath /var/lib/rpm ${RPMPKG}" "${LOGFILE}"
41
+fi
42
+ 
43
+#   Ommited in the filesystem.spec file - not needed for booting
44
+[ -e ${BUILDROOT}/dev/console ] || mknod -m 600 ${BUILDROOT}/dev/console c 5 1
45
+[ -e ${BUILDROOT}/dev/null ]    || mknod -m 666 ${BUILDROOT}/dev/null c 1 3
46
+[ -e ${BUILDROOT}/dev/random ]  || mknod -m 444 ${BUILDROOT}/dev/random c 1 8
47
+[ -e ${BUILDROOT}/dev/urandom ] || mknod -m 444 ${BUILDROOT}/dev/urandom c 1 9
48
+
49
+if [[   $# -eq 0 ]] || [[ $1 != 'install' ]]; then
50
+    chown -R 0:0 ${BUILDROOT}/* || :
51
+fi
52
+
53
+#
54
+#   Mount kernel filesystem
55
+#
56
+#if ! mountpoint ${BUILDROOT}/dev    >/dev/null 2>&1; then mount --rbind /dev ${BUILDROOT}/dev; mount --make-rslave ${BUILDROOT}/dev; fi
57
+#if ! mountpoint ${BUILDROOT}/proc   >/dev/null 2>&1; then mount -t proc proc ${BUILDROOT}/proc; fi
58
+#if ! mountpoint ${BUILDROOT}/sys    >/dev/null 2>&1; then mount -t sysfs sysfs ${BUILDROOT}/sys; fi
59
+#if ! mountpoint ${BUILDROOT}/run    >/dev/null 2>&1; then mount -t tmpfs tmpfs ${BUILDROOT}/run; fi
60
+#if [ -h ${BUILDROOT}/dev/shm ];          then mkdir -pv ${BUILDROOT}/$(readlink ${BUILDROOT}/dev/shm); fi
61
+exit 0
0 62
new file mode 100755
... ...
@@ -0,0 +1,114 @@
0
+#!/bin/bash
1
+#################################################
2
+#       Title:  mk-setup-grub                   #
3
+#        Date:  2014-11-26                      #
4
+#     Version:  1.0                             #
5
+#      Author:  sharathg@vmware.com             #
6
+#     Options:                                  #
7
+#################################################
8
+#    Overview
9
+#        This is a precursor for the vmware build system.
10
+#        This assumes that an empty hard disk is attached to the build VM.
11
+#        The path to this empty disk is specified in the HDD variable in config.inc
12
+#    End
13
+#
14
+
15
+grub_efi_install()
16
+{
17
+    BOOT_PARTITION=/dev/mapper/`basename ${HDD}`p1
18
+#    mount -t vfat $BOOT_PARTITION $BUILDROOT/boot/esp
19
+    # Raspberry prorpiaetary GPU bootloader (1st stage)
20
+    cp -r esp/* $BUILDROOT/boot/esp/
21
+    # u-boot (2nd stage) was copied earlier by installer.py
22
+    # grub efi bootloader (3rd stage)
23
+    mkdir -p $BUILDROOT/boot/esp/EFI/BOOT/
24
+    cp EFI_aarch64/BOOT/* $BUILDROOT/boot/esp/EFI/BOOT/
25
+    mkdir -p $BUILDROOT/boot/esp/boot/grub2
26
+    cat > $BUILDROOT/boot/esp/boot/grub2/grub.cfg << EOF
27
+search -n -u ${BOOT_UUID} -s
28
+configfile ${BOOT_DIRECTORY}grub2/grub.cfg
29
+EOF
30
+#    umount $BUILDROOT/boot/esp
31
+}
32
+
33
+set -o errexit        # exit if error...insurance ;)
34
+set -o nounset        # exit if variable not initalized
35
+set +h            # disable hashall
36
+PRGNAME=${0##*/}    # script name minus the path
37
+SCRIPT_PATH=$(dirname $(realpath -s $0))
38
+INSTALLER_PATH=$SCRIPT_PATH/../../../installer
39
+source $INSTALLER_PATH/config.inc        #    configuration parameters
40
+source $INSTALLER_PATH/function.inc        #    common functions
41
+LOGFILE=/var/log/"${PRGNAME}-${LOGFILE}"    #    set log file name
42
+ARCH=$(uname -m)    # host architecture
43
+[ ${EUID} -eq 0 ]    || fail "${PRGNAME}: Need to be root user: FAILURE"
44
+> ${LOGFILE}        #    clear/initialize logfile
45
+
46
+# Check if passing a HHD and partition
47
+if [ $# -eq 6 ] ; then
48
+    BOOTMODE=$1
49
+    HDD=$2
50
+    ROOT_PARTITION_PATH=$3
51
+    BOOT_PARTITION_PATH=$4
52
+    BOOT_DIRECTORY=$5
53
+    BOOT_PARTITION_NUMBER=$6
54
+fi
55
+
56
+#
57
+#    Install grub2.
58
+#
59
+BOOT_UUID=$(blkid -s UUID -o value $BOOT_PARTITION_PATH)
60
+
61
+mkdir -p $BUILDROOT/boot/grub2
62
+ln -sfv grub2 $BUILDROOT/boot/grub
63
+
64
+grub_efi_install
65
+
66
+rm -rf ${BUILDROOT}/boot/grub2/fonts
67
+cp boot/ascii.pf2 ${BUILDROOT}/boot/grub2/
68
+mkdir -p ${BUILDROOT}/boot/grub2/themes/photon
69
+cp boot/splash.png ${BUILDROOT}/boot/grub2/themes/photon/photon.png
70
+cp boot/terminal_*.tga ${BUILDROOT}/boot/grub2/themes/photon/
71
+cp boot/theme.txt ${BUILDROOT}/boot/grub2/themes/photon/
72
+
73
+EXTRA_PARAMS="rootwait rw console=ttyS0,115200n8 console=tty0 cma=256M"
74
+
75
+cat > $BUILDROOT/boot/grub2/grub.cfg << EOF
76
+# Begin /boot/grub2/grub.cfg
77
+
78
+set default=0
79
+set timeout=2
80
+loadfont ${BOOT_DIRECTORY}grub2/ascii.pf2
81
+
82
+insmod all_video
83
+insmod gfxterm
84
+insmod png
85
+insmod ext2
86
+
87
+set gfxmode="800x600"
88
+gfxpayload=keep
89
+
90
+terminal_output gfxterm
91
+
92
+set theme=${BOOT_DIRECTORY}grub2/themes/photon/theme.txt
93
+load_env -f ${BOOT_DIRECTORY}photon.cfg
94
+if [ -f  ${BOOT_DIRECTORY}systemd.cfg ]; then
95
+    load_env -f ${BOOT_DIRECTORY}systemd.cfg
96
+else
97
+    set systemd_cmdline=net.ifnames=0
98
+fi
99
+set rootpartition=/dev/mmcblk0p2
100
+
101
+menuentry "Photon" {
102
+    linux ${BOOT_DIRECTORY}\$photon_linux root=\$rootpartition \$photon_cmdline \$systemd_cmdline $EXTRA_PARAMS
103
+    if [ -f ${BOOT_DIRECTORY}\$photon_initrd ]; then
104
+        initrd ${BOOT_DIRECTORY}\$photon_initrd
105
+    fi
106
+}
107
+# End /boot/grub2/grub.cfg
108
+EOF
109
+
110
+#Cleanup the workspace directory
111
+rm -rf "$BUILDROOT"/tools
112
+rm -rf "$BUILDROOT"/RPMS
113
+
0 114
new file mode 100755
... ...
@@ -0,0 +1,93 @@
0
+#!/bin/bash
1
+#################################################
2
+#	Title:	mk-setup-vmdk			#
3
+#        Date:	2014-11-14   	 		#
4
+#     Version:	1.0				#
5
+#      Author:	dthaluru@vmware.com		#
6
+#     Options:					#
7
+#################################################
8
+#	Overview
9
+#		Creating hard disk with photon on it
10
+#	End
11
+#
12
+set -o errexit		# exit if error...insurance ;)
13
+set -o nounset		# exit if variable not initalized
14
+set +h			# disable hashall
15
+PRGNAME=${0##*/}	# script name minus the path
16
+SCRIPT_PATH=$(dirname $(realpath -s $0))
17
+INSTALLER_PATH=$SCRIPT_PATH/../../../installer
18
+source ${INSTALLER_PATH}/config.inc		#	configuration parameters
19
+LOGFILE="/var/log/${PRGNAME}-${LOGFILE}"	#	set log file name
20
+LFS_DISK="/mnt/photon-disk"
21
+[ ${EUID} -eq 0 ]	|| die "${PRGNAME}: Need to be root user: FAILURE"
22
+> ${LOGFILE}		#	clear/initialize logfile
23
+
24
+echo -e "Setting up the disk...\n"
25
+VMDK_IMAGE_NAME=mydisk.vmdk
26
+ROOT_PARTITION_SIZE=1
27
+SWAP_PARTITION_SIZE=0
28
+BOOT_FIRM_WARE="bios"
29
+
30
+while [[ $# > 0 ]]
31
+do
32
+	key="$1"
33
+	shift
34
+ 
35
+	case $key in
36
+		-rp|--ROOT_PARTITION_SIZE)
37
+		ROOT_PARTITION_SIZE="$1"
38
+		shift
39
+	;;
40
+		-sp|--SWAP_PARTITION_SIZE)
41
+		SWAP_PARTITION_SIZE="$1"
42
+		shift
43
+	;;
44
+		-fm|--firmware)
45
+		BOOT_FIRM_WARE="$1"
46
+		shift
47
+
48
+	;;
49
+		-n|--IMG_NAME)
50
+		VMDK_IMAGE_NAME="$1".raw
51
+		shift
52
+	;;
53
+		-h|--help)
54
+		echo 'Usage:'
55
+		echo '-rp|--ROOT_PARTITION_SIZE :sets root partition size'
56
+		echo '-sp|--SWAP_PARTITION_SIZE :sets swap partition size'
57
+		echo '-n|--IMG_NAME             :sets name of the vmdk image'
58
+		echo '-fm|--firmware            :firmware'
59
+		exit 0
60
+	;;
61
+	*)
62
+		# unknown option
63
+	;;
64
+	esac
65
+done
66
+
67
+mkdir -p $LFS_DISK
68
+
69
+TOTAL_SIZE=` echo $ROOT_PARTITION_SIZE + $SWAP_PARTITION_SIZE | bc`
70
+
71
+echo "Creating raw disk file " $VMDK_IMAGE_NAME " of size " $TOTAL_SIZE
72
+# hack to create 512MB image instead of 1GB - use 512 instead of 1024
73
+dd if=/dev/zero of=$VMDK_IMAGE_NAME bs=1024 count=$(($TOTAL_SIZE * 1024 * 512))
74
+chmod 755 $VMDK_IMAGE_NAME
75
+
76
+parted -s $VMDK_IMAGE_NAME mklabel msdos mkpart primary fat32 1M 30M mkpart primary ext4 30M 100%
77
+
78
+echo "Associating loopdevice to raw disk"
79
+DISK_DEVICE=`losetup --show -f -P $VMDK_IMAGE_NAME`
80
+
81
+echo "Mapping device partition to loop device"
82
+kpartx -avs $DISK_DEVICE >> $LOGFILE
83
+
84
+DEVICE_NAME=`echo $DISK_DEVICE|cut -c6- `
85
+
86
+echo "Formatting partitions"
87
+mkfs.ext4 /dev/mapper/${DEVICE_NAME}p2
88
+mkfs.fat /dev/mapper/${DEVICE_NAME}p1
89
+
90
+echo "DISK_DEVICE=$DISK_DEVICE"
91
+echo "ROOT_PARTITION=/dev/mapper/${DEVICE_NAME}p2"
92
+echo "ESP_PARTITION=/dev/mapper/${DEVICE_NAME}p1"
0 93
new file mode 100644
... ...
@@ -0,0 +1,15 @@
0
+[Unit]
1
+Description=Resizes rootfs and creates swap partition
2
+DefaultDependencies=no
3
+Conflicts=shutdown.target
4
+After=systemd-remount-fs.service
5
+Before=systemd-sysusers.service sysinit.target shutdown.target
6
+ConditionPathExists=!/dev/mmcblk0p3
7
+
8
+[Service]
9
+Type=oneshot
10
+RemainAfterExit=yes
11
+ExecStart=/usr/local/bin/resizefs.sh
12
+
13
+[Install]
14
+WantedBy=multi-user.target
0 15
new file mode 100755
... ...
@@ -0,0 +1,6 @@
0
+#! /bin/bash
1
+
2
+parted /dev/mmcblk0 resizepart 2 90%
3
+parted /dev/mmcblk0 mkpart primary linux-swap 90% 100%
4
+partprobe
5
+resize2fs /dev/mmcblk0p2
0 6
new file mode 100755
... ...
@@ -0,0 +1,12 @@
0
+#!/bin/bash
1
+
2
+echo -e "changeme\nchangeme" | passwd root
3
+chage -d 0 -M 999 root
4
+
5
+echo "/dev/mmcblk0p3 none swap defaults 0 0" >> /etc/fstab
6
+
7
+chmod +x /usr/local/bin/resizefs.sh
8
+ln -s /lib/systemd/system/resizefs.service /etc/systemd/system/multi-user.target.wants/resizefs.service
9
+ln -s /lib/systemd/system/sshd-keygen.service /etc/systemd/system/multi-user.target.wants/sshd-keygen.service
10
+ln -s /lib/systemd/system/sshd.service /etc/systemd/system/multi-user.target.wants/sshd.service
11
+
0 12
new file mode 100644
... ...
@@ -0,0 +1,82 @@
0
+import os
1
+import ctypes
2
+import ctypes.util
3
+import json
4
+import collections
5
+import subprocess
6
+import fileinput
7
+import re
8
+import shutil
9
+
10
+class Utils(object):
11
+    def __init__(self):
12
+        self.filesystems = []
13
+        with open('/proc/filesystems') as fs:
14
+            for line in fs:
15
+                self.filesystems.append(line.rstrip('\n').split('\t')[1])
16
+
17
+        self.libcloader = ctypes.CDLL(ctypes.util.find_library('c'), use_errno=True)
18
+
19
+    def mount(self, source, destination, filesystem, flags):
20
+        if not os.access(source, os.R_OK):
21
+            raise Exception("Could not find path " + source)
22
+        if not os.access(destination, os.F_OK):
23
+            os.mkdir(destination)
24
+        if not os.access(destination, os.W_OK):
25
+            raise Exception("Could not write to path " + destination)
26
+        if filesystem not in self.filesystems:
27
+            raise ValueError("Filesystem unknown")
28
+        ret = self.libcloader.mount(ctypes.c_char_p(source),
29
+                                    ctypes.c_char_p(destination),
30
+                                    ctypes.c_char_p(filesystem),
31
+                                    ctypes.c_char_p(flags),
32
+                                    0)
33
+        if ret != 0:
34
+            raise RuntimeError(
35
+                "Cannot mount {} : {}".format(source, os.strerror(ctypes.get_errno())))
36
+
37
+    def umount(self, destination):
38
+        ret = self.libcloader.umount(ctypes.c_char_p(destination))
39
+        if ret != 0:
40
+            raise RuntimeError(
41
+                "Cannot umount {} : {}".format(destination, os.strerror(ctypes.get_errno())))
42
+    @staticmethod
43
+    def jsonread(filename):
44
+        json_data = open(filename)
45
+        data = json.load(json_data, object_pairs_hook=collections.OrderedDict)
46
+        json_data.close()
47
+        return data
48
+
49
+    @staticmethod
50
+    def runshellcommand(cmd, ignore_errors=False):
51
+        print(cmd)
52
+        command = cmd.split()
53
+        p = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
54
+        output, err = p.communicate()
55
+        rc = p.returncode
56
+        if not ignore_errors:
57
+            if rc != 0:
58
+                print(err)
59
+                raise RuntimeError("Cannot run command {}".format(cmd))
60
+        return output.decode()
61
+
62
+    @staticmethod
63
+    def replaceinfile(filename, pattern, sub):
64
+        for line in fileinput.input(filename, inplace=True):
65
+            line = re.sub(pattern, sub, line)
66
+            print(line)
67
+
68
+    @staticmethod
69
+    def replaceandsaveasnewfile(old_file, new_file, pattern, sub):
70
+        with open(old_file, "r") as old, open(new_file, "w") as new:
71
+            for line in old:
72
+                line = re.sub(pattern, sub, line)
73
+                new.write(line)
74
+
75
+    @staticmethod
76
+    def copyallfiles(src, target):
77
+        files = os.listdir(src)
78
+        for file in files:
79
+            filename = os.path.join(src, file)
80
+            if os.path.isfile(filename):
81
+                shutil.copy(filename, target)
... ...
@@ -32,7 +32,7 @@ PHOTON_GENERATED_DATA_DIR=$(PHOTON_STAGE)/common/data
32 32
 
33 33
 PHOTON_PKG_BUILDER_DIR=$(SRCROOT)/support/package-builder
34 34
 PHOTON_PULL_PUBLISH_RPMS_DIR=$(SRCROOT)/support/pullpublishrpms
35
-PHOTON_CLOUD_IMAGE_BUILDER_DIR=$(SRCROOT)/support/cloud-image-builder
35
+PHOTON_IMAGE_BUILDER_DIR=$(SRCROOT)/support/image-builder
36 36
 
37 37
 PHOTON_INSTALLER_DIR=$(SRCROOT)/installer
38 38
 PHOTON_INSTALLER=$(PHOTON_INSTALLER_DIR)/photonInstaller.py
... ...
@@ -47,7 +47,7 @@ PHOTON_PULLSOURCES_CONFIG?=$(PHOTON_PKG_BUILDER_DIR)/bintray.conf
47 47
 endif
48 48
 PHOTON_PULL_PUBLISH_RPMS=$(PHOTON_PULL_PUBLISH_RPMS_DIR)/pullpublishrpms.sh
49 49
 PHOTON_PULL_PUBLISH_X_RPMS=$(PHOTON_PULL_PUBLISH_RPMS_DIR)/pullpublishXrpms.sh
50
-PHOTON_CLOUD_IMAGE_BUILDER=$(PHOTON_CLOUD_IMAGE_BUILDER_DIR)/cloud-image-build.sh
50
+PHOTON_IMAGE_BUILDER=$(PHOTON_IMAGE_BUILDER_DIR)/image-builder.sh
51 51
 
52 52
 PHOTON_CHROOT_CLEANER=$(PHOTON_PKG_BUILDER_DIR)/clean-up-chroot.py
53 53
 PHOTON_RPMS_DIR_NOARCH=$(PHOTON_RPMS_DIR)/noarch
... ...
@@ -237,19 +237,13 @@ def main():
237 237
             list_json_files = options.json_file.split("\n")
238 238
             # Generate the expanded package dependencies json file based on package_list_file
239 239
             logger.info("Generating the install time dependency list for all json files")
240
+            if list_json_files:
241
+                shutil.copy2(os.path.dirname(list_json_files[0]) + "/build_install_options_all.json", options.output_dir)
240 242
             for json_file in list_json_files:
241
-                shutil.copy2(json_file, options.output_dir)
242
-                json_wrapper_option_list = JsonWrapper(json_file)
243
-                option_list_json = json_wrapper_option_list.read()
244
-                options_sorted = option_list_json.items()
245
-                for install_option in options_sorted:
246
-                    output_file = None
247
-                    input_value = os.path.join(os.path.dirname(json_file), install_option[1]["file"])
248
-                    if options.display_option == "tree" and install_option[1]["title"] == "ISO Packages":
249
-                        continue
250
-                    if options.display_option == "json":
251
-                        output_file = os.path.join(options.output_dir, install_option[1]["file"])
252
-                    specDeps.process(options.input_type, input_value, options.display_option, output_file)
243
+                output_file = None
244
+                if options.display_option == "json":
245
+                    output_file = os.path.join(options.output_dir, os.path.basename(json_file))
246
+                    specDeps.process(options.input_type, json_file, options.display_option, output_file)
253 247
     except Exception as e:
254 248
         traceback.print_exc()
255 249
         sys.stderr.write(str(e))
256 250
deleted file mode 100644
... ...
@@ -1,45 +0,0 @@
1
-## Photon Packer templates
2
-
3
-This directory contains [Packer](http://packer.io) templates for `photon-build-machine` to build a generic `photon` Vagrant box with `docker` binding on `0.0.0.0:2375`.
4
-
5
-The `photon-build-machine` is a Ubuntu 14.04.4 that contains all the prerequisites to build Photon from scratch, and it is the box referenced by the top-level Vagrantfile. To build this machine, you will need:
6
-
7
-- VMware Workstation (on Windows and Linux) or Fusion (on Mac OS X)
8
-- A recent Packer install (tested on v0.7.5)
9
-- Packer OVF Post Processor from [GitHub](https://github.com/gosddc/packer-post-processor-vagrant-vmware-ovf) (Optional for vCloud Air build)
10
-- Vagrant vCloud Air Provider from [GitHub](https://github.com/gosddc/vagrant-vcloudair) (Optional for vCloud Air usage)
11
-
12
-### Automatic build machine
13
-To automatically build the `photon-build-machine` and push into the local Vagrant box repository, use the make target from the root of the Photon source:
14
-```
15
-make photon-build-machine
16
-```
17
-
18
-### Build an ISO using a Vagrant based build machine
19
-Assuming that the `photon-build-machine` has been created and resides in your local Vagrant repository, running `vagrant up` from the source root will automatically build a new `photon.iso` using the `photon-build-machine` Vagrant box and copy this into the host's `stage` directory. The machine will be halted at the completion of the build and can be reused or destroyed using `vagrant destroy`.
20
-
21
-Alternatively, you can use the convenience make target to run the build process and destroy the machine on completion:
22
-```
23
-make photon-vagrant-build
24
-```
25
-
26
-#### Troubleshooting
27
-
28
-By default Packer will run headless when building the `photon-build-machine` vm. If your packer build fails, try switching `"headless": true,` to `"headless": false,` in [`photon-build-machine.json`](https://github.com/frapposelli/photon/blob/master/support/packer-templates/photon-build-machine.json#L8). This will open the Workstation/Fusion GUI when the build starts so you can watch the process. Make sure not to send any input to the VM during the build as it may interfere with the process.
29
-
30
-## Photon Vagrant box with Docker
31
-To build a new Photon Vagrant box and make it available in the `stage` directory, use the make target from the root of the Photon source:
32
-```
33
-make photon-vagrant-local
34
-```
35
-By default this process will build a Vagrant box using the VMware provider which can be used with VMware Fusion or Workstation. Setting the VAGRANT_BUILD variable allows finer control of the build output:
36
-
37
-1. Vagrant only (default) ```make photon-vagrant-local``` or explicit version ```make photon-vagrant-local VAGRANT_BUILD=vagrant```
38
-2. vCloud Air or vCloud ```make photon-vagrant-local VAGRANT_BUILD=vcloudair```
39
-3. All builds ```make photon-vagrant-local VAGRANT_BUILD=all```
40
-
41
-The Vagrant box is configured to start a Docker service daemon bound to 0.0.0.0:2375 which is remapped to your host for convenience: Export DOCKER_HOST=tcp://127.0.0.1:2375.
42
-
43
-A sample Vagrantfile for use with vCloud Air resides in ```support/vagrant/Vagrantfile_VCA_Sample```. Refer to [vagrant-vcloudair](https://github.com/gosddc/vagrant-vcloudair) for advanced usage details.
44
-
45
-The box is configured to match the Vagrant base box standards; however, it is not meant as an official Vagrant box build for Photon but rather as a starting point to create your own.
46 1
deleted file mode 100644
... ...
@@ -1,62 +0,0 @@
1
-{
2
-  "builders": [{
3
-    "name": "photon-build-machine",
4
-    "vm_name": "photon-build-machine",
5
-    "vmdk_name": "photon-build-machine-disk0",
6
-    "type": "vmware-iso",
7
-    "headless": true,
8
-    "disk_size": 40960,
9
-    "disk_type_id": 0,
10
-    "guest_os_type": "ubuntu-64",
11
-    "iso_url": "http://ubuntu.bhs.mirrors.ovh.net/ftp.ubuntu.com/releases/trusty/ubuntu-14.04.4-server-amd64.iso",
12
-    "iso_checksum": "3ffb7a3690ce9a07ac4a4d1b829f990681f7e47d",
13
-    "iso_checksum_type": "sha1",
14
-    "ssh_username": "vagrant",
15
-    "ssh_password": "vagrant",
16
-    "ssh_wait_timeout": "60m",
17
-    "shutdown_command": "echo 'vagrant' | sudo -S shutdown -P now",
18
-    "http_directory": ".",
19
-    "tools_upload_flavor": "linux",
20
-    "boot_command": [
21
-      "<esc><esc><enter><wait>",
22
-      "/install/vmlinuz noapic ",
23
-      "preseed/url=http://{{ .HTTPIP }}:{{ .HTTPPort }}/scripts/ubuntu-preseed.cfg ",
24
-      "debian-installer=en_US auto locale=en_US kbd-chooser/method=us ",
25
-      "hostname=photon-build-machine ",
26
-      "fb=false debconf/frontend=noninteractive ",
27
-      "keyboard-configuration/modelcode=SKIP keyboard-configuration/layout=USA ",
28
-      "keyboard-configuration/variant=USA console-setup/ask_detect=false ",
29
-      "initrd=/install/initrd.gz -- <enter>"
30
-    ]
31
-  }],
32
-  "provisioners": [{
33
-    "type": "shell",
34
-    "execute_command": "echo 'vagrant' | {{ .Vars }} sudo -E -S sh '{{ .Path }}'",
35
-    "script": "scripts/ubuntu-vmware-tools_install.sh"
36
-  }, {
37
-    "type": "shell",
38
-    "execute_command": "echo 'vagrant' | {{ .Vars }} sudo -E -S sh '{{ .Path }}'",
39
-    "script": "scripts/ubuntu-puppet_install.sh"
40
-  }, {
41
-    "type": "puppet-masterless",
42
-    "execute_command": "{{.FacterVars}}{{if .Sudo}} echo 'vagrant' | sudo -E -S {{end}} puppet apply --verbose --modulepath='{{.ModulePath}}' {{if ne .HieraConfigPath \"\"}}--hiera_config='{{.HieraConfigPath}}' {{end}} {{if ne .ManifestDir \"\"}}--manifestdir='{{.ManifestDir}}' {{end}} --detailed-exitcodes {{.ManifestFile}}",
43
-    "manifest_file": "puppet/manifests/vagrant.pp",
44
-    "manifest_dir": "puppet/manifests",
45
-    "module_paths": [
46
-      "puppet/modules"
47
-    ]
48
-  }, {
49
-    "type": "shell",
50
-    "execute_command": "echo 'vagrant' | {{ .Vars }} sudo -E -S sh '{{ .Path }}'",
51
-    "script": "scripts/ubuntu-install-docker.sh"
52
-  }, {
53
-    "type": "shell",
54
-    "execute_command": "echo 'vagrant' | {{ .Vars }} sudo -E -S sh '{{ .Path }}'",
55
-    "script": "scripts/ubuntu-vmware-final_cleanup.sh"
56
-  }],
57
-  "post-processors": [{
58
-    "type": "vagrant",
59
-    "compression_level": 9,
60
-    "output": "{{.BuildName}}.box"
61
-  }]
62
-}
63 1
deleted file mode 100644
... ...
@@ -1,111 +0,0 @@
1
-{
2
-  "variables": {
3
-    "iso_file": "../../stage/photon.iso",
4
-    "iso_checksum_value": "99afd5b3280ba91be67907ae2d3be79c05ba3067",
5
-    "product_name": "Photon",
6
-    "product_version": "1.0",
7
-    "headless": "true",
8
-    "disk_size": "204080",
9
-    "ssh_password": "VMware123!",
10
-    "ssh_wait_timeout": "5m",
11
-    "shutdown_command": "shutdown -h now"
12
-  },
13
-  "builders": [
14
-    {
15
-      "name": "vagrant",
16
-      "vm_name": "photon",
17
-      "vmdk_name": "photon-disk0",
18
-      "type": "vmware-iso",
19
-      "headless": "{{user `headless`}}",
20
-      "disk_size": "{{user `disk_size`}}",
21
-      "disk_type_id": 0,
22
-      "guest_os_type": "other3xlinux-64",
23
-      "iso_url": "{{user `iso_file`}}",
24
-      "iso_checksum": "{{user `iso_checksum_value`}}",
25
-      "iso_checksum_type": "sha1",
26
-      "ssh_username": "root",
27
-      "ssh_password": "{{user `ssh_password`}}",
28
-      "ssh_wait_timeout": "{{user `ssh_wait_timeout`}}",
29
-      "shutdown_command": "shutdown -h now",
30
-      "http_directory": ".",
31
-      "boot_command": [
32
-        "<enter>",
33
-        "<wait5><enter><enter><enter>",
34
-        "<down><down><enter><wait>",
35
-        "photon<enter><wait>",
36
-        "{{user `ssh_password`}}<enter><wait>",
37
-        "{{user `ssh_password`}}<enter>",
38
-        "<wait10><wait10><wait10><wait10><wait10><wait10><wait10>",
39
-        "<enter>",
40
-        "<wait10><wait10><wait10>",
41
-        "root<enter><wait>{{user `ssh_password`}}<enter><wait>",
42
-        "sed -i -e 's/PermitRootLogin no/PermitRootLogin yes/g' /etc/ssh/sshd_config<enter>",
43
-        "<wait>",
44
-        "systemctl restart sshd.service<enter>",
45
-        "<wait5>"
46
-      ]
47
-    },
48
-    {
49
-      "name": "vcloudair",
50
-      "vm_name": "photon",
51
-      "vmdk_name": "photon-disk0",
52
-      "type": "vmware-iso",
53
-      "headless": "{{user `headless`}}",
54
-      "disk_size": "{{user `disk_size`}}",
55
-      "disk_type_id": 0,
56
-      "guest_os_type": "other3xlinux-64",
57
-      "iso_url": "{{user `iso_file`}}",
58
-      "iso_checksum": "{{user `iso_checksum_value`}}",
59
-      "iso_checksum_type": "sha1",
60
-      "ssh_username": "root",
61
-      "ssh_password": "{{user `ssh_password`}}",
62
-      "ssh_wait_timeout": "{{user `ssh_wait_timeout`}}",
63
-      "shutdown_command": "shutdown -h now",
64
-      "http_directory": ".",
65
-      "boot_command": [
66
-        "<enter>",
67
-        "<wait5><enter><enter><enter>",
68
-        "<down><down><enter><wait>",
69
-        "photon<enter><wait>",
70
-        "{{user `ssh_password`}}<enter><wait>",
71
-        "{{user `ssh_password`}}<enter>",
72
-        "<wait10><wait10><wait10><wait10><wait10><wait10><wait10>",
73
-        "<enter>",
74
-        "<wait10><wait10><wait10>",
75
-        "root<enter><wait>{{user `ssh_password`}}<enter><wait>",
76
-        "sed -i -e 's/PermitRootLogin no/PermitRootLogin yes/g' /etc/ssh/sshd_config<enter>",
77
-        "<wait>",
78
-        "systemctl restart sshd.service<enter>",
79
-        "<wait5>"
80
-      ]
81
-    }
82
-  ],
83
-  "provisioners": [
84
-    {
85
-      "type": "file",
86
-      "source": "scripts/photon-docker.service",
87
-      "destination": "/lib/systemd/system/docker.service"
88
-    },
89
-    {
90
-      "type": "shell",
91
-      "script": "scripts/photon-provisioning.sh"
92
-    }
93
-  ],
94
-  "post-processors": [
95
-    {
96
-      "type": "vagrant",
97
-      "only": ["vagrant"],
98
-      "compression_level": 9,
99
-      "vagrantfile_template": "scripts/photon-vagrantfile_template.rb",
100
-      "output": "{{user `product_name`}}-{{.BuildName}}.box"
101
-    },
102
-    {
103
-      "type": "vagrant-vmware-ovf",
104
-      "only": ["vcloudair"],
105
-      "compression_level": 9,
106
-      "vagrantfile_template": "scripts/photon-vagrantfile_template.rb",
107
-      "output": "{{user `product_name`}}-{{.BuildName}}.box"
108
-    }
109
-  ]
110
-
111
-}
112 1
deleted file mode 100644
... ...
@@ -1,21 +0,0 @@
1
-# create a new run stage to ensure certain modules are included first
2
-stage { 'pre':
3
-  before => Stage['main']
4
-}
5
-
6
-# add the baseconfig module to the new 'pre' run stage
7
-class { 'vagrantbaseconfig':
8
-  stage => 'pre'
9
-}
10
-
11
-# set defaults for file ownership/permissions
12
-File {
13
-  owner => 'root',
14
-  group => 'root',
15
-  mode  => '0644',
16
-}
17
-
18
-# all boxes get the base config
19
-include vagrantbaseconfig
20
-include photonbuildsetup
21
-
22 1
deleted file mode 100644
... ...
@@ -1,43 +0,0 @@
1
-# == Class: photonbuildsetup
2
-#
3
-# Performs initial configuration tasks for all Vagrant boxes.
4
-#
5
-class photonbuildsetup {
6
-
7
-  exec {
8
-    'apt-get update':
9
-      command => '/usr/bin/apt-get update',
10
-  }
11
-
12
-  package { ['build-essential',
13
-            'gawk',
14
-            'bison',
15
-            'libgmp-dev',
16
-            'libmpfr-dev',
17
-            'libmpc-dev',
18
-            'mkisofs',
19
-            'cifs-utils',
20
-            'createrepo',
21
-            'rpm',
22
-            'htop',
23
-            'python-aptdaemon',
24
-            'gdisk',
25
-            'texinfo']:
26
-    ensure => present,
27
-    require => Exec['apt-get update'];
28
-  }
29
-
30
-  file { '/bin/sh':
31
-      ensure => 'link',
32
-      target => '/bin/bash',
33
-  }
34
-
35
-  file {
36
-    '/mnt/photonroot':
37
-    ensure => directory,
38
-    owner  => 'vagrant',
39
-    group  => 'vagrant',
40
-    mode   => '0755',
41
-  }
42
-
43
-}
44 1
deleted file mode 100644
... ...
@@ -1,6 +0,0 @@
1
-# .bash_profile
2
- 
3
-# Get the aliases and functions
4
-if [ -f ~/.bashrc ]; then
5
-  . ~/.bashrc
6
-fi
7 1
deleted file mode 100644
... ...
@@ -1,107 +0,0 @@
1
-# ~/.bashrc: executed by bash(1) for non-login shells.
2
-# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
3
-# for examples
4
-
5
-# If not running interactively, don't do anything
6
-[ -z "$PS1" ] && return
7
-
8
-# don't put duplicate lines or lines starting with space in the history.
9
-# See bash(1) for more options
10
-HISTCONTROL=ignoreboth
11
-
12
-# append to the history file, don't overwrite it
13
-shopt -s histappend
14
-
15
-# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
16
-HISTSIZE=50000
17
-HISTFILESIZE=50000
18
-
19
-# check the window size after each command and, if necessary,
20
-# update the values of LINES and COLUMNS.
21
-shopt -s checkwinsize
22
-
23
-# If set, the pattern "**" used in a pathname expansion context will
24
-# match all files and zero or more directories and subdirectories.
25
-#shopt -s globstar
26
-
27
-# make less more friendly for non-text input files, see lesspipe(1)
28
-[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
29
-
30
-# set variable identifying the chroot you work in (used in the prompt below)
31
-if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then
32
-    debian_chroot=$(cat /etc/debian_chroot)
33
-fi
34
-
35
-# set a fancy prompt (non-color, unless we know we "want" color)
36
-case "$TERM" in
37
-    xterm-color) color_prompt=yes;;
38
-esac
39
-
40
-# uncomment for a colored prompt, if the terminal has the capability; turned
41
-# off by default to not distract the user: the focus in a terminal window
42
-# should be on the output of commands, not on the prompt
43
-force_color_prompt=yes
44
-
45
-if [ -n "$force_color_prompt" ]; then
46
-    if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
47
-	# We have color support; assume it's compliant with Ecma-48
48
-	# (ISO/IEC-6429). (Lack of such support is extremely rare, and such
49
-	# a case would tend to support setf rather than setaf.)
50
-	color_prompt=yes
51
-    else
52
-	color_prompt=
53
-    fi
54
-fi
55
-
56
-if [ "$color_prompt" = yes ]; then
57
-    PS1='${debian_chroot:+($debian_chroot)}\[\033[01;35m\]\u@\h\[\033[00m\]:\[\033[01;33m\]\w\[\033[00m\]\$ '
58
-else
59
-    PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
60
-fi
61
-unset color_prompt force_color_prompt
62
-
63
-# If this is an xterm set the title to user@host:dir
64
-case "$TERM" in
65
-xterm*|rxvt*)
66
-    PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
67
-    ;;
68
-*)
69
-    ;;
70
-esac
71
-
72
-# enable color support of ls and also add handy aliases
73
-if [ -x /usr/bin/dircolors ]; then
74
-    test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
75
-    alias ls='ls --color=auto'
76
-    #alias dir='dir --color=auto'
77
-    #alias vdir='vdir --color=auto'
78
-
79
-    alias grep='grep --color=auto'
80
-    alias fgrep='fgrep --color=auto'
81
-    alias egrep='egrep --color=auto'
82
-fi
83
-
84
-# some more ls aliases
85
-alias ll='ls -alF'
86
-alias la='ls -A'
87
-alias l='ls -CF'
88
-
89
-# Add an "alert" alias for long running commands.  Use like so:
90
-#   sleep 10; alert
91
-alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'
92
-
93
-# Alias definitions.
94
-# You may want to put all your additions into a separate file like
95
-# ~/.bash_aliases, instead of adding them here directly.
96
-# See /usr/share/doc/bash-doc/examples in the bash-doc package.
97
-
98
-if [ -f ~/.bash_aliases ]; then
99
-    . ~/.bash_aliases
100
-fi
101
-
102
-# enable programmable completion features (you don't need to enable
103
-# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
104
-# sources /etc/bash.bashrc).
105
-if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
106
-    . /etc/bash_completion
107
-fi
108 1
deleted file mode 100644
... ...
@@ -1,17 +0,0 @@
1
-Protocol 2
2
-
3
-SyslogFacility AUTHPRIV
4
-PasswordAuthentication yes
5
-
6
-ChallengeResponseAuthentication no
7
-
8
-GSSAPIAuthentication yes
9
-GSSAPICleanupCredentials yes
10
-
11
-UsePAM yes
12
-UseDNS no
13
-
14
-AcceptEnv XMODIFIERS
15
-
16
-X11Forwarding yes
17
-Subsystem       sftp    /usr/libexec/openssh/sftp-server
18 1
\ No newline at end of file
19 2
deleted file mode 100644
... ...
@@ -1,25 +0,0 @@
1
-# /etc/sudoers
2
-#
3
-# This file MUST be edited with the 'visudo' command as root.
4
-#
5
-# See the man page for details on how to write a sudoers file.
6
-#
7
-
8
-Defaults    env_reset
9
-
10
-# Uncomment to allow members of group sudo to not need a password
11
-# %sudo ALL=NOPASSWD: ALL
12
-
13
-# Host alias specification
14
-
15
-# User alias specification
16
-
17
-vagrant ALL=(ALL) NOPASSWD: ALL
18
-
19
-# Cmnd alias specification
20
-
21
-# User privilege specification
22
-root    ALL=(ALL) ALL
23
-
24
-# Members of the admin group may gain root privileges
25
-%admin ALL=(ALL) ALL
26 1
\ No newline at end of file
27 2
deleted file mode 100644
... ...
@@ -1 +0,0 @@
1
-ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA6NF8iallvQVp22WDkTkyrtvp9eWW6A8YVr+kz4TjGYe7gHzIw+niNltGEFHzD8+v1I2YJ6oXevct1YeS0o9HZyN1Q9qgCgzUFtdOKLv6IedplqoPkcmF0aYet2PkEDo3MlTBckFXPITAMzF8dJSIFo9D8HfdOV0IAdx4O7PtixWKn5y2hMNG0zQPyUecp4pzC6kivAIhyfHilFR61RGL+GPXQ2MWZWFYbAGjyiYJnAmCP3NOTd0jMZEnDkbUvxhMmBYSdETk1rRgm+R4LOzFUGaHqHDLKLX+FIPKcF96hrucXzcWyLbIbEgE98OHlnVYCzRdK8jlqm8tehUc9c9WhQ== vagrant insecure public key
2 1
deleted file mode 100644
... ...
@@ -1,58 +0,0 @@
1
-# == Class: vagrantbaseconfig
2
-#
3
-# Performs initial configuration tasks for all Vagrant boxes.
4
-#
5
-class vagrantbaseconfig {
6
-
7
-  file {
8
-    '/home/vagrant/.bashrc':
9
-    owner  => 'vagrant',
10
-    group  => 'vagrant',
11
-    mode   => '0644',
12
-    source => 'puppet:///modules/vagrantbaseconfig/bashrc.sh';
13
-  }
14
-
15
-  file {
16
-    '/home/vagrant/.bash_profile':
17
-    owner  => 'vagrant',
18
-    group  => 'vagrant',
19
-    mode   => '0644',
20
-    source => 'puppet:///modules/vagrantbaseconfig/bash_profile.sh';
21
-  }
22
-
23
-  file {
24
-    '/etc/sudoers':
25
-    owner  => 'root',
26
-    group  => 'root',
27
-    mode   => '0440',
28
-    source => 'puppet:///modules/vagrantbaseconfig/sudoers';
29
-  }
30
-
31
-  file {
32
-    '/home/vagrant/.ssh':
33
-    ensure => directory,
34
-    owner  => 'vagrant',
35
-    group  => 'vagrant',
36
-    mode   => '0700',
37
-  }
38
-
39
-  file {
40
-    '/home/vagrant/.ssh/authorized_keys':
41
-    ensure  => present,
42
-    owner   => 'vagrant',
43
-    group   => 'vagrant',
44
-    mode    => '0600',
45
-    source  => 'puppet:///modules/vagrantbaseconfig/vagrant.pub',
46
-    require => File['/home/vagrant/.ssh']
47
-  }
48
-
49
-  file {
50
-    '/etc/ssh/sshd_config':
51
-    path   => '/etc/ssh/sshd_config',
52
-    owner  => root,
53
-    group  => root,
54
-    mode   => '0444',
55
-    source => 'puppet:///modules/vagrantbaseconfig/sshd_config'
56
-  }
57
-}
58
-
59 1
deleted file mode 100644
... ...
@@ -1,11 +0,0 @@
1
-[Unit]
2
-Description=Docker Daemon
3
-
4
-[Service]
5
-ExecStart=/bin/docker -H tcp://0.0.0.0:2375 -H unix:///var/run/docker.sock -d
6
-ExecReload=/bin/kill -HUP $MAINPID
7
-KillMode=process
8
-Restart=always
9
-
10
-[Install]
11
-WantedBy=multi-user.target
12 1
deleted file mode 100644
... ...
@@ -1,19 +0,0 @@
1
-#!/bin/sh
2
-
3
-HOME_DIR="/home/vagrant"
4
-
5
-# Set up a vagrant user and add the insecure key for Vagrant to login
6
-useradd -g 999 -m vagrant
7
-
8
-# Configure a sudoers for the vagrant user
9
-echo "vagrant ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/vagrant
10
-
11
-# Set up insecure Vagrant key
12
-mkdir -p ${HOME_DIR}/.ssh
13
-echo "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA6NF8iallvQVp22WDkTkyrtvp9eWW6A8YVr+kz4TjGYe7gHzIw+niNltGEFHzD8+v1I2YJ6oXevct1YeS0o9HZyN1Q9qgCgzUFtdOKLv6IedplqoPkcmF0aYet2PkEDo3MlTBckFXPITAMzF8dJSIFo9D8HfdOV0IAdx4O7PtixWKn5y2hMNG0zQPyUecp4pzC6kivAIhyfHilFR61RGL+GPXQ2MWZWFYbAGjyiYJnAmCP3NOTd0jMZEnDkbUvxhMmBYSdETk1rRgm+R4LOzFUGaHqHDLKLX+FIPKcF96hrucXzcWyLbIbEgE98OHlnVYCzRdK8jlqm8tehUc9c9WhQ== vagrant insecure public key" > ${HOME_DIR}/.ssh/authorized_keys
14
-chown -R vagrant:users ${HOME_DIR}/.ssh
15
-chmod 700 ${HOME_DIR}/.ssh
16
-chmod 600 ${HOME_DIR}/.ssh/authorized_keys
17
-
18
-# Enable Docker to start at runtime
19
-systemctl enable docker
20 1
deleted file mode 100644
... ...
@@ -1,24 +0,0 @@
1
-Vagrant.require_version '>= 1.6.2'
2
-
3
-Vagrant.configure('2') do |config|
4
-
5
-  config.vm.synced_folder '.', '/vagrant', disabled: true
6
-
7
-  config.nfs.functional = false
8
-
9
-  config.vm.network "forwarded_port", guest: 2375, host: 2375
10
-
11
-  config.vm.provider :vmware_fusion do |v|
12
-    v.gui = false
13
-    v.vmx['ethernet0.virtualDev'] = 'vmxnet3'
14
-  end
15
-
16
-  config.vm.provider :vmware_workstation do |v|
17
-    v.gui = false
18
-    v.vmx['ethernet0.virtualDev'] = 'vmxnet3'
19
-  end
20
-
21
-  config.vm.provider :vcenter do |vcenter|
22
-    vcenter.enable_vm_customization = false
23
-  end
24
-end
25 1
deleted file mode 100644
... ...
@@ -1,7 +0,0 @@
1
-#!/bin/bash
2
-
3
-echo "==> Setting up docker from apt.dockerproject.org"
4
-sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
5
-echo 'deb https://apt.dockerproject.org/repo ubuntu-trusty main' | sudo tee /etc/apt/sources.list.d/docker.list
6
-sudo apt-get update
7
-sudo apt-get install -y docker-engine
8 1
deleted file mode 100644
... ...
@@ -1,112 +0,0 @@
1
-# Installation
2
-# ============
3
-
4
-# Clock and Timezone
5
-# ------------------
6
-
7
-# ### Hardware Clock
8
-
9
-# Setting the hardware clock to UTC is considered best practice and may be
10
-# assumed by some pacakges
11
-
12
-d-i clock-setup/utc boolean true
13
-
14
-# ### Timezone
15
-
16
-# Generally the server timezone should be set to a value which is logically tied
17
-# to the purpose of the server. The generic nature of this vagrant box lends
18
-# itself to 'GMT' as it is the global time standard.
19
-
20
-d-i time/zone string GMT
21
-
22
-# Account Setup
23
-# -------------
24
-
25
-# ### User Credentials
26
-
27
-# It is conventional to create a user named 'vagrant' with a password of
28
-# 'vagrant' which vagrant will login as. Please note that these credentials are
29
-# public knowledge and you should never have this account on a public server.
30
-
31
-d-i passwd/user-fullname string vagrant
32
-d-i passwd/username string vagrant
33
-d-i passwd/user-password password vagrant
34
-d-i passwd/user-password-again password vagrant
35
-d-i user-setup/allow-password-weak boolean true
36
-
37
-# ### Home Directory Encryption
38
-
39
-# The home directory is not encrypted to aviod any issues that this may cause.
40
-
41
-d-i user-setup/encrypt-home boolean false
42
-
43
-# Partitioning
44
-# ------------
45
-
46
-# ### LVM Partitioning
47
-
48
-# The entire disk is partitioned using LVM and any prompts that LVM partitioning
49
-# raises are confirmed automatically.
50
-
51
-d-i partman-auto/method string lvm
52
-d-i partman-auto-lvm/guided_size string max
53
-d-i partman-auto/choose_recipe select atomic
54
-
55
-# Old LVM partitions are overwritten, pre-existing raid partitions are removed.
56
-
57
-d-i partman-lvm/device_remove_lvm boolean true
58
-d-i partman-md/device_remove_md boolean true
59
-
60
-# The ubuntu installer will prompt for confirmation of the partitioning
61
-# strategies.
62
-
63
-d-i partman-partitioning/confirm_write_new_label boolean true
64
-d-i partman/choose_partition select finish
65
-d-i partman/confirm boolean true
66
-d-i partman-lvm/confirm_nooverwrite boolean true
67
-d-i partman/confirm_nooverwrite boolean true
68
-
69
-# Packages & Updates
70
-# ------------------
71
-
72
-# ### No proxy
73
-
74
-# By default there is no proxy set for the mirror.
75
-
76
-d-i mirror/http/proxy string
77
-
78
-# ### No automatic updates
79
-
80
-# Automatic updates are not applied, everything is updated manually.
81
-d-i pkgsel/update-policy select none
82
-
83
-# ### Ubuntu server
84
-
85
-# The standard ubuntu server
86
-
87
-tasksel tasksel/first multiselect standard
88
-d-i pkgsel/install-language-support boolean false
89
-
90
-# ### Default Packages
91
-
92
-# Vagrant requires the OpenSSH server to be installed in order to be able to
93
-# manage the VM, build tools and the kernel headers to compile VMware Tools
94
-# addons
95
-
96
-d-i pkgsel/include string openssh-server build-essential linux-kernel-headers bc git-core unzip
97
-
98
-# Boot loader installation
99
-# ------------------------
100
-
101
-# The default boot loader (grub) is installed as the boot loader on the server
102
-# and all prompts which it throws up are automatically confirmed.
103
-
104
-d-i grub-installer/only_debian boolean true
105
-
106
-# Complete installation
107
-# ---------------------
108
-
109
-# Ubuntu show a final message once the installation is complete. This message is
110
-# affirmed so it doesn't block the installation process.
111
-
112
-d-i finish-install/reboot_in_progress note
113 1
deleted file mode 100644
... ...
@@ -1,11 +0,0 @@
1
-#!/bin/bash
2
-
3
-. /etc/lsb-release
4
-
5
-echo "==> OS detected: ${DISTRIB_ID} ${DISTRIB_RELEASE} (${DISTRIB_CODENAME})"
6
-echo "==> Setting up puppet from apt.puppetlabs.com"
7
-wget https://apt.puppetlabs.com/puppetlabs-release-${DISTRIB_CODENAME}.deb
8
-dpkg -i puppetlabs-release-${DISTRIB_CODENAME}.deb
9
-rm puppetlabs-release-${DISTRIB_CODENAME}.deb
10
-apt-get update
11
-apt-get install -y puppet
12 1
deleted file mode 100644
... ...
@@ -1,86 +0,0 @@
1
-#!/bin/bash -eux
2
-# Blatantly stolen from from https://raw.githubusercontent.com/StefanScherer/ubuntu-vm/my/script/cleanup-vcloud.sh
3
-# Thanks Stefan!
4
-
5
-CLEANUP_PAUSE=${CLEANUP_PAUSE:-0}
6
-echo "==> Pausing for ${CLEANUP_PAUSE} seconds..."
7
-sleep ${CLEANUP_PAUSE}
8
-
9
-# Make sure udev does not block our network - http://6.ptmc.org/?p=164
10
-echo "==> Cleaning up udev rules"
11
-rm -rf /dev/.udev/
12
-rm /lib/udev/rules.d/75-persistent-net-generator.rules
13
-
14
-echo "==> Cleaning up leftover dhcp leases"
15
-# Ubuntu 10.04
16
-if [ -d "/var/lib/dhcp3" ]; then
17
-    rm /var/lib/dhcp3/*
18
-fi
19
-# Ubuntu 12.04 & 14.04
20
-if [ -d "/var/lib/dhcp" ]; then
21
-    rm /var/lib/dhcp/*
22
-fi 
23
-
24
-if [ ! -d "/etc/dhcp3" ]; then
25
-  if [ -d "/etc/dhcp" ]; then
26
-    echo "Patching /etc/dhcp3 for vCloud"
27
-    ln -s /etc/dhcp /etc/dhcp3
28
-  fi
29
-fi
30
-
31
-echo "==> Removing network-manager (KB2042181)"
32
-apt-get remove --purge network-manager
33
-
34
-echo "==> Cleaning up tmp"
35
-rm -rf /tmp/*
36
-
37
-# Cleanup apt cache
38
-apt-get -y autoremove --purge
39
-apt-get -y clean
40
-apt-get -y autoclean
41
-
42
-echo "==> Installed packages"
43
-dpkg --get-selections | grep -v deinstall
44
-
45
-# Remove Bash history
46
-unset HISTFILE
47
-rm -f /root/.bash_history
48
-rm -f /home/vagrant/.bash_history
49
-
50
-# Clean up log files
51
-find /var/log -type f | while read f; do echo -ne '' > $f; done;
52
-
53
-export PREFIX="/sbin"
54
-
55
-FileSystem=`grep ext /etc/mtab| awk -F" " '{ print $2 }'`
56
-
57
-for i in $FileSystem
58
-do
59
-        echo $i
60
-        number=`df -B 512 $i | awk -F" " '{print $3}' | grep -v Used`
61
-        echo $number
62
-        percent=$(echo "scale=0; $number * 98 / 100" | bc )
63
-        echo $percent
64
-        dd count=`echo $percent` if=/dev/zero of=`echo $i`/zf
65
-        /bin/sync
66
-        sleep 15
67
-        rm -f $i/zf
68
-done
69
-
70
-VolumeGroup=`$PREFIX/vgdisplay | grep Name | awk -F" " '{ print $3 }'`
71
-
72
-for j in $VolumeGroup
73
-do
74
-        echo $j
75
-        $PREFIX/lvcreate -l `$PREFIX/vgdisplay $j | grep Free | awk -F" " '{ print $5 }'` -n zero $j
76
-        if [ -e /dev/$j/zero ]; then
77
-                cat /dev/zero > /dev/$j/zero
78
-                /bin/sync
79
-                sleep 15
80
-                $PREFIX/lvremove -f /dev/$j/zero
81
-        fi
82
-done
83
-
84
-# Make sure we wait until all the data is written to disk, otherwise
85
-# Packer might quit too early before the large files are deleted
86
-sync
87 1
\ No newline at end of file
88 2
deleted file mode 100644
... ...
@@ -1,10 +0,0 @@
1
-#!/bin/bash
2
-
3
-git clone https://github.com/rasa/vmware-tools-patches.git
4
-cd vmware-tools-patches
5
-sudo ./download-tools.sh 8.0.2
6
-sudo ./untar-and-patch.sh
7
-cd vmware-tools-distrib
8
-sudo ./vmware-install.pl -f -d --clobber-kernel-modules=pvscsi,vmblock,vmci,vmhgfs,vmmemctl,vmsync,vmxnet,vmxnet3,vsock
9
-cd "$HOME"
10
-rm -rf vmware-tools-patches
11 1
deleted file mode 100755
... ...
@@ -1,10 +0,0 @@
1
-INLUDEDIR=/usr/include
2
-LIBDIR=/usr/lib
3
-
4
-all: img-converter
5
-
6
-clean:
7
-	$(RM) ../../bin/imgconverter
8
-
9
-img-converter: imgConverter.c
10
-	$(CXX) -o ../../bin/imgconverter -I$(INCLUDEDIR) -L$(LIBDIR) $? -ldl -lz -luuid
11 1
deleted file mode 100644
... ...
@@ -1,794 +0,0 @@
1
-/*
2
-Copyright 2015 VMware, Inc.
3
-
4
-Licensed under the Apache License, Version 2.0 (the "License");
5
-you may not use this file except in compliance with the License.
6
-You may obtain a copy of the License at
7
-
8
-    http://www.apache.org/licenses/LICENSE-2.0
9
-
10
-Unless required by applicable law or agreed to in writing, software
11
-distributed under the License is distributed on an "AS IS" BASIS,
12
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
-See the License for the specific language governing permissions and
14
-limitations under the License.
15
-*/
16
-
17
-/*
18
-VMDK spec reference
19
-https://www.vmware.com/support/developer/vddk/vmdk_50_technote.pdf
20
-
21
-StreamOptimized format
22
-
23
-Sparse header
24
-Embedded descriptor
25
-Grain marker
26
-Compressed grain
27
-...
28
-Grain table marker
29
-Grain table
30
-Grain marker
31
-Compressed grain
32
-...
33
-Grain table marker
34
-Grain table
35
-[ ... ]
36
-Grain directory marker
37
-Grain directory
38
-Footer marker
39
-Footer
40
-End-of-stream marker
41
-
42
-VHD spec reference
43
-https://technet.microsoft.com/en-us/virtualization/bb676673.aspx?f=255&MSPPError=-2147217396
44
-
45
-Hard disk footer fields	Size (bytes)
46
-Cookie	8
47
-Features	4
48
-File Format Version	4
49
-Data Offset	8
50
-Time Stamp	4
51
-Creator Application	4
52
-Creator Version	4
53
-Creator Host OS	4
54
-Original Size	8
55
-Current Size	8
56
-Disk Geometry	4
57
-Disk Type	4
58
-Checksum	4
59
-Unique Id	16
60
-Saved State	1
61
-Reserved	427
62
-
63
-*/
64
-
65
-#include <stdio.h>
66
-#include <stdlib.h>
67
-#include <string.h>
68
-#include <ctype.h>
69
-#include <inttypes.h>
70
-#include <errno.h>
71
-#include <stdint.h>
72
-#include <malloc.h>
73
-
74
-#include <sys/types.h>
75
-#include <sys/stat.h>
76
-#include <zlib.h>
77
-#include <fcntl.h>
78
-#include <sys/user.h>
79
-#include <uuid/uuid.h>
80
-
81
-static char* input_file;
82
-static char* output_file;
83
-static int output_format;
84
-
85
-typedef uint64_t sector_type;
86
-typedef uint8_t Bool;
87
-
88
-#define SPARSE_MAGICNUMBER 0x564d444b /* 'V' 'M' 'D' 'K' */
89
-#define VHD_FIXED_COOKIE 0x636f6e6563746978 /* "conectix" */
90
-#define VHD_DYNAMIC_COOKIE 0x6378737061727365 /* "cxsparse" */
91
-#define VHD_CREATOR_APP 0x70686f74 /* "phot" */
92
-typedef enum _grain_marker_type
93
-{
94
-MARKER_EOS = 0,
95
-MARKER_GT = 1,
96
-MARKER_GD = 2,
97
-MARKER_FOOTER = 3,
98
-} grain_marker_type;
99
-
100
-#define DISK_SECTOR_SIZE 512
101
-#define NUM_GTE_PER_GT 512
102
-#define DISK_DEFAULT_GRAINSIZE 128
103
-#define DISK_DEFAULT_GRAINSIZE_BYTES (DISK_DEFAULT_GRAINSIZE * DISK_SECTOR_SIZE)
104
-#define GEOMETRY_HEADS 255
105
-#define GEOMETRY_SECTORS 63
106
-#define CONST64U(c) c##uLL
107
-#define SPARSE_SINGLE_ENDLINE_SEQUENCE_CHAR   '\n'
108
-#define SPARSE_DOUBLE_ENDLINE_SEQUENCE_CHAR1  '\r'
109
-#define SPARSE_DOUBLE_ENDLINE_SEQUENCE_CHAR2  '\n'
110
-#define SPARSE_NON_ENDLINE_CHAR               ' '
111
-#define SPARSE_VERSION_INCOMPAT_FLAGS   3
112
-#define SPARSE_GD_AT_END                CONST64U(0xFFFFFFFFFFFFFFFF)
113
-#define SPARSEFLAG_VALID_NEWLINE_DETECTOR       (1 << 0)
114
-
115
-#define SPARSEFLAG_COMPRESSED                   (1 << 16)
116
-#define SPARSEFLAG_EMBEDDED_LBA                 (1 << 17)
117
-
118
-#define SPARSEFLAG_NEW_DISK_DEFAULTS SPARSEFLAG_VALID_NEWLINE_DETECTOR
119
-
120
-#define SPARSE_MIN_GRAINSIZE 8
121
-
122
-#define CEILING(a, b) (((a) + (b) - 1) / (b))
123
-#define ROUNDUP(a, b) (((a) + (b) - 1) / (b) * (b))
124
-
125
-#define VHD_BLOCK_SIZE 2097152 // 2 MB
126
-#define SECTOR_PAD_SIZE 7
127
-#define FIXED_VHD_SIZE 512
128
-#define DYNAMIC_VHD_SIZE 1024
129
-
130
-#define SWAP16(val) \
131
-        ( (((val) >> 8) & 0x00FF) | (((val) << 8) & 0xFF00) )
132
-#define SWAP32(val) \
133
-        ( (((val) >> 24) & 0x000000FF) | (((val) >>  8) & 0x0000FF00) | \
134
-        (((val) <<  8) & 0x00FF0000) | (((val) << 24) & 0xFF000000) )
135
-#define SWAP64(val) \
136
-        ( (((val) >> 56) & 0x00000000000000FF) | (((val) >> 40) & 0x000000000000FF00) | \
137
-        (((val) >> 24) & 0x0000000000FF0000) | (((val) >>  8) & 0x00000000FF000000) | \
138
-        (((val) <<  8) & 0x000000FF00000000) | (((val) << 24) & 0x0000FF0000000000) | \
139
-        (((val) << 40) & 0x00FF000000000000) | (((val) << 56) & 0xFF00000000000000) )
140
-
141
-static sector_type byte_count = 0;
142
-
143
-struct _sparse_extent_header
144
-{
145
-    uint32_t magicNumber;
146
-    uint32_t version;
147
-    uint32_t flags;
148
-    sector_type capacity;
149
-    sector_type grainSize;
150
-    sector_type descriptorOffset;
151
-    sector_type descriptorSize;
152
-    uint32_t numGTEsPerGT;
153
-    sector_type rgdOffset;
154
-    sector_type gdOffset;
155
-    sector_type overHead;
156
-    Bool uncleanShutdown;
157
-    char singleEndLineChar;
158
-    char nonEndLineChar;
159
-    char doubleEndLineChar1;
160
-    char doubleEndLineChar2;
161
-    uint16_t compressAlgorithm;
162
-    uint8_t pad[433];
163
-}__attribute__((__packed__));
164
-typedef struct _sparse_extent_header sparse_extent_header;
165
-
166
-struct _vhd_chs
167
-{
168
-	uint16_t cylinders;
169
-	uint8_t  heads;
170
-	uint8_t  sectors;
171
-}__attribute__((__packed__));
172
-typedef struct _vhd_chs vhd_chs;
173
-
174
-struct _fixed_vhd_header {
175
-  uint64_t  cookie;
176
-  uint32_t  features;
177
-  uint32_t  file_format_version;
178
-  uint64_t  data_offset;
179
-  uint32_t  timestamp;
180
-  uint32_t  creator_application;
181
-  uint32_t  creator_version;
182
-  uint32_t  creator_host_os;
183
-  uint64_t  original_size;
184
-  uint64_t  current_size;
185
-  vhd_chs  disk_geometry;
186
-  uint32_t  disk_type;
187
-  uint32_t  checksum;
188
-  uuid_t    unique_id;
189
-  char      saved_state;
190
-  char      reserved[427];
191
-}__attribute__((__packed__));
192
-typedef struct _fixed_vhd_header fixed_vhd_header;
193
-
194
-struct _dynamic_vhd_header {
195
-  uint64_t      cookie;
196
-  uint64_t  data_offset;
197
-  uint64_t  table_offset;
198
-  uint32_t  header_version;
199
-  uint32_t  max_table_entries;
200
-  uint32_t  block_size;
201
-  uint32_t  checksum;
202
-  uuid_t    parent_unique_id;
203
-  uint32_t  parent_timestamp;
204
-  uint32_t  reserved1;
205
-  uint16_t      parent_unicode_name[256];
206
-  char      parent_locator_entry[192];
207
-  char      reserved2[256];
208
-}__attribute__((__packed__));
209
-typedef struct _dynamic_vhd_header dynamic_vhd_header;
210
-
211
-struct _marker
212
-{
213
-    sector_type val;
214
-    uint32_t size;
215
-    union
216
-    {
217
-        uint32_t type;
218
-        uint8_t data[0];
219
-    } u;
220
-}__attribute__((__packed__));
221
-typedef struct _marker marker;
222
-
223
-static sparse_extent_header* vmdk_header;
224
-static uint32_t* grain_directory = NULL;
225
-static uint32_t* current_gt = NULL;
226
-static uint32_t current_gd_index = 0;
227
-static FILE *ifp, *ofp;
228
-
229
-int create_vhd();
230
-int create_vmdk();
231
-void print_usage();
232
-int parse_args(int argc, char* argv []);
233
-off_t file_size(FILE *fp);
234
-void make_sparse_header();
235
-void pad_to(uint32_t alignment);
236
-void write_file(char* buffer, size_t size);
237
-void* aligned_malloc(size_t size);
238
-int write_grain(sector_type index, uint8_t* grain, size_t size);
239
-void flush_current_grain_table();
240
-void add_to_grain_table(sector_type index);
241
-void write_marker(grain_marker_type type, sector_type size);
242
-void write_footer();
243
-vhd_chs calculate_chs(sector_type total_sectors);
244
-uint32_t vhd_checksum(uint8_t *header_data, size_t header_size);
245
-void write_fixed_vhd_header(sector_type sector_count, sector_type size);
246
-void write_dynamic_vhd_header(uint32_t entries);
247
-
248
-void* aligned_malloc(size_t size)
249
-{
250
-    void* buf = NULL;
251
-    buf = memalign(PAGE_SIZE, size);
252
-    return buf;
253
-}
254
-
255
-void print_usage()
256
-{
257
-    printf("Usage: imgconverter -i <input_raw_file> -v <output_format> -o <output_file> \n");
258
-    printf("output_format: vhd OR vmdk\n");
259
-}
260
-
261
-int parse_args(int argc, char* argv[])
262
-{
263
-    int i;
264
-    for (i = 1; i < argc - 1; i++)
265
-    {
266
-        if (!strcmp(argv[i], "-i"))
267
-        {
268
-            input_file = argv[++i];
269
-        }
270
-        else if (!strcmp(argv[i], "-o"))
271
-        {
272
-            output_file = argv[++i];
273
-        }
274
-        else if (!strcmp(argv[i], "-v"))
275
-        {
276
-            i++;
277
-            if (!strcmp(argv[i], "vhd"))
278
-            {
279
-                output_format = 0;
280
-            }
281
-            else if (!strcmp(argv[i], "vmdk"))
282
-            {
283
-                output_format = 1;
284
-            }
285
-            else
286
-            {
287
-                printf("Unknown file format\n");
288
-                return -1;
289
-            }
290
-        }
291
-        else
292
-        {
293
-            printf("Invalid option\n");
294
-            return -1;
295
-        }
296
-    }
297
-    return 0;
298
-}
299
-
300
-off_t file_size(FILE *fp) 
301
-{
302
-    struct stat st;
303
-    fstat(fileno(fp), &st);
304
-    return st.st_size;
305
-}
306
-
307
-void make_sparse_header(sector_type in_sectors, sector_type descSize)
308
-{
309
-    vmdk_header = (sparse_extent_header *) calloc(1, sizeof(*vmdk_header));
310
-    vmdk_header->magicNumber = SPARSE_MAGICNUMBER;
311
-    vmdk_header->version = SPARSE_VERSION_INCOMPAT_FLAGS;
312
-    vmdk_header->flags = SPARSEFLAG_NEW_DISK_DEFAULTS | SPARSEFLAG_EMBEDDED_LBA |
313
-        SPARSEFLAG_COMPRESSED;
314
-    vmdk_header->capacity = in_sectors;
315
-    vmdk_header->grainSize = DISK_DEFAULT_GRAINSIZE;
316
-    vmdk_header->descriptorOffset = descSize > 0 ? 1 : 0;
317
-    vmdk_header->descriptorSize = descSize;
318
-    vmdk_header->numGTEsPerGT = NUM_GTE_PER_GT;
319
-    vmdk_header->rgdOffset = 0;
320
-    vmdk_header->gdOffset = SPARSE_GD_AT_END;
321
-    vmdk_header->overHead = ROUNDUP(1 + descSize, DISK_DEFAULT_GRAINSIZE);
322
-    vmdk_header->uncleanShutdown = 0;
323
-    vmdk_header->singleEndLineChar = SPARSE_SINGLE_ENDLINE_SEQUENCE_CHAR;
324
-    vmdk_header->nonEndLineChar = SPARSE_NON_ENDLINE_CHAR;
325
-    vmdk_header->doubleEndLineChar1 = SPARSE_DOUBLE_ENDLINE_SEQUENCE_CHAR1;
326
-    vmdk_header->doubleEndLineChar2 = SPARSE_DOUBLE_ENDLINE_SEQUENCE_CHAR2;
327
-    vmdk_header->compressAlgorithm = 1;
328
-}
329
-
330
-void write_file(char* buffer, size_t size)
331
-{
332
-    fwrite(buffer, sizeof(char), size, ofp);
333
-    byte_count += size;
334
-}
335
-
336
-void pad_to(uint32_t alignment)
337
-{
338
-    sector_type pad_size = ROUNDUP(byte_count, alignment) - byte_count;
339
-    if (pad_size > 0)
340
-    {
341
-        char* pad_buffer = (char *) calloc(1, pad_size);
342
-        if (!pad_buffer)
343
-        {
344
-            printf("Memory allocation failed\n");
345
-            return;
346
-        }
347
-        write_file(pad_buffer, pad_size);
348
-        free(pad_buffer);
349
-    }
350
-}
351
-
352
-Bool is_zero_grain(uint8_t* grain, uint32_t size)
353
-{
354
-    uint32_t i;
355
-    for (i = 0; i < size; i++)
356
-    {
357
-        if (grain[i])
358
-        {
359
-            return 0;
360
-        }
361
-    }
362
-    return 1;
363
-}
364
-
365
-void write_marker(grain_marker_type type, sector_type size)
366
-{
367
-    uint32_t metadata_marker = 0;
368
-    write_file((char *) &size, sizeof(size));
369
-    write_file((char *) &metadata_marker, sizeof(metadata_marker));
370
-    write_file((char *) &type, sizeof(type));
371
-    pad_to(DISK_SECTOR_SIZE);
372
-}
373
-
374
-void flush_current_grain_table()
375
-{
376
-    write_marker(MARKER_GT, CEILING(vmdk_header->numGTEsPerGT * sizeof(uint32_t), DISK_SECTOR_SIZE));
377
-    grain_directory[current_gd_index] = CEILING(byte_count, DISK_SECTOR_SIZE);
378
-    write_file((char *) current_gt, vmdk_header->numGTEsPerGT * sizeof(uint32_t));
379
-    pad_to(DISK_SECTOR_SIZE);
380
-    free(current_gt);
381
-    current_gt = NULL;
382
-}
383
-
384
-void add_to_grain_table(sector_type index)
385
-{
386
-    sector_type grain_num = index / vmdk_header->grainSize;
387
-    uint32_t gd_index = (uint32_t) (grain_num / vmdk_header->numGTEsPerGT);
388
-    uint32_t gt_index = (uint32_t) (grain_num % vmdk_header->numGTEsPerGT);
389
-
390
-    if (current_gt != NULL && gd_index != current_gd_index)
391
-    {
392
-        flush_current_grain_table(); // sets _currentGrainTable = NULL
393
-    }
394
-
395
-    if (current_gt == NULL)
396
-    {
397
-        current_gt = (uint32_t *) calloc(1, vmdk_header->numGTEsPerGT * sizeof(uint32_t));
398
-        current_gd_index = gd_index;
399
-    }
400
-
401
-    current_gt[gt_index] = CEILING(byte_count, DISK_SECTOR_SIZE);
402
-}
403
-
404
-void write_footer()
405
-{
406
-    if (current_gt != NULL) {
407
-        flush_current_grain_table();
408
-    }
409
-    sector_type num_gdes = CEILING(vmdk_header->capacity, vmdk_header->numGTEsPerGT * vmdk_header->grainSize);
410
-    sector_type gd_size = CEILING(num_gdes * sizeof(uint32_t), DISK_SECTOR_SIZE);
411
-
412
-    write_marker(MARKER_GD, gd_size);
413
-    sector_type gd_offset = CEILING(byte_count, DISK_SECTOR_SIZE);
414
-    write_file((char *) grain_directory, gd_size);
415
-    pad_to(DISK_SECTOR_SIZE);
416
-
417
-    /* Write footer (with correct GD offset) */
418
-    write_marker(MARKER_FOOTER, 1);
419
-    vmdk_header->gdOffset = gd_offset;
420
-    write_file((char *) vmdk_header, sizeof (*vmdk_header));
421
-
422
-    write_marker(MARKER_EOS, 0);
423
-}
424
-
425
-int write_grain(sector_type index, uint8_t* grain, uint32_t grainSizeBytes)
426
-{
427
-    if (is_zero_grain(grain, grainSizeBytes))
428
-    {
429
-        sleep(100); // wait for the buffer to be written to file
430
-        return 0;
431
-    }
432
-    /*
433
-    * Maximum .1% + 12 bytes expansion according to zlib manual.
434
-    Approximating below
435
-    */
436
-    uint32_t max_size = grainSizeBytes + (grainSizeBytes >> 9) + 13;
437
-    uLongf compress_size = max_size;
438
-    char* cmp_buf = (char *) malloc(compress_size);
439
-    if (!cmp_buf)
440
-    {
441
-        printf("Memory allocation failed\n");
442
-        return -1;
443
-    }
444
-    int zlibError = compress((uint8_t*) cmp_buf, &compress_size, grain, grainSizeBytes);
445
-    if (zlibError != 0) 
446
-    {
447
-        free(cmp_buf);
448
-        printf("Compression failed\n");
449
-        return -1;
450
-    }
451
-    if (compress_size >= max_size)
452
-    {
453
-        printf("Compression size larger than max\n");
454
-        free(cmp_buf);
455
-        return -1;
456
-    }
457
-    add_to_grain_table(index);
458
-    write_file((char *) &index, sizeof(index));
459
-    write_file((char *) &compress_size, sizeof(compress_size));
460
-    write_file((char *) &cmp_buf, sizeof(compress_size));
461
-    pad_to(DISK_SECTOR_SIZE);
462
-
463
-    free(cmp_buf);
464
-    return 0;
465
-}
466
-
467
-vhd_chs calculate_chs(sector_type total_sectors)
468
-{
469
-    vhd_chs chs;
470
-    uint8_t heads, sectors_per_track;
471
-    uint64_t cylinder_x_heads;
472
-    //                  C      H     S
473
-    if (total_sectors > 65535 * 16 * 255)
474
-    {
475
-       total_sectors = 65535 * 16 * 255;
476
-    }
477
-     
478
-    if (total_sectors >= 65535 * 16 * 63)
479
-    {
480
-       sectors_per_track = 255;
481
-       heads = 16;
482
-       cylinder_x_heads = total_sectors / sectors_per_track;
483
-    }
484
-    else
485
-    {
486
-       sectors_per_track = 17;
487
-       cylinder_x_heads = total_sectors / sectors_per_track;
488
-     
489
-       heads = (cylinder_x_heads + 1023) / 1024;
490
-         
491
-       if (heads < 4)
492
-       {
493
-          heads = 4;
494
-       }
495
-       if (cylinder_x_heads >= (heads * 1024) || heads > 16)
496
-       {
497
-          sectors_per_track = 31;
498
-          heads = 16;
499
-          cylinder_x_heads = total_sectors / sectors_per_track; 
500
-       }
501
-       if (cylinder_x_heads >= (heads * 1024))
502
-       {
503
-          sectors_per_track = 63;
504
-          heads = 16;
505
-          cylinder_x_heads = total_sectors / sectors_per_track;
506
-       }
507
-    }
508
-    chs.cylinders = cylinder_x_heads / heads;
509
-    chs.heads = heads;
510
-    chs.sectors = sectors_per_track;
511
-    return chs;
512
-}
513
-
514
-uint32_t vhd_checksum(uint8_t *header_data, size_t header_size)
515
-{
516
-    uint32_t checksum = 0;
517
-    while (header_size--)
518
-          {
519
-    	checksum += *header_data++;
520
-    }
521
-    return ~checksum;
522
-}
523
-
524
-void write_fixed_vhd_header(sector_type sector_count, sector_type size)
525
-{
526
-    fixed_vhd_header *header = (fixed_vhd_header *) calloc(1, sizeof(fixed_vhd_header));
527
-    header->cookie = SWAP64(VHD_FIXED_COOKIE);
528
-    header->features = SWAP32(2);
529
-    header->file_format_version = SWAP32(0x10000);
530
-    header->data_offset = SWAP64((uint64_t)512);
531
-    header->timestamp = 0;
532
-    header->creator_application = SWAP32(VHD_CREATOR_APP);
533
-    header->creator_version = SWAP32(0x1);
534
-    header->creator_host_os = 0;
535
-    header->original_size = SWAP64(size);
536
-    header->current_size = SWAP64(size);
537
-    vhd_chs chs = calculate_chs(sector_count);
538
-    vhd_chs chs_swapped;
539
-    chs_swapped.cylinders = SWAP16(chs.cylinders);
540
-    chs_swapped.heads = chs.heads;
541
-    chs_swapped.sectors = chs.sectors;
542
-    header->disk_geometry = chs_swapped;
543
-    header->disk_type = SWAP32(3);
544
-    header->checksum = 0;
545
-    uuid_generate((unsigned char *)&header->unique_id);
546
-    header->saved_state = 0;
547
-    uint32_t cs = vhd_checksum((uint8_t *)header, FIXED_VHD_SIZE);
548
-    header->checksum = SWAP32(cs);
549
-    write_file((char *) header, FIXED_VHD_SIZE);
550
-    fseek(ofp, 0, SEEK_SET);
551
-    write_file((char *) header, FIXED_VHD_SIZE);
552
-    free(header);
553
-}
554
-
555
-void write_dynamic_vhd_header(uint32_t bat_entries)
556
-{
557
-    dynamic_vhd_header *header = (dynamic_vhd_header *) calloc(1, sizeof(dynamic_vhd_header));
558
-    header->cookie = SWAP64(VHD_DYNAMIC_COOKIE);
559
-    header->data_offset = SWAP64(0xFFFFFFFFFFFFFFFF);
560
-    header->table_offset = SWAP64((uint64_t)(FIXED_VHD_SIZE + DYNAMIC_VHD_SIZE));
561
-    header->header_version = SWAP32(0x00010000);
562
-    header->max_table_entries = SWAP32(bat_entries);
563
-    header->block_size = SWAP32(VHD_BLOCK_SIZE);
564
-    uint32_t cs = vhd_checksum((uint8_t *)header, DYNAMIC_VHD_SIZE);
565
-    header->checksum = SWAP32(cs);
566
-    write_file((char *) header, DYNAMIC_VHD_SIZE);
567
-    free(header);
568
-}
569
-
570
-int create_vhd()
571
-{
572
-    ifp = fopen(input_file, "rb");
573
-    if (ifp == NULL)
574
-    {
575
-        printf("Cannot open input file!\n");
576
-        return -1;
577
-    }
578
-
579
-    ofp = fopen(output_file, "wb");
580
-
581
-    if (ofp == NULL)
582
-    {
583
-        printf("Cannot open output file!\n");
584
-        return -1;
585
-    }
586
-
587
-    sector_type in_size = (sector_type) file_size(ifp);
588
-
589
-    if (in_size < 512)
590
-    {
591
-        printf("File size < 512 bytes, exiting...\n");
592
-        return -1;
593
-    }
594
-
595
-    sector_type in_sector_count = CEILING(in_size, DISK_SECTOR_SIZE);
596
-    sector_type numentries_bat = CEILING(in_size, VHD_BLOCK_SIZE);
597
-    sector_type numsectors_bat = CEILING(numentries_bat * sizeof(uint32_t), DISK_SECTOR_SIZE);
598
-
599
-    sector_type begin_sector = ((FIXED_VHD_SIZE + DYNAMIC_VHD_SIZE) / DISK_SECTOR_SIZE) + numsectors_bat;
600
-    fseek(ofp, begin_sector * DISK_SECTOR_SIZE, SEEK_SET);
601
-    
602
-    // start reading from input file
603
-    uint8_t* read_buffer = (uint8_t *) calloc(1, VHD_BLOCK_SIZE);
604
-    uint32_t* bat_buffer = (uint32_t *) calloc(1, numentries_bat * sizeof(uint32_t));
605
-    char* padding = (char *) calloc(1, DISK_SECTOR_SIZE);
606
-    if (!read_buffer || !bat_buffer || !padding)
607
-    {
608
-        printf("Memory allocation failed\n");
609
-        return -1;
610
-    }
611
-    int read_count = 0;
612
-    static const char zero_buffer[VHD_BLOCK_SIZE] = { 0 };
613
-    memset(padding, 0xFF, DISK_SECTOR_SIZE);
614
-
615
-    while (read_count < numentries_bat)
616
-    {
617
-        int data = fread(read_buffer, VHD_BLOCK_SIZE, 1, ifp);
618
-        if (!data)
619
-        {
620
-            break;
621
-        }
622
-
623
-        if (!memcmp(zero_buffer, read_buffer, VHD_BLOCK_SIZE))
624
-        {
625
-            bat_buffer[read_count] = 0xffffffff;
626
-            read_count++;
627
-            continue;
628
-        }
629
-        uint32_t ofp_location = (uint32_t)(ftell(ofp));
630
-        if (ofp_location % DISK_SECTOR_SIZE)
631
-        {
632
-            printf("Wrong sector boundary for %d\n", ofp_location);
633
-	    free(read_buffer);
634
-	    free(bat_buffer);
635
-	    free(padding);
636
-            fclose(ifp);
637
-            fclose(ofp);
638
-            return -1;
639
-        }
640
-        bat_buffer[read_count] = SWAP32((ofp_location / DISK_SECTOR_SIZE));
641
-        write_file(padding, DISK_SECTOR_SIZE);
642
-        write_file((char *)read_buffer, VHD_BLOCK_SIZE);
643
-        read_count++;
644
-        memset(read_buffer, 0, VHD_BLOCK_SIZE);
645
-    }
646
-    free(read_buffer);
647
-    
648
-    write_fixed_vhd_header(in_sector_count, in_size);
649
-    write_dynamic_vhd_header(numentries_bat);
650
-    write_file((char *)bat_buffer, numentries_bat * sizeof(uint32_t));
651
-
652
-    free(bat_buffer);
653
-    free(padding);
654
-    fclose(ifp);
655
-    fclose(ofp);
656
-    return 0;
657
-}
658
-
659
-int create_vmdk()
660
-{
661
-    ifp = fopen(input_file, "rb");
662
-    if (ifp == NULL)
663
-    {
664
-        printf("Cannot open input file!\n");
665
-        return -1;
666
-    }
667
-
668
-    ofp = fopen(output_file, "wb");
669
-
670
-    if (ofp == NULL)
671
-    {
672
-        printf("Cannot open output file!\n");
673
-        return -1;
674
-    }
675
-
676
-    sector_type in_size = (sector_type)file_size(ifp);
677
-
678
-    if (in_size < 512)
679
-    {
680
-        printf("File size < 512 bytes, exiting...\n");
681
-        return -1;
682
-    }
683
-
684
-    sector_type in_sector_count = CEILING(in_size, DISK_SECTOR_SIZE);
685
-    sector_type in_grain_count = CEILING(in_sector_count, DISK_DEFAULT_GRAINSIZE);
686
-    sector_type in_grain_table_count = CEILING(in_grain_count, NUM_GTE_PER_GT);
687
-    sector_type in_cylinder_count = CEILING(in_sector_count, (GEOMETRY_HEADS * GEOMETRY_SECTORS));
688
-
689
-    char buffer[DISK_SECTOR_SIZE] = { '\0' };
690
-    sprintf(buffer,
691
-        "# Disk Descriptor File\n"
692
-        "version = 1\n"
693
-        "CID = fb183c20\n"
694
-        "parentCID = ffffffff\n"
695
-        "createType = \"streamOptimized\"\n"
696
-        "# Extent description\n"
697
-        "RDONLY %lu SPARSE \"photon-ova.vmdk\"\n"
698
-        "# The Disk Data Base\n"
699
-        "#DDB\n"
700
-        "ddb.virtualHWVersion = \"7\"\n"
701
-        "ddb.geometry.cylinders = \"%lu\"\n"
702
-        "ddb.geometry.heads = \"255\"\n"
703
-        "ddb.geometry.sectors = \"63\"\n"
704
-        "ddb.adapterType = \"lsilogic\"\n"
705
-        "ddb.toolsVersion = \"2147483647\"", in_sector_count, in_cylinder_count);
706
-    size_t buffer_length = strlen(buffer);
707
-    printf("%s\n", buffer);
708
-
709
-    sector_type descSize = CEILING(buffer_length, DISK_SECTOR_SIZE);
710
-    make_sparse_header(in_sector_count, descSize);
711
-
712
-    uint32_t num_gdes = CEILING(vmdk_header->capacity, vmdk_header->grainSize * vmdk_header->numGTEsPerGT);
713
-    uint32_t gd_size = num_gdes * sizeof(uint32_t);
714
-    grain_directory = (uint32_t *) calloc(1, gd_size);
715
-
716
-    write_file((char *) vmdk_header, sizeof(*vmdk_header));
717
-    write_file(buffer, DISK_SECTOR_SIZE);
718
-    uint32_t alignment = DISK_DEFAULT_GRAINSIZE * DISK_SECTOR_SIZE;
719
-    pad_to(alignment);
720
-
721
-    sector_type i = 0;
722
-    sector_type capacity = vmdk_header->capacity;
723
-    uint32_t grain_size = vmdk_header->grainSize;
724
-    uint8_t* grain = (uint8_t *) aligned_malloc(grain_size * DISK_SECTOR_SIZE);
725
-    if (!grain)
726
-    {
727
-        printf("Memory allocation failed\n");
728
-        return -1;
729
-    }
730
-    for (i = 0; i < capacity; i++)
731
-    {
732
-        printf("%f percent done\n", (double)i / capacity * 100);
733
-        uint32_t current_grain = grain_size;
734
-        if (i + grain_size >= capacity)
735
-        {
736
-            current_grain = capacity - i;
737
-        }
738
-        if (!fread(grain, current_grain, DISK_SECTOR_SIZE, ifp))
739
-        {
740
-            free(grain);
741
-            return -1;
742
-        }
743
-        int not_written = write_grain(i, grain, current_grain * DISK_SECTOR_SIZE);
744
-        if (not_written)
745
-        {
746
-            printf("Error writing to file\n");
747
-            free(grain);
748
-            return -1;
749
-        }
750
-    }
751
-
752
-    free(grain);
753
-    write_footer();
754
-    free(vmdk_header);
755
-    free(grain_directory);
756
-    fclose(ifp);
757
-    fclose(ofp);
758
-
759
-    return 0;
760
-}
761
-
762
-int main(int argc, char* argv[])
763
-{
764
-    if (argc < 7)
765
-    {
766
-        print_usage();
767
-    }
768
-    else
769
-    {
770
-        int status = 0;
771
-        status = parse_args(argc, argv);
772
-        if (status)
773
-        {
774
-            return status;
775
-        }
776
-        int conversion_status = 0;
777
-
778
-        if (output_format == 1)
779
-        {
780
-            // conversion_status = create_vmdk();
781
-            printf("This feature has not been implemented yet\n");
782
-            return -1;
783
-        }
784
-        else
785
-        {
786
-            conversion_status = create_vhd();
787
-        }
788
-        if (!conversion_status)
789
-        {
790
-            return conversion_status;
791
-        }
792
-    }
793
-    return 0;
794
-}