tools/mic.git
10 years agoupdate changelog and release notes
Gui Chen [Wed, 28 Aug 2013 07:14:09 +0000 (03:14 -0400)]
update changelog and release notes

Signed-off-by: Gui Chen <gui.chen@intel.com>
10 years agobump up to version 0.21-0.rc4
Gui Chen [Tue, 27 Aug 2013 10:39:38 +0000 (06:39 -0400)]
bump up to version 0.21-0.rc4

Signed-off-by: Gui Chen <gui.chen@intel.com>
10 years agodon't exit if parted returns non-zero
Gui Chen [Tue, 27 Aug 2013 10:18:59 +0000 (06:18 -0400)]
don't exit if parted returns non-zero

parted actually returns non-zero even if set
'boot' flag succeeded, to be compatible with
all the case, mic is better to give warning
than to exit immediately

Signed-off-by: Gui Chen <gui.chen@intel.com>
10 years agobump up to version 0.21-0.rc3
Gui Chen [Tue, 27 Aug 2013 02:33:30 +0000 (22:33 -0400)]
bump up to version 0.21-0.rc3

Signed-off-by: Gui Chen <gui.chen@intel.com>
10 years agoraise error if load mapper device failed
Gui Chen [Tue, 27 Aug 2013 02:31:19 +0000 (22:31 -0400)]
raise error if load mapper device failed

if calling 'dmsetup mknodes' doesn't take effect, mic
should raise error to avoid user

Signed-off-by: Gui Chen <gui.chen@intel.com>
10 years agofix uuid KeyError
Gui Chen [Mon, 26 Aug 2013 07:06:02 +0000 (03:06 -0400)]
fix uuid KeyError

Signed-off-by: Gui Chen <gui.chen@intel.com>
10 years agofix kpartx device delay
Gui Chen [Mon, 26 Aug 2013 05:52:27 +0000 (01:52 -0400)]
fix kpartx device delay

Signed-off-by: Gui Chen <gui.chen@intel.com>
10 years agobump up to version 0.21-0.rc2
Gui Chen [Mon, 26 Aug 2013 04:11:10 +0000 (00:11 -0400)]
bump up to version 0.21-0.rc2

Signed-off-by: Gui Chen <gui.chen@intel.com>
10 years agofix umount issue
Gui Chen [Mon, 26 Aug 2013 04:08:34 +0000 (00:08 -0400)]
fix umount issue

if mount dest is updated during mount, self.ismounted() won't
check it out, self.mounted flag is valid all the way

Signed-off-by: Gui Chen <gui.chen@intel.com>
10 years agofix syslinux requires
Gui Chen [Thu, 22 Aug 2013 09:00:05 +0000 (05:00 -0400)]
fix syslinux requires

syslinux is lower than 4.05 in centos, but it works

Signed-off-by: Gui Chen <gui.chen@intel.com>
10 years agobump up to version 0.21-0.rc1
Gui Chen [Thu, 22 Aug 2013 08:07:08 +0000 (04:07 -0400)]
bump up to version 0.21-0.rc1

Signed-off-by: Gui Chen <gui.chen@intel.com>
10 years agofix requires
Gui Chen [Thu, 22 Aug 2013 07:32:00 +0000 (03:32 -0400)]
fix requires

syslinux 4.05 or later fixed the gpt issue
dosfstools has a misused release number

Signed-off-by: Gui Chen <gui.chen@intel.com>
10 years agoExit if partition is marked as active but boot flag can't be set.
Huang Hao [Wed, 14 Aug 2013 06:57:03 +0000 (14:57 +0800)]
Exit if partition is marked as active but boot flag can't be set.

If partition is marked with --active in ks file, mic should set
'boot' flag for MBR or 'legacy_boot' flag for GPT.

parted 2.3 doesn't support 'legacy_boot' flag, so this operation
may fail and when it happens the image will be unbootable.

Fixes: #1067

Change-Id: I8e0a5e901522cfed6af8e7dd892372d3649f2b77

10 years agoFix typo in comments and message
Huang Hao [Tue, 20 Aug 2013 06:56:51 +0000 (14:56 +0800)]
Fix typo in comments and message

Change-Id: I7224bb5c500702c032b8a7c9c1dfbe91e7ae73ed

10 years agorefine SimpleLockfile with closing lockf immediately
Gui Chen [Fri, 16 Aug 2013 03:04:38 +0000 (23:04 -0400)]
refine SimpleLockfile with closing lockf immediately

close the lock file immediately after create and open it,
it doesn't block the O_EXCL working because the file already
exists

Signed-off-by: Gui Chen <gui.chen@intel.com>
10 years agodon't need to clean up extra mounts present
Gui Chen [Fri, 16 Aug 2013 03:22:02 +0000 (23:22 -0400)]
don't need to clean up extra mounts present

cleanup_mount would clean up the chrootdir, which
will block the locking mechanism

Signed-off-by: Gui Chen <gui.chen@intel.com>
10 years agosetup_qemu_emulator: replace open/close with with_statement
Gui Chen [Thu, 15 Aug 2013 08:02:23 +0000 (04:02 -0400)]
setup_qemu_emulator: replace open/close with with_statement

