diff --git a/CMakeLists.txt b/CMakeLists.txt index 8358060ba..f98b25c99 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -185,6 +185,50 @@ set( CALAMARES_LIBRARIES calamares ) set( THIRDPARTY_DIR "${CMAKE_SOURCE_DIR}/thirdparty" ) +### Example Distro +# +# For testing purposes Calamares includes a very, very, limited sample +# distro called "Generic". The root filesystem of "Generic" lives in +# data/example-root and can be squashed up as part of the build, so +# that a pure-upstream run of ./calamares -d from the build directory +# (with all the default settings and configurations) can actually +# do an complete example run. +# +# Some binaries from the build host (e.g. /bin and /lib) are also +# squashed into the example filesystem. +# +# To build the example distro (for use by the default, example, +# unsquashfs module), build the target 'example-distro', eg.: +# +# make example-distro +# +find_program( mksquashfs_PROGRAM mksquashfs ) +macro_log_feature( mksquashfs_PROGRAM "mksquashfs" "Create example distro" "http://tldp.org/HOWTO/SquashFS-HOWTO/creatingandusing.html") +if( mksquashfs_PROGRAM ) + set( src_fs ${CMAKE_SOURCE_DIR}/data/example-root/ ) + set( dst_fs ${CMAKE_BINARY_DIR}/example.sqfs ) + if( EXISTS ${src_fs} ) + # Collect directories needed for a minimal binary distro, + # based on the build host. If /lib64 exists, assume it is needed. + # Note that the last path component is added to the root, so + # if you add /usr/sbin here, it will be put into /sbin_1. + # Add such paths to /etc/profile under ${src_fs}. + set( candidate_fs /sbin /bin /lib /lib64 ) + set( host_fs "" ) + foreach( c_fs ${candidate_fs} ) + if( EXISTS ${c_fs} ) + list( APPEND host_fs ${c_fs} ) + endif() + endforeach() + add_custom_command( + OUTPUT ${dst_fs} + COMMAND ${mksquashfs_PROGRAM} ${src_fs} ${dst_fs} -all-root + COMMAND ${mksquashfs_PROGRAM} ${host_fs} ${dst_fs} -all-root + ) + add_custom_target(example-distro DEPENDS ${dst_fs}) + endif() +endif() + add_subdirectory( thirdparty ) add_subdirectory( src ) diff --git a/ci/txpush.sh b/ci/txpush.sh index 5ec2c0614..cb2499f3e 100755 --- a/ci/txpush.sh +++ b/ci/txpush.sh @@ -47,11 +47,7 @@ tx push --source --no-interactive -r calamares.fdo # - python modules without lang/, which use one shared catalog # -# Arch -# PYGETTEXT=/usr/lib/python3.5/Tools/i18n/pygettext.py - -# Ubuntu -PYGETTEXT=pygettext3 +PYGETTEXT="xgettext --keyword=_n:1,2 -L python" SHARED_PYTHON="" for MODULE_DIR in $(find src/modules -maxdepth 1 -mindepth 1 -type d) ; do @@ -59,7 +55,7 @@ for MODULE_DIR in $(find src/modules -maxdepth 1 -mindepth 1 -type d) ; do if test -n "$FILES" ; then MODULE_NAME=$(basename ${MODULE_DIR}) if [ -d ${MODULE_DIR}/lang ]; then - ${PYGETTEXT} -p ${MODULE_DIR}/lang -d ${MODULE_NAME} ${MODULE_DIR}/*.py + ${PYGETTEXT} -p ${MODULE_DIR}/lang -d ${MODULE_NAME} -o ${MODULE_NAME}.pot ${MODULE_DIR}/*.py if [ -f ${MODULE_DIR}/lang/${MODULE_NAME}.pot ]; then tx set -r calamares.${MODULE_NAME} --source -l en ${MODULE_DIR}/lang/${MODULE_NAME}.pot tx push --source --no-interactive -r calamares.${MODULE_NAME} @@ -71,7 +67,7 @@ for MODULE_DIR in $(find src/modules -maxdepth 1 -mindepth 1 -type d) ; do done if test -n "$SHARED_PYTHON" ; then - ${PYGETTEXT} -p lang -d python $SHARED_PYTHON + ${PYGETTEXT} -p lang -d python -o python.pot $SHARED_PYTHON tx set -r calamares.python --source -l en lang/python.pot tx push --source --no-interactive -r calamares.python fi diff --git a/data/example-root/README.md b/data/example-root/README.md new file mode 100644 index 000000000..7173b3eaf --- /dev/null +++ b/data/example-root/README.md @@ -0,0 +1,11 @@ +# Example Filesystem + +This is a filesystem that will be used as / in an example distro, +*if* you build the `example-distro` target and use the default +unpackfs configuration. It should hold files and configuration +bits that need to be on the target system for example purposes. + +It should *not* have a bin/, lib/, sbin/ or lib64/ directory, +since those are copied into the example-distro filesystem +from the build host. + diff --git a/data/example-root/etc/bash.bashrc b/data/example-root/etc/bash.bashrc new file mode 100644 index 000000000..42bd3d007 --- /dev/null +++ b/data/example-root/etc/bash.bashrc @@ -0,0 +1,2 @@ +# Global .profile -- add /sbin_1 +PATH=$PATH:/sbin_1:/xbin diff --git a/data/example-root/etc/group b/data/example-root/etc/group new file mode 100644 index 000000000..1dbf9013e --- /dev/null +++ b/data/example-root/etc/group @@ -0,0 +1 @@ +root:x:0: diff --git a/data/example-root/etc/issue b/data/example-root/etc/issue new file mode 100644 index 000000000..ce0ac58e3 --- /dev/null +++ b/data/example-root/etc/issue @@ -0,0 +1 @@ +This is an example /etc/issue file. diff --git a/data/example-root/etc/locale.gen b/data/example-root/etc/locale.gen new file mode 100644 index 000000000..5e729a18d --- /dev/null +++ b/data/example-root/etc/locale.gen @@ -0,0 +1,486 @@ +# This file lists locales that you wish to have built. You can find a list +# of valid supported locales at /usr/share/i18n/SUPPORTED, and you can add +# user defined locales to /usr/local/share/i18n/SUPPORTED. If you change +# this file, you need to rerun locale-gen. + + +# aa_DJ ISO-8859-1 +# aa_DJ.UTF-8 UTF-8 +# aa_ER UTF-8 +# aa_ER@saaho UTF-8 +# aa_ET UTF-8 +# af_ZA ISO-8859-1 +# af_ZA.UTF-8 UTF-8 +# ak_GH UTF-8 +# am_ET UTF-8 +# an_ES ISO-8859-15 +# an_ES.UTF-8 UTF-8 +# anp_IN UTF-8 +# ar_AE ISO-8859-6 +# ar_AE.UTF-8 UTF-8 +# ar_BH ISO-8859-6 +# ar_BH.UTF-8 UTF-8 +# ar_DZ ISO-8859-6 +# ar_DZ.UTF-8 UTF-8 +# ar_EG ISO-8859-6 +# ar_EG.UTF-8 UTF-8 +# ar_IN UTF-8 +# ar_IQ ISO-8859-6 +# ar_IQ.UTF-8 UTF-8 +# ar_JO ISO-8859-6 +# ar_JO.UTF-8 UTF-8 +# ar_KW ISO-8859-6 +# ar_KW.UTF-8 UTF-8 +# ar_LB ISO-8859-6 +# ar_LB.UTF-8 UTF-8 +# ar_LY ISO-8859-6 +# ar_LY.UTF-8 UTF-8 +# ar_MA ISO-8859-6 +# ar_MA.UTF-8 UTF-8 +# ar_OM ISO-8859-6 +# ar_OM.UTF-8 UTF-8 +# ar_QA ISO-8859-6 +# ar_QA.UTF-8 UTF-8 +# ar_SA ISO-8859-6 +# ar_SA.UTF-8 UTF-8 +# ar_SD ISO-8859-6 +# ar_SD.UTF-8 UTF-8 +# ar_SS UTF-8 +# ar_SY ISO-8859-6 +# ar_SY.UTF-8 UTF-8 +# ar_TN ISO-8859-6 +# ar_TN.UTF-8 UTF-8 +# ar_YE ISO-8859-6 +# ar_YE.UTF-8 UTF-8 +# as_IN UTF-8 +# ast_ES ISO-8859-15 +# ast_ES.UTF-8 UTF-8 +# ayc_PE UTF-8 +# az_AZ UTF-8 +# be_BY CP1251 +# be_BY.UTF-8 UTF-8 +# be_BY@latin UTF-8 +# bem_ZM UTF-8 +# ber_DZ UTF-8 +# ber_MA UTF-8 +# bg_BG CP1251 +# bg_BG.UTF-8 UTF-8 +# bhb_IN.UTF-8 UTF-8 +# bho_IN UTF-8 +# bn_BD UTF-8 +# bn_IN UTF-8 +# bo_CN UTF-8 +# bo_IN UTF-8 +# br_FR ISO-8859-1 +# br_FR.UTF-8 UTF-8 +# br_FR@euro ISO-8859-15 +# brx_IN UTF-8 +# bs_BA ISO-8859-2 +# bs_BA.UTF-8 UTF-8 +# byn_ER UTF-8 +# ca_AD ISO-8859-15 +# ca_AD.UTF-8 UTF-8 +# ca_ES ISO-8859-1 +# ca_ES.UTF-8 UTF-8 +# ca_ES.UTF-8@valencia UTF-8 +# ca_ES@euro ISO-8859-15 +# ca_ES@valencia ISO-8859-15 +# ca_FR ISO-8859-15 +# ca_FR.UTF-8 UTF-8 +# ca_IT ISO-8859-15 +# ca_IT.UTF-8 UTF-8 +# ce_RU UTF-8 +# ckb_IQ UTF-8 +# cmn_TW UTF-8 +# crh_UA UTF-8 +# cs_CZ ISO-8859-2 +# cs_CZ.UTF-8 UTF-8 +# csb_PL UTF-8 +# cv_RU UTF-8 +# cy_GB ISO-8859-14 +# cy_GB.UTF-8 UTF-8 +# da_DK ISO-8859-1 +# da_DK.UTF-8 UTF-8 +# de_AT ISO-8859-1 +# de_AT.UTF-8 UTF-8 +# de_AT@euro ISO-8859-15 +# de_BE ISO-8859-1 +# de_BE.UTF-8 UTF-8 +# de_BE@euro ISO-8859-15 +# de_CH ISO-8859-1 +# de_CH.UTF-8 UTF-8 +# de_DE ISO-8859-1 +# de_DE.UTF-8 UTF-8 +# de_DE@euro ISO-8859-15 +# de_LI.UTF-8 UTF-8 +# de_LU ISO-8859-1 +# de_LU.UTF-8 UTF-8 +# de_LU@euro ISO-8859-15 +# doi_IN UTF-8 +# dv_MV UTF-8 +# dz_BT UTF-8 +# el_CY ISO-8859-7 +# el_CY.UTF-8 UTF-8 +# el_GR ISO-8859-7 +# el_GR.UTF-8 UTF-8 +# en_AG UTF-8 +# en_AU ISO-8859-1 +# en_AU.UTF-8 UTF-8 +# en_BW ISO-8859-1 +# en_BW.UTF-8 UTF-8 +# en_CA ISO-8859-1 +en_CA.UTF-8 UTF-8 +# en_DK ISO-8859-1 +# en_DK.ISO-8859-15 ISO-8859-15 +# en_DK.UTF-8 UTF-8 +# en_GB ISO-8859-1 +# en_GB.ISO-8859-15 ISO-8859-15 +# en_GB.UTF-8 UTF-8 +# en_HK ISO-8859-1 +# en_HK.UTF-8 UTF-8 +# en_IE ISO-8859-1 +# en_IE.UTF-8 UTF-8 +# en_IE@euro ISO-8859-15 +# en_IN UTF-8 +# en_NG UTF-8 +# en_NZ ISO-8859-1 +# en_NZ.UTF-8 UTF-8 +# en_PH ISO-8859-1 +# en_PH.UTF-8 UTF-8 +# en_SG ISO-8859-1 +# en_SG.UTF-8 UTF-8 +# en_US ISO-8859-1 +# en_US.ISO-8859-15 ISO-8859-15 +en_US.UTF-8 UTF-8 +# en_ZA ISO-8859-1 +# en_ZA.UTF-8 UTF-8 +# en_ZM UTF-8 +# en_ZW ISO-8859-1 +# en_ZW.UTF-8 UTF-8 +# eo ISO-8859-3 +# eo.UTF-8 UTF-8 +# eo_US.UTF-8 UTF-8 +# es_AR ISO-8859-1 +# es_AR.UTF-8 UTF-8 +# es_BO ISO-8859-1 +# es_BO.UTF-8 UTF-8 +# es_CL ISO-8859-1 +# es_CL.UTF-8 UTF-8 +# es_CO ISO-8859-1 +# es_CO.UTF-8 UTF-8 +# es_CR ISO-8859-1 +# es_CR.UTF-8 UTF-8 +# es_CU UTF-8 +# es_DO ISO-8859-1 +# es_DO.UTF-8 UTF-8 +# es_EC ISO-8859-1 +# es_EC.UTF-8 UTF-8 +# es_ES ISO-8859-1 +# es_ES.UTF-8 UTF-8 +# es_ES@euro ISO-8859-15 +# es_GT ISO-8859-1 +# es_GT.UTF-8 UTF-8 +# es_HN ISO-8859-1 +# es_HN.UTF-8 UTF-8 +# es_MX ISO-8859-1 +# es_MX.UTF-8 UTF-8 +# es_NI ISO-8859-1 +# es_NI.UTF-8 UTF-8 +# es_PA ISO-8859-1 +# es_PA.UTF-8 UTF-8 +# es_PE ISO-8859-1 +# es_PE.UTF-8 UTF-8 +# es_PR ISO-8859-1 +# es_PR.UTF-8 UTF-8 +# es_PY ISO-8859-1 +# es_PY.UTF-8 UTF-8 +# es_SV ISO-8859-1 +# es_SV.UTF-8 UTF-8 +# es_US ISO-8859-1 +# es_US.UTF-8 UTF-8 +# es_UY ISO-8859-1 +# es_UY.UTF-8 UTF-8 +# es_VE ISO-8859-1 +# es_VE.UTF-8 UTF-8 +# et_EE ISO-8859-1 +# et_EE.ISO-8859-15 ISO-8859-15 +# et_EE.UTF-8 UTF-8 +# eu_ES ISO-8859-1 +# eu_ES.UTF-8 UTF-8 +# eu_ES@euro ISO-8859-15 +# eu_FR ISO-8859-1 +# eu_FR.UTF-8 UTF-8 +# eu_FR@euro ISO-8859-15 +# fa_IR UTF-8 +# ff_SN UTF-8 +# fi_FI ISO-8859-1 +# fi_FI.UTF-8 UTF-8 +# fi_FI@euro ISO-8859-15 +# fil_PH UTF-8 +# fo_FO ISO-8859-1 +# fo_FO.UTF-8 UTF-8 +# fr_BE ISO-8859-1 +# fr_BE.UTF-8 UTF-8 +# fr_BE@euro ISO-8859-15 +# fr_CA ISO-8859-1 +# fr_CA.UTF-8 UTF-8 +# fr_CH ISO-8859-1 +# fr_CH.UTF-8 UTF-8 +# fr_FR ISO-8859-1 +# fr_FR.UTF-8 UTF-8 +# fr_FR@euro ISO-8859-15 +# fr_LU ISO-8859-1 +# fr_LU.UTF-8 UTF-8 +# fr_LU@euro ISO-8859-15 +# fur_IT UTF-8 +# fy_DE UTF-8 +# fy_NL UTF-8 +# ga_IE ISO-8859-1 +# ga_IE.UTF-8 UTF-8 +# ga_IE@euro ISO-8859-15 +# gd_GB ISO-8859-15 +# gd_GB.UTF-8 UTF-8 +# gez_ER UTF-8 +# gez_ER@abegede UTF-8 +# gez_ET UTF-8 +# gez_ET@abegede UTF-8 +# gl_ES ISO-8859-1 +# gl_ES.UTF-8 UTF-8 +# gl_ES@euro ISO-8859-15 +# gu_IN UTF-8 +# gv_GB ISO-8859-1 +# gv_GB.UTF-8 UTF-8 +# ha_NG UTF-8 +# hak_TW UTF-8 +# he_IL ISO-8859-8 +# he_IL.UTF-8 UTF-8 +# hi_IN UTF-8 +# hne_IN UTF-8 +# hr_HR ISO-8859-2 +# hr_HR.UTF-8 UTF-8 +# hsb_DE ISO-8859-2 +# hsb_DE.UTF-8 UTF-8 +# ht_HT UTF-8 +# hu_HU ISO-8859-2 +# hu_HU.UTF-8 UTF-8 +# hy_AM UTF-8 +# hy_AM.ARMSCII-8 ARMSCII-8 +# ia_FR UTF-8 +# id_ID ISO-8859-1 +# id_ID.UTF-8 UTF-8 +# ig_NG UTF-8 +# ik_CA UTF-8 +# is_IS ISO-8859-1 +# is_IS.UTF-8 UTF-8 +# it_CH ISO-8859-1 +# it_CH.UTF-8 UTF-8 +# it_IT ISO-8859-1 +# it_IT.UTF-8 UTF-8 +# it_IT@euro ISO-8859-15 +# iu_CA UTF-8 +# iw_IL ISO-8859-8 +# iw_IL.UTF-8 UTF-8 +# ja_JP.EUC-JP EUC-JP +# ja_JP.UTF-8 UTF-8 +# ka_GE GEORGIAN-PS +# ka_GE.UTF-8 UTF-8 +# kk_KZ PT154 +# kk_KZ RK1048 +# kk_KZ.UTF-8 UTF-8 +# kl_GL ISO-8859-1 +# kl_GL.UTF-8 UTF-8 +# km_KH UTF-8 +# kn_IN UTF-8 +# ko_KR.EUC-KR EUC-KR +# ko_KR.UTF-8 UTF-8 +# kok_IN UTF-8 +# ks_IN UTF-8 +# ks_IN@devanagari UTF-8 +# ku_TR ISO-8859-9 +# ku_TR.UTF-8 UTF-8 +# kw_GB ISO-8859-1 +# kw_GB.UTF-8 UTF-8 +# ky_KG UTF-8 +# lb_LU UTF-8 +# lg_UG ISO-8859-10 +# lg_UG.UTF-8 UTF-8 +# li_BE UTF-8 +# li_NL UTF-8 +# lij_IT UTF-8 +# ln_CD UTF-8 +# lo_LA UTF-8 +# lt_LT ISO-8859-13 +# lt_LT.UTF-8 UTF-8 +# lv_LV ISO-8859-13 +# lv_LV.UTF-8 UTF-8 +# lzh_TW UTF-8 +# mag_IN UTF-8 +# mai_IN UTF-8 +# mg_MG ISO-8859-15 +# mg_MG.UTF-8 UTF-8 +# mhr_RU UTF-8 +# mi_NZ ISO-8859-13 +# mi_NZ.UTF-8 UTF-8 +# mk_MK ISO-8859-5 +# mk_MK.UTF-8 UTF-8 +# ml_IN UTF-8 +# mn_MN UTF-8 +# mni_IN UTF-8 +# mr_IN UTF-8 +# ms_MY ISO-8859-1 +# ms_MY.UTF-8 UTF-8 +# mt_MT ISO-8859-3 +# mt_MT.UTF-8 UTF-8 +# my_MM UTF-8 +# nan_TW UTF-8 +# nan_TW@latin UTF-8 +# nb_NO ISO-8859-1 +# nb_NO.UTF-8 UTF-8 +# nds_DE UTF-8 +# nds_NL UTF-8 +# ne_NP UTF-8 +# nhn_MX UTF-8 +# niu_NU UTF-8 +# niu_NZ UTF-8 +# nl_AW UTF-8 +# nl_BE ISO-8859-1 +# nl_BE.UTF-8 UTF-8 +# nl_BE@euro ISO-8859-15 +# nl_NL ISO-8859-1 +# nl_NL.UTF-8 UTF-8 +# nl_NL@euro ISO-8859-15 +# nn_NO ISO-8859-1 +# nn_NO.UTF-8 UTF-8 +# nr_ZA UTF-8 +# nso_ZA UTF-8 +# oc_FR ISO-8859-1 +# oc_FR.UTF-8 UTF-8 +# om_ET UTF-8 +# om_KE ISO-8859-1 +# om_KE.UTF-8 UTF-8 +# or_IN UTF-8 +# os_RU UTF-8 +# pa_IN UTF-8 +# pa_PK UTF-8 +# pap_AN UTF-8 +# pap_AW UTF-8 +# pap_CW UTF-8 +# pl_PL ISO-8859-2 +# pl_PL.UTF-8 UTF-8 +# ps_AF UTF-8 +# pt_BR ISO-8859-1 +# pt_BR.UTF-8 UTF-8 +# pt_PT ISO-8859-1 +# pt_PT.UTF-8 UTF-8 +# pt_PT@euro ISO-8859-15 +# quz_PE UTF-8 +# raj_IN UTF-8 +# ro_RO ISO-8859-2 +# ro_RO.UTF-8 UTF-8 +# ru_RU ISO-8859-5 +# ru_RU.CP1251 CP1251 +# ru_RU.KOI8-R KOI8-R +# ru_RU.UTF-8 UTF-8 +# ru_UA KOI8-U +# ru_UA.UTF-8 UTF-8 +# rw_RW UTF-8 +# sa_IN UTF-8 +# sat_IN UTF-8 +# sc_IT UTF-8 +# sd_IN UTF-8 +# sd_IN@devanagari UTF-8 +# sd_PK UTF-8 +# se_NO UTF-8 +# shs_CA UTF-8 +# si_LK UTF-8 +# sid_ET UTF-8 +# sk_SK ISO-8859-2 +# sk_SK.UTF-8 UTF-8 +# sl_SI ISO-8859-2 +# sl_SI.UTF-8 UTF-8 +# so_DJ ISO-8859-1 +# so_DJ.UTF-8 UTF-8 +# so_ET UTF-8 +# so_KE ISO-8859-1 +# so_KE.UTF-8 UTF-8 +# so_SO ISO-8859-1 +# so_SO.UTF-8 UTF-8 +# sq_AL ISO-8859-1 +# sq_AL.UTF-8 UTF-8 +# sq_MK UTF-8 +# sr_ME UTF-8 +# sr_RS UTF-8 +# sr_RS@latin UTF-8 +# ss_ZA UTF-8 +# st_ZA ISO-8859-1 +# st_ZA.UTF-8 UTF-8 +# sv_FI ISO-8859-1 +# sv_FI.UTF-8 UTF-8 +# sv_FI@euro ISO-8859-15 +# sv_SE ISO-8859-1 +# sv_SE.ISO-8859-15 ISO-8859-15 +# sv_SE.UTF-8 UTF-8 +# sw_KE UTF-8 +# sw_TZ UTF-8 +# szl_PL UTF-8 +# ta_IN UTF-8 +# ta_LK UTF-8 +# tcy_IN.UTF-8 UTF-8 +# te_IN UTF-8 +# tg_TJ KOI8-T +# tg_TJ.UTF-8 UTF-8 +# th_TH TIS-620 +# th_TH.UTF-8 UTF-8 +# the_NP UTF-8 +# ti_ER UTF-8 +# ti_ET UTF-8 +# tig_ER UTF-8 +# tk_TM UTF-8 +# tl_PH ISO-8859-1 +# tl_PH.UTF-8 UTF-8 +# tn_ZA UTF-8 +# tr_CY ISO-8859-9 +# tr_CY.UTF-8 UTF-8 +# tr_TR ISO-8859-9 +# tr_TR.UTF-8 UTF-8 +# ts_ZA UTF-8 +# tt_RU UTF-8 +# tt_RU@iqtelif UTF-8 +# ug_CN UTF-8 +# ug_CN@latin UTF-8 +# uk_UA KOI8-U +# uk_UA.UTF-8 UTF-8 +# unm_US UTF-8 +# ur_IN UTF-8 +# ur_PK UTF-8 +# uz_UZ ISO-8859-1 +# uz_UZ.UTF-8 UTF-8 +# uz_UZ@cyrillic UTF-8 +# ve_ZA UTF-8 +# vi_VN UTF-8 +# wa_BE ISO-8859-1 +# wa_BE.UTF-8 UTF-8 +# wa_BE@euro ISO-8859-15 +# wae_CH UTF-8 +# wal_ET UTF-8 +# wo_SN UTF-8 +# xh_ZA ISO-8859-1 +# xh_ZA.UTF-8 UTF-8 +# yi_US CP1255 +# yi_US.UTF-8 UTF-8 +# yo_NG UTF-8 +# yue_HK UTF-8 +# zh_CN GB2312 +# zh_CN.GB18030 GB18030 +# zh_CN.GBK GBK +# zh_CN.UTF-8 UTF-8 +# zh_HK BIG5-HKSCS +# zh_HK.UTF-8 UTF-8 +# zh_SG GB2312 +# zh_SG.GBK GBK +# zh_SG.UTF-8 UTF-8 +# zh_TW BIG5 +# zh_TW.EUC-TW EUC-TW +# zh_TW.UTF-8 UTF-8 +# zu_ZA ISO-8859-1 +# zu_ZA.UTF-8 UTF-8 diff --git a/data/example-root/etc/profile b/data/example-root/etc/profile new file mode 100644 index 000000000..42bd3d007 --- /dev/null +++ b/data/example-root/etc/profile @@ -0,0 +1,2 @@ +# Global .profile -- add /sbin_1 +PATH=$PATH:/sbin_1:/xbin diff --git a/data/example-root/etc/sudoers.d/10-installer b/data/example-root/etc/sudoers.d/10-installer new file mode 100644 index 000000000..e69de29bb diff --git a/data/example-root/usr/share/zoneinfo/.dummy b/data/example-root/usr/share/zoneinfo/.dummy new file mode 100644 index 000000000..e69de29bb diff --git a/data/example-root/usr/share/zoneinfo/America/New_York b/data/example-root/usr/share/zoneinfo/America/New_York new file mode 100644 index 000000000..7553fee37 Binary files /dev/null and b/data/example-root/usr/share/zoneinfo/America/New_York differ diff --git a/data/example-root/usr/share/zoneinfo/UTC b/data/example-root/usr/share/zoneinfo/UTC new file mode 100644 index 000000000..c3b97f1a1 Binary files /dev/null and b/data/example-root/usr/share/zoneinfo/UTC differ diff --git a/data/example-root/usr/share/zoneinfo/Zulu b/data/example-root/usr/share/zoneinfo/Zulu new file mode 100644 index 000000000..c3b97f1a1 Binary files /dev/null and b/data/example-root/usr/share/zoneinfo/Zulu differ diff --git a/data/example-root/var/lib/dbus/.dummy b/data/example-root/var/lib/dbus/.dummy new file mode 100644 index 000000000..e69de29bb diff --git a/data/example-root/var/lib/initramfs-tools b/data/example-root/var/lib/initramfs-tools new file mode 100644 index 000000000..e69de29bb diff --git a/data/example-root/xbin/linux-version b/data/example-root/xbin/linux-version new file mode 100755 index 000000000..3e91d5333 --- /dev/null +++ b/data/example-root/xbin/linux-version @@ -0,0 +1 @@ +#! /bin/true diff --git a/data/example-root/xbin/useradd b/data/example-root/xbin/useradd new file mode 100755 index 000000000..3e91d5333 --- /dev/null +++ b/data/example-root/xbin/useradd @@ -0,0 +1 @@ +#! /bin/true diff --git a/src/libcalamaresui/modulesystem/ModuleManager.cpp b/src/libcalamaresui/modulesystem/ModuleManager.cpp index dd7abdf29..d08cdf8dd 100644 --- a/src/libcalamaresui/modulesystem/ModuleManager.cpp +++ b/src/libcalamaresui/modulesystem/ModuleManager.cpp @@ -57,7 +57,13 @@ ModuleManager::ModuleManager( const QStringList& paths, QObject* parent ) ModuleManager::~ModuleManager() -{} +{ + // The map is populated with Module::fromDescriptor(), which allocates on the heap. + for( auto moduleptr : m_loadedModulesByInstanceKey ) + { + delete moduleptr; + } +} void diff --git a/src/modules/initcpiocfg/main.py b/src/modules/initcpiocfg/main.py index eb29d7def..a18cd0c4f 100644 --- a/src/modules/initcpiocfg/main.py +++ b/src/modules/initcpiocfg/main.py @@ -65,8 +65,13 @@ def write_mkinitcpio_lines(hooks, modules, files, root_mount_point): :param files: :param root_mount_point: """ - with open("/etc/mkinitcpio.conf", "r") as mkinitcpio_file: - mklins = [x.strip() for x in mkinitcpio_file.readlines()] + hostfile = "/etc/mkinitcpio.conf" + try: + with open(hostfile, "r") as mkinitcpio_file: + mklins = [x.strip() for x in mkinitcpio_file.readlines()] + except FileNotFoundError: + libcalamares.utils.debug("Could not open host file '%s'" % hostfile) + mklins = [] for i in range(len(mklins)): if mklins[i].startswith("HOOKS"): diff --git a/src/modules/packages/main.py b/src/modules/packages/main.py index 93fcc9eb7..48caae6bd 100644 --- a/src/modules/packages/main.py +++ b/src/modules/packages/main.py @@ -21,126 +21,324 @@ # You should have received a copy of the GNU General Public License # along with Calamares. If not, see . +import abc +from string import Template import subprocess + import libcalamares from libcalamares.utils import check_target_env_call, target_env_call -from string import Template +from libcalamares.utils import gettext_path, gettext_languages + +import gettext +_translation = gettext.translation("calamares-python", + localedir=gettext_path(), + languages=gettext_languages(), + fallback=True) +_ = _translation.gettext +_n = _translation.ngettext -class PackageManager: +total_packages = 0 # For the entire job +completed_packages = 0 # Done so far for this job +group_packages = 0 # One group of packages from an -install or -remove entry + +INSTALL = object() +REMOVE = object() +mode_packages = None # Changes to INSTALL or REMOVE + + +def _change_mode(mode): + global mode_packages + mode_packages = mode + libcalamares.job.setprogress(completed_packages * 1.0 / total_packages) + + +def pretty_name(): + if not group_packages: + # Outside the context of an operation + s = _("Processing packages (%(count)d / %(total)d)") + elif mode_packages is INSTALL: + s = _n("Installing one package.", + "Installing %(num)d packages.", group_packages) + elif mode_packages is REMOVE: + s = _n("Removing one package.", + "Removing %(num)d packages.", group_packages) + else: + # No mode, generic description + s = _("Install packages.") + + return s % {"num": group_packages, + "count": completed_packages, + "total": total_packages} + + +class PackageManager(metaclass=abc.ABCMeta): """ - Package manager class. + Package manager base class. A subclass implements package management + for a specific backend, and must have a class property `backend` + with the string identifier for that backend. - :param backend: + Subclasses are collected below to populate the list of possible + backends. """ - def __init__(self, backend): - self.backend = backend + backend = None + @abc.abstractmethod def install(self, pkgs, from_local=False): - """ Installs packages. - - :param pkgs: - :param from_local: """ - if self.backend == "packagekit": - for pkg in pkgs: - check_target_env_call(["pkcon", "-py", "install", pkg]) - elif self.backend == "zypp": - check_target_env_call(["zypper", "--non-interactive", - "--quiet-install", "install", - "--auto-agree-with-licenses", - "install"] + pkgs) - elif self.backend == "yum": - check_target_env_call(["yum", "install", "-y"] + pkgs) - elif self.backend == "dnf": - check_target_env_call(["dnf", "install", "-y"] + pkgs) - elif self.backend == "urpmi": - check_target_env_call(["urpmi", "--download-all", "--no-suggests", - "--no-verify-rpm", "--fastunsafe", - "--ignoresize", "--nolock", - "--auto"] + pkgs) - elif self.backend == "apt": - check_target_env_call(["apt-get", "-q", "-y", "install"] + pkgs) - elif self.backend == "pacman": - if from_local: - pacman_flags = "-U" - else: - pacman_flags = "-Sy" + Install a list of packages (named) into the system. + Although this handles lists, in practice it is called + with one package at a time. - check_target_env_call(["pacman", pacman_flags, - "--noconfirm"] + pkgs) - elif self.backend == "portage": - check_target_env_call(["emerge", "-v"] + pkgs) - elif self.backend == "entropy": - check_target_env_call(["equo", "i"] + pkgs) + @param pkgs: list[str] + list of package names + @param from_local: bool + if True, then these are local packages (on disk) and the + pkgs names are paths. + """ + pass + @abc.abstractmethod def remove(self, pkgs): - """ Removes packages. - - :param pkgs: """ - if self.backend == "packagekit": - for pkg in pkgs: - check_target_env_call(["pkcon", "-py", "remove", pkg]) - elif self.backend == "zypp": - check_target_env_call(["zypper", "--non-interactive", - "remove"] + pkgs) - elif self.backend == "yum": - check_target_env_call(["yum", "--disablerepo=*", "-C", "-y", - "remove"] + pkgs) - elif self.backend == "dnf": - # ignore the error code for now because dnf thinks removing a - # nonexistent package is an error - target_env_call(["dnf", "--disablerepo=*", "-C", "-y", - "remove"] + pkgs) - elif self.backend == "urpmi": - check_target_env_call(["urpme", "--auto"] + pkgs) - elif self.backend == "apt": - check_target_env_call(["apt-get", "--purge", "-q", "-y", - "remove"] + pkgs) - check_target_env_call(["apt-get", "--purge", "-q", "-y", - "autoremove"]) - elif self.backend == "pacman": - check_target_env_call(["pacman", "-Rs", "--noconfirm"] + pkgs) - elif self.backend == "portage": - check_target_env_call(["emerge", "-C"] + pkgs) - check_target_env_call(["emerge", "--depclean", "-q"]) - elif self.backend == "entropy": - check_target_env_call(["equo", "rm"] + pkgs) + Removes packages. + @param pkgs: list[str] + list of package names + """ + pass + + @abc.abstractmethod def update_db(self): - if self.backend == "packagekit": - check_target_env_call(["pkcon", "refresh"]) - elif self.backend == "zypp": - check_target_env_call(["zypper", "--non-interactive", "update"]) - elif self.backend == "urpmi": - check_target_env_call(["urpmi.update", "-a"]) - elif self.backend == "apt": - check_target_env_call(["apt-get", "update"]) - elif self.backend == "pacman": - check_target_env_call(["pacman", "-Sy"]) - elif self.backend == "portage": - check_target_env_call(["emerge", "--sync"]) - elif self.backend == "entropy": - check_target_env_call(["equo", "update"]) + pass def run(self, script): if script != "": check_target_env_call(script.split(" ")) + def install_package(self, packagedata, from_local=False): + """ + Install a package from a single entry in the install list. + This can be either a single package name, or an object + with pre- and post-scripts. -def subst_locale(list): - ret = [] + @param packagedata: str|dict + @param from_local: bool + see install.from_local + """ + if isinstance(packagedata, str): + self.install([packagedata], from_local=from_local) + else: + self.run(packagedata["pre-script"]) + self.install([packagedata["package"]], from_local=from_local) + self.run(packagedata["post-script"]) + + +class PMPackageKit(PackageManager): + backend = "packagekit" + + def install(self, pkgs, from_local=False): + for pkg in pkgs: + check_target_env_call(["pkcon", "-py", "install", pkg]) + + def remove(self, pkgs): + for pkg in pkgs: + check_target_env_call(["pkcon", "-py", "remove", pkg]) + + def update_db(self): + check_target_env_call(["pkcon", "refresh"]) + + +class PMZypp(PackageManager): + backend = "zypp" + + def install(self, pkgs, from_local=False): + check_target_env_call(["zypper", "--non-interactive", + "--quiet-install", "install", + "--auto-agree-with-licenses", + "install"] + pkgs) + + def remove(self, pkgs): + check_target_env_call(["zypper", "--non-interactive", + "remove"] + pkgs) + + def update_db(self): + check_target_env_call(["zypper", "--non-interactive", "update"]) + + +class PMYum(PackageManager): + backend = "yum" + + def install(self, pkgs, from_local=False): + check_target_env_call(["yum", "install", "-y"] + pkgs) + + def remove(self, pkgs): + check_target_env_call(["yum", "--disablerepo=*", "-C", "-y", + "remove"] + pkgs) + + def update_db(self): + # Doesn't need updates + pass + + +class PMDnf(PackageManager): + backend = "dnf" + + def install(self, pkgs, from_local=False): + check_target_env_call(["dnf", "install", "-y"] + pkgs) + + def remove(self, pkgs): + # ignore the error code for now because dnf thinks removing a + # nonexistent package is an error + target_env_call(["dnf", "--disablerepo=*", "-C", "-y", + "remove"] + pkgs) + + def update_db(self): + # Doesn't need to update explicitly + pass + + +class PMUrpmi(PackageManager): + backend = "urpmi" + + def install(self, pkgs, from_local=False): + check_target_env_call(["urpmi", "--download-all", "--no-suggests", + "--no-verify-rpm", "--fastunsafe", + "--ignoresize", "--nolock", + "--auto"] + pkgs) + + def remove(self, pkgs): + check_target_env_call(["urpme", "--auto"] + pkgs) + + def update_db(self): + check_target_env_call(["urpmi.update", "-a"]) + + +class PMApt(PackageManager): + backend = "apt" + + def install(self, pkgs, from_local=False): + check_target_env_call(["apt-get", "-q", "-y", "install"] + pkgs) + + def remove(self, pkgs): + check_target_env_call(["apt-get", "--purge", "-q", "-y", + "remove"] + pkgs) + check_target_env_call(["apt-get", "--purge", "-q", "-y", + "autoremove"]) + + def update_db(self): + check_target_env_call(["apt-get", "update"]) + + +class PMPacman(PackageManager): + backend = "pacman" + + def install(self, pkgs, from_local=False): + if from_local: + pacman_flags = "-U" + else: + pacman_flags = "-Sy" + + check_target_env_call(["pacman", pacman_flags, + "--noconfirm"] + pkgs) + + def remove(self, pkgs): + check_target_env_call(["pacman", "-Rs", "--noconfirm"] + pkgs) + + def update_db(self): + check_target_env_call(["pacman", "-Sy"]) + + +class PMPortage(PackageManager): + backend = "portage" + + def install(self, pkgs, from_local=False): + check_target_env_call(["emerge", "-v"] + pkgs) + + def remove(self, pkgs): + check_target_env_call(["emerge", "-C"] + pkgs) + check_target_env_call(["emerge", "--depclean", "-q"]) + + def update_db(self): + check_target_env_call(["emerge", "--sync"]) + + +class PMEntropy(PackageManager): + backend = "entropy" + + def install(self, pkgs, from_local=False): + check_target_env_call(["equo", "i"] + pkgs) + + def remove(self, pkgs): + check_target_env_call(["equo", "rm"] + pkgs) + + def update_db(self): + check_target_env_call(["equo", "update"]) + + +class PMDummy(PackageManager): + backend = "dummy" + + def install(self, pkgs, from_local=False): + libcalamares.utils.debug("Installing " + str(pkgs)) + + def remove(self, pkgs): + libcalamares.utils.debug("Removing " + str(pkgs)) + + def update_db(self): + libcalamares.utils.debug("Updating DB") + + def run(self, script): + libcalamares.utils.debug("Running script '" + str(script) + "'") + + +# Collect all the subclasses of PackageManager defined above, +# and index them based on the backend property of each class. +backend_managers = [ + (c.backend, c) + for c in globals().values() + if type(c) is abc.ABCMeta and issubclass(c, PackageManager) and c.backend] + + +def subst_locale(plist): + """ + Returns a locale-aware list of packages, based on @p plist. + Package names that contain LOCALE are localized with the + BCP47 name of the chosen system locale; if the system + locale is 'en' (e.g. English, US) then these localized + packages are dropped from the list. + + @param plist: list[str|dict] + Candidate packages to install. + @return: list[str|dict] + """ locale = libcalamares.globalstorage.value("locale") - if locale: - for e in list: - if locale != "en": - entry = Template(e) - ret.append(entry.safe_substitute(LOCALE=locale)) - elif 'LOCALE' not in e: - ret.append(e) - else: - ret = list + if not locale: + return plist + + ret = [] + for packagedata in plist: + if isinstance(packagedata, str): + packagename = packagedata + else: + packagename = packagedata["package"] + + # Update packagename: substitute LOCALE, and drop packages + # if locale is en and LOCALE is in the package name. + if locale != "en": + packagename = Template(packagename).safe_substitute(LOCALE=locale) + elif 'LOCALE' in packagename: + packagename = None + + if packagename is not None: + # Put it back in packagedata + if isinstance(packagedata, str): + packagedata = packagename + else: + packagedata["package"] = packagename + + ret.append(packagedata) + return ret @@ -151,39 +349,34 @@ def run_operations(pkgman, entry): :param pkgman: :param entry: """ + global group_packages, completed_packages, mode_packages + for key in entry.keys(): entry[key] = subst_locale(entry[key]) + group_packages = len(entry[key]) if key == "install": - if isinstance(entry[key], list): - for package in entry[key]: - pkgman.run(package["pre-script"]) - pkgman.install([package["package"]]) - pkgman.run(package["post-script"]) - else: + _change_mode(INSTALL) + if all([isinstance(x, str) for x in entry[key]]): pkgman.install(entry[key]) + else: + for package in entry[key]: + pkgman.install_package(package) elif key == "try_install": + _change_mode(INSTALL) # we make a separate package manager call for each package so a # single failing package won't stop all of them for package in entry[key]: - if isinstance(package, str): - try: - pkgman.install([package]) - except subprocess.CalledProcessError: - warn_text = "WARNING: could not install package " - warn_text += package - libcalamares.utils.debug(warn_text) - else: - try: - pkgman.run(package["pre-script"]) - pkgman.install([package["package"]]) - pkgman.run(package["post-script"]) - except subprocess.CalledProcessError: - warn_text = "WARNING: could not install packages " - warn_text += package["package"] - libcalamares.utils.debug(warn_text) + try: + pkgman.install_package(package) + except subprocess.CalledProcessError: + warn_text = "WARNING: could not install package " + warn_text += str(package) + libcalamares.utils.debug(warn_text) elif key == "remove": + _change_mode(REMOVE) pkgman.remove(entry[key]) elif key == "try_remove": + _change_mode(REMOVE) for package in entry[key]: try: pkgman.remove([package]) @@ -192,8 +385,16 @@ def run_operations(pkgman, entry): warn_text += package libcalamares.utils.debug(warn_text) elif key == "localInstall": + _change_mode(INSTALL) pkgman.install(entry[key], from_local=True) + completed_packages += len(entry[key]) + libcalamares.job.setprogress(completed_packages * 1.0 / total_packages) + libcalamares.utils.debug(pretty_name()) + + group_packages = 0 + _change_mode(None) + def run(): """ @@ -202,24 +403,44 @@ def run(): :return: """ + global mode_packages, total_packages, completed_packages, group_packages + backend = libcalamares.job.configuration.get("backend") - if backend not in ("packagekit", "zypp", "yum", "dnf", "urpmi", "apt", - "pacman", "portage", "entropy"): + for identifier, impl in backend_managers: + if identifier == backend: + pkgman = impl() + break + else: return "Bad backend", "backend=\"{}\"".format(backend) - pkgman = PackageManager(backend) - operations = libcalamares.job.configuration.get("operations", []) - update_db = libcalamares.job.configuration.get("update_db", False) if update_db and libcalamares.globalstorage.value("hasInternet"): pkgman.update_db() + operations = libcalamares.job.configuration.get("operations", []) + if libcalamares.globalstorage.contains("packageOperations"): + operations += libcalamares.globalstorage.value("packageOperations") + + mode_packages = None + total_packages = 0 + completed_packages = 0 + for op in operations: + for packagelist in op.values(): + total_packages += len(packagelist) + + if not total_packages: + # Avoids potential divide-by-zero in progress reporting + return None + for entry in operations: + group_packages = 0 + libcalamares.utils.debug(pretty_name()) run_operations(pkgman, entry) - if libcalamares.globalstorage.contains("packageOperations"): - run_operations(pkgman, - libcalamares.globalstorage.value("packageOperations")) + mode_packages = None + + libcalamares.job.setprogress(1.0) + libcalamares.utils.debug(pretty_name()) return None diff --git a/src/modules/packages/packages.conf b/src/modules/packages/packages.conf index 4039278b3..6e3af05a8 100644 --- a/src/modules/packages/packages.conf +++ b/src/modules/packages/packages.conf @@ -8,11 +8,15 @@ # - urpmi - Mandriva package manager # - apt - APT frontend for DEB and RPM # - pacman - Pacman -# - portage - Gentoo package manager -# - entropy - Sabayon package manager +# - portage - Gentoo package manager +# - entropy - Sabayon package manager +# - dummy - Dummy manager, only logs # -backend: packagekit +backend: dummy +# If set to true, a package-manager specific update procedure +# is run first (only if there is internet) to update the list +# of packages and dependencies. update_db: true # @@ -29,20 +33,90 @@ update_db: true # storage called "packageOperations" and it is processed # after the static list in the job configuration. # -#operations: -# - install: -# - pkg1 -# - pkg2 -# - remove: -# - pkg3 -# - pkg4 -# - try_install: # no system install failure if a package cannot be installed -# - pkg5 -# - try_remove: # no system install failure if a package cannot be removed -# - pkg2 -# - pkg1 -# - install: -# - pkgs6 -# - pkg7 -# - localInstall: -# - /path/to/pkg8 +# Allowed package operations are: +# - install, try_install: will call the package manager to +# install one or more packages. The install target will +# abort the whole installation if package-installation +# fails, while try_install carries on. Packages may be +# listed as (localized) names, or as (localized) package-data. +# See below for the description of the format. +# - localInstall: this is used to call the package manager +# to install a package from a path-to-a-package. This is +# useful if you have a static package archive on the install media. +# - remove, try_remove: will call the package manager to +# remove one or more packages. The remove target will +# abort the whole installation if package-removal fails, +# while try_remove carries on. Packages may be listed as +# (localized) names. +# +# There are two formats for naming packages: as a name # or as package-data, +# which is an object notation providing package-name, as well as pre- and +# post-install scripts. +# +# Here are both formats, for installing vi. The first one just names the +# package for vi (using the naming of the installed package manager), while +# the second contains three data-items; the pre-script is run before invoking +# the package manager, and the post-script runs once it is done. +# +# - install +# - vi +# - package: vi +# pre-script: touch /tmp/installing-vi +# post-script: rm -f /tmp/installing-vi +# +# The pre- and post-scripts are optional, but not both optional: using +# "package: vi" with neither script option will trick Calamares into +# trying to install a package named "package: vi", which is unlikely to work. +# +# Any package name may be localized; this is used to install localization +# packages for software based on the selected system locale. By including +# the string LOCALE in the package name, the following happens: +# +# - if the system locale is English (generally US English; en_GB is a valid +# localization), then the package is not installed at all, +# - otherwise LOCALE is replaced by the Bcp47 name of the selected system +# locale, e.g. nl_BE. +# +# The following installs localizations for vi, if they are relevant; if +# there is no localization, installation continues normally. +# +# - install +# - vi-LOCALE +# - package: vi-LOCALE +# pre-script: touch /tmp/installing-vi +# post-script: rm -f /tmp/installing-vi +# +# When installing packages, Calamares will invoke the package manager +# with a list of package names if it can; package-data prevents this because +# of the scripts that need to run. In other words, this: +# +# - install: +# - vi +# - binutils +# - package: wget +# pre-script: touch /tmp/installing-wget +# +# This will invoke the package manager three times, once for each package, +# because not all of them are simple package names. You can speed up the +# process if you have only a few pre-scriots, by using multiple install targets: +# +# - install: +# - vi +# - binutils +# - install: +# - package: wget +# pre-script: touch /tmp/installing-wget +# +# This will call the package manager once with the package-names "vi" and +# "binutils", and then a second time for "wget". When installing large numbers +# of packages, this can lead to a considerable time savings. +# +operations: + - install: + - vi + - wget + - binutils + - remove: + - vi + - wget + - binutils diff --git a/src/modules/packages/test.yaml b/src/modules/packages/test.yaml index 345172622..8902b657a 100644 --- a/src/modules/packages/test.yaml +++ b/src/modules/packages/test.yaml @@ -1,10 +1,12 @@ +backend: dummy rootMountPoint: /tmp/mount -packageOperations: +operations: - install: - pre-script: touch /tmp/foo package: vi post-script: rm /tmp/foo - wget + - binutils - remove: - vi - wget diff --git a/src/modules/partition/core/DeviceList.cpp b/src/modules/partition/core/DeviceList.cpp index 5bce4a0e3..055c18dbc 100644 --- a/src/modules/partition/core/DeviceList.cpp +++ b/src/modules/partition/core/DeviceList.cpp @@ -106,12 +106,22 @@ operator <<( QDebug& s, QList< Device* >::iterator& it ) return s; } +using DeviceList = QList< Device* >; + +static inline DeviceList::iterator +erase(DeviceList& l, DeviceList::iterator& it) +{ + Device* p = *it; + auto r = l.erase( it ); + if (p) + delete p; + return r; +} + QList< Device* > getDevices( DeviceType which, qint64 minimumSize ) { bool writableOnly = (which == DeviceType::WritableOnly); - using DeviceList = QList< Device* >; - CoreBackend* backend = CoreBackendManager::self()->backend(); DeviceList devices = backend->scanDevices( true ); @@ -123,8 +133,8 @@ QList< Device* > getDevices( DeviceType which, qint64 minimumSize ) ( *it )->deviceNode().startsWith( "/dev/zram" ) ) { - cDebug() << " .. Removing" << it; - it = devices.erase( it ); + cDebug() << " .. Removing zram" << it; + it = erase(devices, it ); } else if ( writableOnly && ( @@ -132,13 +142,13 @@ QList< Device* > getDevices( DeviceType which, qint64 minimumSize ) isIso9660( *it ) ) ) { - cDebug() << " .. Removing" << it; - it = devices.erase( it ); + cDebug() << " .. Removing root-or-CD" << it; + it = erase(devices, it ); } else if ( (minimumSize >= 0) && !( (*it)->capacity() > minimumSize ) ) { cDebug() << " .. Removing too-small" << it; - it = devices.erase( it ); + it = erase(devices, it ); } else ++it; diff --git a/src/modules/partition/core/PartitionCoreModule.cpp b/src/modules/partition/core/PartitionCoreModule.cpp index ac22b2b7a..07c09c6d7 100644 --- a/src/modules/partition/core/PartitionCoreModule.cpp +++ b/src/modules/partition/core/PartitionCoreModule.cpp @@ -122,6 +122,7 @@ PartitionCoreModule::doInit() cDebug() << "node\tcapacity\tname\tprettyName"; for ( auto device : devices ) { + // Gives ownership of the Device* to the DeviceInfo object auto deviceInfo = new DeviceInfo( device ); m_deviceInfos << deviceInfo; cDebug() << device->deviceNode() << device->capacity() << device->name() << device->prettyName(); diff --git a/src/modules/partition/gui/DeviceInfoWidget.cpp b/src/modules/partition/gui/DeviceInfoWidget.cpp index 1fadb9566..abe5c7a49 100644 --- a/src/modules/partition/gui/DeviceInfoWidget.cpp +++ b/src/modules/partition/gui/DeviceInfoWidget.cpp @@ -33,6 +33,7 @@ DeviceInfoWidget::DeviceInfoWidget( QWidget* parent ) : QWidget( parent ) , m_ptIcon( new QLabel ) , m_ptLabel( new QLabel ) + , m_tableType( PartitionTable::unknownTableType ) { QHBoxLayout* mainLayout = new QHBoxLayout; setLayout( mainLayout ); diff --git a/src/modules/partition/gui/EncryptWidget.cpp b/src/modules/partition/gui/EncryptWidget.cpp index 9fc7be59d..198f2ebe1 100644 --- a/src/modules/partition/gui/EncryptWidget.cpp +++ b/src/modules/partition/gui/EncryptWidget.cpp @@ -23,6 +23,7 @@ EncryptWidget::EncryptWidget( QWidget* parent ) : QWidget( parent ) + , m_state( EncryptionDisabled ) { setupUi( this ); diff --git a/src/modules/testmodule.py b/src/modules/testmodule.py index 955db1830..d115694eb 100755 --- a/src/modules/testmodule.py +++ b/src/modules/testmodule.py @@ -88,6 +88,7 @@ def main(): libcalamares.globalstorage = libcalamares.GlobalStorage(None) libcalamares.globalstorage.insert("testing", True) if args.lang: + libcalamares.globalstorage.insert("locale", args.lang) libcalamares.globalstorage.insert("localeConf", {"LANG": args.lang}) # if a file for simulating globalStorage contents is provided, load it diff --git a/src/modules/unpackfs/unpackfs.conf b/src/modules/unpackfs/unpackfs.conf index ce50d8f29..b2b107268 100644 --- a/src/modules/unpackfs/unpackfs.conf +++ b/src/modules/unpackfs/unpackfs.conf @@ -13,12 +13,28 @@ unpack: # Each list item is unpacked, in order, to the target system. # Each list item has the following attributes: # source: path relative to the live / intstalling system to the image -# sourcefs: ext4 or squashfs (may be others if mount supports is) +# sourcefs: ext4 or squashfs (may be others if mount supports it) # destination: path relative to rootMountPoint (so in the target # system) where this filesystem is unpacked. + +# Usually you list a filesystem image to unpack; you can use +# squashfs or an ext4 image. +# +# - source: "/path/to/filesystem.sqfs" +# sourcefs: "squashfs" +# destination: "" + +# You can list more than one filesystem. +# +# - source: "/path/to/another/filesystem.img" +# sourcefs: "ext4" +# destination: "" +# + +# You can list filesystem source paths relative to the Calamares run +# directory, if you use -d (this is only useful for testing, though). - source: "_root-image_" sourcefs: "squashfs" destination: "" - source: "_desktop-image_" sourcefs: "squashfs" - destination: "" diff --git a/src/modules/welcome/checker/partman_devices.c b/src/modules/welcome/checker/partman_devices.c index d417f3c0f..2cc97557a 100644 --- a/src/modules/welcome/checker/partman_devices.c +++ b/src/modules/welcome/checker/partman_devices.c @@ -112,7 +112,7 @@ process_device(PedDevice *dev) int check_big_enough(long long required_space) { - PedDevice *dev; + PedDevice *dev = NULL; ped_exception_fetch_all(); ped_device_probe_all(); @@ -126,7 +126,15 @@ check_big_enough(long long required_space) break; } } - ped_device_free_all(); + + // We would free the devices to release allocated memory, + // but other modules might be using partman use well, + // and they can hold pointers to libparted structures in + // other threads. + // + // So prefer to leak memory, instead. + // + // ped_device_free_all(); return big_enough; }