Browse Source

Translate comments and dialogue strings to English

master
NaiJi 6 months ago
parent
commit
9d35619f57
  1. 72
      iso_updater.sh

72
iso_updater.sh

@ -1,53 +1,53 @@
#!/bin/bash
tryUpdateFromSdb()
tryUpdateFromSd()
{
local sdb_name=$1
# режем /dev/sdb1 по символу / и берём 3-е значение из результата, то есть sdb1
local sdb_folder_name=$(echo "${sdb_name}" | cut -f 3 -d '/')
local sd_name=$1
# cut received line by / and take the third found result. (for /dev/sdb1 it's sdb1)
local sd_folder_name=$(echo "${sd_name}" | cut -f 3 -d '/')
exit_condition=false
while [ "$exit_condition" == false ]
do
echo "Вы желаете обновиться с ${sdb_name}? (Д/н)"
echo "Do you want to update ${sd_name}? (Y/n)"
read input_char
if [ "$input_char" == "д" ] || [ "$input_char" == "Д" ]
if [ "$input_char" == "y" ] || [ "$input_char" == "Y" ]
then
echo " - Создаём папку /media/iso-$sdb_folder_name"
mkdir /media/iso-$sdb_folder_name
echo " - Create folder /media/iso-$sd_folder_name"
mkdir /media/iso-$sd_folder_name
echo " - Монтируем ${sdb_name} в папку /media/iso-$sdb_folder_name"
mount $sdb_name /media/iso-$sdb_folder_name
echo " - Mount ${sd_name} into /media/iso-$sd_folder_name"
mount $sd_name /media/iso-$sd_folder_name
echo " - Обновляем пакетный менеджер системы."
echo " - Update the package manager."
cp /etc/apt/sources.list /etc/apt/sources-backup.list
mkdir /home/temp-apt
mv /etc/apt/sources.list.d/* /home/temp-apt/
echo "deb [trusted=yes] file:/media/iso-$sdb_folder_name orel main contrib" > /etc/apt/sources.list
echo "deb [trusted=yes] file:/media/iso-$sd_folder_name orel main contrib" > /etc/apt/sources.list
echo " - Обновляем пакеты."
echo " - Update packages."
apt update
apt upgrade
echo " - Отсоединяем ${sdb_name}"
umount /media/iso-$sdb_folder_name
rm -rf /media/iso-$sdb_folder_name
echo " - Unmount ${sd_name}"
umount /media/iso-$sd_folder_name
rm -rf /media/iso-$sd_folder_name
echo " - Восстанавливаем пакетный менеджер системы."
echo " - Restore the package manager."
mv /etc/apt/sources-backup.list /etc/apt/sources.list
mv /home/temp-apt/* /etc/apt/sources.list.d/
rm -rf /home/temp-apt/
exit_condition=true
elif [ "$input_char" == "н" ] || [ "$input_char" == "Н" ]
elif [ "$input_char" == "n" ] || [ "$input_char" == "N" ]
then
echo "Пропускаем "${sdb_name}""
echo "Skip "${sd_name}""
exit_condition=true
else
echo "Пожалуйста, введите Д или д для согласия, либо Н или н для отказа."
echo "Для закрытия программы введите Ctrl+C."
echo "Please input Y or y to agree and N or n to decline."
echo "To close the application please input Ctrl+C."
fi
done
}
@ -55,33 +55,33 @@ tryUpdateFromSdb()
############################################ MAIN ############################################
if [[ $UID != 0 ]]; then
echo "Пожалуйста, запустите эту программу из-под sudo:"
echo "Please run the application from sudo:"
echo "sudo $0 $*"
exit 1
fi
echo "Подготовка к обновлению пакетов операционной системы."
echo "Preparing to update the Operational System."
# Выводим носители через fdisk -l
# фильтруем строки, которые содержат "sdb" КРОМЕ "sdb:"
# режем по символу пробела и берём первый элемент
# как результат: /dev/sdb1 , например
sdb_arr_raw=$(fdisk -l | egrep "sdb[^:]" | cut -f 1 -d ' ')
# Show devices with fdisk -l
# Filter all lines which contain "sd*" (where * -- any latin letter from B to Z) except for "sd*:"
# cut by space character and take the first found result
# so it is: /dev/sdb1 , for example
sd_arr_raw=$(fdisk -l | egrep "sd[b-zB-Z][^:]" | cut -f 1 -d ' ')
amount_of_sdb=0
for sdb_raw in $sdb_arr_raw
amount_of_sd=0
for sd_raw in $sd_arr_raw
do
amount_of_sdb=$(($amount_of_sdb+1))
echo "${sdb_raw}; ID=${amount_of_sdb}"
amount_of_sd=$(($amount_of_sd+1))
echo "${sd_raw}; ID=${amount_of_sd}"
done
if (( $amount_of_sdb < 1 ))
if (( $amount_of_sd < 1 ))
then
echo "Доступные внешние носители для обновления системы не найдены. Пожалуйста, проверьте подключение внешних носителей."
echo "Available external devices weren't detected. Please make sure they are connected."
else
for sdb_raw in $sdb_arr_raw
for sd_raw in $sd_arr_raw
do
tryUpdateFromSdb "${sdb_raw}"
tryUpdateFromSd "${sd_raw}"
done
fi

Loading…
Cancel
Save