to avoid unexpected IOError caused by open/close

Signed-off-by: Gui Chen <gui.chen@intel.com>
10 years agobind mount /lib/modules with 'ro' option
Gui Chen [Thu, 15 Aug 2013 07:47:01 +0000 (03:47 -0400)]
bind mount /lib/modules with 'ro' option

to keep the /lib/modules untouch as expected, we must
use 'ro' option when mounting it

Signed-off-by: Gui Chen <gui.chen@intel.com>
10 years agofix chroot_lock reference
Gui Chen [Thu, 15 Aug 2013 02:06:01 +0000 (22:06 -0400)]
fix chroot_lock reference

Signed-off-by: Gui Chen <gui.chen@intel.com>
10 years agoinitialize installerfw.features
Gui Chen [Wed, 14 Aug 2013 08:35:13 +0000 (04:35 -0400)]
initialize installerfw.features

this varialbe is not initialized, so mic will throw
traceback: no attribute "features"

Signed-off-by: Gui Chen <gui.chen@intel.com>
10 years agoMerge "remove unused code and check chroot_lock before release" into devel
Gui Chen [Wed, 14 Aug 2013 09:03:05 +0000 (02:03 -0700)]
Merge "remove unused code and check chroot_lock before release" into devel

10 years agoremove unused code and check chroot_lock before release
Gui Chen [Wed, 14 Aug 2013 08:40:19 +0000 (04:40 -0400)]
remove unused code and check chroot_lock before release

the open of chroot lock file is unneccessary, remove it;
if chroot_lock is None, release is invalid, check it.

Signed-off-by: Gui Chen <gui.chen@intel.com>
10 years agoDisable using proxy from /etc/sysconfig/proxy
Zhang Qiang [Thu, 8 Aug 2013 13:20:47 +0000 (21:20 +0800)]
Disable using proxy from /etc/sysconfig/proxy

Always set 'proxy' query paramer to disable using proxy from
/etc/sysconfig/proxy.

Fixes: #1093

Change-Id: I6a75c9e61bb2b2142c8401036ddd21b85886fa28

10 years agotypo fix
Gui Chen [Wed, 14 Aug 2013 07:38:19 +0000 (03:38 -0400)]
typo fix

Signed-off-by: Gui Chen <gui.chen@intel.com>
10 years agofix bootloader options omitted
Gui Chen [Wed, 14 Aug 2013 03:47:00 +0000 (23:47 -0400)]
fix bootloader options omitted

when extra option is more than 1, the 1st will be
saved, but the others will be omitted, this patch
is fixing it

Fixes: #607

Signed-off-by: Gui Chen <gui.chen@intel.com>
10 years agokickstart: add an alias for installerfw
Artem Bityutskiy [Thu, 8 Aug 2013 12:01:59 +0000 (15:01 +0300)]
kickstart: add an alias for installerfw

In commit "d52080c kickstart: add the installerfw KS command" we introduced the
"installerfw" option. However, the later feed-back was that the name is very
confusing and non-intuitive, and we agreed to re-name this option to
"installerfw_plugins". With this name it is more obvious that this command
enables a list of plugins.

The name of the "extlinux" option of this command was also criticized, and we
agreed to rename it to more generic "bootloader" name.

We agreed that we do the following.

1. Add "installerfw_plugins" alias for "installerfw"
2. Add "bootloader" alias for "extlinux"
3. When users use the old "installerfw" and "extlinux" names, accept this,
   but print a warning which says that these obsolete names will be removed in
   future releases
4. Remove the old keywords later, after a couple releases.

This patch implements just that - introduces the aliases, prints warnings, makes
sure that internally we only use the new names, amends commentaries.

Base on suggestions and the initial patch from Alexander Kanevskiy.

Change-Id: I4646d437833f5252061cb963385269dc240f5792
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agoraw.py: print a message when compressing the image
Artem Bityutskiy [Thu, 8 Aug 2013 12:48:01 +0000 (15:48 +0300)]
raw.py: print a message when compressing the image

Image compression may take very long time. The last message on the screen
before compression starts is "Generating map file(s)", and then a very long
delay, so that it looks like it takes so long to generate map files, but it is
not, it is actually the compression which is slow.

Let's inform users that we start compressing the image to make it obvious what
causes the delay.

Change-Id: Ie547451519aae7be5173c05bcfab1aca6c165148
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agoremove myfuser to detect the instance
Gui Chen [Fri, 9 Aug 2013 08:42:53 +0000 (04:42 -0400)]
remove myfuser to detect the instance

the detection of .chroot.lock is not so correct in logic,
if the .chroot.lock is used by another process, it works;
if it is used by this process, it faults. so fuser is not
working as expected here. also removing fuser will break
a dependency of 'fuser' command

Signed-off-by: Gui Chen <gui.chen@intel.com>
10 years agofix pylint
Gui Chen [Fri, 9 Aug 2013 06:45:28 +0000 (02:45 -0400)]
fix pylint

