Commit 1fd781f5 authored by Igor Pecovnik's avatar Igor Pecovnik
Browse files

RFC #2

parent 9d28e6e2
......@@ -28,7 +28,7 @@ Installation steps
cd ~
git clone https://github.com/igorpecovnik/Debian-micro-home-server
cd Debian-micro-home-server
sudo ./install.sh
sudo ./softy
Thank you for your support
......
#!/bin/bash
#
# Copyright (c) 2017 Igor Pecovnik, igor.pecovnik@gma**.com
#
# This file is licensed under the terms of the GNU General Public
# License version 2. This program is licensed "as is" without any
# warranty of any kind, whether express or implied.
# check for root
#
if [[ $EUID != 0 ]]; then
dialog --title "Warning" --infobox "\nThis script requires root privileges.\n\nExiting ..." 7 41
sleep 3
exit
fi
# Install basic stuff
#
apt-get -y --no-install-recommends install dialog whiptail lsb-release bc expect rcconf
# gather some info
#
[[ -f /etc/armbian-release ]] && source /etc/armbian-release && ARMBIAN="Armbian $VERSION $IMAGE_TYPE";
DISTRO=$(lsb_release -is)
DISTROID=$(lsb_release -rs)
BACKTITLE="$ARMBIAN $DISTRO $DISTROID configuration utility, http://www.armbian.com"
TITLE="Configuring $BOARD_NAME"
LIST=()
###########################################################################################################################################
# here we add new items to menu. with condition when needed
[[ -n $(ls -1 /sys/class/net/ | grep -vE "eth|lo|enp") ]] && LIST+=( "Wireless" "Connect to your router" )
LIST+=( "Network" "Edit network settings" )
[[ -f /boot/armbianEnv.txt ]] && LIST+=( "Booting" "Edit boot environment" )
[[ -f /usr/sbin/nand-sata-install ]] && LIST+=( "Install" "Install Armbian to SATA, eMMC, NAND, USB" )
LIST+=( "Services" "Toogle running services" )
[[ -f /usr/bin/armbianmonitor ]] && LIST+=( "Monitor" "Provides simple CLI monitoring" )
[[ -f /usr/bin/softy ]] && LIST+=( "Softy" "Install 3rd party applications" )
[[ -f /usr/bin/armbianmonitor ]] && LIST+=( "Diagnostics" "Send diagnostics" )
###########################################################################################################################################
LISTLENGHT="$((7+${#LIST[@]}/2))"
# main dialog routine
DIALOG_CANCEL=1
DIALOG_ESC=255
while true; do
exec 3>&1
selection=$(dialog --backtitle "$BACKTITLE" --title "$TITLE" --clear --cancel-label "Exit" --menu "Please select:" $LISTLENGHT 70 15 \
"${LIST[@]}" 2>&1 1>&3)
exit_status=$?
exec 3>&-
case $exit_status in
$DIALOG_CANCEL)
clear
echo -e "\n\e[0;33mThank you for using Armbian configuration tool! Support: \e[1m\e[39mwww.armbian.com\x1B[0m\n"
exit
;;
$DIALOG_ESC)
clear
exit 1
;;
esac
#######################################################################################################################################
case $selection in
"Services" )
rcconf
;;
"Network" )
dialog --title "Edit network configuration" --no-collapse --editbox /etc/network/interfaces 30 0 2> /etc/network/interfaces.out
[[ $? = 0 ]] && mv /etc/network/interfaces.out /etc/network/interfaces
;;
"Booting" )
dialog --title "Edit u-boot environment" --no-collapse --editbox /boot/armbianEnv.txt 30 0 2> /boot/armbianEnv.txt.out
[[ $? = 0 ]] && mv /boot/armbianEnv.txt.out /boot/armbianEnv.txt
;;
"Install" )
nand-sata-install
;;
"Wireless" )
nmtui-connect
;;
"Diagnostics" )
clear
armbianmonitor -u
echo ""
read -n 1 -s -p "Press any key to continue"
;;
"Softy" )
softy
;;
"Monitor" )
clear
armbianmonitor -m | dialog --backtitle "$BACKTITLE" --title "Simple CLI monitoring $BOARD" --progressbox 15 64
;;
esac
#######################################################################################################################################
done
\ No newline at end of file
#!/bin/bash
#
# Debian micro home server installation(c) Igor Pecovnik
#
# Copyright (c) 2015 Igor Pecovnik, igor.pecovnik@gma**.com
#
# This file is licensed under the terms of the GNU General Public
# License version 2. This program is licensed "as is" without any
# warranty of any kind, whether express or implied.
#
# This file is a part of https://github.com/igorpecovnik/Debian-micro-home-server
#
# Read functions
source "functions.sh"
# Check if user is root
if [ $(id -u) != "0" ]; then
dialog --msgbox "Error: You must be root to run this script, please use the root user to install the software." 7 70
exit 1
fi
# Debian only
if [ ! -f /etc/debian_version ]; then
dialog --msgbox "Warning: Unsupported Linux Distribution, it might not install properly. Tailored for Debian. " 7 70
fi
# Ramlog must be disabled
if [ -f /run/ramlog.lock ]; then
dialog --msgbox "Ramlog is running. Please disable before running (service ramlog disable). Reboot is required." 7 70
exit 1
fi
# Choose what to install
what_to_install
for menu_choice in "${choice[@]}"
do
if [[ "$menu_choice" == ISPConfig* ]] ; then
server_conf
if [[ "$MYSQL_PASS" == "" ]]; then
dialog --msgbox "Mysql password can't be blank. Exiting..." 7 70
exit
fi
install_basic; install_DashNTP; install_MySQL; install_MySQLDovecot; install_Virus; install_$server; install_hhvm
create_ispconfig_configuration; install_PureFTPD; install_Fail2BanDovecot; install_Fail2BanRulesDovecot;
install_ISPConfig
fi
if [[ "$menu_choice" == *Tasksel* ]] ; then
tasksel
fi
if [[ "$menu_choice" == *headend* ]] ; then
install_tvheadend
check_port 9981 "HTS tvheadend"
echo $menu_choice;
fi
if [[ "$menu_choice" == *Syncthing* ]] ; then
install_syncthing
check_port 8384 "Syncthing"
fi
if [[ "$menu_choice" == CUPS* ]] ; then
install_cups
fi
if [[ "$menu_choice" == *server* ]] ; then
install_vpn_server
fi
if [[ "$menu_choice" == Scanner* ]] ; then
install_scaner_and_scanbuttons
fi
if [[ "$menu_choice" == *monitor* ]] ; then
armbianmonitor -r
fi
if [[ "$menu_choice" == *OMV* ]] ; then
install_omv
fi
if [[ "$menu_choice" == *hole* ]] ; then
curl -L install.pi-hole.net | bash
fi
if [[ "$menu_choice" == *Minidlna* ]] ; then
install_packet "minidlna" "Install lightweight DLNA/UPnP-AV server"
check_port 8200
fi
if [[ "$menu_choice" == *Transmission* ]] ; then
install_transmission
check_port 9091
fi
done
\ No newline at end of file
[global]
workgroup = SMBGROUP
server string = %h server
hosts allow = SUBNET
log file = /var/log/samba/log.%m
max log size = 1000
syslog = 0
panic action = /usr/share/samba/panic-action %d
load printers = yes
printing = cups
printcap name = cups
[printers]
comment = All Printers
path = /var/spool/samba
browseable = no
public = yes
guest ok = yes
writable = no
printable = yes
printer admin = SMBUSER
[print$]
comment = Printer Drivers
path = /etc/samba/drivers
browseable = yes
guest ok = no
read only = yes
write list = SMBUSER
[ext]
comment = Storage
path = /ext
writable = yes
public = no
valid users = SMBUSER
force create mode = 0777
This diff is collapsed.
#!/bin/bash
#
# SoC/HDD temperature daemon. Writes the current temperatures to
# /run/soc-temp and /run/hdd-temp (since we're experiencing always
# timeouts under heavy load when trying to get the temperatures
# directly from within RPi-Monitor.
Main() {
# SoCTempAdjustment is needed because the A20 SoC delivers uncalibrated temp values
SoCTempAdjustment=1447
# ensure module sunxi-dbgreg.ko is loaded
grep -q sunxi_dbgreg </proc/modules || ( modprobe sunxi-dbgreg ; sleep 0.1 )
# open GPIO22, PIR sensor
echo 22 > /sys/class/gpio/export
# prepare registers
echo 'f1c25000:27003f' > /sys/devices/virtual/misc/sunxi-dbgreg/rw/write;
echo 'f1c25010:40000' > /sys/devices/virtual/misc/sunxi-dbgreg/rw/write;
echo 'f1c25018:10fff' > /sys/devices/virtual/misc/sunxi-dbgreg/rw/write;
echo 'f1c25004:10' > /sys/devices/virtual/misc/sunxi-dbgreg/rw/write;
while [ 2 -ge 1 ]; do
# let the value be written to syslog
echo 'f1c25020' > /sys/devices/virtual/misc/sunxi-dbgreg/rw/read;
# wait 0.1 seconds
sleep 0.1
# read return value from syslog and transform it into degrees Celsius
HexVal=$(tail /var/log/syslog | awk -F" 0x" '/ 0x/ {print $2}' | tail -n1 )
SoCTemp=$(echo $(( 0x${HexVal} - ${SoCTempAdjustment} )) | awk '{printf ("%0.1f",$1/10); }')
if [ "X${SoCTemp}" != "X" ]; then
echo -n ${SoCTemp} >/run/soc-temp
fi
# HDD/SSD temp
DiskTemp=$(hddtemp -n /dev/sda)
if [ "X${DiskTemp}" != "X" ]; then
echo -n ${DiskTemp} >/run/hdd-temp
fi
# PIR sensor
if [ ! -f /run/pir-temp ]; then echo 0 > /run/pir-temp; fi
if [ "$(cat /sys/class/gpio/gpio22/value)" == "1" ]; then echo 1 > /run/pir-temp; fi
if [ `stat --format=%Y /run/pir-temp` -le $(( `date +%s` - 600 )) ]; then
cat /sys/class/gpio/gpio22/value > /run/pir-temp
fi
# sleep 5 secs
sleep 5
done
} # Main
Main
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