0xV3NOMx
Linux ip-172-26-7-228 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64



Your IP : 18.188.130.151


Current Path : /proc/self/root/usr/share/language-tools/
Upload File :
Current File : //proc/self/root/usr/share/language-tools/save-to-pam-env

#!/bin/sh -pe
#
# updates the ~/.pam_environment config file

homedir=$1
locale_name=$2
language_list=$3

[ -n "$homedir" -a -n "$locale_name" ] || exit 1

langtoolsdir=/usr/share/language-tools

# create ~/.pam_environment if it doesn't exist
touch "$homedir/.pam_environment" || exit 1

save_to_pam_env() {
    var=$1; value=$2
    if [ "$( grep -E "^$var(\s+DEFAULT|=)" .pam_environment )" ]; then
        sed -r -i "s/^$var(\s+DEFAULT|=).*/$var\tDEFAULT=$value/" .pam_environment
    else
        echo "$var\tDEFAULT=$value" >> .pam_environment
    fi
}

cd "$homedir" 
if [ -n "$language_list" ]; then
    save_to_pam_env 'LANGUAGE' $language_list
    save_to_pam_env 'LANG' $locale_name
else
    for var in 'LC_NUMERIC' 'LC_TIME' 'LC_MONETARY' 'LC_PAPER' 'LC_NAME' \
               'LC_ADDRESS' 'LC_TELEPHONE' 'LC_MEASUREMENT' 'LC_IDENTIFICATION'; do
        save_to_pam_env $var $locale_name
    done
    papersize=$( $langtoolsdir/locale2papersize $locale_name )
    save_to_pam_env 'PAPERSIZE' $papersize
    echo $locale_name
fi    

exit 0