W: 50,0:elf_arch: Dangerous default value ['/bin/bash', '/sbin/init'] as argument
C: 76,4:global_mounts.totuple: Missing docstring
C:126,8:bind_mount: Invalid name "b" for type variable (should match [a-z_][a-z0-9_]{2,30}$)
W:134,4:setup_resolv: No exception type(s) specified
C:168,8:bind_unmount: Invalid name "b" for type variable (should match [a-z_][a-z0-9_]{2,30}$)
W:178,4:cleanup_resolv: No exception type(s) specified
C:175,8:cleanup_resolv: Invalid name "fd" for type variable (should match [a-z_][a-z0-9_]{2,30}$)
C:184,8:kill_processes: Invalid name "fp" for type variable (should match [a-z_][a-z0-9_]{2,30}$)
W:189,8:kill_processes: No exception type(s) specified
C:283,4:chroot.mychroot: Missing docstring

Signed-off-by: Gui Chen <gui.chen@intel.com>
10 years agoadd docstring for functions
Gui Chen [Fri, 9 Aug 2013 06:29:35 +0000 (02:29 -0400)]
add docstring for functions

Signed-off-by: Gui Chen <gui.chen@intel.com>
10 years agoadd lockfile support for mic/chroot.py module
Gui Chen [Fri, 9 Aug 2013 03:58:40 +0000 (23:58 -0400)]
add lockfile support for mic/chroot.py module

a simple lockfile implementation is added,
and it is supposed to provide an exclusive
locking in the chroot dir

Signed-off-by: Gui Chen <gui.chen@intel.com>
10 years agokill processes inside instroot chroot
Gui Chen [Thu, 8 Aug 2013 05:50:58 +0000 (01:50 -0400)]
kill processes inside instroot chroot

when processes forked inside chroot is alive,
mic should kill it first before umount

Signed-off-by: Gui Chen <gui.chen@intel.com>
10 years agosplit save fs code to savefs_before_chroot
Gui Chen [Wed, 7 Aug 2013 08:50:51 +0000 (04:50 -0400)]
split save fs code to savefs_before_chroot

Signed-off-by: Gui Chen <gui.chen@intel.com>
10 years agorewrite chroot arch detecting
Gui Chen [Wed, 7 Aug 2013 08:00:44 +0000 (04:00 -0400)]
rewrite chroot arch detecting

Signed-off-by: Gui Chen <gui.chen@intel.com>
10 years agorefactor mic/chroot.py:global_mounts
Gui Chen [Wed, 7 Aug 2013 03:18:13 +0000 (23:18 -0400)]
refactor mic/chroot.py:global_mounts

describe more clear logic in this function
refine the /lib/modules handling

Signed-off-by: Gui Chen <gui.chen@intel.com>
10 years agorefactor mic/chroot.py
Gui Chen [Wed, 7 Aug 2013 02:58:56 +0000 (22:58 -0400)]
refactor mic/chroot.py

put inner function outside to be api of
the chroot module
correct logic in setup_chrootenv and
cleanup_chrootenv
remove unused dev_null code

Signed-off-by: Gui Chen <gui.chen@intel.com>
10 years agoSupport user/password in proxy
Zhang Qiang [Wed, 7 Aug 2013 08:27:58 +0000 (16:27 +0800)]
Support user/password in proxy

If password contains special char ':' which should be replaced with
its' quoted char '%3A'.

Fixes: #541

Change-Id: I12575208c7c337f0bad3a40bac0988e17b160819

10 years agoadjust some requires for suse and tizen
Gui Chen [Tue, 23 Jul 2013 02:56:05 +0000 (22:56 -0400)]
adjust some requires for suse and tizen

rpm-python is called as python-rpm in tizen
isomd5sum is not provided in tizen, livecd will be not supported in tizen
change qemu requires for suse and tizen to file requires

Signed-off-by: Gui Chen <gui.chen@intel.com>
10 years agoremove record file to fix duplicated manifest
Gui Chen [Tue, 23 Jul 2013 02:56:30 +0000 (22:56 -0400)]
remove record file to fix duplicated manifest

Signed-off-by: Gui Chen <gui.chen@intel.com>
10 years agoAdded psmisc runtime dependency
Ed Bartosh [Fri, 19 Jul 2013 15:42:57 +0000 (18:42 +0300)]
Added psmisc runtime dependency

Mic users fuser utility from psmisc package, but doesn't depend on
psmic. This causes crash on the system without psmisc installed:

Error <creator>: Command 'fuser' is not available.
Exception mic.utils.errors.CreatorError: CreatorError() in <bound method
LiveUSBImageCreator.__del__ of <mic.imager.liveusb.LiveUSBImageCreator
object at 0x15a9fd0>> ignored
Warning: Can't cleanup loop device /dev/loop1
Info: mic instance shutdown
Warning: No image and other files in output dir, mic failed?

Change-Id: Id6026d0cc4a805397dc6c206e93f645ff669f7ce
Signed-off-by: Ed Bartosh <eduard.bartosh@intel.com>
10 years agoupdate release notes release-0.20
Gui Chen [Mon, 8 Jul 2013 06:06:32 +0000 (02:06 -0400)]
update release notes

