add noreboot flag
This commit is contained in:
parent
d99a314350
commit
d4d5ac6ae8
25
install
25
install
@ -1,6 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
#
|
#
|
||||||
# shellcheck disable=SC1090,SC1091,SC1117,SC2016,SC2046,SC2086,SC2174
|
# shellcheck disable=SC1090,SC1091,SC1117,SC2010,SC2016,SC2046,SC2086,SC2174
|
||||||
#
|
#
|
||||||
# Copyright (c) 2015-2021 OpenMediaVault Plugin Developers
|
# Copyright (c) 2015-2021 OpenMediaVault Plugin Developers
|
||||||
# Copyright (c) 2017-2020 Armbian Developers
|
# Copyright (c) 2017-2020 Armbian Developers
|
||||||
@ -13,7 +13,7 @@
|
|||||||
# https://github.com/armbian/config/blob/master/debian-software
|
# https://github.com/armbian/config/blob/master/debian-software
|
||||||
# https://forum.openmediavault.org/index.php/Thread/25062-Install-OMV5-on-Debian-10-Buster/
|
# https://forum.openmediavault.org/index.php/Thread/25062-Install-OMV5-on-Debian-10-Buster/
|
||||||
#
|
#
|
||||||
# version: 1.3.0
|
# version: 1.3.1
|
||||||
#
|
#
|
||||||
|
|
||||||
if [[ $(id -u) -ne 0 ]]; then
|
if [[ $(id -u) -ne 0 ]]; then
|
||||||
@ -31,6 +31,7 @@ declare -i cfg=0
|
|||||||
declare -i ipv6=0
|
declare -i ipv6=0
|
||||||
declare -i skipFlash=0
|
declare -i skipFlash=0
|
||||||
declare -i skipNet=0
|
declare -i skipNet=0
|
||||||
|
declare -i skipReboot=0
|
||||||
declare -i version
|
declare -i version
|
||||||
|
|
||||||
declare -l codename
|
declare -l codename
|
||||||
@ -62,7 +63,7 @@ if [ -f /etc/armbian-release ]; then
|
|||||||
. /etc/armbian-release
|
. /etc/armbian-release
|
||||||
fi
|
fi
|
||||||
|
|
||||||
while getopts "fhin" opt; do
|
while getopts "fhinr" opt; do
|
||||||
echo "option ${opt}"
|
echo "option ${opt}"
|
||||||
case "${opt}" in
|
case "${opt}" in
|
||||||
f)
|
f)
|
||||||
@ -76,6 +77,8 @@ while getopts "fhin" opt; do
|
|||||||
echo " enable using IPv6 for apt"
|
echo " enable using IPv6 for apt"
|
||||||
echo " -n"
|
echo " -n"
|
||||||
echo " to skip the network setup"
|
echo " to skip the network setup"
|
||||||
|
echo " -r"
|
||||||
|
echo " to skip reboot"
|
||||||
echo ""
|
echo ""
|
||||||
echo "Examples:"
|
echo "Examples:"
|
||||||
echo " install"
|
echo " install"
|
||||||
@ -89,6 +92,9 @@ while getopts "fhin" opt; do
|
|||||||
n)
|
n)
|
||||||
skipNet=1
|
skipNet=1
|
||||||
;;
|
;;
|
||||||
|
r)
|
||||||
|
skipReboot=1
|
||||||
|
;;
|
||||||
\?)
|
\?)
|
||||||
echo "Invalid option: -${OPTARG}"
|
echo "Invalid option: -${OPTARG}"
|
||||||
;;
|
;;
|
||||||
@ -479,7 +485,7 @@ if [ ${version} -gt 4 ] && [ ${skipNet} -ne 1 ]; then
|
|||||||
echo "${nic} already found in database. Skipping..."
|
echo "${nic} already found in database. Skipping..."
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
nettype="dhcp"
|
||||||
if udevadm info /sys/class/net/${nic} | grep -q wlan; then
|
if udevadm info /sys/class/net/${nic} | grep -q wlan; then
|
||||||
if [ -f "${wpaConf}" ]; then
|
if [ -f "${wpaConf}" ]; then
|
||||||
country=$(awk -F'=' '/country=/{gsub(/["\r]/,""); print $NF}' ${wpaConf})
|
country=$(awk -F'=' '/country=/{gsub(/["\r]/,""); print $NF}' ${wpaConf})
|
||||||
@ -505,12 +511,13 @@ if [ ${version} -gt 4 ] && [ ${skipNet} -ne 1 ]; then
|
|||||||
[ "$(ip -j -o -4 addr show ${nic} | jq --raw-output '.[] | select(.addr_info[0].dev) | .addr_info[0].dynamic')" == "null" ]; then
|
[ "$(ip -j -o -4 addr show ${nic} | jq --raw-output '.[] | select(.addr_info[0].dev) | .addr_info[0].dynamic')" == "null" ]; then
|
||||||
ipv4Addr=$(ip -j -o -4 addr show ${nic} | jq --raw-output '.[] | select(.addr_info[0].dev) | .addr_info[0].local')
|
ipv4Addr=$(ip -j -o -4 addr show ${nic} | jq --raw-output '.[] | select(.addr_info[0].dev) | .addr_info[0].local')
|
||||||
ipv4CIDR=$(ip -j -o -4 addr show ${nic} | jq --raw-output '.[] | select(.addr_info[0].dev) | .addr_info[0].prefixlen')
|
ipv4CIDR=$(ip -j -o -4 addr show ${nic} | jq --raw-output '.[] | select(.addr_info[0].dev) | .addr_info[0].prefixlen')
|
||||||
bitmaskValue=$(( 0xffffffff ^ ((1 << (32 - ${ipv4CIDR})) - 1) ))
|
bitmaskValue=$(( 0xffffffff ^ ((1 << (32 - ipv4CIDR)) - 1) ))
|
||||||
ipv4Netmask=$(( (${bitmaskValue} >> 24) & 0xff )).$(( (${bitmaskValue} >> 16) & 0xff )).$(( (${bitmaskValue} >> 8) & 0xff )).$(( ${bitmaskValue} & 0xff ))
|
ipv4Netmask=$(( (bitmaskValue >> 24) & 0xff )).$(( (bitmaskValue >> 16) & 0xff )).$(( (bitmaskValue >> 8) & 0xff )).$(( bitmaskValue & 0xff ))
|
||||||
ipv4GW=$(ip -j -o -4 route show | jq --raw-output '.[] | select(.dst=="default") | .gateway')
|
ipv4GW=$(ip -j -o -4 route show | jq --raw-output '.[] | select(.dst=="default") | .gateway')
|
||||||
jq --null-input --compact-output \
|
jq --null-input --compact-output \
|
||||||
"{uuid: \"${OMV_CONFIGOBJECT_NEW_UUID}\", devicename: \"${nic}\", method: \"static\", address: \"${ipv4Addr}\", netmask: \"${ipv4Netmask}\", gateway: \"${ipv4GW}\", dnsnameservers: \"8.8.8.8 ${ipv4GW}\"}" | \
|
"{uuid: \"${OMV_CONFIGOBJECT_NEW_UUID}\", devicename: \"${nic}\", method: \"static\", address: \"${ipv4Addr}\", netmask: \"${ipv4Netmask}\", gateway: \"${ipv4GW}\", dnsnameservers: \"8.8.8.8 ${ipv4GW}\"}" | \
|
||||||
omv-confdbadm update "conf.system.network.interface" -
|
omv-confdbadm update "conf.system.network.interface" -
|
||||||
|
nettype="static"
|
||||||
else
|
else
|
||||||
jq --null-input --compact-output \
|
jq --null-input --compact-output \
|
||||||
"{uuid: \"${OMV_CONFIGOBJECT_NEW_UUID}\", devicename: \"${nic}\", method: \"dhcp\", method6: \"dhcp\"}" | \
|
"{uuid: \"${OMV_CONFIGOBJECT_NEW_UUID}\", devicename: \"${nic}\", method: \"dhcp\", method6: \"dhcp\"}" | \
|
||||||
@ -529,8 +536,10 @@ if [ ${version} -gt 4 ] && [ ${skipNet} -ne 1 ]; then
|
|||||||
# create config files
|
# create config files
|
||||||
${confCmd} ${network}
|
${confCmd} ${network}
|
||||||
|
|
||||||
echo "Network setup for DHCP. Rebooting..."
|
if [ ${skipReboot} -ne 1 ]; then
|
||||||
reboot
|
echo "Network setup for ${nettype}. Rebooting..."
|
||||||
|
reboot
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
echo "It is recommended to reboot and then setup the network adapter in the openmediavault web interface."
|
echo "It is recommended to reboot and then setup the network adapter in the openmediavault web interface."
|
||||||
fi
|
fi
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user