Skip to content

Commit

Permalink
0.0.13
Browse files Browse the repository at this point in the history
  • Loading branch information
snuglinux committed Oct 27, 2018
1 parent e0a747f commit c331582
Show file tree
Hide file tree
Showing 3 changed files with 121 additions and 78 deletions.
37 changes: 15 additions & 22 deletions install-snuglinux
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,20 @@ PO_DIR=${INSTALL_PREFIX}/share/snuglinux
TMP_DIR=/tmp/snuglinux

#=======================================
ping_server() {
show_message PING_SERVER $SNUG_SERVER
res=1
/bin/ping ${SNUG_SERVER} -c 3 > /dev/null 2>&1 && res=0
if [ ${res} -ne 0 ]; then
show_message NOT_ACCESS_SERVER $SNUG_SERVER
exit 1
else
show_message OK
fi
download_updates_func(){
if ! [ -d "$TMP_DIR" ]; then
mkdir "$TMP_DIR"
fi
wget --quiet --tries=3 -c https://snuglinux.pp.ua/install/install-snuglinux.func -P $TMP_DIR
wget --quiet --tries=3 -c https://snuglinux.pp.ua/install/install-partition.func -P $TMP_DIR
wget --quiet --tries=3 -c https://snuglinux.pp.ua/install/install-video.func -P $TMP_DIR
wget --quiet --tries=3 -c https://snuglinux.pp.ua/install/install-snuglinux.messages -P $TMP_DIR

if [ -f $TMP_DIR/install-snuglinux.func -a -f $TMP_DIR/install-partition.func -a -f $TMP_DIR/install-video.func -a -f $TMP_DIR/install-snuglinux.messages ]; then
PO_DIR=$TMP_DIR
fi
}

system_language



if ! [ -f ${PO_DIR}/install-snuglinux.func ]; then
case $lang in
ru) echo -e "\e[31mОшибка:\e[0m не найден файл install-snuglinux.func в '${PO_DIR}'!!!";;
Expand All @@ -33,9 +31,10 @@ if ! [ -f ${PO_DIR}/install-snuglinux.func ]; then
esac
exit 1
else
. ${PO_DIR}/install-snuglinux.func
source ${PO_DIR}/install-snuglinux.func
fi

system_language

set_options $*

Expand All @@ -49,13 +48,7 @@ if [ "$?" = 1 ]; then
exit 1;
fi

if ! [ -d "$TMP_DIR" ]; then
mkdir "$TMP_DIR"
fi
exit
wget --quiet --tries=3 -c https://github.com/snuglinux/install-snuglinux/master/install-snuglinux.func -P $TMP_DIR
wget --quiet --tries=3 -c https://github.com/snuglinux/install-snuglinux/master/install-snuglinux.func -P $TMP_DIR

download_updates_func

pacman -Sy

Expand Down
138 changes: 85 additions & 53 deletions install-snuglinux.func
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,47 @@ if ! [ -f $CONFIG_FILE ]; then
show_message NOT_FOUND_CONFIG $CONFIG_FILE
exit 1
else
. "$CONFIG_FILE"
source "$CONFIG_FILE"
fi

#=======================================
system_language() {
local UP_LANG_SELECT LANG_UTF8 STR_READ

PATH_INST=$1

if ! [ -f ~/.config/lang.conf ]; then
while [ "${LIST_LANG}" = "${LIST_LANG#*$LANG_SELECT}" ] ; do
STR_READ=`echo "$(tput bold)$(tput setaf 2)Specify the required language: $(tput setaf 1) ${LIST_LANG} $(tput sgr0)"`
read -p "${STR_READ}" LANG_SELECT
if [ "${LIST_LANG}" = "${LIST_LANG#*$LANG_SELECT}" ]; then
echo "Incorrect value"
else
echo -e "LANG_SELECT=${LANG_SELECT}" > ~/.config/lang.conf
echo "OK"
fi
done
fi
source ~/.config/lang.conf
UP_LANG_SELECT=`echo "${LANG_SELECT^^}"`
LANG_UTF8=${LANG_SELECT}"_"${UP_LANG_SELECT}.UTF-8
if [ -z "${PATH_INST}" ]; then
loadkeys ${LANG_SELECT}
export LANG=${LANG_UTF8}
setfont cyr-sun16
clear
else
arch-chroot ${PATH_INST} loadkeys ${LANG_SELECT}
arch-chroot ${PATH_INST} setfont cyr-sun16
echo -e "LANG=${LANG_UTF8}" > ${PATH_INST}/etc/locale.conf
echo -e "KEYMAP=${LANG_SELECT}\nFONT=cyr-sun16\nFONT_MAP=" > ${PATH_INST}/etc/vconsole.conf
sed -i ${PATH_INST}/etc/locale.gen -e 's|#\(en_US.UTF-8 UTF-8\)|\1|'
sed -i ${PATH_INST}/etc/locale.gen -e 's|#\(uk_UA.UTF-8 UTF-8\)|\1|'
sed -i ${PATH_INST}/etc/locale.gen -e 's|#\(ru_RU.UTF-8 UTF-8\)|\1|'
arch-chroot ${PATH_INST} locale-gen
fi
}