Signed-off-by: Gui Chen <gui.chen@intel.com>
10 years agobump up to 0.20 0.20
Gui Chen [Fri, 5 Jul 2013 10:51:36 +0000 (06:51 -0400)]
bump up to 0.20

Signed-off-by: Gui Chen <gui.chen@intel.com>
10 years agobump up to 0.20-0.rc1
Gui Chen [Thu, 4 Jul 2013 02:15:12 +0000 (22:15 -0400)]
bump up to 0.20-0.rc1

Signed-off-by: Gui Chen <gui.chen@intel.com>
10 years agoliveusb: fix vfat UUID
Artem Bityutskiy [Mon, 1 Jul 2013 12:25:41 +0000 (15:25 +0300)]
liveusb: fix vfat UUID

Commit '3577b518715c29175c5f517c6f3cf7a70b0e3d39' fixed the UUID string for
raw images, but broke it for liveusb images. And this patch fixes the issue by
making the liveusb code stop adding a dash to the UUID, because now the dash is
there, just like in UUID of ext4.

Change-Id: Ibfccdf204b301808ef63589dbc3934e517a0212d
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agobump up to 0.20-0.rc0
Gui Chen [Mon, 1 Jul 2013 09:50:52 +0000 (05:50 -0400)]
bump up to 0.20-0.rc0

Signed-off-by: Gui Chen <gui.chen@intel.com>
10 years agoimplement '--check-pkgs' to check if packages included in image
Gui Chen [Thu, 27 Jun 2013 07:41:59 +0000 (03:41 -0400)]
implement '--check-pkgs' to check if packages included in image

check the given package list, if it will be installed, remove it
from the checking list. when check done, it proves some given
packages won't be installed to the image, mic should abort

Signed-off-by: Gui Chen <gui.chen@intel.com>
10 years agointroduce '--check-pkgs' to check packages included
Gui Chen [Thu, 27 Jun 2013 07:04:27 +0000 (03:04 -0400)]
introduce '--check-pkgs' to check packages included

in some situation like pre-release image, they expect mic
not going on if there are some packages not going to include
in the image

Example: --check-pkgs=eglibc,bash
if either of eglibc and bash will not be present in the image,
mic should not go on the image creation

Signed-off-by: Gui Chen <gui.chen@intel.com>
10 years agoraw: support the 'fstab' installerfw attribute
Artem Bityutskiy [Thu, 27 Jun 2013 04:35:55 +0000 (07:35 +0300)]
raw: support the 'fstab' installerfw attribute

Similarly to the 'extlinux' attribute of the 'installerfw' KS command, start
supporitng the 'fstab' attribute. This means, for example, if the KS file has
this command:

installerfw "extlinux,fstab"

then MIC will not install/configure extlinux, and it will not generate
/etc/fstab. Instead, installer framework scripts will do that.

I've added the support only to raw images, since installerfw "extlinux" is
allso supported only by raw images. The liveusb support can be added later. I
do not do this because I cannot test liveusb images at this point, so I am
afraid of breaking it.

Change-Id: Ic6bb7241783aeff571956762a42665fcd8881e3f
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agobaseimager: export partition device node
Artem Bityutskiy [Thu, 27 Jun 2013 03:56:29 +0000 (06:56 +0300)]
baseimager: export partition device node

Also export the device node name for each partition. This will be helpful when
we start generating fstab entries in the installer framework scripts.

In MIC environment, the device node name is easily constructed from the disk
name.  The disk name compes from the KS file from the --ondisk option of the
'part' command. And --ondisk is a mandatory argument.

In other installer environments, the disk names may be very different.

Change-Id: Idafce950e511f4a7693e17be10e69fbb1e7d00d8
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agoraw: export file-system UUIDs
Artem Bityutskiy [Thu, 27 Jun 2013 03:49:41 +0000 (06:49 +0300)]
raw: export file-system UUIDs

This will be useful when we want to create fstab entries ourselfs by using the
installer framework.

Change-Id: Ibc425517888d45a86b73e8c73abba5639eb7e093
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agoVfatDiskMount: fix vfat UUID string
Artem Bityutskiy [Wed, 26 Jun 2013 14:28:13 +0000 (17:28 +0300)]
VfatDiskMount: fix vfat UUID string

The right format for the UUID string for vfat in Linux is 'XXXX-XXXX'. This is
how it can be used in fstab, for example (UUID='XXXX-XXXX'). Also, Linux udev
creates /dev/disk/by-uuid/XXXX-XXXX entries for vfat volumes.

The problem in VfatDiskMount is that it provides it in the 'XXXXXXXX' form
(without dash). However, mkfs.vfat does not like the dash, and this is why we
did not have it, I guess.

This patch fixes the situation and makes VfatDiskMount class expose UUID in a
fstab-friendly format. This makes --fstab-entry=uuid option also work for VFAT
volumes (I tested this).

Change-Id: I1d676e3707ef1777df910273381fe4437b415f41
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agoRevert "VfatDiskMount: do not initialize uuid"
Artem Bityutskiy [Wed, 26 Jun 2013 14:21:54 +0000 (17:21 +0300)]
Revert "VfatDiskMount: do not initialize uuid"

This reverts commit 83410bc120b1f214401517f00da86c53e9f3d1b2.

This patch is actually wrong. I discovered that FATFS actually _does_ support
UUID, it is just shorted - it is a 32-bit integer, but has to have the
'XXXX-XXXX' format for fstab.

Let's revert this patch and fix the problem properly.

Change-Id: I1d2019f2f93094d8e222b926ac2519e8e9b9c0b5
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agobaseimager: export INSTALLERFW_MOUNT_PREFIX
Artem Bityutskiy [Wed, 26 Jun 2013 09:15:28 +0000 (12:15 +0300)]
baseimager: export INSTALLERFW_MOUNT_PREFIX

The installer framework scripts sometimes need to know the real current path
where the partitions are mounted. In MIC environment, the real path is the same
as the mountpoint, except when we are not in chroot, in which case the real
path has a prefix. Export this information in the 'INSTALLERFW_MOUNT_PREFIX'
variable.

In other environments, like pc-installer, the current path may be different,
and pc-installer will export it in 'INSTALLERFW_MOUNT_PREFIX'.

This will allow us writing configuration scripts which will work in both MIC
and pc-installer environments.

Change-Id: Ia867685acb43836c7086b062e2f34908f378f355
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agobaseimager: move environment variable definitions
Artem Bityutskiy [Wed, 26 Jun 2013 09:08:49 +0000 (12:08 +0300)]
baseimager: move environment variable definitions

It is cleaner to have a single place where we define all the environement
variables. Move a couple of historical variables to the
'_get_post_scripts_env()' function.

Change-Id: I58e5d2dbe4477effccf254c48a1f74ccad484c8c
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agoRevert "baseimager: add a couple of more installer FW variables"
Artem Bityutskiy [Wed, 26 Jun 2013 08:36:27 +0000 (11:36 +0300)]
Revert "baseimager: add a couple of more installer FW variables"

A better solution is invented.

This reverts commit be0a53342bec78025413dbbd0bf4de5d9c8b454f.

10 years agobaseimager: add a couple of more installer FW variables
Artem Bityutskiy [Wed, 26 Jun 2013 05:25:38 +0000 (08:25 +0300)]
baseimager: add a couple of more installer FW variables

Add two more installer framework variables:

INSTALLERFW_ROOT_PART_NUM and INSTALLERFW_BOOT_PART_NUM

which define the boot and root parition numbers.

Change-Id: I6b717d3051faa23edb58b44265b3eae3aab2a63e
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agofix rpm header not including 'VCS' tag
Gui Chen [Tue, 25 Jun 2013 09:19:54 +0000 (05:19 -0400)]
fix rpm header not including 'VCS' tag

Signed-off-by: Gui Chen <gui.chen@intel.com>
10 years agoExtDiskMount: fix the UUID feature for extX
Artem Bityutskiy [Mon, 24 Jun 2013 10:12:42 +0000 (13:12 +0300)]
ExtDiskMount: fix the UUID feature for extX

The current implementation of ExtDiskMount is strange. Instead of generating a
random UUID and then ask mkfs.extX to use that UUID, it run mkfs.extX without
-U, let's mkfs.extX generate a random UUID, and then uses e2fsdump and parses
its output.

This is not very logical, and this also does not work with the version of
mkfs that we use at the moment.

Change the logic and simply use mkfs.extX -U.

Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agoVfatDiskMount: do not initialize uuid
Artem Bityutskiy [Mon, 24 Jun 2013 08:30:31 +0000 (11:30 +0300)]
VfatDiskMount: do not initialize uuid

Do not try to be too smart and initialize UUID to a time-stamp. This UUID is
later on used form mounting in /etc/fstab (UUID=...), and of course this fails
for VFAT because VfatDiskMount provides a fake UUID.

Instead, make VfatDiskMount provide no UUID at all.

Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agobaseimager: export a number of helful environment variables
Artem Bityutskiy [Fri, 21 Jun 2013 06:02:04 +0000 (09:02 +0300)]
baseimager: export a number of helful environment variables

Make the MIC export a number of environment variables for the %post section of
the KickStart file.

Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agopartitionedfs: preserve the KS partition number
Artem Bityutskiy [Mon, 24 Jun 2013 06:09:29 +0000 (09:09 +0300)]
partitionedfs: preserve the KS partition number

The 'add_partition()' function takes partition from the KS file and processes
them. A commentary in 'add_partition()' says: "partitions have to be added in
the first-to-last order", so the order is important.

The order number is basically the partition entry number in the KS file.
Unfortunately, it is lost once the partition is added, and later on it is not
easy to match a partition from the KS file to the processed partition.

