From d1f5f254b15945141ba1e09bb82b141835bd334f Mon Sep 17 00:00:00 2001 From: David P Date: Sat, 1 Aug 2020 18:45:42 -0400 Subject: [lxde-openrc] make it shellcheck-compliant Signed-off-by: David P --- configs/lxde-openrc/airootfs/root/.keymap.sh | 12 ++++++------ configs/lxde-openrc/airootfs/root/.language.sh | 12 ++++++------ configs/lxde-openrc/build.sh | 25 +++++++++++++------------ 3 files changed, 25 insertions(+), 24 deletions(-) diff --git a/configs/lxde-openrc/airootfs/root/.keymap.sh b/configs/lxde-openrc/airootfs/root/.keymap.sh index 0823fde..c6ed5fd 100755 --- a/configs/lxde-openrc/airootfs/root/.keymap.sh +++ b/configs/lxde-openrc/airootfs/root/.keymap.sh @@ -1,13 +1,13 @@ #!/bin/bash #Comprobe if X11 keymap was selected -code=$(cat .codecheck | grep XKBMAP= | cut -d '=' -f 2) -keymaps_list=$(sed -e '/! layout/,/^$/!d;/! layout/d;s/ /_/g;s/__/ /g;s/ _//' /usr/share/X11/xkb/rules/evdev.lst | sort) +code="$(grep XKBMAP= .codecheck | cut -d '=' -f 2)" +keymaps_list="$(sed -e '/! layout/,/^$/!d;/! layout/d;s/ /_/g;s/__/ /g;s/ _//' /usr/share/X11/xkb/rules/evdev.lst | sort)" + if [[ $code = "0" ]]; then - keymap=$(zenity --list --title="Select your keymap" --column="Code Name" --column="Keymap" --hide-column=1 $keymaps_list) - - setxkbmap $keymap - + keymap=$(zenity --list --title="Select your keymap" --column="Code Name" --column="Keymap" --hide-column=1 "$keymaps_list") + setxkbmap "$keymap" + #Save XKBMAP in .codecheck to use in other time. For example if you install X11 with scripts sed -i '/XKBMAP=./d' ~/.codecheck echo "XKBMAP=$keymap" >> ~/.codecheck diff --git a/configs/lxde-openrc/airootfs/root/.language.sh b/configs/lxde-openrc/airootfs/root/.language.sh index 11e986e..acce4bb 100755 --- a/configs/lxde-openrc/airootfs/root/.language.sh +++ b/configs/lxde-openrc/airootfs/root/.language.sh @@ -1,8 +1,8 @@ #!/bin/bash #Comprobe if language was selected -code=$(cat ~/.codecheck | grep LANG= | tail --bytes 2) -if [ $code = "0" ]; then +code=$(grep LANG= ~/.codecheck | tail --bytes 2) +if [ "$code" = "0" ]; then lang=$(dialog --stdout --backtitle "System language selection" --menu "Choose your language:" 15 40 10 \ "en_US.UTF-8" "English" \ "gl_ES.UTF-8" "Galego" \ @@ -12,17 +12,17 @@ if [ $code = "0" ]; then "it_IT.UTF-8" "Italian" \ "fr_FR.UTF-8" "French" \ "eo" "Esperanto") - + #Copy locale in locale.conf - [ $lang = "" ] || echo "LANG=$lang" > /etc/locale.conf + [ -z "$lang" ] || echo "LANG=$lang" > /etc/locale.conf #Put a new line confirm that language was selected sed -i '/LANG=./d' ~/.codecheck echo "LANG=1" >> ~/.codecheck - + #Copy scripts to install in that language case ${lang/_*/} in - en|gl|es|pt) cp -a ~/.scriptsInstallation/language/${lang/_*/}/* ~/.scriptsInstallation/ + en|gl|es|pt) cp -a ~/.scriptsInstallation/language/"${lang/_*/}"/* ~/.scriptsInstallation/ cp ~/.scriptsInstallation/install.sh ~/ ;; *) cp -a ~/.scriptsInstallation/language/en/* ~/.scriptsInstallation/ diff --git a/configs/lxde-openrc/build.sh b/configs/lxde-openrc/build.sh index a25c000..2ef0cdc 100755 --- a/configs/lxde-openrc/build.sh +++ b/configs/lxde-openrc/build.sh @@ -16,6 +16,9 @@ arch=$(uname -m) verbose="" script_path="$( cd -P "$( dirname "$(readlink -f "$0")" )" && pwd )" +export arch +umask 0022 + _usage () { echo "usage ${0} [options]" @@ -42,8 +45,6 @@ _usage () exit "${1}" } -umask 0022 - # Helper function to run make_*() only one time per architecture. run_once() { if [[ ! -e "${work_dir}/build.${1}_${arch}" ]]; then @@ -94,10 +95,10 @@ make_packages() { exec 17<>"${work_dir}/gpgkey" fi if [ -n "${verbose}" ]; then - PARABOLAISO_GNUPG_FD="${gpg_key:+17}" arch="${arch}" mkparabolaiso -v -w "${work_dir}/${arch}" -C "${work_dir}/pacman.conf" -D "${install_dir}" \ + PARABOLAISO_GNUPG_FD="${gpg_key:+17}" mkparabolaiso -v -w "${work_dir}/${arch}" -C "${work_dir}/pacman.conf" -D "${install_dir}" \ -p "$(grep -h -v '^#' "${script_path}"/packages.{both,"${arch}"}| sed ':a;N;$!ba;s/\n/ /g')" install else - PARABOLAISO_GNUPG_FD="${gpg_key:+17}" arch="${arch}" mkparabolaiso -w "${work_dir}/${arch}" -C "${work_dir}/pacman.conf" -D "${install_dir}" \ + PARABOLAISO_GNUPG_FD="${gpg_key:+17}" mkparabolaiso -w "${work_dir}/${arch}" -C "${work_dir}/pacman.conf" -D "${install_dir}" \ -p "$(grep -h -v '^#' "${script_path}"/packages.{both,"${arch}"}| sed ':a;N;$!ba;s/\n/ /g')" install fi if [[ "${gpg_key}" ]]; then @@ -118,10 +119,10 @@ make_customize_airootfs() { if [[ -e "${work_dir}/${arch}/airootfs/root/customize_airootfs.sh" ]]; then if [ -n "${verbose}" ]; then - arch="${arch}" mkparabolaiso -v -w "${work_dir}/${arch}" -C "${work_dir}/pacman.conf" -D "${install_dir}" \ + mkparabolaiso -v -w "${work_dir}/${arch}" -C "${work_dir}/pacman.conf" -D "${install_dir}" \ -r '/root/customize_airootfs.sh' run else - arch="${arch}" mkparabolaiso -w "${work_dir}/${arch}" -C "${work_dir}/pacman.conf" -D "${install_dir}" \ + mkparabolaiso -w "${work_dir}/${arch}" -C "${work_dir}/pacman.conf" -D "${install_dir}" \ -r '/root/customize_airootfs.sh' run fi rm "${work_dir}/${arch}/airootfs/root/customize_airootfs.sh" @@ -225,11 +226,11 @@ make_efiboot() { make_prepare() { cp -a -l -f "${work_dir}/${arch}/airootfs" "${work_dir}" if [ -n "${verbose}" ]; then - arch="${arch}" mkparabolaiso -v -w "${work_dir}" -D "${install_dir}" pkglist - arch="${arch}" mkparabolaiso -v -w "${work_dir}" -D "${install_dir}" ${gpg_key:+-g ${gpg_key}} prepare + mkparabolaiso -v -w "${work_dir}" -D "${install_dir}" pkglist + mkparabolaiso -v -w "${work_dir}" -D "${install_dir}" ${gpg_key:+-g ${gpg_key}} prepare else - arch="${arch}" mkparabolaiso -w "${work_dir}" -D "${install_dir}" pkglist - arch="${arch}" mkparabolaiso -w "${work_dir}" -D "${install_dir}" ${gpg_key:+-g ${gpg_key}} prepare + mkparabolaiso -w "${work_dir}" -D "${install_dir}" pkglist + mkparabolaiso -w "${work_dir}" -D "${install_dir}" ${gpg_key:+-g ${gpg_key}} prepare fi rm -rf "${work_dir}/airootfs" # rm -rf "${work_dir}/${arch}/airootfs" (if low space, this helps) @@ -238,10 +239,10 @@ make_prepare() { # Build ISO make_iso() { if [ -n "${verbose}" ]; then - arch="${arch}" mkparabolaiso -v -w "${work_dir}" -D "${install_dir}" -L "${iso_label}" -P "${iso_publisher}" \ + mkparabolaiso -v -w "${work_dir}" -D "${install_dir}" -L "${iso_label}" -P "${iso_publisher}" \ -A "${iso_application}" -o "${out_dir}" iso "${iso_name}-${iso_version}-dual.iso" else - arch="${arch}" mkparabolaiso -w "${work_dir}" -D "${install_dir}" -L "${iso_label}" -P "${iso_publisher}" \ + mkparabolaiso -w "${work_dir}" -D "${install_dir}" -L "${iso_label}" -P "${iso_publisher}" \ -A "${iso_application}" -o "${out_dir}" iso "${iso_name}-${iso_version}-dual.iso" fi } -- cgit v1.2.2