[arch-releng] [PATCH] [archiso2dual] Check if is a core.iso before exec core_* functions

Gerardo Exequiel Pozzi vmlinuz386 at yahoo.com.ar
Sat Jul 10 13:24:47 EDT 2010


  On 07/10/2010 03:43 AM, Dieter Plaetinck wrote:
> On Fri,  9 Jul 2010 19:05:43 -0300
> Gerardo Exequiel Pozzi<vmlinuz386 at yahoo.com.ar>  wrote:
>
>> Signed-off-by: Gerardo Exequiel Pozzi<vmlinuz386 at yahoo.com.ar>
>> ---
>>   archiso2dual/archiso2dual |   18 +++++++++++++++---
>>   1 files changed, 15 insertions(+), 3 deletions(-)
>>
>> diff --git a/archiso2dual/archiso2dual b/archiso2dual/archiso2dual
>> index 0654602..a41c093 100755
>> --- a/archiso2dual/archiso2dual
>> +++ b/archiso2dual/archiso2dual
>> @@ -23,6 +23,7 @@ appname=${0##*/}
>>   _error="0"
>>   _confirm="n"
>>   _v=""
>> +_iscoreiso=n
>>
>>   iso_umount() {
>>       echo "Executing: ${FUNCNAME}"
>> @@ -150,6 +151,13 @@ core_pkgs_extract() {
>>       done
>>   }
>>
>> +check_if_core_medium() {
>> +    echo "Executing: ${FUNCNAME}"
>> +    if [ -f ${work_dir}/iso/i686/core-pkgs.sqfs ]&&  [ -f
>> ${work_dir}/iso/x86_64/core-pkgs.sqfs ]; then
>> +        _iscoreiso=y
>> +    fi
>> +}
>> +
>>   root_image_extract() {
>>       echo "Executing: ${FUNCNAME}"
>>       for _arch in i686 x86_64; do
>> @@ -357,12 +365,12 @@ if [ "${_confirm}" != "y" ]; then
>>      echo "If configuration is correct, re-execute with -y"
>>      exit 1
>>   fi
>> -
>>   make_workspace
>>   iso_mount
>>   kernel_copy
>>   isolinux_copy
>>   squashfs_copy
>> +check_if_core_medium
>>   iso_umount
>>   isolinuxcfg_copy
>>   isomounts_copy
>> @@ -371,10 +379,14 @@ if [ ${profile_type} = "full" ] ||
>> [ ${profile_type} = "split" ]; then if [ ${profile_type} = "full" ];
>> then root_image_purge
>>       fi
>> -    core_pkgs_extract
>> +    if [ ${_iscoreiso} = "y" ]; then
>> +        core_pkgs_extract
>> +    fi
>>       usrshare_make_image
>>       libmodules_make_image
>>       root_image_make_image
>> -    core_pkgs_make_image
>> +    if [ ${_iscoreiso} = "y" ]; then
>> +       core_pkgs_make_image
>> +    fi
>>   fi
>>   make_iso
> functions can have exit codes.
>
> mufunction () {
> 	foo
> 	return 1
> }
>
> if myfunction; then
> 	echo "it executed fine"
> else
> 	echo "it failed"
> fi
>
Yes, thanks for the tip. I had a short period of mixture of languages 
(see previous email :P)

Also when I was a "return 1" did not work, because this script is run 
with "set-e", then the execution terminates immediately.
Anyways looks good now, check_if_core_medium() is not needed to be 
executed more than one time.

-- 
Gerardo Exequiel Pozzi
\cos^2\alpha + \sin^2\alpha = 1




More information about the arch-releng mailing list