This patch teaches 'add_partition()' to preserve the KS file partition number
for later use. The new key 'ks_pnum' will be useful in the next patch, when we
export information about partitions and we want it to be in the KS file order.

Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agoraw: add an option to avoid installing extlinux
Artem Bityutskiy [Thu, 20 Jun 2013 13:58:27 +0000 (16:58 +0300)]
raw: add an option to avoid installing extlinux

Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agokickstart: add the installerfw KS command
Gui Chen [Tue, 25 Jun 2013 07:44:18 +0000 (03:44 -0400)]
kickstart: add the installerfw KS command

This command will be used in the KS file and it will specify the list legacy
MIC features which have to be disabled. Instead of these feature, the general
installer framework infrastructure mechanisms will be used.

The first option will be "extlinux" which will disable the legacy extlinux
installation feature. At some point, installerfw=all will be supported,
it will disable all the legacy features (for keyboard, fstab, users, etc).

Along with the option, introduce a helper function which checks if a the
installer framework has to be used for a feature. Usage example:

if use_installerfw(ks, "extlinux"):
    # do not execute MIC's built-in extlinux installation code
else:
    # the compatibility legacy mode

original written by Artem
Artem: added the use_installerfw() function.

Signed-off-by: Gui Chen <gui.chen@intel.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
10 years agoShow stdout and stderr log of post script using msger
Yeongil Jang [Thu, 10 Jan 2013 12:42:21 +0000 (21:42 +0900)]
Show stdout and stderr log of post script using msger

 - Msger can't show and recode stdout and stderr log of post script
 because subprocess excuted post script with sys.stdout and sys.stderr.
 Then mic get the log using subprocess pipe and show log using msger.

Signed-off-by: Yeongil Jang <yg0577.jang@samsung.com>
10 years agoReverted c619010d3b5efa9dc0ebec7839b73cbcd59edcb2
Ed Bartosh [Sun, 16 Jun 2013 13:39:40 +0000 (16:39 +0300)]
Reverted c619010d3b5efa9dc0ebec7839b73cbcd59edcb2

Reverted wrong implementation of getting default architecture. It was
caused inconsitent determination of arch. Different arch was determined
for different orders of repos in .ks file. As a result of wrong
determination of architecture there are image creation failures for the
configurations, where arch was determined incorrectly.

Signed-off-by: Ed Bartosh <eduard.bartosh@intel.com>
11 years agoMerge branch 'release-0.19' into devel
Gui Chen [Mon, 20 May 2013 05:55:04 +0000 (01:55 -0400)]
Merge branch 'release-0.19' into devel

11 years agobump up to release 0.19 0.19
Gui Chen [Mon, 20 May 2013 05:44:17 +0000 (01:44 -0400)]
bump up to release 0.19

Signed-off-by: Gui Chen <gui.chen@intel.com>
11 years agobump up to 0.19-0.rc2
Gui Chen [Fri, 17 May 2013 05:44:34 +0000 (01:44 -0400)]
bump up to 0.19-0.rc2

Signed-off-by: Gui Chen <gui.chen@intel.com>
11 years agofix empty value in max built-in
Gui Chen [Fri, 17 May 2013 06:00:07 +0000 (02:00 -0400)]
fix empty value in max built-in

Signed-off-by: Gui Chen <gui.chen@intel.com>
11 years agotry to wait for mapping device mapper
Gui Chen [Fri, 17 May 2013 05:40:23 +0000 (01:40 -0400)]
try to wait for mapping device mapper

a delay for setup multipath device will throw error:
/dev/loop0X: No such file or directory

Signed-off-by: Gui Chen <gui.chen@intel.com>
11 years agogpt_parser: bugfix: correctly update alternate GPT header
Artem Bityutskiy [Thu, 16 May 2013 10:44:02 +0000 (13:44 +0300)]
gpt_parser: bugfix: correctly update alternate GPT header

This patch is a bug-fix which fixes the --part-type option.

The sysmptom of the issue was the following warning from kpartx:

GPT: partition_entry_array_crc32 values don't match: 0xa24d9e34 != 0xc4e77ef0
GPT: Use GNU Parted to correct GPT errors.

The reason of the issue was that we did not update the alternate partition
array. The root-cause is that we cannot rely on the 'offs' element of the
partition entry dictionary because it points to the primary prition array
offset, while we needed the alternate. Instead, we have to calculate the offset
ourselves.

Change-Id: Iec35ebefa28ba8f7a65c414177c909747b6512ed
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
11 years agogpt_parser: bugfix: correctly update alternate GPT header
Artem Bityutskiy [Thu, 16 May 2013 10:44:02 +0000 (13:44 +0300)]
gpt_parser: bugfix: correctly update alternate GPT header

This patch is a bug-fix which fixes the --part-type option.

The sysmptom of the issue was the following warning from kpartx:

GPT: partition_entry_array_crc32 values don't match: 0xa24d9e34 != 0xc4e77ef0
GPT: Use GNU Parted to correct GPT errors.

The reason of the issue was that we did not update the alternate partition
array. The root-cause is that we cannot rely on the 'offs' element of the
partition entry dictionary because it points to the primary prition array
offset, while we needed the alternate. Instead, we have to calculate the offset
ourselves.

