Unverified Commit dce8f6ea authored by Aristo Chen's avatar Aristo Chen Committed by GitHub
Browse files

Increase readability (#91)

parent b4691785
......@@ -17,27 +17,27 @@ mkdir -p $COPY_TO
function database_backup ()
{
if which mysql >/dev/null; then
mysqldump -Q -q -e -R --add-drop-table -A -u $USER -p$PASSWORD > $COPY_TO/all.db
for db in $(echo 'SHOW DATABASES;'|mysql -u$USER -p$PASSWORD -h$HOST|grep -v '^Database$'|grep -v "^performance_schema" |grep -v "^information_schema" |grep -v "^mysql");
do
mysqldump \
-u$USER -p$PASSWORD -h$HOST \
-Q -c -C --add-drop-table --add-locks --quick --lock-tables \
$db | gzip --best -c > $COPY_TO/$DBBACKUPNAME-$db.sql.gz;
echo -e "[\e[0;32m o.k. \x1B[0m] \e[1;32m$1\x1B[0mDatabase $db backup"
done;
mysqldump -Q -q -e -R --add-drop-table -A -u $USER -p$PASSWORD > $COPY_TO/all.db
for db in $(echo 'SHOW DATABASES;'|mysql -u$USER -p$PASSWORD -h$HOST|grep -v '^Database$'|grep -v "^performance_schema" |grep -v "^information_schema" |grep -v "^mysql");
do
mysqldump \
-u$USER -p$PASSWORD -h$HOST \
-Q -c -C --add-drop-table --add-locks --quick --lock-tables \
$db | gzip --best -c > $COPY_TO/$DBBACKUPNAME-$db.sql.gz;
echo -e "[\e[0;32m o.k. \x1B[0m] \e[1;32m$1\x1B[0mDatabase $db backup"
done;
fi
}
function web_backup ()
{
if [[ -d /var/www ]]; then
echo -e "[\e[0;32m o.k. \x1B[0m] \e[1;32m$1\x1B[0mWebsites backup"
for x in $(find $COPY_FROM -maxdepth 2 -name "web*" -type d -print0 | xargs -0)
do
tar -cpvzf $COPY_TO/$WEBBACKUPNAME-$(basename $x).tar.gz $x &> /dev/null
done;
if [[ -d /var/www ]]; then
echo -e "[\e[0;32m o.k. \x1B[0m] \e[1;32m$1\x1B[0mWebsites backup"
for x in $(find $COPY_FROM -maxdepth 2 -name "web*" -type d -print0 | xargs -0)
do
tar -cpvzf $COPY_TO/$WEBBACKUPNAME-$(basename $x).tar.gz $x &> /dev/null
done;
fi
}
......@@ -75,11 +75,11 @@ function conf_backup ()
function mail_backup ()
{
if [[ -d /var/vmail ]]; then
if [[ -d /var/vmail ]]; then
service dovecot stop &> /dev/null
service postfix stop &> /dev/null
echo -e "[\e[0;32m o.k. \x1B[0m] \e[1;32m$1\x1B[0mMail backup"
tar cvPfz $COPY_TO/$FILEBACKUPNAME-mail.tgz /var/vmail
tar cvPfz $COPY_TO/$FILEBACKUPNAME-mail.tgz /var/vmail
service postfix start &> /dev/null
service dovecot start &> /dev/null
fi
......
......@@ -2,22 +2,21 @@
REMOTE=
function sync_backup ()
function sync_backup ()
{
echo -e "[\e[0;32m o.k. \x1B[0m] \e[1;32m$1\x1B[0mSync over trusted ssh net"
filename=filelist.txt
IFS=$'\n'
for next in `cat $filename`
do
if [[ $next != \#* ]]; then
echo $next
rsync --dry-run -az --progress $REMOTE:$next ${next%*/*}
[[ ! $? -eq 0 ]] && read
fi
done
echo -e "[\e[0;32m o.k. \x1B[0m] \e[1;32m$1\x1B[0mSync over trusted ssh net"
filename=filelist.txt
IFS=$'\n'
for next in `cat $filename`
do
if [[ $next != \#* ]]; then
echo $next
rsync --dry-run -az --progress $REMOTE:$next ${next%*/*}
[[ ! $? -eq 0 ]] && read
fi
done
}
sync_backup
......@@ -25,8 +25,8 @@ fi
#
wget -q --spider http://github.com
if [[ $? -ne 0 ]]; then
read -n 1 -s -p "Warning: Configuration cannot work properly without a working internet connection. \
Press CTRL C to stop or any key to ignore and continue."
read -n 1 -s -p "Warning: Configuration cannot work properly without a working internet connection. \
Press CTRL C to stop or any key to ignore and continue."
fi
......@@ -58,12 +58,12 @@ fi
# Script parameters handling
while [[ $1 == *=* ]]; do
parameter=${1%%=*}
value=${1##*=}
shift
echo "Command line: setting $parameter to ${value:-(empty)}"
eval "$parameter=\"$value\""
scripted=true
parameter=${1%%=*}
value=${1##*=}
shift
echo "Command line: setting $parameter to ${value:-(empty)}"
eval "$parameter=\"$value\""
scripted=true
done
# Display help
......
......@@ -199,8 +199,8 @@ check_if_installed (){
function is_package_manager_running() {
if ps -C apt-get,apt,dpkg >/dev/null ; then
[[ -z $scripted ]] && dialog --colors --title " \Z1Error\Z0 " --backtitle "$BACKTITLE" --no-collapse --msgbox \
"\n\Z0Package manager is running in the background. \n\nCan't install dependencies. Try again later." 9 53
[[ -z $scripted ]] && dialog --colors --title " \Z1Error\Z0 " --backtitle "$BACKTITLE" --no-collapse --msgbox \
"\n\Z0Package manager is running in the background. \n\nCan't install dependencies. Try again later." 9 53
return 0
else
return 1
......@@ -232,15 +232,15 @@ function fancy_wget()
function display_qr_code()
{
clear
SECRET=$(head -1 /root/.google_authenticator)
qrencode -m 2 -d 9 -8 -t ANSI256 "otpauth://totp/test?secret=$SECRET"
echo -e "\nHow to setup your one type password generator?\n"
echo -e "\nInstall a one-time password authenticator on your mobile device (e.g. FreeOTP) from the Android \
clear
SECRET=$(head -1 /root/.google_authenticator)
qrencode -m 2 -d 9 -8 -t ANSI256 "otpauth://totp/test?secret=$SECRET"
echo -e "\nHow to setup your one type password generator?\n"
echo -e "\nInstall a one-time password authenticator on your mobile device (e.g. FreeOTP) from the Android \
market or F-Droid. \n\nIn the application menu, click the corresponding button to create a new account and either \
scan the QR code or enter the secret key manually:\\n\n$SECRET \n\nYou should now see a new passcode token being \
generated every 60 seconds on your phone.\n" | fold -sw 60
read -n 1 -s -r -p "Press any key to continue"
read -n 1 -s -r -p "Press any key to continue"
}
......@@ -308,15 +308,15 @@ function description
;;
*mirrors.netix.net/armbian/apt/*)
echo "Bulgarija"
;;
;;
*mirrors.dotsrc.org/armbian-apt/*)
echo "Denmark"
;;
;;
*.armbian.com*)
echo "Estonia"
;;
*)
echo ""
echo ""
;;
esac
}
......@@ -327,27 +327,27 @@ function description
#
function generic_select()
{
IFS=$' '
PARAMETER=($1)
local LIST=()
for i in "${PARAMETER[@]}"
do
if [[ -n $3 ]]; then
[[ ${i[0]} -ge $3 ]] && \
LIST+=( "${i[0]//[[:blank:]]/}" "" )
else
LIST+=( "${i[0]//[[:blank:]]/}" "" )
fi
done
LIST_LENGTH=$((${#LIST[@]}/2));
if [ "$LIST_LENGTH" -eq 1 ]; then
PARAMETER=${PARAMETER[0]}
else
exec 3>&1
PARAMETER=$(dialog --nocancel --backtitle "$BACKTITLE" --no-collapse \
--title "$2" --clear --menu "" $((6+${LIST_LENGTH})) 0 $((1+${LIST_LENGTH})) "${LIST[@]}" 2>&1 1>&3)
exec 3>&-
fi
IFS=$' '
PARAMETER=($1)
local LIST=()
for i in "${PARAMETER[@]}"
do
if [[ -n $3 ]]; then
[[ ${i[0]} -ge $3 ]] && \
LIST+=( "${i[0]//[[:blank:]]/}" "" )
else
LIST+=( "${i[0]//[[:blank:]]/}" "" )
fi
done
LIST_LENGTH=$((${#LIST[@]}/2));
if [ "$LIST_LENGTH" -eq 1 ]; then
PARAMETER=${PARAMETER[0]}
else
exec 3>&1
PARAMETER=$(dialog --nocancel --backtitle "$BACKTITLE" --no-collapse \
--title "$2" --clear --menu "" $((6+${LIST_LENGTH})) 0 $((1+${LIST_LENGTH})) "${LIST[@]}" 2>&1 1>&3)
exec 3>&-
fi
}
......@@ -475,7 +475,7 @@ function other_kernel_version ()
\n\n\Z1In case of troubles expect no help!\Z0"
if [[ -n $ACKNOWLEDGEMENT ]]; then
exec 3>&1
TARGET_VERSION=$(dialog --cancel-label "Cancel" --backtitle "$BACKTITLE" --no-collapse \
TARGET_VERSION=$(dialog --cancel-label "Cancel" --backtitle "$BACKTITLE" --no-collapse \
--title "Switch from and reboot" --clear --menu "\n${CURRENT_VERSION} $(uname -r) \n \n" \
$((9+${LIST_LENGTH})) 62 25 "${LIST[@]}" 2>&1 1>&3)
exitstatus=$?;
......@@ -544,28 +544,28 @@ function aval_dtbs ()
{
if [[ $LINUXFAMILY == cubox ]]; then
local width=80
LIST=("imx6dl-hummingboard.dtb" "HB Solo/DualLite" "imx6dl-hummingboard-emmc-som-v15.dtb" "HB Solo/DualLite v1.5 with eMMC" "imx6dl-hummingboard-som-v15.dtb" "HB Solo/DualLite v1.5" \
"imx6dl-hummingboard2.dtb" "HB2 Solo/DualLite" "imx6dl-hummingboard2-emmc-som-v15.dtb" "HB2 Solo/DualLite v1.5 with eMMC" "imx6dl-hummingboard2-som-v15.dtb" "HB2 Solo/DualLite v1.5" \
"imx6q-hummingboard.dtb" "HB Dual/Quad" "imx6q-hummingboard-emmc-som-v15.dtb" "HB Dual/Quad v1.5 with eMMC" "imx6q-hummingboard-som-v15.dtb" "HB Dual/Quad v1.5" \
"imx6q-hummingboard2.dtb" "HB2 Dual/Quad" "imx6q-hummingboard2-emmc-som-v15.dtb" "HB2 Dual/Quad v1.5 with eMMC" "imx6q-hummingboard2-som-v15.dtb" "HB2 Dual/Quad v1.5" \
"imx6dl-cubox-i.dtb" "Cubox-i Solo/DualLite" "imx6dl-cubox-i-emmc-som-v15.dtb" "Cubox-i Solo/DualLite v1.5 with eMMC" "imx6dl-cubox-i-som-v15.dtb" "Cubox-i Solo/DualLite v1.5" \
"imx6q-cubox-i.dtb" "Cubox-i Dual/Quad" "imx6q-cubox-i-emmc-som-v15.dtb" "Cubox-i Dual/Quad v1.5 with eMMC" "imx6q-cubox-i-som-v15.dtb" "Cubox-i Dual/Quad v1.5")
local width=80
LIST=("imx6dl-hummingboard.dtb" "HB Solo/DualLite" "imx6dl-hummingboard-emmc-som-v15.dtb" "HB Solo/DualLite v1.5 with eMMC" "imx6dl-hummingboard-som-v15.dtb" "HB Solo/DualLite v1.5" \
"imx6dl-hummingboard2.dtb" "HB2 Solo/DualLite" "imx6dl-hummingboard2-emmc-som-v15.dtb" "HB2 Solo/DualLite v1.5 with eMMC" "imx6dl-hummingboard2-som-v15.dtb" "HB2 Solo/DualLite v1.5" \
"imx6q-hummingboard.dtb" "HB Dual/Quad" "imx6q-hummingboard-emmc-som-v15.dtb" "HB Dual/Quad v1.5 with eMMC" "imx6q-hummingboard-som-v15.dtb" "HB Dual/Quad v1.5" \
"imx6q-hummingboard2.dtb" "HB2 Dual/Quad" "imx6q-hummingboard2-emmc-som-v15.dtb" "HB2 Dual/Quad v1.5 with eMMC" "imx6q-hummingboard2-som-v15.dtb" "HB2 Dual/Quad v1.5" \
"imx6dl-cubox-i.dtb" "Cubox-i Solo/DualLite" "imx6dl-cubox-i-emmc-som-v15.dtb" "Cubox-i Solo/DualLite v1.5 with eMMC" "imx6dl-cubox-i-som-v15.dtb" "Cubox-i Solo/DualLite v1.5" \
"imx6q-cubox-i.dtb" "Cubox-i Dual/Quad" "imx6q-cubox-i-emmc-som-v15.dtb" "Cubox-i Dual/Quad v1.5 with eMMC" "imx6q-cubox-i-som-v15.dtb" "Cubox-i Dual/Quad v1.5")
else
local width=52
LIST=("xu4" "Odroid XU4" "xu3" "Odroid XU3" "xu3l" "Odroid XU3 Lite" "hc1" "Odroid HC1/HC2")
local width=52
LIST=("xu4" "Odroid XU4" "xu3" "Odroid XU3" "xu3l" "Odroid XU3 Lite" "hc1" "Odroid HC1/HC2")
fi
LIST_LENGTH=$((${#LIST[@]}/2));
if [ "$LIST_LENGTH" -eq 1 ]; then
TARGET_BOARD=${AVAL_KERNEL[0]}
TARGET_BOARD=${AVAL_KERNEL[0]}
else
exec 3>&1
TARGET_BOARD=$(dialog --cancel-label "Cancel" --backtitle "$BACKTITLE" --no-collapse \
--title "Select optimised board configuration" --clear --menu \
"" $((6+${LIST_LENGTH})) ${width} 25 "${LIST[@]}" 2>&1 1>&3)
exitstatus=$?;
exec 3>&-
exec 3>&1
TARGET_BOARD=$(dialog --cancel-label "Cancel" --backtitle "$BACKTITLE" --no-collapse \
--title "Select optimised board configuration" --clear --menu \
"" $((6+${LIST_LENGTH})) ${width} 25 "${LIST[@]}" 2>&1 1>&3)
exitstatus=$?;
exec 3>&-
fi
}
......@@ -585,19 +585,19 @@ function get_a20modes ()
local LIST=()
for i in "${SCREEN_RESOLUTION[@]}"
do
LIST+=( "${i[0]//[[:blank:]]/}" "" )
LIST+=( "${i[0]//[[:blank:]]/}" "" )
done
LIST_LENGTH=$((${#LIST[@]}/2));
#echo $LIST_LENGTH
#exit
if [ "$LIST_LENGTH" -eq 1 ]; then
SCREEN_RESOLUTION=${SCREEN_RESOLUTION[0]}
SCREEN_RESOLUTION=${SCREEN_RESOLUTION[0]}
else
exec 3>&1
SCREEN_RESOLUTION=$(dialog --nocancel --backtitle "$BACKTITLE" --no-collapse \
--title "Select video mode" --clear --menu \
"" $((6+${LIST_LENGTH})) 25 $((1+${LIST_LENGTH})) "${LIST[@]}" 2>&1 1>&3)
exec 3>&-
exec 3>&1
SCREEN_RESOLUTION=$(dialog --nocancel --backtitle "$BACKTITLE" --no-collapse \
--title "Select video mode" --clear --menu \
"" $((6+${LIST_LENGTH})) 25 $((1+${LIST_LENGTH})) "${LIST[@]}" 2>&1 1>&3)
exec 3>&-
fi
}
......@@ -611,27 +611,27 @@ function get_a20modes ()
function get_odroidmodes ()
{
IFS=$'\r\n'
GLOBIGNORE='*'
SCREEN_RESOLUTION=($(cat /boot/boot.ini | grep -w "# setenv" | grep "hz" | cut -d'"' -f 2))
IFS=$'\r\n'
GLOBIGNORE='*'
SCREEN_RESOLUTION=($(cat /boot/boot.ini | grep -w "# setenv" | grep "hz" | cut -d'"' -f 2))
SCREEN_RESOLUTION=($(cat /boot/boot.ini | grep "Progressive" | grep -v "setenv" | cut -d'"' -f 2))
local LIST=()
for i in "${SCREEN_RESOLUTION[@]}"
do
LIST+=( "${i[0]//[[:blank:]]/}" "" )
done
LIST_LENGTH=$((${#LIST[@]}/2));
#echo $LIST_LENGTH
#exit
if [ "$LIST_LENGTH" -eq 1 ]; then
SCREEN_RESOLUTION=${SCREEN_RESOLUTION[0]}
else
exec 3>&1
SCREEN_RESOLUTION=$(dialog --nocancel --backtitle "$BACKTITLE" --no-collapse \
--title "Select video mode" --clear --menu \
"" $((6+${LIST_LENGTH})) 25 $((1+${LIST_LENGTH})) "${LIST[@]}" 2>&1 1>&3)
exec 3>&-
fi
local LIST=()
for i in "${SCREEN_RESOLUTION[@]}"
do
LIST+=( "${i[0]//[[:blank:]]/}" "" )
done
LIST_LENGTH=$((${#LIST[@]}/2));
#echo $LIST_LENGTH
#exit
if [ "$LIST_LENGTH" -eq 1 ]; then
SCREEN_RESOLUTION=${SCREEN_RESOLUTION[0]}
else
exec 3>&1
SCREEN_RESOLUTION=$(dialog --nocancel --backtitle "$BACKTITLE" --no-collapse \
--title "Select video mode" --clear --menu \
"" $((6+${LIST_LENGTH})) 25 $((1+${LIST_LENGTH})) "${LIST[@]}" 2>&1 1>&3)
exec 3>&-
fi
}
......@@ -650,19 +650,19 @@ function get_h3modes ()
local LIST=()
for i in "${SCREEN_RESOLUTION[@]}"
do
LIST+=( "${i[0]//[[:blank:]]/}" "" )
LIST+=( "${i[0]//[[:blank:]]/}" "" )
done
LIST_LENGTH=$((${#LIST[@]}/2));
#echo $LIST_LENGTH
#exit
if [ "$LIST_LENGTH" -eq 1 ]; then
SCREEN_RESOLUTION=${SCREEN_RESOLUTION[0]}
SCREEN_RESOLUTION=${SCREEN_RESOLUTION[0]}
else
exec 3>&1
SCREEN_RESOLUTION=$(dialog --nocancel --backtitle "$BACKTITLE" --no-collapse \
--title "Select video mode" --clear --menu \
"" $((6+${LIST_LENGTH})) 25 $((1+${LIST_LENGTH})) "${LIST[@]}" 2>&1 1>&3)
exec 3>&-
exec 3>&1
SCREEN_RESOLUTION=$(dialog --nocancel --backtitle "$BACKTITLE" --no-collapse \
--title "Select video mode" --clear --menu \
"" $((6+${LIST_LENGTH})) 25 $((1+${LIST_LENGTH})) "${LIST[@]}" 2>&1 1>&3)
exec 3>&-
fi
}
......@@ -699,12 +699,12 @@ function add_choose_user ()
echo "Trying to add user $CHOSEN_USER"
adduser $CHOSEN_USER || return
elif [ "$LIST_LENGTH" -eq 1 ]; then
CHOSEN_USER=${USERS[0]}
CHOSEN_USER=${USERS[0]}
else
exec 3>&1
CHOSEN_USER=$(dialog --nocancel --backtitle "$BACKTITLE" --no-collapse \
--title "Select unprivileged user" --clear --menu "" $((6+${LIST_LENGTH})) 40 15 "${LIST[@]}" 2>&1 1>&3)
exec 3>&-
exec 3>&1
CHOSEN_USER=$(dialog --nocancel --backtitle "$BACKTITLE" --no-collapse \
--title "Select unprivileged user" --clear --menu "" $((6+${LIST_LENGTH})) 40 15 "${LIST[@]}" 2>&1 1>&3)
exec 3>&-
fi
}
......
......@@ -53,7 +53,7 @@ function initialize_lte ()
# Source repository: https://github.com/ssinyagin/wwan_udev_rules
if ! check_if_installed ppp then; then
apt-get -y -qq install ppp >/dev/null 2>&1
apt-get -y -qq install ppp >/dev/null 2>&1
fi
cat >/etc/udev/rules.d/99-wwan.rules <<'EOT'
......@@ -224,16 +224,16 @@ function check_advanced_modes ()
#
function create_if_config() {
address=$(ip -4 addr show dev $1 | awk '/inet/ {print $2}' | cut -d'/' -f1)
netmask=$(ip -4 addr show dev $1 | awk '/inet/ {print $2}' | cut -d'/' -f2)
gateway=$(route -n | grep 'UG[ \t]' | awk '{print $2}' | sed -n '1p')
echo -e "# armbian-config created"
echo -e "source /etc/network/interfaces.d/*\n"
if [[ "$3" == "fixed" ]]; then
echo -e "# Local loopback\nauto lo\niface lo init loopback\n"
echo -e "# Interface $2\nauto $2\nallow-hotplug $2"
echo -e "iface $2 inet static\n\taddress $address\n\tnetmask $netmask\n\tgateway $gateway\n\tdns-nameservers 8.8.8.8"
fi
address=$(ip -4 addr show dev $1 | awk '/inet/ {print $2}' | cut -d'/' -f1)
netmask=$(ip -4 addr show dev $1 | awk '/inet/ {print $2}' | cut -d'/' -f2)
gateway=$(route -n | grep 'UG[ \t]' | awk '{print $2}' | sed -n '1p')
echo -e "# armbian-config created"
echo -e "source /etc/network/interfaces.d/*\n"
if [[ "$3" == "fixed" ]]; then
echo -e "# Local loopback\nauto lo\niface lo init loopback\n"
echo -e "# Interface $2\nauto $2\nallow-hotplug $2"
echo -e "iface $2 inet static\n\taddress $address\n\tnetmask $netmask\n\tgateway $gateway\n\tdns-nameservers 8.8.8.8"
fi
}
......@@ -273,7 +273,7 @@ function check_port ()
# check wifi high throughput
#
function check_ht_capab ()
{
{
declare -a arr=("[HT40+][LDPC][SHORT-GI-20][SHORT-GI-40][TX-STBC][RX-STBC1][DSSS_CCK-40][SMPS-STATIC]" \
"[HT40-][SHORT-GI-40][SHORT-GI-40][DSSS_CCK-40]" "[SHORT-GI-20][SHORT-GI-40][HT40+]" "[DSSS_CK-40][HT20+]" "")
local j=0
......@@ -336,13 +336,13 @@ function check_channels ()
#
function netmask_to_cidr ()
{
IFS=' '
local bits=0
for octet in $(echo $1| sed 's/\./ /g'); do
binbits=$(echo "obase=2; ibase=10; ${octet}"| bc | sed 's/0//g')
let bits+=${#binbits}
done
echo "${bits}"
IFS=' '
local bits=0
for octet in $(echo $1| sed 's/\./ /g'); do
binbits=$(echo "obase=2; ibase=10; ${octet}"| bc | sed 's/0//g')
let bits+=${#binbits}
done
echo "${bits}"
}
......@@ -362,12 +362,12 @@ exec 3>&1
read -r address;read -r netmask;read -r gateway
if [[ $? = 0 ]]; then
localuuid=$(LC_ALL=C nmcli -f UUID,DEVICE connection show | grep $1 | awk '{print $1}')
# convert netmask value to CIDR if required
if [[ $netmask =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then
CIDR=$(netmask_to_cidr ${netmask})
else
CIDR=${netmask}
fi
# convert netmask value to CIDR if required
if [[ $netmask =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then
CIDR=$(netmask_to_cidr ${netmask})
else
CIDR=${netmask}
fi
if [[ -n "$localuuid" ]]; then
# adjust existing
nmcli con mod $localuuid ipv4.method manual ipv4.addresses "$address/$CIDR" >/dev/null 2>&1
......@@ -407,10 +407,10 @@ function systemd_ip_editor ()
2>&1 1>&3 | {
read -r address;read -r netmask;read -r gateway
if [[ $? = 0 ]]; then
echo -e "[Network]" >>$filename
echo -e "Address=$address" >> $filename
echo -e "Gateway=$gateway" >> $filename
echo -e "DNS=8.8.8.8" >> $filename
echo -e "[Network]" >>$filename
echo -e "Address=$address" >> $filename
echo -e "Gateway=$gateway" >> $filename
echo -e "DNS=8.8.8.8" >> $filename
fi
}
fi
......@@ -435,10 +435,10 @@ function ip_editor ()
2>&1 1>&3 | {
read -r address;read -r netmask;read -r gateway
if [[ $? = 0 ]]; then
echo -e "# armbian-config created\nsource /etc/network/interfaces.d/*\n" >$3
echo -e "# Local loopback\nauto lo\niface lo inet loopback\n" >> $3
echo -e "# Interface $2\nauto $2\nallow-hotplug $2\niface $2 inet static\
\n\taddress $address\n\tnetmask $netmask\n\tgateway $gateway\n\tdns-nameservers 8.8.8.8" >> $3
echo -e "# armbian-config created\nsource /etc/network/interfaces.d/*\n" >$3
echo -e "# Local loopback\nauto lo\niface lo inet loopback\n" >> $3
echo -e "# Interface $2\nauto $2\nallow-hotplug $2\niface $2 inet static\
\n\taddress $address\n\tnetmask $netmask\n\tgateway $gateway\n\tdns-nameservers 8.8.8.8" >> $3
fi
}
......@@ -462,11 +462,11 @@ function wlan_edit_basic ()
2>&1 1>&3 | {
read -r ssid;read -r wpa_passphrase;read -r channel
if [[ $? = 0 ]]; then
sed -i "s/^ssid=.*/ssid=$ssid/" /etc/hostapd.conf
sed -i "s/^wpa_passphrase=.*/wpa_passphrase=$wpa_passphrase/" /etc/hostapd.conf
sed -i "s/^channel=.*/channel=$channel/" /etc/hostapd.conf
wpa_psk=$(wpa_passphrase $ssid $wpa_passphrase | grep '^[[:blank:]]*[^[:blank:]#;]' | grep psk | cut -d= -f2-)
sed -i "s/^wpa_psk=.*/wpa_psk=$wpa_psk/" /etc/hostapd.conf
sed -i "s/^ssid=.*/ssid=$ssid/" /etc/hostapd.conf
sed -i "s/^wpa_passphrase=.*/wpa_passphrase=$wpa_passphrase/" /etc/hostapd.conf
sed -i "s/^channel=.*/channel=$channel/" /etc/hostapd.conf
wpa_psk=$(wpa_passphrase $ssid $wpa_passphrase | grep '^[[:blank:]]*[^[:blank:]#;]' | grep psk | cut -d= -f2-)
sed -i "s/^wpa_psk=.*/wpa_psk=$wpa_psk/" /etc/hostapd.conf
fi
}
}
......@@ -553,17 +553,17 @@ function get_wlan_interface ()
local LIST=()
for i in "${WLAN_INTERFACES[@]}"
do
LIST+=( "${i[0]//[[:blank:]]/}" "" )
LIST+=( "${i[0]//[[:blank:]]/}" "" )
done
LIST_LENGTH=$((${#LIST[@]}/2));
if [ "$LIST_LENGTH" -eq 1 ]; then
WIRELESS_ADAPTER=${WLAN_INTERFACES[0]}
WIRELESS_ADAPTER=${WLAN_INTERFACES[0]}
else
exec 3>&1
WIRELESS_ADAPTER=$(dialog --nocancel --backtitle "$BACKTITLE" --no-collapse \
--title "Select interface" --clear --menu "" $((6+${LIST_LENGTH})) 40 15 "${LIST[@]}" 2>&1 1>&3)
exec 3>&-
exec 3>&1
WIRELESS_ADAPTER=$(dialog --nocancel --backtitle "$BACKTITLE" --no-collapse \
--title "Select interface" --clear --menu "" $((6+${LIST_LENGTH})) 40 15 "${LIST[@]}" 2>&1 1>&3)
exec 3>&-
fi
}
......@@ -624,26 +624,26 @@ function select_default_interface ()
local LIST=()
for i in "${ADAPTER[@]}"
do
local IPADDR=$(LC_ALL=C ip -4 addr show dev ${i[0]} | awk '/inet/ {print $2}' | cut -d'/' -f1)
ADD_SPEED=""
[[ $i == eth* || $i == en* ]] && ADD_SPEED=$(ethtool $i | grep Speed)
[[ $i == wl* ]] && ADD_SPEED=$(LC_ALL=C nmcli -f RATE,DEVICE,ACTIVE dev wifi list | grep $i | grep yes | awk 'NF==4{print $1""$2}NF==1' | sed -e 's/^/ Speed: /' | tail -1)
if [[ $1 == "default" ]]; then
[[ $IPADDR != "172.24.1.1" && -n $IPADDR ]] && LIST+=( "${i[0]//[[:blank:]]/}" "${IPADDR} ${ADD_SPEED}" )
else
[[ $IPADDR != "172.24.1.1" ]] && LIST+=( "${i[0]//[[:blank:]]/}" "${IPADDR} ${ADD_SPEED}" )
fi
local IPADDR=$(LC_ALL=C ip -4 addr show dev ${i[0]} | awk '/inet/ {print $2}' | cut -d'/' -f1)
ADD_SPEED=""
[[ $i == eth* || $i == en* ]] && ADD_SPEED=$(ethtool $i | grep Speed)
[[ $i == wl* ]] && ADD_SPEED=$(LC_ALL=C nmcli -f RATE,DEVICE,ACTIVE dev wifi list | grep $i | grep yes | awk 'NF==4{print $1""$2}NF==1' | sed -e 's/^/ Speed: /' | tail -1)
if [[ $1 == "default" ]]; then
[[ $IPADDR != "172.24.1.1" && -n $IPADDR ]] && LIST+=( "${i[0]//[[:blank:]]/}" "${IPADDR} ${ADD_SPEED}" )
else
[[ $IPADDR != "172.24.1.1" ]] && LIST+=( "${i[0]//[[:blank:]]/}" "${IPADDR} ${ADD_SPEED}" )
fi
done
LIST_LENGTH=$((${#LIST[@]}/2));
if [ "$LIST_LENGTH" -eq 0 ]; then
DEFAULT_ADAPTER="lo"
DEFAULT_ADAPTER="lo"
elif [ "$LIST_LENGTH" -eq 1 ]; then
DEFAULT_ADAPTER=${ADAPTER[0]}
DEFAULT_ADAPTER=${ADAPTER[0]}
else
exec 3>&1
DEFAULT_ADAPTER=$(dialog --nocancel --backtitle "$BACKTITLE" --no-collapse \
--title "Select $1 interface" --clear --menu "" $((6+${LIST_LENGTH})) 74 14 "${LIST[@]}" 2>&1 1>&3)
exec 3>&-
exec 3>&1
DEFAULT_ADAPTER=$(dialog --nocancel --backtitle "$BACKTITLE" --no-collapse \
--title "Select $1 interface" --clear --menu "" $((6+${LIST_LENGTH})) 74 14 "${LIST[@]}" 2>&1 1>&3)
exec 3>&-
fi
fi
......@@ -700,43 +700,43 @@ EOF
function connect_bt_interface ()
{
IFS=$'\r\n'
GLOBIGNORE='*'
dialog --backtitle "$BACKTITLE" --title "Please wait" --infobox "\nDiscovering Bluetooth devices ... " 5 37
BT_INTERFACES=($(hcitool scan | sed '1d'))
IFS=$'\r\n'
GLOBIGNORE='*'
dialog --backtitle "$BACKTITLE" --title "Please wait" --infobox "\nDiscovering Bluetooth devices ... " 5 37
BT_INTERFACES=($(hcitool scan | sed '1d'))
local LIST=()
for i in "${BT_INTERFACES[@]}"
do
local a=$(echo ${i[0]//[[:blank:]]/} | sed -e 's/^\(.\{17\}\).*/\1/')
local b=${i[0]//$a/}
local b=$(echo $b | sed -e 's/^[ \t]*//')
LIST+=( "$a" "$b")
done
local LIST=()
for i in "${BT_INTERFACES[@]}"
do
local a=$(echo ${i[0]//[[:blank:]]/} | sed -e 's/^\(.\{17\}\).*/\1/')
local b=${i[0]//$a/}
local b=$(echo $b | sed -e 's/^[ \t]*//')
LIST+=( "$a" "$b")
done
LIST_LENGTH=$((${#LIST[@]}/2));
if [ "$LIST_LENGTH" -eq 0 ]; then
BT_ADAPTER=${WLAN_INTERFACES[0]}
dialog --backtitle "$BACKTITLE" --title "Bluetooth" --msgbox "\nNo nearby Bluetooth devices were found!" 7 43
else
exec 3>&1
BT_ADAPTER=$(dialog --backtitle "$BACKTITLE" --no-collapse --title "Select interface" \
--clear --menu "" $((6+${LIST_LENGTH})) 50 15 "${LIST[@]}" 2>&1 1>&3)
exec 3>&-
if [[ $BT_ADAPTER != "" ]]; then
dialog --backtitle "$BACKTITLE" --title "Please wait" --infobox "\nConnecting to $BT_ADAPTER " 5 35
BT_EXEC=$(
expect -c 'set prompt "#";set address '$BT_ADAPTER';spawn bluetoothctl;expect -re $prompt;send "disconnect $address\r";
sleep 1;send "remove $address\r";sleep 1;expect -re $prompt;send "scan on\r";sleep 8;send "scan off\r";
expect "Controller";send "trust $address\r";sleep 2;send "pair $address\r";sleep 2;send "connect $address\r";
send_user "\nShould be paired now.\r";sleep 2;send "quit\r";expect eof')
echo "$BT_EXEC" > /tmp/bt-connect-debug.log
if [[ $(echo "$BT_EXEC" | grep "Connection successful" ) != "" ]]; then
dialog --backtitle "$BACKTITLE" --title "Bluetooth" --msgbox "\nYour device is ready to use!" 7 32
else
dialog --backtitle "$BACKTITLE" --title "Bluetooth" --msgbox "\nError connecting. Try again!" 7 32
fi
fi
LIST_LENGTH=$((${#LIST[@]}/2));
if [ "$LIST_LENGTH" -eq 0 ]; then
BT_ADAPTER=${WLAN_INTERFACES[0]}
dialog --backtitle "$BACKTITLE" --title "Bluetooth" --msgbox "\nNo nearby Bluetooth devices were found!" 7 43
else
exec 3>&1
BT_ADAPTER=$(dialog --backtitle "$BACKTITLE" --no-collapse --title "Select interface" \
--clear --menu "" $((6+${LIST_LENGTH})) 50 15 "${LIST[@]}" 2>&1 1>&3)
exec 3>&-
if [[ $BT_ADAPTER != "" ]]; then
dialog --backtitle "$BACKTITLE" --title "Please wait" --infobox "\nConnecting to $BT_ADAPTER " 5 35
BT_EXEC=$(
expect -c 'set prompt "#";set address '$BT_ADAPTER';spawn bluetoothctl;expect -re $prompt;send "disconnect $address\r";
sleep 1;send "remove $address\r";sleep 1;expect -re $prompt;send "scan on\r";sleep 8;send "scan off\r";
expect "Controller";send "trust $address\r";sleep 2;send "pair $address\r";sleep 2;send "connect $address\r";
send_user "\nShould be paired now.\r";sleep 2;send "quit\r";expect eof')
echo "$BT_EXEC" > /tmp/bt-connect-debug.log
if [[ $(echo "$BT_EXEC" | grep "Connection successful" ) != "" ]]; then
dialog --backtitle "$BACKTITLE" --title "Bluetooth" --msgbox "\nYour device is ready to use!" 7 32
else
dialog --backtitle "$BACKTITLE" --title "Bluetooth" --msgbox "\nError connecting. Try again!" 7 32
fi
fi
fi
}
......@@ -367,17 +367,17 @@ unset selection
# Connect to wireless access point
#
"WiFi" )
# disable AP mode on certain adapters
wlan_exceptions "off"
[[ "$reboot_module" == true ]] && dialog --backtitle "$BACKTITLE" --title " Warning " --msgbox "\nReboot is required for this adapter to switch to STA mode" 7 62 && reboot
nmtui-connect
# disable AP mode on certain adapters
wlan_exceptions "off"
[[ "$reboot_module" == true ]] && dialog --backtitle "$BACKTITLE" --title " Warning " --msgbox "\nReboot is required for this adapter to switch to STA mode" 7 62 && reboot
nmtui-connect
;;
# Connect to 3G/4G network
#
"LTE" )
if ! is_package_manager_running; then
if ! is_package_manager_running; then
if [[ $LTE_MODEM == *online* ]]; then
dialog --title " LTE modem is connected " --colors --backtitle "$BACKTITLE" --yes-label "Back" --no-label "Disconnect" --yesno "\n\Z1Disconnect:\Z0 kill mobile connection\n\n" 7 42
[[ $? = 1 ]] && lte "$LTE_MODEM_ID" "off"
......@@ -385,28 +385,28 @@ unset selection
dialog --title " LTE modem is disconnected " --colors --backtitle "$BACKTITLE" --yes-label "Back" --no-label "Connect" --yesno "\n\Z1Connect:\Z0 dial mobile connection\n\n" 7 42
[[ $? = 1 ]] && lte "$LTE_MODEM_ID" "on"
fi
fi
fi
;;
# Connect to wireless access point
#
"Clear" )
# remove managed interfaces
systemctl daemon-reload
nmcli con delete $(nmcli --fields NAME,UUID,TYPE con | grep wifi | awk '{print $2}')
sed 's/interface-name:wl.*//' -i /etc/NetworkManager/conf.d/10-ignore-interfaces.conf
sed 's/,$//' -i /etc/NetworkManager/conf.d/10-ignore-interfaces.conf
rm -f /etc/network/interfaces.d/armbian.ap.*
rm -f /etc/dnsmasq.conf
systemctl stop dnsmasq
systemctl disable dnsmasq
iptables -t nat -D POSTROUTING 1 >/dev/null 2>&1
systemctl stop armbian-restore-iptables.service
systemctl disable armbian-restore-iptables.service
rm -f /etc/iptables.ipv4.nat
rm -f /var/run/hostapd/* >/dev/null 2>&1
reload-nety
# remove managed interfaces
systemctl daemon-reload
nmcli con delete $(nmcli --fields NAME,UUID,TYPE con | grep wifi | awk '{print $2}')
sed 's/interface-name:wl.*//' -i /etc/NetworkManager/conf.d/10-ignore-interfaces.conf
sed 's/,$//' -i /etc/NetworkManager/conf.d/10-ignore-interfaces.conf
rm -f /etc/network/interfaces.d/armbian.ap.*
rm -f /etc/dnsmasq.conf
systemctl stop dnsmasq
systemctl disable dnsmasq
iptables -t nat -D POSTROUTING 1 >/dev/null 2>&1
systemctl stop armbian-restore-iptables.service
systemctl disable armbian-restore-iptables.service
rm -f /etc/iptables.ipv4.nat
rm -f /var/run/hostapd/* >/dev/null 2>&1
reload-nety
;;
......@@ -688,69 +688,69 @@ unset selection
}
function raise_dev {
i=0;
while [[ -z "$TEMP" && $i<5 ]]; do
TEMP=$(${VPNDIR}vpncmd /client localhost /cmd accountlist | grep Status | grep Connected)
sleep 1
i=$((i+1))
done
dhclient vpn_se
i=0;
while [[ -z "$TEMP" && $i<5 ]]; do
TEMP=$(${VPNDIR}vpncmd /client localhost /cmd accountlist | grep Status | grep Connected)
sleep 1
i=$((i+1))
done
dhclient vpn_se
}
if pgrep -x "vpnclient" > /dev/null
then
${VPNDIR}vpnclient stop >/dev/null 2>&1
${VPNDIR}vpnclient start >/dev/null 2>&1
if [[ -z $(${VPNDIR}vpncmd /client localhost /cmd nicList | grep Enabled) ]]; then
${VPNDIR}vpncmd /client localhost /cmd niccreate se >/dev/null 2>&1
fi
if [[ -z $(${VPNDIR}vpncmd /client localhost /cmd accountlist | grep "VPN Server") ]]; then
dialog --backtitle "$BACKTITLE" --no-label " Cancel " --yes-label " Import " --title " VPN " --yesno "\nA VPN configuration was not found.\n\nPlace valid file at /etc/server.vpn" 9 45
if [[ $? = 0 && -f /etc/server.vpn ]]; then
${VPNDIR}vpncmd /client localhost /cmd accountimport //etc//server.vpn >/dev/null 2>&1
${VPNDIR}vpnclient stop >/dev/null 2>&1
${VPNDIR}vpnclient start >/dev/null 2>&1
if [[ -z $(${VPNDIR}vpncmd /client localhost /cmd nicList | grep Enabled) ]]; then
${VPNDIR}vpncmd /client localhost /cmd niccreate se >/dev/null 2>&1
fi
if [[ -z $(${VPNDIR}vpncmd /client localhost /cmd accountlist | grep "VPN Server") ]]; then
dialog --backtitle "$BACKTITLE" --no-label " Cancel " --yes-label " Import " --title " VPN " --yesno "\nA VPN configuration was not found.\n\nPlace valid file at /etc/server.vpn" 9 45
if [[ $? = 0 && -f /etc/server.vpn ]]; then
${VPNDIR}vpncmd /client localhost /cmd accountimport //etc//server.vpn >/dev/null 2>&1
${VPNDIR}vpnclient stop >/dev/null 2>&1
${VPNDIR}vpnclient start >/dev/null 2>&1
[[ $? = 0 ]] && dialog --backtitle "$BACKTITLE" --title " VPN " --msgbox "\nConfiguration was successfully imported!" 7 43
fi
fi
[[ $? = 0 ]] && dialog --backtitle "$BACKTITLE" --title " VPN " --msgbox "\nConfiguration was successfully imported!" 7 43
fi
fi
# raise devices
raise_dev
# raise devices
raise_dev
if [[ -n $(${VPNDIR}vpncmd /client localhost /cmd accountlist | grep Status | grep Connected) ]]; then
get_numbers
echo "ip route add $VPNSERVERIP via $IP dev $ADAPTER"
echo "ip route del default"
echo "ip route add default via $GW dev vpn_se"
read
dialog --title "VPN client is connected to $VPNSERVERIP" --colors --backtitle "$BACKTITLE" --help-button --help-label "Cancel" --yes-label "Stop" --no-label " Import " --yesno "\n\Z1Stop: \Z0 stop\n\n\Z1Import:\Z0 import new config from /etc/armbian.vpn" 9 70
fi
response=$?
if [[ $response = 0 ]]; then
get_numbers
echo "ip route del $VPNSERVERIP"
echo "ip route del default"
echo "ip route add default via $IP dev $ADAPTER"
read
dialog --backtitle "$BACKTITLE" --nocancel --nook --infobox "\nClosing VPN connection" 5 27
${VPNDIR}vpnclient stop >/dev/null 2>&1
fi
if [[ -n $(${VPNDIR}vpncmd /client localhost /cmd accountlist | grep Status | grep Connected) ]]; then
get_numbers
echo "ip route add $VPNSERVERIP via $IP dev $ADAPTER"
echo "ip route del default"
echo "ip route add default via $GW dev vpn_se"
read
dialog --title "VPN client is connected to $VPNSERVERIP" --colors --backtitle "$BACKTITLE" --help-button --help-label "Cancel" --yes-label "Stop" --no-label " Import " --yesno "\n\Z1Stop: \Z0 stop\n\n\Z1Import:\Z0 import new config from /etc/armbian.vpn" 9 70
fi
response=$?
if [[ $response = 0 ]]; then
get_numbers
echo "ip route del $VPNSERVERIP"
echo "ip route del default"
echo "ip route add default via $IP dev $ADAPTER"
read
dialog --backtitle "$BACKTITLE" --nocancel --nook --infobox "\nClosing VPN connection" 5 27
${VPNDIR}vpnclient stop >/dev/null 2>&1
fi
else
dialog --title "VPN client is disconnected" --colors --backtitle "$BACKTITLE" --help-button --help-label "Cancel" --yes-label "Connect" --no-label " Import " --yesno "\n\Z1Connect:\Z0 Connect with your VPN server \n\n\Z1Import:\Z0 import new config from /etc/armbian.vpn" 9 70
response=$?
if [[ $response = 0 ]]; then
${VPNDIR}vpnclient start >/dev/null 2>&1
# raise devices
raise_dev
get_numbers
echo "ip route add $VPNSERVERIP via $IP dev $ADAPTER"
echo "ip route del default"
echo "ip route add default via $GW dev vpn_se"
read
dialog --title "VPN client is disconnected" --colors --backtitle "$BACKTITLE" --help-button --help-label "Cancel" --yes-label "Connect" --no-label " Import " --yesno "\n\Z1Connect:\Z0 Connect with your VPN server \n\n\Z1Import:\Z0 import new config from /etc/armbian.vpn" 9 70
response=$?
if [[ $response = 0 ]]; then
${VPNDIR}vpnclient start >/dev/null 2>&1
# raise devices
raise_dev
get_numbers
echo "ip route add $VPNSERVERIP via $IP dev $ADAPTER"
echo "ip route del default"
echo "ip route add default via $GW dev vpn_se"
read
fi
[[ $response = 1 ]] && vpn_reconfigure
fi
[[ $response = 1 ]] && vpn_reconfigure
fi
;;
......@@ -859,43 +859,43 @@ unset selection
#
"ZSH" )
if ! is_package_manager_running; then
if ! check_if_installed zsh ; then
debconf-apt-progress -- apt-get update
debconf-apt-progress -- apt-get install -y zsh tmux
fi
rm -rf /etc/oh-my-zsh
git clone --quiet https://github.com/robbyrussell/oh-my-zsh.git /etc/oh-my-zsh
cp /etc/oh-my-zsh/templates/zshrc.zsh-template /etc/skel/.zshrc
mkdir -p /etc/skel/.oh-my-zsh/cache
# change shell for future users
sed -i "s/^SHELL=.*/SHELL=\/usr\/bin\/zsh/" /etc/default/useradd
# we have common settings
sed -i "s/^export ZSH=.*/export ZSH=\/etc\/oh-my-zsh/" /etc/skel/.zshrc
# user cache
sed -i "/^export ZSH=.*/a export ZSH_CACHE_DIR=~\/.oh-my-zsh\/cache" /etc/skel/.zshrc
# define theme
sed -i 's/^ZSH_THEME=.*/ZSH_THEME="risto"/' /etc/skel/.zshrc
# define default plugins
sed -i 's/^plugins=.*/plugins=(git git-extras debian tmux screen history extract colorize web-search docker)/' /etc/skel/.zshrc
# change shell for root
chsh -s $(grep /zsh$ /etc/shells | tail -1)
# copy cache directory
cp -R --attributes-only /etc/skel/.oh-my-zsh /root/.oh-my-zsh
cp /etc/skel/.zshrc /root/.zshrc
# and for selected normal user
add_choose_user
if [ -n "$CHOSEN_USER" ]; then
chsh -s $(grep /zsh$ /etc/shells | tail -1) $CHOSEN_USER
if ! check_if_installed zsh ; then
debconf-apt-progress -- apt-get update
debconf-apt-progress -- apt-get install -y zsh tmux
fi
rm -rf /etc/oh-my-zsh
git clone --quiet https://github.com/robbyrussell/oh-my-zsh.git /etc/oh-my-zsh
cp /etc/oh-my-zsh/templates/zshrc.zsh-template /etc/skel/.zshrc
mkdir -p /etc/skel/.oh-my-zsh/cache
# change shell for future users
sed -i "s/^SHELL=.*/SHELL=\/usr\/bin\/zsh/" /etc/default/useradd
# we have common settings
sed -i "s/^export ZSH=.*/export ZSH=\/etc\/oh-my-zsh/" /etc/skel/.zshrc
# user cache
sed -i "/^export ZSH=.*/a export ZSH_CACHE_DIR=~\/.oh-my-zsh\/cache" /etc/skel/.zshrc
# define theme
sed -i 's/^ZSH_THEME=.*/ZSH_THEME="risto"/' /etc/skel/.zshrc
# define default plugins
sed -i 's/^plugins=.*/plugins=(git git-extras debian tmux screen history extract colorize web-search docker)/' /etc/skel/.zshrc
# change shell for root
chsh -s $(grep /zsh$ /etc/shells | tail -1)
# copy cache directory
cp -R --attributes-only /etc/skel/.oh-my-zsh /home/$CHOSEN_USER/.oh-my-zsh
cp /etc/skel/.zshrc /home/$CHOSEN_USER/.zshrc
chown -R ${CHOSEN_USER}:${CHOSEN_USER} /home/${CHOSEN_USER}/{.zshrc,.oh-my-zsh}
fi
# add a cronjob to update oh-my-zsh once per month
(crontab -l 2>/dev/null; echo "0 0 1 * * cd /etc/oh-my-zsh ; git pull origin master >/dev/null 2>/dev/null") | crontab -
if [[ -z $scripted ]]; then
dialog --backtitle "$BACKTITLE" --title "Info" --colors --msgbox "\nYour default shell was switched to: \Z1ZSH\Z0\n\nPlease logout & login from this session!" 9 47
fi
cp -R --attributes-only /etc/skel/.oh-my-zsh /root/.oh-my-zsh
cp /etc/skel/.zshrc /root/.zshrc
# and for selected normal user
add_choose_user
if [ -n "$CHOSEN_USER" ]; then
chsh -s $(grep /zsh$ /etc/shells | tail -1) $CHOSEN_USER
# copy cache directory
cp -R --attributes-only /etc/skel/.oh-my-zsh /home/$CHOSEN_USER/.oh-my-zsh
cp /etc/skel/.zshrc /home/$CHOSEN_USER/.zshrc
chown -R ${CHOSEN_USER}:${CHOSEN_USER} /home/${CHOSEN_USER}/{.zshrc,.oh-my-zsh}
fi
# add a cronjob to update oh-my-zsh once per month
(crontab -l 2>/dev/null; echo "0 0 1 * * cd /etc/oh-my-zsh ; git pull origin master >/dev/null 2>/dev/null") | crontab -
if [[ -z $scripted ]]; then
dialog --backtitle "$BACKTITLE" --title "Info" --colors --msgbox "\nYour default shell was switched to: \Z1ZSH\Z0\n\nPlease logout & login from this session!" 9 47
fi
fi
;;
......@@ -943,28 +943,28 @@ unset selection
unset PACKAGE_LIST
# basic packages
check_if_installed linux-u-boot-${BOARD}-${BRANCH} && PACKAGE_LIST+=" linux-u-boot-${BOARD}-${BRANCH}"
check_if_installed linux-image-${BRANCH}-${LINUXFAMILY} && PACKAGE_LIST+=" linux-image-${BRANCH}-${LINUXFAMILY}"
check_if_installed linux-dtb-${BRANCH}-${LINUXFAMILY} && PACKAGE_LIST+=" linux-dtb-${BRANCH}-${LINUXFAMILY}"
check_if_installed linux-headers-${BRANCH}-${LINUXFAMILY} && PACKAGE_LIST+=" linux-headers-${BRANCH}-${LINUXFAMILY}"
# new BSP
check_if_installed armbian-${LINUXFAMILY} && PACKAGE_LIST+=" armbian-${LINUXFAMILY}"
check_if_installed armbian-${BOARD} && PACKAGE_LIST+=" armbian-${BOARD}"
check_if_installed armbian-${DISTROID} && PACKAGE_LIST+=" armbian-${DISTROID}"
check_if_installed armbian-${DISTROID}-desktop-xfce && PACKAGE_LIST+=" armbian-${DISTROID}-desktop-xfce"
check_if_installed armbian-firmware && PACKAGE_LIST+=" armbian-firmware"
check_if_installed armbian-firmware-full && PACKAGE_LIST+=" armbian-firmware-full"
local words=( $PACKAGE_LIST )
local command="unhold"
IFS=" "
[[ $1 == "Freeze" ]] && local command="hold"
for word in $PACKAGE_LIST; do apt-mark $command $word; done | dialog --backtitle "$BACKTITLE" --title "Packages ${1,,}" --progressbox $((${#words[@]}+2)) 64
# basic packages
check_if_installed linux-u-boot-${BOARD}-${BRANCH} && PACKAGE_LIST+=" linux-u-boot-${BOARD}-${BRANCH}"
check_if_installed linux-image-${BRANCH}-${LINUXFAMILY} && PACKAGE_LIST+=" linux-image-${BRANCH}-${LINUXFAMILY}"
check_if_installed linux-dtb-${BRANCH}-${LINUXFAMILY} && PACKAGE_LIST+=" linux-dtb-${BRANCH}-${LINUXFAMILY}"
check_if_installed linux-headers-${BRANCH}-${LINUXFAMILY} && PACKAGE_LIST+=" linux-headers-${BRANCH}-${LINUXFAMILY}"
# new BSP
check_if_installed armbian-${LINUXFAMILY} && PACKAGE_LIST+=" armbian-${LINUXFAMILY}"
check_if_installed armbian-${BOARD} && PACKAGE_LIST+=" armbian-${BOARD}"
check_if_installed armbian-${DISTROID} && PACKAGE_LIST+=" armbian-${DISTROID}"
check_if_installed armbian-${DISTROID}-desktop-xfce && PACKAGE_LIST+=" armbian-${DISTROID}-desktop-xfce"
check_if_installed armbian-firmware && PACKAGE_LIST+=" armbian-firmware"
check_if_installed armbian-firmware-full && PACKAGE_LIST+=" armbian-firmware-full"
local words=( $PACKAGE_LIST )
local command="unhold"
IFS=" "
[[ $1 == "Freeze" ]] && local command="hold"
for word in $PACKAGE_LIST; do apt-mark $command $word; done | dialog --backtitle "$BACKTITLE" --title "Packages ${1,,}" --progressbox $((${#words[@]}+2)) 64
fi
fi
fi
;;
......@@ -1145,9 +1145,9 @@ unset selection
#
"Bootscript" )
if [[ -f /boot/boot.ini ]]; then
dialog --title " Edit boot.ini script " --ok-label "Save" \
--no-collapse --editbox /boot/boot.ini 30 0 2> /boot/boot.ini.out
[[ $? = 0 ]] && mv /boot/boot.ini.out /boot/boot.ini
dialog --title " Edit boot.ini script " --ok-label "Save" \
--no-collapse --editbox /boot/boot.ini 30 0 2> /boot/boot.ini.out
[[ $? = 0 ]] && mv /boot/boot.ini.out /boot/boot.ini
fi
;;
......@@ -1478,13 +1478,13 @@ unset selection
if ! is_package_manager_running; then
aval_dtbs
if [[ $exitstatus = 0 ]]; then
BOX_LENGTH=$((${#TARGET_BOARD}+28));
dialog --title "Switching board config" --backtitle "$BACKTITLE" --yes-label "Reboot" --no-label "Cancel" --yesno "\nReboot to $TARGET_BOARD settings?" 7 $BOX_LENGTH
if [[ $? = 0 ]]; then
sed -i "s/^fdt_file=.*/fdt_file=$TARGET_BOARD/" /boot/armbianEnv.txt 2> /dev/null && grep -q "fdt_file=$TARGET_BOARD" /boot/armbianEnv.txt 2> /dev/null || echo "fdt_file=$TARGET_BOARD" >> /boot/armbianEnv.txt
[[ "$LINUXFAMILY" = odroidxu4 ]] && sed -i "s/^fdt_file/board_name/" /boot/armbianEnv.txt && sed -i "s/^BOARD_NAME.*/BOARD_NAME=\"Odroid ${TARGET_BOARD^^}\"/" /etc/armbian-release
reboot;
fi
BOX_LENGTH=$((${#TARGET_BOARD}+28));
dialog --title "Switching board config" --backtitle "$BACKTITLE" --yes-label "Reboot" --no-label "Cancel" --yesno "\nReboot to $TARGET_BOARD settings?" 7 $BOX_LENGTH
if [[ $? = 0 ]]; then
sed -i "s/^fdt_file=.*/fdt_file=$TARGET_BOARD/" /boot/armbianEnv.txt 2> /dev/null && grep -q "fdt_file=$TARGET_BOARD" /boot/armbianEnv.txt 2> /dev/null || echo "fdt_file=$TARGET_BOARD" >> /boot/armbianEnv.txt
[[ "$LINUXFAMILY" = odroidxu4 ]] && sed -i "s/^fdt_file/board_name/" /boot/armbianEnv.txt && sed -i "s/^BOARD_NAME.*/BOARD_NAME=\"Odroid ${TARGET_BOARD^^}\"/" /etc/armbian-release
reboot;
fi
fi
fi
;;
......
......@@ -96,13 +96,13 @@ while true; do
[[ "$LINUXFAMILY" = odroidc* || "$LINUXFAMILY" = odroidn2 && "$BRANCH" = "default" ]] && LIST+=( "Display" "Set the display resolution" )
# desktop
if [[ -n $DISPLAY_MANAGER ]]; then
LIST+=( "Desktop" "Disable desktop or change login type" )
LIST+=( "Desktop" "Disable desktop or change login type" )
else
if [[ -n $DESKTOP_INSTALLED ]]; then
LIST+=( "Desktop" "Enable desktop" )
else
LIST+=( "Default" "Install desktop with browser and extras" )
fi
if [[ -n $DESKTOP_INSTALLED ]]; then
LIST+=( "Desktop" "Enable desktop" )
else
LIST+=( "Default" "Install desktop with browser and extras" )
fi
fi
# overlayroot
......@@ -379,32 +379,32 @@ while true; do
fi
if [[ -n $DISPLAY_MANAGER ]]; then
if [[ $(service xrdp status 2> /dev/null | grep -w active) ]]; then
LIST+=( "RDP" "Disable remote desktop access from Windows" )
else
LIST+=( "RDP" "Enable remote desktop access from Windows" )
fi
if ! check_if_installed thunderbird ; then
LIST+=( "Thunderbird" "Install full featured email client" )
else
LIST+=( "Thunderbird" "Remove full featured email client" )
fi
if ! check_if_installed gimp ; then
LIST+=( "Gimp" "Install photo manipulation tool" )
else
LIST+=( "Gimp" "Remove photo manipulation tool" )
fi
if ! check_if_installed libreoffice-writer ; then
LIST+=( "Writer" "Libreoffice: Writer only" )
if [[ $(service xrdp status 2> /dev/null | grep -w active) ]]; then
LIST+=( "RDP" "Disable remote desktop access from Windows" )
else
LIST+=( "RDP" "Enable remote desktop access from Windows" )
fi
if ! check_if_installed thunderbird ; then
LIST+=( "Thunderbird" "Install full featured email client" )
else
LIST+=( "Thunderbird" "Remove full featured email client" )
fi
if ! check_if_installed gimp ; then
LIST+=( "Gimp" "Install photo manipulation tool" )
else
LIST+=( "Gimp" "Remove photo manipulation tool" )
fi
if ! check_if_installed libreoffice-writer ; then
LIST+=( "Writer" "Libreoffice: Writer only" )
LIST+=( "Suite" "Libreoffice: Full suite" )
else
if ! check_if_installed libreoffice-base ; then
LIST+=( "Suite" "Libreoffice: Full suite" )
else
if ! check_if_installed libreoffice-base ; then
LIST+=( "Suite" "Libreoffice: Full suite" )
LIST+=( "Libre" "Remove Libre office packages" )
else
LIST+=( "Libre" "Remove Libre office packages" )
fi
LIST+=( "Libre" "Remove Libre office packages" )
else
LIST+=( "Libre" "Remove Libre office packages" )
fi
fi
fi
# count number of menu items to adjust window sizee
......
......@@ -114,13 +114,13 @@ function check_status
LIST+=( "Syncthing" "$DESCRIPTION" "$SYNCTHING_STATUS" )
# Hass.io
HASS_STATUS="$([[ -f /etc/hassio.json ]] && echo "on" || echo "off" )"
alive_port "Home assistant smarthome suite" "8123"
LIST+=( "Hassio" "$DESCRIPTION" "$HASS_STATUS" )
HASS_STATUS="$([[ -f /etc/hassio.json ]] && echo "on" || echo "off" )"
alive_port "Home assistant smarthome suite" "8123"
LIST+=( "Hassio" "$DESCRIPTION" "$HASS_STATUS" )
# OpenHab
OPENHAB_STATUS="$([[ -f /usr/bin/openhab-cli ]] && echo "on" || echo "off" )"
alive_port "Openhab2 smarthome suite" "8080"
alive_port "Openhab2 smarthome suite" "8080"
LIST+=( "OpenHAB" "$DESCRIPTION" "$OPENHAB_STATUS" )
# VPN
......@@ -196,7 +196,7 @@ function check_status
if [[ "$DOCKER_STATUS" == "on" ]]; then
curl --output /dev/null --silent --head --fail http://localhost/authentication/login/?next=
MAYAN_STATUS=$([[ $? -eq 0 ]] && echo "on" || echo "off")
else
else
MAYAN_STATUS="off"
fi
......@@ -306,22 +306,22 @@ declare -a PACKETS=($1)
#skupaj=$(apt-get -s -y -qq install $1 | wc -l)
skupaj=${#PACKETS[@]}
while [[ $i -lt $skupaj ]]; do
procent=$(echo "scale=2;($j/$skupaj)*100"|bc)
x=${PACKETS[$i]}
if [ $(dpkg-query -W -f='${Status}' $x 2>/dev/null | grep -c "ok installed") -eq 0 ]; then
printf '%.0f\n' $procent | dialog \
--backtitle "$BACKTITLE" \
--title "Installing" \
--gauge "\n$2\n\n$x" 10 70
procent=$(echo "scale=2;($j/$skupaj)*100"|bc)
x=${PACKETS[$i]}
if [ $(dpkg-query -W -f='${Status}' $x 2>/dev/null | grep -c "ok installed") -eq 0 ]; then
printf '%.0f\n' $procent | dialog \
--backtitle "$BACKTITLE" \
--title "Installing" \
--gauge "\n$2\n\n$x" 10 70
if [ "$(DEBIAN_FRONTEND=noninteractive apt-get -qq -y install $x >${TEMP_DIR}/install.log 2>&1 || echo 'Installation failed' \
| grep 'Installation failed')" != "" ]; then
echo -e "[\e[0;31m error \x1B[0m] Installation failed"
tail ${TEMP_DIR}/install.log
exit
fi
fi
i=$[$i+1]
j=$[$j+1]
fi
i=$[$i+1]
j=$[$j+1]
done
echo ""
}
......@@ -335,24 +335,15 @@ alive_port ()
# Displays URL to the service $1 on port $2 or just that is active if $3 = boolean $4 = path
#
if [[ -n $(netstat -lnt | awk '$6 == "LISTEN" && $4 ~ ".'$2'"') ]]; then
if [[ $3 == boolean ]]; then
DESCRIPTION="$1 is \Z1active\Z0";
elif [[ $3 == ssl ]]; then
elif [[ $3 == ssl ]]; then
DESCRIPTION="Active on https://${serverIP}:\Z1$2\Z0$4";
else
else
DESCRIPTION="Active on http://${serverIP}:\Z1$2\Z0$4";
fi
else
DESCRIPTION="$1";
fi
}
......@@ -553,7 +544,7 @@ install_omv (){
# Install OpenMediaVault on Debian
#
if [ -f /etc/armbian-release ]; then
. /etc/armbian-release
. /etc/armbian-release
fi
# Don't allow installation on Ubuntu
......@@ -578,7 +569,7 @@ fancy_wget "$wgeturl" "-O ${TEMP_DIR}/omv_install.sh"
# Remove Crony on Stretch since OMV4 depends on NTP
if [[ "$distribution" == "stretch" ]]; then
apt-get -y -qq remove chrony
apt-get -y -qq remove chrony
fi
# Execute install script
......@@ -639,8 +630,8 @@ if [[ "$family" == "Ubuntu" ]]; then
debconf-apt-progress -- apt-get -y install libssl-doc libssl1.0.0 zlib1g-dev tvheadend xmltv-util
else
if [ ! -f /etc/apt/sources.list.d/tvheadend.list ]; then
echo "deb https://www.deb-multimedia.org ${distribution} main non-free" >> /etc/apt/sources.list.d/tvheadend.list
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 5C808C2B65558117 >/dev/null 2>&1
echo "deb https://www.deb-multimedia.org ${distribution} main non-free" >> /etc/apt/sources.list.d/tvheadend.list
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 5C808C2B65558117 >/dev/null 2>&1
fi
URL="https://security.debian.org/debian-security/pool/updates/main/o/openssl/libssl1.0.0_1.0.1t-1+deb8u9_"$(dpkg --print-architecture)".deb"
fancy_wget "$URL" "-O ${TEMP_DIR}/package.deb"
......@@ -891,8 +882,8 @@ systemctl start syncthing@${CHOSEN_USER}.service >/dev/null 2>&1
# wait until config file is created
while :
do
if [[ -f /home/${CHOSEN_USER}/.config/syncthing/config.xml ]]; then break; fi
sleep 1
if [[ -f /home/${CHOSEN_USER}/.config/syncthing/config.xml ]]; then break; fi
sleep 1
done
# change to server IP
sed -i "s/127.0.0.1/${serverIP}/" /home/${CHOSEN_USER}/.config/syncthing/config.xml
......@@ -922,8 +913,8 @@ install_emby_server ()
#
# Emby server
#
ARCH=$(dpkg --print-architecture)
URL=$(curl -s https://api.github.com/repos/MediaBrowser/Emby.Releases/releases/latest | grep "/emby-server-deb.*${ARCH}.deb" | cut -d : -f 2,3 | tr -d \")
ARCH=$(dpkg --print-architecture)
URL=$(curl -s https://api.github.com/repos/MediaBrowser/Emby.Releases/releases/latest | grep "/emby-server-deb.*${ARCH}.deb" | cut -d : -f 2,3 | tr -d \")
fancy_wget "$URL" "-O ${TEMP_DIR}/emby.deb"
dpkg -i ${TEMP_DIR}/emby.deb >/dev/null 2>&1
apt-get -yy -f install
......@@ -1093,10 +1084,10 @@ install_packet "debconf-utils unzip build-essential html2text apt-transport-http
URL=$(wget -q $PREFIX -O - | html2text | grep rtm | awk ' { print $(NF) }' | tail -1)
SUFIX="${URL/-tree/}"
if [ "$(dpkg --print-architecture | grep armhf)" != "" ]; then
DLURL=$PREFIX$URL"/Linux/SoftEther_VPN_Client/32bit_-_ARM_EABI/softether-vpnclient-$SUFIX-linux-arm_eabi-32bit.tar.gz"
DLURL=$PREFIX$URL"/Linux/SoftEther_VPN_Client/32bit_-_ARM_EABI/softether-vpnclient-$SUFIX-linux-arm_eabi-32bit.tar.gz"
else
install_packet "gcc-multilib" "Install libraries"
DLURL=$PREFIX$URL"/Linux/SoftEther_VPN_Client/32bit_-_Intel_x86/softether-vpnclient-$SUFIX-linux-x86-32bit.tar.gz"
install_packet "gcc-multilib" "Install libraries"
DLURL=$PREFIX$URL"/Linux/SoftEther_VPN_Client/32bit_-_Intel_x86/softether-vpnclient-$SUFIX-linux-x86-32bit.tar.gz"
fi
wget -q $DLURL -O - | tar -xz
cd vpnclient
......@@ -1209,7 +1200,7 @@ packets="amavisd-new spamassassin clamav clamav-daemon unzip bzip2 arj p7zip unr
cabextract apt-listchanges libnet-ldap-perl libauthen-sasl-perl clamav-docs daemon libio-string-perl libio-socket-ssl-perl \
libnet-ident-perl zip libnet-dns-perl postgrey"
if [[ $distribution != "bionic" ]] && [[ $distribution != "buster" ]]; then
packets=$packets" zoo"
packets=$packets" zoo"
fi
if [[ $distribution != "buster" ]]; then packets=$packets" ripole"; fi
install_packet "$packets" "amavisd, spamassassin, clamav"
......@@ -1251,15 +1242,15 @@ install_phpmyadmin ()
# Phpmyadmin unattended installation
#
if [[ "$family" != "Ubuntu" ]]; then
DEBIAN_FRONTEND=noninteractive debconf-apt-progress -- apt-get -y install phpmyadmin
DEBIAN_FRONTEND=noninteractive debconf-apt-progress -- apt-get -y install phpmyadmin
else
debconf-set-selections <<< "phpmyadmin phpmyadmin/internal/skip-preseed boolean true"
debconf-set-selections <<< "phpmyadmin phpmyadmin/reconfigure-webserver multiselect true"
debconf-set-selections <<< "phpmyadmin phpmyadmin/dbconfig-install boolean false"
echo "phpmyadmin phpmyadmin/internal/skip-preseed boolean true" | debconf-set-selections
echo "phpmyadmin phpmyadmin/reconfigure-webserver multiselect" | debconf-set-selections
echo "phpmyadmin phpmyadmin/dbconfig-install boolean false" | debconf-set-selections
debconf-apt-progress -- apt-get install -y phpmyadmin
debconf-set-selections <<< "phpmyadmin phpmyadmin/internal/skip-preseed boolean true"
debconf-set-selections <<< "phpmyadmin phpmyadmin/reconfigure-webserver multiselect true"
debconf-set-selections <<< "phpmyadmin phpmyadmin/dbconfig-install boolean false"
echo "phpmyadmin phpmyadmin/internal/skip-preseed boolean true" | debconf-set-selections
echo "phpmyadmin phpmyadmin/reconfigure-webserver multiselect" | debconf-set-selections
echo "phpmyadmin phpmyadmin/dbconfig-install boolean false" | debconf-set-selections
debconf-apt-progress -- apt-get install -y phpmyadmin
fi
# Apache2 needs additional hack
WWW_RECONFIG=$(expect -c "
......@@ -1322,22 +1313,22 @@ EOT
a2enmod actions proxy_fcgi setenvif fastcgi alias httpoxy suexec rewrite ssl actions include dav_fs dav auth_digest cgi headers >/dev/null 2>&1
case $distribution in
jessie)
a2enconf php5-fpm >/dev/null 2>&1
;;
xenial)
a2enconf php7.0-fpm >/dev/null 2>&1
;;
stretch)
a2enconf php7.0-fpm >/dev/null 2>&1
;;
bionic)
a2enconf php7.2-fpm >/dev/null 2>&1
;;
buster)
a2enconf php7.3-fpm >/dev/null 2>&1
;;
esac
jessie)
a2enconf php5-fpm >/dev/null 2>&1
;;
xenial)
a2enconf php7.0-fpm >/dev/null 2>&1
;;
stretch)
a2enconf php7.0-fpm >/dev/null 2>&1
;;
bionic)
a2enconf php7.2-fpm >/dev/null 2>&1
;;
buster)
a2enconf php7.3-fpm >/dev/null 2>&1
;;
esac
service apache2 restart >> /dev/null
}
......@@ -1374,37 +1365,37 @@ local temp="pkg_${distribution}"
install_packet "${pkg} ${!temp}" "Nginx for $family $distribution"
case $distribution in
jessie)
jessie)
phpenmod mcrypt mbstring
debconf-apt-progress -- apt-get install -y python-certbot -t jessie-backports
service php5-fpm reload >> /dev/null
;;
service php5-fpm reload >> /dev/null
;;
xenial)
phpenmod mcrypt mbstring
tz=$(cat /etc/timezone | sed 's/\//\\\//g')
sed -i "s/^cgi.fix_pathinfo=.*/cgi.fix_pathinfo=0/" /etc/php/7.0/fpm/php.ini
sed -i "s/^date.timezone=.*/date.timezone=""$tz""/" /etc/php/7.0/fpm/php.ini
service php7.0-fpm reload >> /dev/null
sed -i "s/^cgi.fix_pathinfo=.*/cgi.fix_pathinfo=0/" /etc/php/7.0/fpm/php.ini
sed -i "s/^date.timezone=.*/date.timezone=""$tz""/" /etc/php/7.0/fpm/php.ini
service php7.0-fpm reload >> /dev/null
;;
stretch)
tz=$(cat /etc/timezone | sed 's/\//\\\//g')
sed -i "s/^cgi.fix_pathinfo=.*/cgi.fix_pathinfo=0/" /etc/php/7.0/fpm/php.ini
sed -i "s/^date.timezone=.*/date.timezone=""$tz""/" /etc/php/7.0/fpm/php.ini
service php7.0-fpm reload >> /dev/null
sed -i "s/^cgi.fix_pathinfo=.*/cgi.fix_pathinfo=0/" /etc/php/7.0/fpm/php.ini
sed -i "s/^date.timezone=.*/date.timezone=""$tz""/" /etc/php/7.0/fpm/php.ini
service php7.0-fpm reload >> /dev/null
phpenmod mcrypt mbstring
;;
bionic)
tz=$(cat /etc/timezone | sed 's/\//\\\//g')
sed -i "s/^cgi.fix_pathinfo=.*/cgi.fix_pathinfo=0/" /etc/php/7.2/fpm/php.ini
sed -i "s/^date.timezone=.*/date.timezone=""$tz""/" /etc/php/7.2/fpm/php.ini
service php7.2-fpm reload >> /dev/null
sed -i "s/^cgi.fix_pathinfo=.*/cgi.fix_pathinfo=0/" /etc/php/7.2/fpm/php.ini
sed -i "s/^date.timezone=.*/date.timezone=""$tz""/" /etc/php/7.2/fpm/php.ini
service php7.2-fpm reload >> /dev/null
phpenmod mbstring
;;
buster)
tz=$(cat /etc/timezone | sed 's/\//\\\//g')
sed -i "s/^cgi.fix_pathinfo=.*/cgi.fix_pathinfo=0/" /etc/php/7.3/fpm/php.ini
sed -i "s/^date.timezone=.*/date.timezone=""$tz""/" /etc/php/7.3/fpm/php.ini
service php7.3-fpm reload >> /dev/null
sed -i "s/^cgi.fix_pathinfo=.*/cgi.fix_pathinfo=0/" /etc/php/7.3/fpm/php.ini
sed -i "s/^date.timezone=.*/date.timezone=""$tz""/" /etc/php/7.3/fpm/php.ini
service php7.3-fpm reload >> /dev/null
phpenmod mbstring
;;
esac
......@@ -1568,10 +1559,10 @@ cd ${TEMP_DIR}/ispconfig3_install/install/
php -q install.php --autoinstall=${TEMP_DIR}/isp.conf.php &>> /var/log/ispconfig_config.log
dialog --colors --backtitle "$BACKTITLE" --no-collapse --title " Auto updating SSL certificate " --clear --yesno "\nDo you want to secure ISPConfig control panel and all services with free Let's Encrypt SSL certificate?" 8 80
if [[ $? == 0 ]]; then
dialog --colors --backtitle "$BACKTITLE" --no-collapse --title " Instructions " --clear --msgbox "\n1. Access admin panel with your browser: \Z1https://$serverIP:8080\Z0\n\nUsername: \Z1admin\Z0\nPassword: \Z11234\Z0 \n\n\n2. Go to Sites > Website > \Z1Add new website\Z0\n\nDomain: \Z1$(hostname -f)\Z0\nAuto-Subdomain: \Z1None\Z0\nSSL: \Z1enable\Z0\nLet's Encrypt SSL: \Z1enable\Z0\n\n\n3. Go to Tools > \Z1Password and language\Z0\n\nChange ISPConfig control panel password.\n\nSave and Logout. \n\n\n4. Wait until SSL is not working here: \Z1https://$(hostname -f)\Z0 \n\nIt can take up to a few minutes.\n\n\n5. Proceed with install (\Z1Press ENTER\Z0):" 33 80
curl -sSL https://github.com/ahrasis/LE4ISPC/archive/master.zip > master.zip 2> /dev/null
unzip -qq master.zip
bash LE4ISPC-master/${server}/le4ispc.sh 2>&1
dialog --colors --backtitle "$BACKTITLE" --no-collapse --title " Instructions " --clear --msgbox "\n1. Access admin panel with your browser: \Z1https://$serverIP:8080\Z0\n\nUsername: \Z1admin\Z0\nPassword: \Z11234\Z0 \n\n\n2. Go to Sites > Website > \Z1Add new website\Z0\n\nDomain: \Z1$(hostname -f)\Z0\nAuto-Subdomain: \Z1None\Z0\nSSL: \Z1enable\Z0\nLet's Encrypt SSL: \Z1enable\Z0\n\n\n3. Go to Tools > \Z1Password and language\Z0\n\nChange ISPConfig control panel password.\n\nSave and Logout. \n\n\n4. Wait until SSL is not working here: \Z1https://$(hostname -f)\Z0 \n\nIt can take up to a few minutes.\n\n\n5. Proceed with install (\Z1Press ENTER\Z0):" 33 80
curl -sSL https://github.com/ahrasis/LE4ISPC/archive/master.zip > master.zip 2> /dev/null
unzip -qq master.zip
bash LE4ISPC-master/${server}/le4ispc.sh 2>&1
fi
}
......@@ -1714,10 +1705,10 @@ if ! is_package_manager_running; then
selection=${selection//Hassio/}
fi
if [[ "$selection" == *OpenHAB* && "$OPENHAB_STATUS" != "on" ]]; then
install_openhab
selection=${selection//OpenHAB/}
fi
if [[ "$selection" == *OpenHAB* && "$OPENHAB_STATUS" != "on" ]]; then
install_openhab
selection=${selection//OpenHAB/}
fi
if [[ "$selection" == *server* && "$VPN_SERVER_STATUS" != "on" ]]; then
install_vpn_server
......@@ -1728,9 +1719,9 @@ if ! is_package_manager_running; then
install_vpn_client
selection=${selection//\"VPN client\"/}
fi
if [[ "$selection" == *NCP* && "$NCP_STATUS" != "on" ]]; then
if [[ "$selection" == *NCP* && "$NCP_STATUS" != "on" ]]; then
install_ncp
selection=${selection//NCP/}
selection=${selection//NCP/}
fi
if [[ "$selection" == *OMV* && "$OMV_STATUS" != "on" ]]; then
......
......@@ -4,53 +4,52 @@ vflag=
cflag=
if (( $# < 1 ))
then
### URL of your XML file
wget -qO - "http://xml.tv.data"
exit 0
### URL of your XML file
wget -qO - "http://xml.tv.data"
exit 0
fi
for arg
do
delim=""
case "$arg" in
#translate --gnu-long-options to -g (short options)
--description) args="${args}-d ";;
--version) args="${args}-v ";;
--capabilities) args="${args}-c ";;
#pass through anything else
*) [[ "${arg:0:1}" == "-" ]] || delim="\""
args="${args}${delim}${arg}${delim} ";;
delim=""
case "$arg" in
#translate --gnu-long-options to -g (short options)
--description) args="${args}-d ";;
--version) args="${args}-v ";;
--capabilities) args="${args}-c ";;
#pass through anything else
*) [[ "${arg:0:1}" == "-" ]] || delim="\""
args="${args}${delim}${arg}${delim} ";;
esac
done
#Reset the positional parameters to the short options
eval set -- $args
while getopts "dvc" option
while getopts "dvc" option
do
case $option in
d) dflag=1;;
v) vflag=1;;
c) cflag=1;;
\?) printf "unknown option: -%s\n" $OPTARG
printf "Usage: %s: [--description] [--version] [--capabilities] \n" $(basename $0)
exit 2
;;
esac >&2
case $option in
d) dflag=1;;
v) vflag=1;;
c) cflag=1;;
\?) printf "unknown option: -%s\n" $OPTARG
printf "Usage: %s: [--description] [--version] [--capabilities] \n" $(basename $0)
exit 2
;;
esac >&2
done
if [ "$dflag" ]
then
printf "tv_grag_file is a simple grabber that just read the ~/.xmltv/tv_grab_file.xmltv file\n"
printf "tv_grag_file is a simple grabber that just read the ~/.xmltv/tv_grab_file.xmltv file\n"
fi
if [ "$vflag" ]
then
printf "0.1\n"
printf "0.1\n"
fi
if [ "$cflag" ]
then
printf "baseline\n"
printf "baseline\n"
fi
exit 0
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment