diff options
author | 2012-12-07 20:25:47 +0100 | |
---|---|---|
committer | 2012-12-07 20:25:47 +0100 | |
commit | 3e30bbfd7be4d5a37ba9e7238a3204ea96380191 (patch) | |
tree | 062c0592b02047da94f73c92eeb84b64b240ceee | |
parent | Removed useless etab function, also fix more tabs-spaces. (diff) | |
download | localepurge-3e30bbfd7be4d5a37ba9e7238a3204ea96380191.tar.gz localepurge-3e30bbfd7be4d5a37ba9e7238a3204ea96380191.tar.bz2 localepurge-3e30bbfd7be4d5a37ba9e7238a3204ea96380191.zip |
Generate localelist from glibc supported locales and packaged list.
-rw-r--r-- | defaultlist | 346 | ||||
-rw-r--r-- | localelist-extra | 44 | ||||
-rwxr-xr-x | localepurge | 37 |
3 files changed, 77 insertions, 350 deletions
diff --git a/defaultlist b/defaultlist deleted file mode 100644 index 59c5d3f..0000000 --- a/defaultlist +++ /dev/null @@ -1,346 +0,0 @@ -aa -af -af_ZA -am -am_ET -ang -ar -ar_AE -ar_BH -ar_DZ -ar_EG -ar_IN -ar_IQ -ar_JO -ar_KW -ar_LB -ar_LY -ar_MA -ar_OM -ar_QA -ar_SA -ar_SD -ar_SY -ar_TN -ar_YE -as -ast -az -az_AZ -az_IR -be -be@latin -be_BY -bg -bg_BG -bn -bn_IN -br -br_FR -bs -bs_BA -byn -ca -ca@valencia -ca_ES -ca_ES@euro -ca_ES@valencia -chs -cht -crh -cs -cs_CZ -cy -cy_GB -cz -da -da_DK -de -de_AT -de_AT@euro -de_BE -de_BE@euro -de_CH -de_DE -de_DE.UTF-8 -de_DE@euro -de_LU -de_LU@euro -dk -dv -dz -el -el_GR -el_GR.UTF-8 -el_GR@euro -en -en@IPA -en@boldquot -en@quot -en@shaw -en_AU -en_BW -en_CA -en_DK -en_GB -en_GB.UTF-8 -en_HK -en_IE -en_IE@euro -en_IN -en_NZ -en_PH -en_RN -en_SG -en_UK -en_US -en_US.UTF-8 -en_ZA -en_ZW -eo -eo_EO -es -es_AR -es_BO -es_CL -es_CO -es_CR -es_DO -es_EC -es_ES -es_ES.UTF-8 -es_ES@euro -es_GT -es_HN -es_MX -es_NI -es_PA -es_PE -es_PR -es_PY -es_SV -es_US -es_UY -es_VE -et -et_EE -eu -eu_ES -eu_ES@euro -fa -fa_IR -fa_IR.UTF-8 -fi -fi_FI -fi_FI@euro -fo -fo_FO -fr -fr_BE -fr_BE@euro -fr_CA -fr_CH -fr_FR -fr_FR.UTF-8 -fr_FR@euro -fr_LU -fr_LU@euro -fur -fy -ga -ga_IE -ga_IE@euro -gd -gd_GB -gez -gl -gl_ES -gl_ES@euro -gr -gu -gv -gv_GB -haw -he -he_IL -hi -hi_IN -hi_IN.UTF-8 -hr -hr_HR -hu -hu_HU -hy -hy_AM -ia -id -id_ID -is -is_IS -it -it_CH -it_IT -it_IT@euro -iu -iw -iw_IL -ja -ja_JP -ja_JP.EUC -ja_JP.EUC-JP -ja_JP.UTF-8 -ja_JP.eucJP -ka -ka_GE -kk -kl -kl_GL -km -km_KH -kn -ko -ko_KR -ko_KR.EUC-KR -ko_KR.UTF-8 -kok -ku -kw -kw_GB -ky -la -lg -li -lo -lt -lt_LT -lv -lv_LV -mai -mg -mhr -mi -mi_NZ -mk -mk_MK -ml -mn -mr -mr_IN -mr_IN.UTF-8 -ms -ms_MY -mt -mt_MT -my -my_MM -nb -nb_NO -nds -ne -nl -nl_BE -nl_BE@euro -nl_NL -nl_NL@euro -nn -nn_NO -no -no_NO -nso -nyc -oc -oc_FR -om -or -pa -pl -pl_PL -ps -pt -pt_BR -pt_PT -pt_PT@euro -rm -ro -ro_RO -ru -ru_RU -ru_RU.KOI8-R -ru_RU.UTF-8 -ru_UA -rw -sa -si -sid -sk -sk_SK -sl -sl_SI -so -sp -sq -sq_AL -sr -sr@Latn -sr@ije -sr@latin -sr_RS -sr_YU -sr_YU@cyrillic -sv -sv_FI -sv_FI@euro -sv_SE -sw -syr -ta -ta_IN -te -te_IN -tg -tg_TJ -th -th_TH -ti -ti_ER -ti_ET -tig -tk -tl -tl_PH -tr -tr_TR -tt -tt_RU -ug -uk -uk_UA -ur -ur_PK -uz -uz@Latn -uz_UZ -ve -vi -vi_VN -vi_VN.UTF-8 -wa -wal -wo -xh -yi -yi_US -zh -zh_CN -zh_CN.GB18030 -zh_CN.GB2312 -zh_CN.GBK -zh_CN.UTF-8 -zh_HK -zh_HK.UTF-8 -zh_SG -zh_TW -zh_TW.Big5 -zh_TW.EUC-TW -zh_TW.UTF-8 -zu diff --git a/localelist-extra b/localelist-extra new file mode 100644 index 0000000..848bb99 --- /dev/null +++ b/localelist-extra @@ -0,0 +1,44 @@ +ang +az_IR +be@latin +ca@valencia +ca_ES@valencia +chs +cht +cz +dk +el_GR@euro +en@IPA +en@boldquot +en@quot +en@shaw +en_RN +en_UK +eo +eo_EO +fa_IR.UTF8 +gr +haw +hi_IN.UTF8 +ia +ja_JP +ja_JP.EUC +ja_JP.eucJP +ko_KR +la +mr_IN.UTF8 +no +no_NO +nyc +rm +sp +sr@Latn +sr@ije +sr@latin +sr_YU +sr_YU@cyrillic +syr +uz@Latn +vi_VN.UTF8 +zh_CN.GB2312 +zh_TW.Big5 diff --git a/localepurge b/localepurge index f31867f..28e2091 100755 --- a/localepurge +++ b/localepurge @@ -13,7 +13,10 @@ LOCALEDIRS="/usr/share/locale /usr/local/share/locale /usr/kde/?.?/share/locale MANPAGEDIRS="/usr/share/man /usr/man /usr/local/share/man /usr/kde/?.?/share/man /usr/kde/?.?/man /opt/sun-jdk-*/man /opt/sun-jre-bin-*/man" LOCALELIST="${PREFIX}/var/cache/localepurge/localelist" +LOCALELIST_GLIBC="${PREFIX}/var/cache/localepurge/localelist-glibc" +LOCALELIST_EXTRA="${PREFIX}/var/cache/localepurge/localelist-extra" CONFIGFILE="${PREFIX}/etc/locale.nopurge" + VERSION="0.5.4" LOCALETOTAL=0 @@ -72,6 +75,25 @@ version () { einfo "${BRACKET}[${NORMAL} ${GOOD}${VERSION}${NORMAL} ${BRACKET}]${NORMAL}" } +# Creates new localelist +# from glibc supported locales and the packaged extra locales + +createlist() { + if [ "$VERBOSE" = "enabled" ]; then + einfo "localepurge: updating list of locales in ${LOCALELIST} ..." + fi + + # select all supported glibc locales + localeworkfile=$(mktemp) + cat /usr/share/i18n/SUPPORTED | cut -d ' ' -f 1 > ${localeworkfile} + cat /usr/share/i18n/SUPPORTED | cut -d '_' -f 1 | uniq >> ${localeworkfile} + cat ${localeworkfile} | sort > ${LOCALELIST_GLIBC} + rm ${localeworkfile} + + # add the extra locales + cat ${LOCALELIST_GLIBC} ${LOCALELIST_EXTRA} | sort | uniq > ${LOCALELIST} +} + # Check options in CONFIGFILE grep -xq SHOWFREEDSPACE ${CONFIGFILE} && SHOWFREEDSPACE=enabled @@ -151,10 +173,6 @@ else fi fi -# Prune the locale list using CONFIGFILE as a list of regex patterns: - -PURGELIST=`grep -xvf ${CONFIGFILE} "${LOCALELIST}"` - # Deleting a filepath and optionally counting freed space @@ -247,6 +265,17 @@ purgeman () { fi } +# If running for the first time, create new localelist: +if [ ! -f ${LOCALELIST_GLIBC} ]; then + if [ "$VERBOSE" = "enabled" ]; then + einfo "localepurge: running for the first time" + fi + createlist +fi + +# Prune the locale list using CONFIGFILE as a list of regex patterns: +PURGELIST=`grep -xvf ${CONFIGFILE} "${LOCALELIST}"` + [ "${LIST}" = "enabled" ] && [ "${VERBOSE}" = "enabled" ] && ewarn "If not in list mode, localepurge would clear the following directories:\n" |