Change-Id: Iec35ebefa28ba8f7a65c414177c909747b6512ed
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
11 years agobump up to 0.19-0.rc1
Gui Chen [Thu, 16 May 2013 06:59:52 +0000 (02:59 -0400)]
bump up to 0.19-0.rc1

Signed-off-by: Gui Chen <gui.chen@intel.com>
11 years agoupdate release date
Gui Chen [Thu, 16 May 2013 06:55:37 +0000 (02:55 -0400)]
update release date

Signed-off-by: Gui Chen <gui.chen@intel.com>
11 years agofix OSError caused by symlink removing
Gui Chen [Thu, 16 May 2013 06:46:03 +0000 (02:46 -0400)]
fix OSError caused by symlink removing

Signed-off-by: Gui Chen <gui.chen@intel.com>
11 years agobump up to 0.19-0.rc
Gui Chen [Thu, 16 May 2013 02:44:11 +0000 (22:44 -0400)]
bump up to 0.19-0.rc

Signed-off-by: Gui Chen <gui.chen@intel.com>
11 years agofix symlink bind mount dirname
Gui Chen [Thu, 16 May 2013 01:58:41 +0000 (21:58 -0400)]
fix symlink bind mount dirname

Signed-off-by: Gui Chen <gui.chen@intel.com>
11 years agofix relative symbolic link in bind mount
Gui Chen [Wed, 15 May 2013 12:11:36 +0000 (08:11 -0400)]
fix relative symbolic link in bind mount

Signed-off-by: Gui Chen <gui.chen@intel.com>
11 years agotypo fix
Gui Chen [Wed, 15 May 2013 11:07:37 +0000 (07:07 -0400)]
typo fix

Signed-off-by: Gui Chen <gui.chen@intel.com>
11 years agofix '/var/lock' non-existent throw traceback
Gui Chen [Wed, 15 May 2013 07:18:22 +0000 (03:18 -0400)]
fix '/var/lock' non-existent throw traceback

Signed-off-by: Gui Chen <gui.chen@intel.com>
11 years agofix symlink bind mount left issue
Gui Chen [Wed, 15 May 2013 07:08:09 +0000 (03:08 -0400)]
fix symlink bind mount left issue

when bind mount point is symbolic link,
the umount will make it left when clean up

Signed-off-by: Gui Chen <gui.chen@intel.com>
11 years agoraw: use bmap creation code from bmap-tools
Artem Bityutskiy [Tue, 7 May 2013 06:42:12 +0000 (09:42 +0300)]
raw: use bmap creation code from bmap-tools

This patch copies the bmap creation code from the bmap-tools project to mic.
Hopefully, at some point we can just make mic package depend on bmap-tools and
directly invoke bmap creation functions from bmap-tools. However, mid
maintainers have issues with this at this point, so we just copy the code.

Unlike the old mic implementation which uses FIBMAP ioctl, bmap-tools use the
FIEMAP ioctl, which is better and also works on btrfs.

Change-Id: I8807ac32d3fcb31e9d410250348318fd04a63275
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
11 years agomisc: add get_block_size helper function
Artem Bityutskiy [Tue, 7 May 2013 07:02:19 +0000 (10:02 +0300)]
misc: add get_block_size helper function

It returns file-system block size.

Change-Id: Idc512a90c58d76925e46f3bd3782093f2c102d5e
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
11 years agofix some depends and add tizen requires
Gui Chen [Thu, 2 May 2013 10:33:05 +0000 (06:33 -0400)]
fix some depends and add tizen requires

tizen-python-zypp is provided by 'python-zypp' maintained
by tizen tools, the provide is different with upstream

Signed-off-by: Gui Chen <gui.chen@intel.com>
11 years agogpt_parser: update class commentary
Artem Bityutskiy [Fri, 19 Apr 2013 13:29:38 +0000 (16:29 +0300)]
gpt_parser: update class commentary

We now support CRC checking and partition table changing, so update
commentaries.

Change-Id: Id3acd1699d2da2752d6d05c4400404361a3e5634
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
11 years agopartitinedfs.py: implement the --part-type option
Artem Bityutskiy [Thu, 11 Apr 2013 12:01:07 +0000 (15:01 +0300)]
partitinedfs.py: implement the --part-type option

Implement the --part-type option for GPT partitions. In case of MBR partitions
- just error out and say that the option is not implemented, but if someone
needs it for the MBR case in the future - it may be implemented.

Change-Id: I7f45db71df85bd36850d1379a38a84fe73532de6
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
11 years agopartition.py: add --part-type option
Artem Bityutskiy [Thu, 11 Apr 2013 11:33:08 +0000 (14:33 +0300)]
partition.py: add --part-type option

Add a kickstart file partition option for specifying partition type. In case of
GPT partitions, this is an UUID which is stored at offset 0 of the partition
entry in the partition table. In case of MBR partitions, this will be the
1-byte partition type which is stored at offset 4 of the partition entry in the
partition table.

Change-Id: I8d03c2414b8e8c555b18f9f94f60a9e0f7742536
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
11 years agogpt_parser: add parition modification functinality
Artem Bityutskiy [Thu, 11 Apr 2013 10:56:37 +0000 (13:56 +0300)]
gpt_parser: add parition modification functinality

