made some progress and checks
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
!#/bin/env bash
|
#!/usr/bin/env bash
|
||||||
#
|
#
|
||||||
# firebee_setup_script.sh
|
# firebee_setup_script.sh
|
||||||
#
|
#
|
||||||
@@ -16,43 +16,147 @@ RESET='\033[0m'
|
|||||||
BLINK_ON="\e[?12h"
|
BLINK_ON="\e[?12h"
|
||||||
BLINK_OFF="\e[?12l"
|
BLINK_OFF="\e[?12l"
|
||||||
|
|
||||||
# clear screen before output
|
# some definitions
|
||||||
clear
|
INST_TEMP="./tmp"
|
||||||
|
|
||||||
echo ""
|
fb_installer_usage() {
|
||||||
echo -e " ${RED}**${RESET} ${YELLOW}FireBee Setup Script${RESET} ${RED}**${RESET}"
|
# clear screen before output
|
||||||
echo -e " ${YELLOW}==========================${RESET}"
|
clear
|
||||||
echo ""
|
|
||||||
echo " This script will create a new setup for your FireBee."
|
|
||||||
echo " When it's finished, you can copy the content of DEST/* to you CompactFlash-Card"
|
|
||||||
echo ""
|
|
||||||
echo " This script relies on a working internet connection. So make sure you have"
|
|
||||||
echo " it working in first place."
|
|
||||||
echo ""
|
|
||||||
echo " What language do you want to install?"
|
|
||||||
echo -e "${BLINK_ON}"
|
|
||||||
read -p " Languages are: en, de, fr, es, it, nl, ru, cs : " LANG
|
|
||||||
echo -e "${BLINK_OFF}"
|
|
||||||
echo
|
|
||||||
|
|
||||||
if [[ ${LANG} == "" ]]; then
|
# welcome user and ask for lang. to install
|
||||||
|
echo ""
|
||||||
|
echo -e " ${RED}**${RESET} ${YELLOW}FireBee Setup Script${RESET} ${RED}**${RESET}"
|
||||||
|
echo -e " ${YELLOW}==========================${RESET}"
|
||||||
|
echo ""
|
||||||
|
echo " This script will create a new setup for your FireBee."
|
||||||
|
echo " When it's finished, you can copy the content of DEST/* to you CompactFlash-Card"
|
||||||
|
echo ""
|
||||||
|
echo " This script relies on a working internet connection. So make sure you have"
|
||||||
|
echo " it working in first place."
|
||||||
|
echo ""
|
||||||
|
echo " What language do you want to install?"
|
||||||
|
echo -e "${BLINK_ON}"
|
||||||
|
read -p " Languages are: en, de, fr, es, it, nl, ru, cs : " LANG
|
||||||
|
echo -e "${BLINK_OFF}"
|
||||||
|
echo
|
||||||
|
|
||||||
|
# give user a feedback which lang. is used
|
||||||
|
if [[ ${LANG} == "" ]]; then
|
||||||
echo "You didn't give any language. Going default with English"
|
echo "You didn't give any language. Going default with English"
|
||||||
elif [ ${LANG} == "en" ]; then
|
elif [ ${LANG} == "en" ]; then
|
||||||
echo "Okay, using English"
|
echo "Okay, using English"
|
||||||
elif [[ ${LANG} == "de" ]]; then
|
elif [[ ${LANG} == "de" ]]; then
|
||||||
echo "Okay, using German"
|
echo "Okay, using German"
|
||||||
elif [[ ${LANG} == "fr" ]]; then
|
elif [[ ${LANG} == "fr" ]]; then
|
||||||
echo "Okay, using French"
|
echo "Okay, using French"
|
||||||
elif [[ ${LANG} == "es" ]]; then
|
elif [[ ${LANG} == "es" ]]; then
|
||||||
echo "Okay, using Spanish"
|
echo "Okay, using Spanish"
|
||||||
elif [[ ${LANG} == "it" ]]; then
|
elif [[ ${LANG} == "it" ]]; then
|
||||||
echo "Okay, using Italian"
|
echo "Okay, using Italian"
|
||||||
elif [[ ${LANG} == "nl" ]]; then
|
elif [[ ${LANG} == "nl" ]]; then
|
||||||
echo "Okay, using Dutch"
|
echo "Okay, using Dutch"
|
||||||
elif [[ ${LANG} == "ru" ]]; then
|
elif [[ ${LANG} == "ru" ]]; then
|
||||||
echo "Okay, using Russian"
|
echo "Okay, using Russian"
|
||||||
elif [[ ${LANG} == "cs" ]]; then
|
elif [[ ${LANG} == "cs" ]]; then
|
||||||
echo "Okay, using Czech"
|
echo "Okay, using Czech"
|
||||||
else
|
else
|
||||||
echo -e "I'm sorry, Dave. I'm afraid I can't do \"${LANG}\"!"
|
echo -e "I'm sorry, Dave. I'm afraid I can't do \"${LANG}\"!"
|
||||||
fi
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
fb_installer_test_mainloop() {
|
||||||
|
fb_installer_check_tmp
|
||||||
|
}
|
||||||
|
|
||||||
|
fb_installer_check_tmp() {
|
||||||
|
# check if there is a tmp dir to install and is it
|
||||||
|
# writeable by user?
|
||||||
|
|
||||||
|
# make dir if not exists
|
||||||
|
if [ ! -d "$INST_TEMP" ]; then
|
||||||
|
mkdir -p "$INST_TEMP"
|
||||||
|
# check if mkdir was successful
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
echo "${RED}Error${RESET}: Could not create Install-Dir '${INST_TEMP}'!"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# check if it is writable
|
||||||
|
if [ -w "$INST_TEMP" ]; then
|
||||||
|
# check if the directory is not empty
|
||||||
|
if [ "$(ls -A "$INST_TEMP")" ]; then
|
||||||
|
rm -rf "${INST_TEMP:?}/"*
|
||||||
|
fi
|
||||||
|
fb_installer_check_bin
|
||||||
|
else
|
||||||
|
echo "${RED}Error${RESET}: '${INST_TEMP}' is not writeable!"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
fb_installer_check_bin() {
|
||||||
|
# list of binaries we need as array
|
||||||
|
bin_needed=("wget" "git" "cp" "rm" "mv" "sed" "cut" "grep" "unzip" "install")
|
||||||
|
|
||||||
|
# Flag,
|
||||||
|
bin_avail=true
|
||||||
|
|
||||||
|
# empty list for binaries who are not available
|
||||||
|
missing_bin=()
|
||||||
|
|
||||||
|
# check if binary is available
|
||||||
|
for prog in "${bin_needed[@]}"; do
|
||||||
|
if which "$prog" &>/dev/null; then
|
||||||
|
# just continue, no output
|
||||||
|
continue
|
||||||
|
else
|
||||||
|
bin_avail=false
|
||||||
|
missing_bin+=("$prog") # add missing binary to a list
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# when every binary is there, continue to download
|
||||||
|
if ${bin_avail}; then
|
||||||
|
fb_installer_download
|
||||||
|
else
|
||||||
|
echo -e "${RED}Error${RESET}: Missing ${missing_bin[@]}! Please install it first"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fb_installer_download() {
|
||||||
|
# first cd into INSTALL-DIR
|
||||||
|
cd ${INST_TEMP}
|
||||||
|
|
||||||
|
# clone setup repo
|
||||||
|
echo "Cloning git repo"
|
||||||
|
git clone https://codeberg.org/firebee/FireBee_Setup.git &>/dev/null
|
||||||
|
|
||||||
|
# download latest freemint
|
||||||
|
# download bootable mint build and decompress it
|
||||||
|
wget https://tho-otto.de/snapshots/freemint/bootable/freemint-latest-col-firebee.zip &>/dev/null
|
||||||
|
unzip -d freemint freemint-latest-col-firebee.zip &>/dev/null
|
||||||
|
rm freemint-latest-col-firebee.zip &>/dev/null
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
fb_installer_install_mint() {
|
||||||
|
echo "install mint"
|
||||||
|
}
|
||||||
|
|
||||||
|
fb_installer_hidden_gems() {
|
||||||
|
# download a pre-packed nvdi, fvdi or both
|
||||||
|
#
|
||||||
|
# note: since we don't ship it by default,
|
||||||
|
# this can be enabled by adding an argument
|
||||||
|
# to the scriptname so it's kind of hidden
|
||||||
|
# and will not packed when the arguments
|
||||||
|
# are omitted
|
||||||
|
echo "none"
|
||||||
|
}
|
||||||
|
|
||||||
|
fb_installer_usage
|
||||||
|
fb_installer_test_mainloop
|
||||||
|
|||||||
Reference in New Issue
Block a user