#========================
set_options(){
while [ ! -z "$1" ]; do
Expand All @@ -39,6 +77,19 @@ set_options(){
done
}

#=======================================
ping_server() {
show_message PING_SERVER $SNUG_SERVER
res=1
/bin/ping ${SNUG_SERVER} -c 3 > /dev/null 2>&1 && res=0
if [ ${res} -ne 0 ]; then
show_message NOT_ACCESS_SERVER $SNUG_SERVER
exit 1
else
show_message OK
fi
}

#=======================================
preparation_disk(){
local OK AMSURE
Expand Down Expand Up @@ -122,6 +173,9 @@ install_sevice(){

#=======================================
not_installed_pkg() {
# Example: not_installed_pkg "1" "2"
# 1 - list name pkg
# 2 - path chroot
local list_pkg inst_list path_chroot

inst_list=""
Expand Down Expand Up @@ -224,15 +278,19 @@ install_video_driver(){
local NVIDIA ATI INTEL VIDEO INSTALL_VIDEO

if [ -f "${PO_DIR}/install-video.func" ]; then
. "${PO_DIR}/install-video.func"
source "${PO_DIR}/install-video.func"
else
show_message FILE_NOT_FOUND "${PO_DIR}/install-video.func"
exit 1
fi
installed_pkg "xorg-server" "/mnt"
if [ $? = 0 ]; then
return 0;
NOT_INSTALL_PKG=$(not_installed_pkg "xorg-server" "/mnt")
if [ -n "$NOT_INSTALL_PKG" ] ; then
installed_pkg "xorg-server" "/mnt"
if [ $? = 0 ]; then
return 1;
fi
fi

INSTALL_VIDEO="no"
VIDEO=`lspci | grep -i --color vga`

Expand All @@ -259,6 +317,9 @@ install_video_driver(){
fi
if [ "${INSTALL_VIDEO}" == "no" ]; then
install_video_vesa
if [ $? = 1 ]; then
INSTALL_VIDEO="yes"
fi
fi
}

Expand Down Expand Up @@ -478,67 +539,29 @@ add_users(){
return 0
}

#=======================================
system_language() {
local UP_LANG_SELECT LANG_UTF8 STR_READ

PATH_INST=$1

if ! [ -f ~/.config/lang.conf ]; then
while [ "${LIST_LANG}" = "${LIST_LANG#*$LANG_SELECT}" ] ; do
STR_READ=`echo "$(tput bold)$(tput setaf 2)Specify the required language: $(tput setaf 1) ${LIST_LANG} $(tput sgr0)"`
read -p "${STR_READ}" LANG_SELECT
if [ "${LIST_LANG}" = "${LIST_LANG#*$LANG_SELECT}" ]; then
echo "Incorrect value"
else
echo -e "LANG_SELECT=${LANG_SELECT}" > ~/.config/lang.conf
echo "OK"
fi
done
fi
source ~/.config/lang.conf
UP_LANG_SELECT=`echo "${LANG_SELECT^^}"`
LANG_UTF8=${LANG_SELECT}"_"${UP_LANG_SELECT}.UTF-8
if [ -z "${PATH_INST}" ]; then
loadkeys ${LANG_SELECT}
export LANG=${LANG_UTF8}
setfont cyr-sun16
clear
else
arch-chroot ${PATH_INST} loadkeys ${LANG_SELECT}
arch-chroot ${PATH_INST} setfont cyr-sun16
echo -e "LANG=${LANG_UTF8}" > ${PATH_INST}/etc/locale.conf
echo -e "KEYMAP=${LANG_SELECT}\nFONT=cyr-sun16\nFONT_MAP=" > ${PATH_INST}/etc/vconsole.conf
sed -i /mnt/etc/locale.gen -e 's|#\(en_US.UTF-8 UTF-8\)|\1|'
sed -i /mnt/etc/locale.gen -e 's|#\(uk_UA.UTF-8 UTF-8\)|\1|'
sed -i /mnt/etc/locale.gen -e 's|#\(ru_RU.UTF-8 UTF-8\)|\1|'
arch-chroot /mnt locale-gen
fi
}

#=======================================
download_type(){
local STR_N FILE_LISTS TMP_DOWN TYPE

show_message LOADING_DATA_SERVER ${SNUG_SERVER}
TMP_DOWN="/tmp/install-types"
TMP_DOWN="/tmp/install/types"
FILE_LISTS=$TMP_DOWN"/lists"
rm -fr $TMP_DOWN
wget --quiet --tries=3 -c https://${SNUG_SERVER}/install-types/lists -P $TMP_DOWN
wget --quiet --tries=3 -c https://${SNUG_SERVER}/install/types/lists -P $TMP_DOWN
if [ $? != 0 ]; then
show_message FAILED_LOAD_FILE https://${SNUG_SERVER}/install-types/lists
show_message FAILED_LOAD_FILE https://${SNUG_SERVER}/install/types/lists
exit 1;
fi
while read line ; do
let STR_N=$STR_N+1;
TYPE=`sed -n ${STR_N}p $FILE_LISTS`;
wget --quiet --tries=3 -c https://${SNUG_SERVER}/install-types/$TYPE/lang/$LANG_SELECT -P $TMP_DOWN/$TYPE/lang
wget --quiet --tries=3 -c https://${SNUG_SERVER}/install/types/$TYPE/lang/$LANG_SELECT -P $TMP_DOWN/$TYPE/lang
if [ $? != 0 ]; then
wget --quiet --tries=3 -c https://${SNUG_SERVER}/install-types/$TYPE/lang/en -P $TMP_DOWN/$TYPE/lang
wget --quiet --tries=3 -c https://${SNUG_SERVER}/install/types/$TYPE/lang/en -P $TMP_DOWN/$TYPE/lang
fi
wget --quiet --tries=3 -c https://${SNUG_SERVER}/install-types/$TYPE/packages -P $TMP_DOWN/$TYPE
wget --quiet --tries=3 -c https://${SNUG_SERVER}/install/types/$TYPE/packages -P $TMP_DOWN/$TYPE
if [ $? != 0 ]; then
show_message FAILED_LOAD_FILE https://${SNUG_SERVER}/install-types/$TYPE/packages
show_message FAILED_LOAD_FILE https://${SNUG_SERVER}/install/types/$TYPE/packages
fi
done < $FILE_LISTS
}
Expand All @@ -549,7 +572,7 @@ select_type() {

download_type

TMP_DOWN="/tmp/install-types"
TMP_DOWN="/tmp/snuglinux/install/types"
FILE_LISTS=${TMP_DOWN}"/lists"
if ! [ -f ${FILE_LISTS} ]; then
show_message FILE_NOT_FOUND ${FILE_LISTS}
Expand Down Expand Up @@ -593,7 +616,7 @@ download_pkg(){
local FILE_LISTS TMP_DOWN TYPE PKG_NAME

PKG_NAME=$1
TMP_DOWN="/tmp/install-types"
TMP_DOWN="/tmp/install/types"
FILE_LISTS=${TMP_DOWN}"/lists"

TYPE=`sed -n ${SELECT_TYPE}p $FILE_LISTS`;
Expand All @@ -603,11 +626,17 @@ download_pkg(){
# if ! [ -d /mnt/$TMP_DOWN/$TYPE/pack ]; then
# mkdit -p /mnt/$TMP_DOWN/$TYPE/pack
# fi
wget --quiet --tries=3 -c https://${SNUG_SERVER}/install-types/${TYPE}/pack/${PKG_NAME} -P ${TMP_DOWN}/${TYPE}/pack
wget --quiet --tries=3 -c https://${SNUG_SERVER}/install/types/${TYPE}/pack/${PKG_NAME} -P ${TMP_DOWN}/${TYPE}/pack
if [ $? = 0 ]; then
if [ -f ${TMP_DOWN}/${TYPE}/pack/${PKG_NAME} ]; then
source ${TMP_DOWN}/${TYPE}/pack/${PKG_NAME}
if [ $? = 0 ]; then
show_message FAILED_EXECUTE_COMMAND ${TMP_DOWN}/${TYPE}/pack/${PKG_NAME}
show_message CONTINUE_PRESS_ANY_KEY
read
fi
fi
read
fi
}

Expand All @@ -631,6 +660,9 @@ install_type() {
install_pkg "${STR_PKG[0]}" "${STR_PKG[1]}" "${STR_PKG[2]}"
if [ $? = 0 ]; then
download_pkg "${STR_PKG[0]}"
else
show_message CONTINUE_PRESS_ANY_KEY
read
fi
done
IFS=$IFS_OLD
Expand Down
24 changes: 21 additions & 3 deletions install-snuglinux.messages
Original file line number Diff line number Diff line change
Expand Up @@ -688,7 +688,16 @@ uk) echo -e "${FC_2}1${FC_3} - nvidia (Остання версія драйве
esac;;

################
2_NVIDIA_340XX)
2_NVIDIA_390XX)
################
case $lang in
ru) echo -e "${FC_2}2${FC_3} - nvidia-390xx (для карт GeForce 400 series и более новых [NVCx и новее]) ${FC_0}";;
uk) echo -e "${FC_2}2${FC_3} - nvidia-390xx (для карт GeForce 400 series та новіших [NVCx і новіше]) ${FC_0}";;
*) echo -e "${FC_2}2${FC_3} - nvidia-390xx (for GeForce 400 series cards and newer [NVCx and newer]) ${FC_0}";;
esac;;

################
3_NVIDIA_340XX)
################
case $lang in
ru) echo -e "${FC_2}2${FC_3} - nvidia-340xx (для карт GeForce 8000/9000 и 100-300 series [NV5x, NV8x, NV9x и NVAx] года производства 2006-2010) ${FC_0}";;
Expand All @@ -697,7 +706,7 @@ uk) echo -e "${FC_2}2${FC_3} - nvidia-340xx (для карт GeForce 8000/9000
esac;;

################
3_NVIDIA_304XX)
4_NVIDIA_304XX)
################
case $lang in
ru) echo -e "${FC_2}2${FC_3} - nvidia-304xx (для карт GeForce 6000/7000 series [NV4x и NV6x] года производства 2004-2006) ${FC_0}";;
Expand All @@ -706,7 +715,7 @@ uk) echo -e "${FC_2}2${FC_3} - nvidia-304xx (для карт GeForce 6000/7000 s
esac;;

################
4_XF86_VIDEO_NOUVEAU)
5_XF86_VIDEO_NOUVEAU)
################
case $lang in
ru) echo -e "${FC_2}4${FC_3} - xf86-video-nouveau (Драйвер с открытым исходным кодом 2D-ускорения для видео карт nVidia) ${FC_0}";;
Expand Down Expand Up @@ -768,6 +777,15 @@ uk) echo -e "${FC_4}Довільна точка монтування розді
*) echo -e "${FC_4}Any partition mount point (${FC_2}i${FC_4} - skip, example: ${FC_3}/home${FC_4}, ${FC_3}/var${FC_4}, ${FC_3}/boot${FC_4}): ${FC_0}";;
esac;;

################
CONTINUE_PRESS_ANY_KEY)
################
case $lang in
ru) echo -e "${FC_4}Для продолжения нажмите любую клавишу${FC_0}";;
uk) echo -e "${FC_4}Для продовження натисніть будь-яку клавішу${FC_0}";;
*) echo -e "${FC_4}To continue, press any key${FC_0}";;
esac;;

*)
echo -e "Unknown string $1";
exit 1
Expand Down

0 comments on commit c331582

Please sign in to comment.