Add a 'change_partition()' method which allows changing partition records.

Change-Id: I29c103f856a51aab4ce11d60126128e3770906be
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
11 years agogpt_parser: introduce more useful dict keys
Artem Bityutskiy [Thu, 11 Apr 2013 10:19:55 +0000 (13:19 +0300)]
gpt_parser: introduce more useful dict keys

Add some more useful information to the GPT header and partition entry
dictionaries.

Change-Id: I5ab5ff309d8a926c317d1bf22d2797e0f08539f2
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
11 years agogpt_parser: rename the parts_cnt dict key
Artem Bityutskiy [Thu, 11 Apr 2013 10:05:08 +0000 (13:05 +0300)]
gpt_parser: rename the parts_cnt dict key

The 'parts_cnt' header dictionary key is named poorly because this is actually
the number of available partition table entries, not the number of partitions.
Thus, rename it to 'entries_cnt'.

Change-Id: I565ac7b700ab5ae3b1bb7c8aa503585465588db9
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
11 years agogpt_parser: implement partition table CRC checking
Artem Bityutskiy [Thu, 11 Apr 2013 09:33:09 +0000 (12:33 +0300)]
gpt_parser: implement partition table CRC checking

Introduce a new helper function for checking partition table CRC32 checksum and
use it in 'get_partitions()' to validate the table.

Change-Id: I1bba90d174a5e146403c1eeff6188426ab7066a2
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
11 years agogpt_parser: improve naming some more
Artem Bityutskiy [Thu, 11 Apr 2013 09:19:57 +0000 (12:19 +0300)]
gpt_parser: improve naming some more

Use "raw_" prefix for the on-disk data to make the code more readable.

Change-Id: I644f6250ddc3f6483910b94242f06c49c64b5e75
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
11 years agogpt_parser: add 'primary' dictionary key
Artem Bityutskiy [Thu, 11 Apr 2013 09:17:15 +0000 (12:17 +0300)]
gpt_parser: add 'primary' dictionary key

Add another key to the GPT header and parition record dictionaries to indicate
whether it belongs to the primary or to the backup parition.

Change-Id: I0292badb61cf279a0fd9ac8c1f5bad47c05c1537
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
11 years agogpt_parser: return a dict from get_partitions
Artem Bityutskiy [Wed, 10 Apr 2013 11:27:16 +0000 (14:27 +0300)]
gpt_parser: return a dict from get_partitions

This makes the code more redable.

Change-Id: I1b41de463d108937ace8b9ce46f08deb0a4d6081
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
11 years agogpt_parser: return a dict from read_headers
Artem Bityutskiy [Wed, 10 Apr 2013 11:12:53 +0000 (14:12 +0300)]
gpt_parser: return a dict from read_headers

Use a dictionary instead of a tuple because it makes it possible to write more
readable code. Indeed, header['hdr_crc'] is more readable than header[3].

Change-Id: Ia488d61580a9b1d848421a6abc462870418daa34
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
11 years agogpt_parser: spelling fixes
Artem Bityutskiy [Wed, 10 Apr 2013 08:50:35 +0000 (11:50 +0300)]
gpt_parser: spelling fixes

A couple of spelling fixes.

Change-Id: I7807b071af34ce360bc274d9d0ffa8a7fd12a00b
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
11 years agogpt_parser: use _read_disk helper in get_partitions
Artem Bityutskiy [Wed, 10 Apr 2013 08:47:41 +0000 (11:47 +0300)]
gpt_parser: use _read_disk helper in get_partitions

Use the helper which we just introduced, because it does errors checking. Also,
introduce a helper _GPT_ENTRY_SIZE constant.

Change-Id: I496933f46292f31987ff37fdc9dabc8c5bd150c6
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
11 years agogpt_parser: introduce a helpful _GPT_HEADER_SIZE constant
Artem Bityutskiy [Wed, 10 Apr 2013 08:38:13 +0000 (11:38 +0300)]
gpt_parser: introduce a helpful _GPT_HEADER_SIZE constant

Change-Id: Ieaf8a4f916dde383cfeb8a7191cce7bcc72617c3
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
11 years agogpt_parser: introduce a _disk_read helper
Artem Bityutskiy [Wed, 10 Apr 2013 08:36:05 +0000 (11:36 +0300)]
gpt_parser: introduce a _disk_read helper

It is useful because we can encapsulate all the error checking
in a single function.

Change-Id: I0aac2d2223bc75113b43994db39df71f2ed7cf89
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>
11 years agogpt_parser: add an index element to the partition record
Artem Bityutskiy [Wed, 10 Apr 2013 07:36:17 +0000 (10:36 +0300)]
gpt_parser: add an index element to the partition record

Add an 'index' element to the partition record returned by the
'get_partitions()' method. This is very useful to have when one wants
to change a partition record, which will be implemented in one of the
following patches.

Change-Id: I04b560a7d1e8a97470eea5c221cba7d3e039a501
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>