fixed indentation
This commit is contained in:
@@ -35,69 +35,69 @@ conf_network()
|
||||
# First configure IPv4 ifaces
|
||||
local iface=
|
||||
for iface in $IPV4_IFACES; do
|
||||
echo -e "\n# --------------------------------\n" >> $if_file
|
||||
echo -e "\n# --------------------------------\n" >> $if_file
|
||||
|
||||
if [[ $(eval echo \$NET4_MODE_$iface) == static ]]; then
|
||||
prnt I "Configuring IPv4 network interface $iface in static mode..."
|
||||
echo "auto $iface" >> $if_file
|
||||
echo "iface $iface inet static" >> $if_file
|
||||
echo -e "\taddress $(eval echo \$NET4_IP_$iface)" >> $if_file
|
||||
if [[ $(eval echo \$NET4_MODE_$iface) == static ]]; then
|
||||
prnt I "Configuring IPv4 network interface $iface in static mode..."
|
||||
echo "auto $iface" >> $if_file
|
||||
echo "iface $iface inet static" >> $if_file
|
||||
echo -e "\taddress $(eval echo \$NET4_IP_$iface)" >> $if_file
|
||||
|
||||
if [[ -n $(eval echo \$NET4_GW_$iface) ]]; then
|
||||
echo -e "\tgateway $(eval echo \$NET4_GW_$iface)" >> $if_file
|
||||
fi
|
||||
if [[ -n $(eval echo \$NET4_GW_$iface) ]]; then
|
||||
echo -e "\tgateway $(eval echo \$NET4_GW_$iface)" >> $if_file
|
||||
fi
|
||||
|
||||
if [[ -n $(eval echo \$NET4_NS_$iface) ]]; then
|
||||
echo -e "\tdns_nameservers $(eval echo \$NET4_NS_$iface)" >> $if_file
|
||||
fi
|
||||
if [[ -n $(eval echo \$NET4_NS_$iface) ]]; then
|
||||
echo -e "\tdns_nameservers $(eval echo \$NET4_NS_$iface)" >> $if_file
|
||||
fi
|
||||
|
||||
if [[ -n $(eval echo \$NET4_NS_SEARCH_$iface) ]]; then
|
||||
echo -e "\tdns_search $(eval echo \$NET4_NS_SEARCH_$iface)" >> $if_file
|
||||
fi
|
||||
if [[ -n $(eval echo \$NET4_NS_SEARCH_$iface) ]]; then
|
||||
echo -e "\tdns_search $(eval echo \$NET4_NS_SEARCH_$iface)" >> $if_file
|
||||
fi
|
||||
|
||||
elif [[ $(eval echo \$NET4_MODE_$iface) == dhcp ]]; then
|
||||
prnt I "Configuring IPv4 network interface $iface in DHCP mode..."
|
||||
echo "auto $iface" >> $if_file
|
||||
echo "iface $iface inet dhcp" >> $if_file
|
||||
elif [[ $(eval echo \$NET4_MODE_$iface) == dhcp ]]; then
|
||||
prnt I "Configuring IPv4 network interface $iface in DHCP mode..."
|
||||
echo "auto $iface" >> $if_file
|
||||
echo "iface $iface inet dhcp" >> $if_file
|
||||
|
||||
elif [[ $(eval echo \$NET4_MODE_$iface) == manual ]]; then
|
||||
local fname=$(eval echo \$NET4_MANUAL_FILE_$iface)
|
||||
append_file $fname $if_file
|
||||
unset fname
|
||||
fi
|
||||
elif [[ $(eval echo \$NET4_MODE_$iface) == manual ]]; then
|
||||
local fname=$(eval echo \$NET4_MANUAL_FILE_$iface)
|
||||
append_file $fname $if_file
|
||||
unset fname
|
||||
fi
|
||||
done
|
||||
|
||||
for iface in $IPV6_IFACES; do
|
||||
echo -e "\n# --------------------------------\n" >> $if_file
|
||||
echo -e "\n# --------------------------------\n" >> $if_file
|
||||
|
||||
if [[ $(eval echo \$NET6_MODE_$iface) == static ]]; then
|
||||
prnt I "Configuring IPv6 network interface $iface in static mode..."
|
||||
echo "auto $iface" >> $if_file
|
||||
echo "iface $iface inet6 static" >> $if_file
|
||||
echo -e "\taddress $(eval echo \$NET6_IP_$iface)" >> $if_file
|
||||
if [[ $(eval echo \$NET6_MODE_$iface) == static ]]; then
|
||||
prnt I "Configuring IPv6 network interface $iface in static mode..."
|
||||
echo "auto $iface" >> $if_file
|
||||
echo "iface $iface inet6 static" >> $if_file
|
||||
echo -e "\taddress $(eval echo \$NET6_IP_$iface)" >> $if_file
|
||||
|
||||
if [[ -n $(eval echo \$NET6_GW_$iface) ]]; then
|
||||
echo -e "\tgateway $(eval echo \$NET6_GW_$iface)" >> $if_file
|
||||
fi
|
||||
if [[ -n $(eval echo \$NET6_GW_$iface) ]]; then
|
||||
echo -e "\tgateway $(eval echo \$NET6_GW_$iface)" >> $if_file
|
||||
fi
|
||||
|
||||
if [[ -n $(eval echo \$NET6_NS_$iface) ]]; then
|
||||
echo -e "\tdns_nameservers $(eval echo \$NET6_NS_$iface)" >> $if_file
|
||||
fi
|
||||
if [[ -n $(eval echo \$NET6_NS_$iface) ]]; then
|
||||
echo -e "\tdns_nameservers $(eval echo \$NET6_NS_$iface)" >> $if_file
|
||||
fi
|
||||
|
||||
if [[ -n $(eval echo \$NET6_NS_SEARCH_$iface) ]]; then
|
||||
echo -e "\tdns_search $(eval echo \$NET6_NS_SEARCH_$iface)" >> $if_file
|
||||
fi
|
||||
if [[ -n $(eval echo \$NET6_NS_SEARCH_$iface) ]]; then
|
||||
echo -e "\tdns_search $(eval echo \$NET6_NS_SEARCH_$iface)" >> $if_file
|
||||
fi
|
||||
|
||||
elif [[ $(eval echo \$NET6_MODE_$iface) == dhcp ]]; then
|
||||
prnt I "Configuring IPv6 network interface $iface in DHCP mode..."
|
||||
echo "auto $iface" >> $if_file
|
||||
echo "iface $iface inet6 dhcp" >> $if_file
|
||||
elif [[ $(eval echo \$NET6_MODE_$iface) == dhcp ]]; then
|
||||
prnt I "Configuring IPv6 network interface $iface in DHCP mode..."
|
||||
echo "auto $iface" >> $if_file
|
||||
echo "iface $iface inet6 dhcp" >> $if_file
|
||||
|
||||
elif [[ $(eval echo \$NET6_MODE_$iface) == manual ]]; then
|
||||
local fname=$(eval echo \$NET6_MANUAL_FILE_$iface)
|
||||
append_file $fname $if_file
|
||||
unset fname
|
||||
fi
|
||||
elif [[ $(eval echo \$NET6_MODE_$iface) == manual ]]; then
|
||||
local fname=$(eval echo \$NET6_MANUAL_FILE_$iface)
|
||||
append_file $fname $if_file
|
||||
unset fname
|
||||
fi
|
||||
done
|
||||
|
||||
unset iface if_file
|
||||
@@ -108,80 +108,80 @@ precheck_conf_network()
|
||||
{
|
||||
file_must_exists interfaces.head
|
||||
if [[ -z $IPV4_IFACES ]]; then
|
||||
prnt W "No IPv4 interfaces to configure."
|
||||
prnt W "No IPv4 interfaces to configure."
|
||||
else
|
||||
for iface in $IPV4_IFACES; do
|
||||
if [[ ! -d /sys/class/net/$iface ]]; then
|
||||
prnt E "The iface $iface, asked to configure, do not exist!"
|
||||
die 175
|
||||
else
|
||||
if [[ $(grep "up" /sys/class/net/$iface/operstate) ]]; then
|
||||
prnt W "The IPv4 iface $iface, is already configured, a reboot will be required."
|
||||
fi
|
||||
fi
|
||||
if [[ -z $(eval echo \$NET4_MODE_$iface) ]]; then
|
||||
prnt E "Interfaces $iface have no mode set!"
|
||||
die 175
|
||||
else
|
||||
case $(eval echo \$NET4_MODE_$iface) in
|
||||
"static")
|
||||
if [[ -z $(eval echo \$NET4_IP_$iface) ]]; then
|
||||
prnt E "No IPv4 have been assigned to static interface $iface!"
|
||||
fi
|
||||
prnt m " * Interface $iface will have $(eval echo \$NET4_IP_$iface) static IPv4 address."
|
||||
;;
|
||||
"dhcp")
|
||||
prnt m " * Interface $iface will use DHCP."
|
||||
;;
|
||||
"manual")
|
||||
file_must_exists $(eval echo \$NET4_MANUAL_FILE_$iface)
|
||||
prnt m " * Interface $iface will use manual IPv4 configuration in a file."
|
||||
;;
|
||||
*)
|
||||
prnt E "Interfaces mode \"$(eval echo \$NET4_MODE_$iface)\" unsuported!"
|
||||
die 175
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
done
|
||||
for iface in $IPV4_IFACES; do
|
||||
if [[ ! -d /sys/class/net/$iface ]]; then
|
||||
prnt E "The iface $iface, asked to configure, do not exist!"
|
||||
die 175
|
||||
else
|
||||
if [[ $(grep "up" /sys/class/net/$iface/operstate) ]]; then
|
||||
prnt W "The IPv4 iface $iface, is already configured, a reboot will be required."
|
||||
fi
|
||||
fi
|
||||
if [[ -z $(eval echo \$NET4_MODE_$iface) ]]; then
|
||||
prnt E "Interfaces $iface have no mode set!"
|
||||
die 175
|
||||
else
|
||||
case $(eval echo \$NET4_MODE_$iface) in
|
||||
"static")
|
||||
if [[ -z $(eval echo \$NET4_IP_$iface) ]]; then
|
||||
prnt E "No IPv4 have been assigned to static interface $iface!"
|
||||
fi
|
||||
prnt m " * Interface $iface will have $(eval echo \$NET4_IP_$iface) static IPv4 address."
|
||||
;;
|
||||
"dhcp")
|
||||
prnt m " * Interface $iface will use DHCP."
|
||||
;;
|
||||
"manual")
|
||||
file_must_exists $(eval echo \$NET4_MANUAL_FILE_$iface)
|
||||
prnt m " * Interface $iface will use manual IPv4 configuration in a file."
|
||||
;;
|
||||
*)
|
||||
prnt E "Interfaces mode \"$(eval echo \$NET4_MODE_$iface)\" unsuported!"
|
||||
die 175
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
done
|
||||
fi
|
||||
if [[ -z $IPV6_IFACES ]]; then
|
||||
prnt W "No IPv6 interfaces to configure."
|
||||
prnt W "No IPv6 interfaces to configure."
|
||||
else
|
||||
for iface in $IPV6_IFACES; do
|
||||
if [[ ! -d /sys/class/net/$iface ]]; then
|
||||
prnt E "The iface $iface, asked to configure, do not exist!"
|
||||
die 175
|
||||
else
|
||||
if [[ $(grep "up" /sys/class/net/$iface/operstate) ]]; then
|
||||
prnt W "The IPv6 iface $iface, is already configured, a reboot will be required."
|
||||
fi
|
||||
fi
|
||||
if [[ -z $(eval echo \$NET6_MODE_$iface) ]]; then
|
||||
prnt E "Interfaces $iface have no mode set!"
|
||||
die 175
|
||||
else
|
||||
case $(eval echo \$NET6_MODE_$iface) in
|
||||
"static")
|
||||
if [[ -z $(eval echo \$NET6_IP_$iface) ]]; then
|
||||
prnt E "No IPv6 have been assigned to static interface $iface!"
|
||||
fi
|
||||
prnt m " * Interface $iface will have $(eval echo \$NET6_IP_$iface) static IPv6 address."
|
||||
;;
|
||||
"dhcp")
|
||||
prnt m " * Interface $iface will use DHCPv6."
|
||||
;;
|
||||
"manual")
|
||||
file_must_exists $(eval echo \$NET6_MANUAL_FILE_$iface)
|
||||
prnt m " * Interface $iface will use manual IPv6 configuration in a file."
|
||||
;;
|
||||
*)
|
||||
prnt E "Interfaces mode \"$(eval echo \$NET6_MODE_$iface)\" unsuported!"
|
||||
die 175
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
done
|
||||
for iface in $IPV6_IFACES; do
|
||||
if [[ ! -d /sys/class/net/$iface ]]; then
|
||||
prnt E "The iface $iface, asked to configure, do not exist!"
|
||||
die 175
|
||||
else
|
||||
if [[ $(grep "up" /sys/class/net/$iface/operstate) ]]; then
|
||||
prnt W "The IPv6 iface $iface, is already configured, a reboot will be required."
|
||||
fi
|
||||
fi
|
||||
if [[ -z $(eval echo \$NET6_MODE_$iface) ]]; then
|
||||
prnt E "Interfaces $iface have no mode set!"
|
||||
die 175
|
||||
else
|
||||
case $(eval echo \$NET6_MODE_$iface) in
|
||||
"static")
|
||||
if [[ -z $(eval echo \$NET6_IP_$iface) ]]; then
|
||||
prnt E "No IPv6 have been assigned to static interface $iface!"
|
||||
fi
|
||||
prnt m " * Interface $iface will have $(eval echo \$NET6_IP_$iface) static IPv6 address."
|
||||
;;
|
||||
"dhcp")
|
||||
prnt m " * Interface $iface will use DHCPv6."
|
||||
;;
|
||||
"manual")
|
||||
file_must_exists $(eval echo \$NET6_MANUAL_FILE_$iface)
|
||||
prnt m " * Interface $iface will use manual IPv6 configuration in a file."
|
||||
;;
|
||||
*)
|
||||
prnt E "Interfaces mode \"$(eval echo \$NET6_MODE_$iface)\" unsuported!"
|
||||
die 175
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
@@ -17,8 +17,8 @@ export DEP_conf_ntp=""
|
||||
conf_ntp()
|
||||
{
|
||||
if [[ $(pidof systemd) ]]; then
|
||||
prnt I "Disabling Systemd-timesyncd..."
|
||||
systemctl disable systemd-timesyncd || true
|
||||
prnt I "Disabling Systemd-timesyncd..."
|
||||
systemctl disable systemd-timesyncd || true
|
||||
fi
|
||||
|
||||
prnt I "Installing ntp daemon..."
|
||||
@@ -33,11 +33,11 @@ conf_ntp()
|
||||
install_file ntp.conf $dest
|
||||
local line=""
|
||||
for srv in $NTP_SERVERS; do
|
||||
line="${line}server $srv iburst\n"
|
||||
line="${line}server $srv iburst\n"
|
||||
done
|
||||
sed -i -e "s/@SERVERLIST@/$line/" $dest &&
|
||||
echo "# Generated on $(stdtime)" >> $dest &&
|
||||
mv -fv $dest /etc/ntp.conf
|
||||
echo "# Generated on $(stdtime)" >> $dest &&
|
||||
mv -fv $dest /etc/ntp.conf
|
||||
|
||||
prnt I "Starting service ntp..."
|
||||
svc_start ntp
|
||||
@@ -49,14 +49,14 @@ conf_ntp()
|
||||
precheck_conf_ntp()
|
||||
{
|
||||
if [[ -z $NTP_SERVERS ]]; then
|
||||
prnt E "No configured NTP server!"
|
||||
die 151
|
||||
prnt E "No configured NTP server!"
|
||||
die 151
|
||||
else
|
||||
file_must_exists ntp.conf
|
||||
prnt m "The NTP servers to be used will be:"
|
||||
for srv in $NTP_SERVERS; do
|
||||
prnt m " * $srv"
|
||||
done
|
||||
file_must_exists ntp.conf
|
||||
prnt m "The NTP servers to be used will be:"
|
||||
for srv in $NTP_SERVERS; do
|
||||
prnt m " * $srv"
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
@@ -24,9 +24,9 @@ conf_ssh()
|
||||
|
||||
prnt I "Installating OpenSSH configuration files..."
|
||||
for f in /etc/ssh/ssh{,d}_config; do
|
||||
backup_dist $f
|
||||
install_file ssh/$(basename $f) $f
|
||||
tag_file $f
|
||||
backup_dist $f
|
||||
install_file ssh/$(basename $f) $f
|
||||
tag_file $f
|
||||
done
|
||||
sed -i -e "s#@SSHD_PERMITROOT_RANGE@#$SSHD_PERMITROOT_RANGE#" /etc/ssh/sshd_config
|
||||
|
||||
|
||||
@@ -17,8 +17,8 @@ export DEP_create_vm="upgrade_dist install_pkg"
|
||||
create_vm()
|
||||
{
|
||||
if [[ $WITH_VM != "yes" ]]; then
|
||||
prnt W "That computer is not configured for virtualisation, nothing to do."
|
||||
return 0
|
||||
prnt W "That computer is not configured for virtualisation, nothing to do."
|
||||
return 0
|
||||
fi
|
||||
|
||||
pkginst virtualbox
|
||||
@@ -32,60 +32,60 @@ create_vm()
|
||||
|
||||
local accel_2d=off
|
||||
case $VM_OS in
|
||||
Windows*)
|
||||
accel_2d=on
|
||||
;;
|
||||
Windows*)
|
||||
accel_2d=on
|
||||
;;
|
||||
esac
|
||||
|
||||
# Create emty VM
|
||||
local targetdir=$VM_ROOT/vms/$VM_NAME
|
||||
vboxmanage createvm --ostype $VM_OS --basefolder $targetdir \
|
||||
--name $VM_NAME --register
|
||||
--name $VM_NAME --register
|
||||
|
||||
# Give main caracteristics
|
||||
vboxmanage modifyvm $VM_NAME \
|
||||
--cpus $VM_CPU --memory $VM_MEM --vram $VM_VID_MEM \
|
||||
--boot1 $VM_BOOT1 --VM_BOOT2 $VM_BOOT2 --boot3 $VM_BOOT3 \
|
||||
--nic1 bridged --bridgeadapter1 $VM_IF_BRIDGE \
|
||||
--accelerate2dvideo $accel_2d \
|
||||
--clipboard bidirectional --draganddrop disabled
|
||||
--cpus $VM_CPU --memory $VM_MEM --vram $VM_VID_MEM \
|
||||
--boot1 $VM_BOOT1 --VM_BOOT2 $VM_BOOT2 --boot3 $VM_BOOT3 \
|
||||
--nic1 bridged --bridgeadapter1 $VM_IF_BRIDGE \
|
||||
--accelerate2dvideo $accel_2d \
|
||||
--clipboard bidirectional --draganddrop disabled
|
||||
|
||||
# Add a SATA controler
|
||||
vboxmanage storagectl $VM_NAME \
|
||||
--name sata0 --add sata --controller IntelAHCI --bootable on \
|
||||
--hostiocache on --portcount 6
|
||||
--name sata0 --add sata --controller IntelAHCI --bootable on \
|
||||
--hostiocache on --portcount 6
|
||||
|
||||
# Create a virtual HDD
|
||||
vboxmanage createmedium \
|
||||
--size $VM_DISK_SIZE --variant Fixed --filename $targetdir/$VM_NAME.vdi
|
||||
--size $VM_DISK_SIZE --variant Fixed --filename $targetdir/$VM_NAME.vdi
|
||||
|
||||
# Connect the created HDD to the VM
|
||||
vboxmanage storageattach $VM_NAME \
|
||||
--storagectl sata0 --port 1 --device 0 --type hdd \
|
||||
--medium $targetdir/$VM_NAME.vdi
|
||||
--storagectl sata0 --port 1 --device 0 --type hdd \
|
||||
--medium $targetdir/$VM_NAME.vdi
|
||||
|
||||
unset targetdir accel_2d
|
||||
|
||||
# Add empty DVD
|
||||
vboxmanage storageattach $VM_NAME --storagectl sata0 --port 2 --device 0 \
|
||||
--medium emptydrive
|
||||
--medium emptydrive
|
||||
|
||||
# Add shares
|
||||
local share= i=0
|
||||
for share in $VM_SHARES_NAME; do
|
||||
(( i+=1 ))
|
||||
(( i+=1 ))
|
||||
|
||||
local j=0 hostpath=""
|
||||
for path in $VM_SHARES_PATH; do
|
||||
(( j+=1 ))
|
||||
if [[ $i -eq $j ]]; then
|
||||
hostpath=$path
|
||||
fi
|
||||
done
|
||||
unset j
|
||||
local j=0 hostpath=""
|
||||
for path in $VM_SHARES_PATH; do
|
||||
(( j+=1 ))
|
||||
if [[ $i -eq $j ]]; then
|
||||
hostpath=$path
|
||||
fi
|
||||
done
|
||||
unset j
|
||||
|
||||
vboxmanage sharedfolder add $VM_NAME \
|
||||
--name ${VM_SHARES_NAME,,} --hostpath $hostpath
|
||||
vboxmanage sharedfolder add $VM_NAME \
|
||||
--name ${VM_SHARES_NAME,,} --hostpath $hostpath
|
||||
done
|
||||
unset share i
|
||||
}
|
||||
@@ -93,35 +93,35 @@ create_vm()
|
||||
precheck_create_vm()
|
||||
{
|
||||
if [[ $WITH_VM == "yes" ]]; then
|
||||
if [[ -z $VM_NAME ]]; then
|
||||
prnt E "The virtual machine must have a name."
|
||||
die 181
|
||||
fi
|
||||
if [[ -z VM_CPU || -z VM_MEM || -z VM_OS || -z VM_ROOT || \
|
||||
-z VM_BOOT1 || -z VM_BOOT2 || -z VM_BOOT3 || -z VM_VID_MEM ||
|
||||
-z VM_IF_BRIDGE || -z VM_DISK_SIZE ]]; then
|
||||
prnt E "A necessary declaration for the virtual machine is absent!"
|
||||
die 181
|
||||
else
|
||||
prnt I "The virtual machine \"$VM_NAME\" will be created in $VM_ROOT..."
|
||||
fi
|
||||
if [[ -z $VM_NAME ]]; then
|
||||
prnt E "The virtual machine must have a name."
|
||||
die 181
|
||||
fi
|
||||
if [[ -z VM_CPU || -z VM_MEM || -z VM_OS || -z VM_ROOT || \
|
||||
-z VM_BOOT1 || -z VM_BOOT2 || -z VM_BOOT3 || -z VM_VID_MEM ||
|
||||
-z VM_IF_BRIDGE || -z VM_DISK_SIZE ]]; then
|
||||
prnt E "A necessary declaration for the virtual machine is absent!"
|
||||
die 181
|
||||
else
|
||||
prnt I "The virtual machine \"$VM_NAME\" will be created in $VM_ROOT..."
|
||||
fi
|
||||
|
||||
local share= i=0 j=0
|
||||
for share in $VM_SHARES_NAME; do
|
||||
(( i+=1 ))
|
||||
done
|
||||
for share in $VM_SHARES_PATH; do
|
||||
(( j+=1 ))
|
||||
done
|
||||
unset share
|
||||
if [[ $i -eq $j ]]; then
|
||||
prnt I "The virtual machine will access $i directories from the host."
|
||||
else
|
||||
prnt E "The number of share and path to share is different!"
|
||||
die 182
|
||||
fi
|
||||
local share= i=0 j=0
|
||||
for share in $VM_SHARES_NAME; do
|
||||
(( i+=1 ))
|
||||
done
|
||||
for share in $VM_SHARES_PATH; do
|
||||
(( j+=1 ))
|
||||
done
|
||||
unset share
|
||||
if [[ $i -eq $j ]]; then
|
||||
prnt I "The virtual machine will access $i directories from the host."
|
||||
else
|
||||
prnt E "The number of share and path to share is different!"
|
||||
die 182
|
||||
fi
|
||||
else
|
||||
prnt I "No virtual machine to create."
|
||||
prnt I "No virtual machine to create."
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
@@ -20,18 +20,18 @@ install_chromium()
|
||||
{
|
||||
# Add Debian repo to sources.list.d directory depending on Ubuntu version
|
||||
case $SYS_VER in
|
||||
16.04|16.10|17.04|17.10)
|
||||
prnt I "Adding Debian Stretch repository to software sources..."
|
||||
install_file debian_stretch.list /etc/apt/sources.list.d/
|
||||
;;
|
||||
18.04|18.10|19.04|19.10)
|
||||
prnt I "Adding Debian Buster repository to software sources..."
|
||||
install_file debian_buster.list /etc/apt/sources.list.d/
|
||||
;;
|
||||
20.04|20.10|21.04|21.10)
|
||||
prnt I "Adding Debian Bullseye repository to software sources..."
|
||||
install_file debian_bullseye.list /etc/apt/sources.list.d/
|
||||
;;
|
||||
16.04|16.10|17.04|17.10)
|
||||
prnt I "Adding Debian Stretch repository to software sources..."
|
||||
install_file debian_stretch.list /etc/apt/sources.list.d/
|
||||
;;
|
||||
18.04|18.10|19.04|19.10)
|
||||
prnt I "Adding Debian Buster repository to software sources..."
|
||||
install_file debian_buster.list /etc/apt/sources.list.d/
|
||||
;;
|
||||
20.04|20.10|21.04|21.10)
|
||||
prnt I "Adding Debian Bullseye repository to software sources..."
|
||||
install_file debian_bullseye.list /etc/apt/sources.list.d/
|
||||
;;
|
||||
esac
|
||||
|
||||
# Install Debian GPG keys
|
||||
@@ -56,23 +56,23 @@ precheck_install_chromium()
|
||||
{
|
||||
# Check we run Ubuntu
|
||||
if [[ $SYS_DIST != "ubuntu" ]]; then
|
||||
prnt E "The install_chromium module is a Ubuntu only workaround."
|
||||
die 165
|
||||
prnt E "The install_chromium module is a Ubuntu only workaround."
|
||||
die 165
|
||||
fi
|
||||
case $SYS_VER in
|
||||
16.04|16.10|17.04|17.10)
|
||||
prnt m " * Detected Ubuntu $SYS_VER, will install Stretch version of Chromium"
|
||||
;;
|
||||
18.04|18.10|19.04|19.10)
|
||||
prnt m " * Detected Ubuntu $SYS_VER, will install Buster version of Chromium"
|
||||
;;
|
||||
20.04|20.10|21.04|21.10)
|
||||
prnt m " * Detected Ubuntu $SYS_VER, will install Bullseye version of Chromium"
|
||||
;;
|
||||
*)
|
||||
prnt E "Unable to determine the corresponding Debian version."
|
||||
die 165
|
||||
;;
|
||||
16.04|16.10|17.04|17.10)
|
||||
prnt m " * Detected Ubuntu $SYS_VER, will install Stretch version of Chromium"
|
||||
;;
|
||||
18.04|18.10|19.04|19.10)
|
||||
prnt m " * Detected Ubuntu $SYS_VER, will install Buster version of Chromium"
|
||||
;;
|
||||
20.04|20.10|21.04|21.10)
|
||||
prnt m " * Detected Ubuntu $SYS_VER, will install Bullseye version of Chromium"
|
||||
;;
|
||||
*)
|
||||
prnt E "Unable to determine the corresponding Debian version."
|
||||
die 165
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
|
||||
@@ -21,12 +21,12 @@ export DEP_install_desktop="upgrade_dist"
|
||||
install_desktop()
|
||||
{
|
||||
if [[ -n $X11_DRV ]]; then
|
||||
prnt I "Installing additionnal X11 drivers..."
|
||||
pkginst $X11_DRV
|
||||
prnt I "Installing additionnal X11 drivers..."
|
||||
pkginst $X11_DRV
|
||||
fi
|
||||
if [[ $UBUNTU_FLAVOR ]]; then
|
||||
prnt I "Installing $UBUNTU_FLAVOR environment..."
|
||||
pkginst ${UBUNTU_FLAVOR}-desktop
|
||||
prnt I "Installing $UBUNTU_FLAVOR environment..."
|
||||
pkginst ${UBUNTU_FLAVOR}-desktop
|
||||
fi
|
||||
# Because we're lazy but manual actions can avoid reboot...
|
||||
NEED_REBOOT=true
|
||||
@@ -35,12 +35,12 @@ install_desktop()
|
||||
precheck_install_desktop()
|
||||
{
|
||||
if [[ -z $UBUNTU_FLAVOR ]]; then
|
||||
prnt W "No Ubuntu flavor chosen, no desktop environment will be installed!"
|
||||
prnt W "No Ubuntu flavor chosen, no desktop environment will be installed!"
|
||||
else
|
||||
prnt m " * The flavor $UBUNTU_FLAVOR will be installed..."
|
||||
prnt m " * The flavor $UBUNTU_FLAVOR will be installed..."
|
||||
fi
|
||||
if [[ -n $X11_DRV ]]; then
|
||||
prnt W "Non free drivers will be installed."
|
||||
prnt W "Non free drivers will be installed."
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
@@ -35,16 +35,16 @@ install_mkagent()
|
||||
precheck_install_mkagent()
|
||||
{
|
||||
if [[ -z $MK_VERSION ]]; then
|
||||
prnt E "Undeclared check_mk version of the agent to install."
|
||||
die 162
|
||||
prnt E "Undeclared check_mk version of the agent to install."
|
||||
die 162
|
||||
fi
|
||||
if [[ -z $MK_URL ]]; then
|
||||
prnt E "Undeclared check_mk download URL."
|
||||
die 162
|
||||
prnt E "Undeclared check_mk download URL."
|
||||
die 162
|
||||
fi
|
||||
if [[ -z $MK_SERVER_IP ]]; then
|
||||
prnt E "Undeclared check_mk server."
|
||||
die 162
|
||||
prnt E "Undeclared check_mk server."
|
||||
die 162
|
||||
fi
|
||||
file_must_exists cmk/check_mk cmk/mk_apt
|
||||
}
|
||||
|
||||
@@ -20,28 +20,28 @@ install_pkg()
|
||||
{
|
||||
# Remove unnecessary packages
|
||||
if [[ -n $PKGS_RMLIST ]]; then
|
||||
prnt I "Removing some undesired packages..."
|
||||
pkgrm $PKGS_RMLIST
|
||||
prnt I "Removing some undesired packages..."
|
||||
pkgrm $PKGS_RMLIST
|
||||
fi
|
||||
|
||||
# Blacklist some anoying packages (and remove them if needed)
|
||||
if [[ -n PKGS_BLACKLIST ]]; then
|
||||
for pkg in $PKGS_BLACKLIST; do
|
||||
prnt I "Placing $pkg into the blacklist..."
|
||||
local dest=/etc/apt/preferences.d/blacklist_$pkg
|
||||
install_file pkgman/blacklist.conf $dest &&
|
||||
sed -i -e "s/@pkg@/pkg/" $dest
|
||||
tag_file $dest
|
||||
for pkg in $PKGS_BLACKLIST; do
|
||||
prnt I "Placing $pkg into the blacklist..."
|
||||
local dest=/etc/apt/preferences.d/blacklist_$pkg
|
||||
install_file pkgman/blacklist.conf $dest &&
|
||||
sed -i -e "s/@pkg@/pkg/" $dest
|
||||
tag_file $dest
|
||||
|
||||
# If blacklisted we suppose uninstall as well (if neeeded)
|
||||
pkgrm $pkg
|
||||
done
|
||||
# If blacklisted we suppose uninstall as well (if neeeded)
|
||||
pkgrm $pkg
|
||||
done
|
||||
fi
|
||||
|
||||
# Install all the configured packages
|
||||
if [[ -n $PKGSEL ]]; then
|
||||
prnt I "Installing the package selection..."
|
||||
pkginst $PKGSEL
|
||||
prnt I "Installing the package selection..."
|
||||
pkginst $PKGSEL
|
||||
fi
|
||||
|
||||
# Cleaning
|
||||
@@ -52,22 +52,22 @@ install_pkg()
|
||||
precheck_install_pkg()
|
||||
{
|
||||
if [[ -z PKGS_RMLIST ]]; then
|
||||
prnt m " * No package to remove."
|
||||
prnt m " * No package to remove."
|
||||
else
|
||||
prnt m " * $(echo $PKGS_RMLIST | wc -w) package to remove."
|
||||
prnt m " * $(echo $PKGS_RMLIST | wc -w) package to remove."
|
||||
fi
|
||||
|
||||
if [[ -z PKGS_BLACKLIST ]]; then
|
||||
prnt m " * The packages $pkg will be placed into the blacklist !"
|
||||
file_must_exists pkgman/blacklist.conf
|
||||
prnt m " * The packages $pkg will be placed into the blacklist !"
|
||||
file_must_exists pkgman/blacklist.conf
|
||||
else
|
||||
prnt m " * No package to blacklist."
|
||||
prnt m " * No package to blacklist."
|
||||
fi
|
||||
|
||||
if [[ -z $PKGSEL ]]; then
|
||||
prnt m " * No additionnal package to install !"
|
||||
prnt m " * No additionnal package to install !"
|
||||
else
|
||||
prnt m " * $(echo $PKGSEL | wc -w) additionnal package have to be installed."
|
||||
prnt m " * $(echo $PKGSEL | wc -w) additionnal package have to be installed."
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
@@ -18,16 +18,16 @@ install_profile()
|
||||
|
||||
local usrlist="/root"
|
||||
if find /home -mindepth 1 -maxdepth 1 -type d | read; then
|
||||
usrlist="$usrlist /home/*"
|
||||
usrlist="$usrlist /home/*"
|
||||
fi
|
||||
|
||||
for usr in $usrlist; do
|
||||
prnt I "Installing profile for user $usr..."
|
||||
backup_dist $usr/{.,}profile $usr/.bashrc
|
||||
install_file profile/{{.,}profile,.bashrc} $usr/
|
||||
tag_file $usr/{{.,}profile,.bashrc}
|
||||
install_file profile/.tmux/.tmux.conf{,.local} $usr/
|
||||
tag_file $usr/.tmux.conf{,.local}
|
||||
prnt I "Installing profile for user $usr..."
|
||||
backup_dist $usr/{.,}profile $usr/.bashrc
|
||||
install_file profile/{{.,}profile,.bashrc} $usr/
|
||||
tag_file $usr/{{.,}profile,.bashrc}
|
||||
install_file profile/.tmux/.tmux.conf{,.local} $usr/
|
||||
tag_file $usr/.tmux.conf{,.local}
|
||||
done
|
||||
unset usrlist
|
||||
|
||||
|
||||
@@ -16,21 +16,21 @@ patch_snmp()
|
||||
pkginst snmpd
|
||||
prnt I "Configuring SNMP daemon..."
|
||||
backup_dist /etc/snmp/snmpd.conf /etc/default/snmpd \
|
||||
/lib/systemd/system/snmpd.service /etc/init.d/snmpd
|
||||
/lib/systemd/system/snmpd.service /etc/init.d/snmpd
|
||||
install_file snmpd/snmpd.conf /etc/snmp/snmpd.conf
|
||||
tag_file /etc/snmp/snmpd.conf
|
||||
# No longer required with Debian >= 11 or Devuan >= 4
|
||||
if [[ ($SYS_DIST == 'debian' && $SYS_VER -lt 11) ||
|
||||
($SYS_DIST == 'devuan' && $SYS_VER -lt 4) ]]; then
|
||||
install_file snmpd/snmpd.init /etc/init.d/snmpd
|
||||
($SYS_DIST == 'devuan' && $SYS_VER -lt 4) ]]; then
|
||||
install_file snmpd/snmpd.init /etc/init.d/snmpd
|
||||
fi
|
||||
install_file snmpd/snmpd.default /etc/default/snmpd
|
||||
tag_file /etc/default/snmpd
|
||||
if [[ -e /lib/systemd/system/snmpd.service ]]; then
|
||||
install_file snmpd/snmpd.service /lib/systemd/system/snmpd.service
|
||||
if command -v systemctl &> /dev/null; then
|
||||
systemctl daemon-reload
|
||||
fi
|
||||
install_file snmpd/snmpd.service /lib/systemd/system/snmpd.service
|
||||
if command -v systemctl &> /dev/null; then
|
||||
systemctl daemon-reload
|
||||
fi
|
||||
fi
|
||||
svc_restart snmpd
|
||||
}
|
||||
@@ -39,7 +39,7 @@ precheck_patch_snmp()
|
||||
{
|
||||
file_must_exists snmpd/snmpd.{conf,default}
|
||||
if [[ -e /lib/systemd/system/snmpd.service ]]; then
|
||||
file_must_exists snmpd/snmpd.service
|
||||
file_must_exists snmpd/snmpd.service
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
@@ -36,19 +36,19 @@ upgrade_dist()
|
||||
|
||||
prnt I "Configuring proxy for APT..."
|
||||
if [[ -n $PROXY_APT ]]; then
|
||||
if [[ ! -d $(dirname $proxyfile) ]]; then
|
||||
mkdir -pv $(dirname $proxyfile) || (
|
||||
prnt E "Impossible to create directory to receive APT configuration."
|
||||
die 60
|
||||
)
|
||||
fi
|
||||
tag_file $proxyfile
|
||||
echo "Acquire::http::Proxy \"http://${PROXY_APT}:${PROXY_APT_PORT}\";" >> $proxyfile
|
||||
if [[ ! -d $(dirname $proxyfile) ]]; then
|
||||
mkdir -pv $(dirname $proxyfile) || (
|
||||
prnt E "Impossible to create directory to receive APT configuration."
|
||||
die 60
|
||||
)
|
||||
fi
|
||||
tag_file $proxyfile
|
||||
echo "Acquire::http::Proxy \"http://${PROXY_APT}:${PROXY_APT_PORT}\";" >> $proxyfile
|
||||
elif [[ -n $PROXY_SRV ]]; then
|
||||
tag_file $proxyfile
|
||||
echo "Acquire::http::Proxy \"http://${PROXY_SRV}:${PROXY_SRV_PORT}\";" >> $proxyfile
|
||||
tag_file $proxyfile
|
||||
echo "Acquire::http::Proxy \"http://${PROXY_SRV}:${PROXY_SRV_PORT}\";" >> $proxyfile
|
||||
else
|
||||
prnt I "No proxy configured, nothing to do."
|
||||
prnt I "No proxy configured, nothing to do."
|
||||
fi
|
||||
|
||||
# Remplace source.list from dist with ours (be smarter)
|
||||
@@ -69,16 +69,16 @@ precheck_upgrade_dist()
|
||||
prnt I "Checking network connectivity..."
|
||||
|
||||
if [[ $(noerror wget -q --tries=10 --timeout=20 --spider http://www.tetaneutral.net) != 0 ]]; then
|
||||
prnt E "It seems network configuration is not functionnal! Giving up."
|
||||
die 160
|
||||
prnt E "It seems network configuration is not functionnal! Giving up."
|
||||
die 160
|
||||
fi
|
||||
if [[ -n $PROXY_APT && -z $PROXY_APT_PORT ]]; then
|
||||
prnt E "An APT proxy server have been specified but not its working port."
|
||||
die 160
|
||||
prnt E "An APT proxy server have been specified but not its working port."
|
||||
die 160
|
||||
fi
|
||||
if [[ -n $PROXY_SRV && -z $PROXY_SRV_PORT ]]; then
|
||||
prnt E "A general proxy server have been specified but not its working port."
|
||||
die 160
|
||||
prnt E "A general proxy server have been specified but not its working port."
|
||||
die 160
|
||||
fi
|
||||
file_must_exists pkgman/${SYS_DIST}_${SYS_VER}.list
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user