diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 2a4c2159c7..96e8a07d5c 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1,3 +1,31 @@ +v133 +(08/10/16) + +Changes / Improvements / Optimizations: +DietPi-Software | Added installation option for Webmin: http://dietpi.com/phpbb/viewtopic.php?f=8&t=5&p=3047#p3047 +DietPi-Software | Libcec3 now installed with Kodi by default: https://github.com/Fourdee/DietPi/issues/283 +DietPi-Software | Emby is now available for ARM64 devices. Many thanks to Gabriel for making this possible: http://dietpi.com/phpbb/viewtopic.php?f=11&t=720&p=3120#p3117 +DietPi-Software | Urbackup server installation updated to 2.0.36. +DietPi-Config | You can now change Apt mirrors from the "Networking NAS/Misc menu": https://github.com/Fourdee/DietPi/issues/519 +DietPi-Config | Added ability to tweak Ondemand sampling rates in the performance menu: https://github.com/Fourdee/DietPi/issues/541 +DietPi-Drive_Manager | To support large filesystems, GPT is now the default paritition table type on format, (previously MBR). Many thanks to Zone22: https://github.com/Fourdee/DietPi/issues/531 +DietPi-Drive_Manager | Current userdata location is now shown in the main menu. +DietPi-Set_Cpu | If the target CPU gov is not available on the system, an alternative will be set and saved automatically. +DietPi-Automation | Added a global password var (AUTO_Global_Password=) in dietpi.txt, which will be applied to root login, and, during dietpi-software installations, for all software that use a password: https://github.com/Fourdee/DietPi/issues/533 +DietPi-Automation | Added filesystem format type for USB drive format (AUTO_Dedicated_Usb_Drive_Format_Filesystem=) in dietpi.txt: https://github.com/Fourdee/DietPi/issues/537 +DietPi-Automation | Added ability to force ethernet link speeds on 1st run (Ethernet_Force_Speed=) in dietpi.txt: https://github.com/Fourdee/DietPi/issues/544#issuecomment-252068249 +General | Interactive is now the default CPU gov, provides improved response times: https://github.com/Fourdee/DietPi/issues/535 +General | Ethtool is now installed by default. Mainly used to provide a workaround for known HW failure Pine A64 1Gbit boards: https://github.com/Fourdee/DietPi/issues/544#issuecomment-252068249 + +Bug fixes: +DietPi-Software | Emby has been disabled for ARMv6 devices, due to unsupported/broken repo on armv6 hardware: https://github.com/Fourdee/DietPi/issues/534 +DietPi-Software | Resolved an issue where Nginx would prevent file uploads over 2MB. Many thanks to @pfeerick for reporting this and providing the solution: https://github.com/Fourdee/DietPi/issues/546 +DietPi-Services | Resolved an issue where Samba services smbd and nmbd, were not being applied. Many thanks to RajatNair: https://github.com/Fourdee/DietPi/issues/542 +DietPi-Config | Resolved an issue where NanoPiM2 was allowing H3 soundcards to be set. +General | Improved detection for RPi boards with warranty bit set. + +----------------------------------------------------------------------------------------------------------- + v132 (25/09/16) @@ -10,7 +38,7 @@ DietPi-Software | Cleaned up the default samba server config. Many thanks to Acr DietPi-Software | Php max upload size is now set automatically to the max capable on your device. Generally, 2GB for 32bit systems, 8796PB for 64bit systems. Used by programs such as Nextcloud. DietPi-Software | UrBackup installation updated to 2.0.34. DietPi-Update | Added a notice prior to update, with regards to: manually edited Linux configurations possibily affecting the update: https://github.com/Fourdee/DietPi/issues/525 -DietPi-Drive_Manager | Added root FS (SD/EMMC) to list of drives, and an option to move userdata their also. +DietPi-Drive_Manager | Added root FS (SD/EMMC) to list of drives, and option to move userdata there also. General | p7zip is now installed by default. Bug fixes: diff --git a/PREP_SYSTEM_FOR_DIETPI.sh b/PREP_SYSTEM_FOR_DIETPI.sh index f8a9b36402..59e36a12a4 100644 --- a/PREP_SYSTEM_FOR_DIETPI.sh +++ b/PREP_SYSTEM_FOR_DIETPI.sh @@ -62,6 +62,10 @@ rm /etc/apt/sources.list.d/deb-multimedia.list # deb-src http://ftp.debian.org/debian jessie-backports main contrib non-free # deb-src http://ftp.debian.org/debian jessie-proposed-updates contrib non-free main + +#NOTE: +#Apt mirror will get overwritten by: /DietPi/dietpi/func/dietpi-set_software apt-mirror default : during finalize. + # - Everything else (excluding RPi!) cat << _EOF_ > /etc/apt/sources.list deb http://ftp.debian.org/debian jessie main contrib non-free @@ -70,11 +74,11 @@ deb http://security.debian.org jessie/updates main contrib non-free deb http://ftp.debian.org/debian jessie-backports main contrib non-free _EOF_ -# RPI UK for my testing, mirror director is slow, unstable and unreliable ------------------------- +# RPI UK mirror director is slow, unstable and unreliable ------------------------- cat << _EOF_ > /etc/apt/sources.list deb http://mirror.ox.ac.uk/sites/archive.raspbian.org/archive/raspbian jessie main contrib non-free rpi _EOF_ -# RPI UK for my testing, mirror director is slow, unstable and unreliable ------------------------- +# RPI UK mirror director is slow, unstable and unreliable ------------------------- #Remove following Jessie @@ -82,21 +86,20 @@ apt-get clean apt-get update apt-get purge libpng* cpp-* cpp ntpdate bluez bluetooth rsync dialog dhcpcd5 libsqlite* libxapian22 lua5.1 netcat-* make makedev ncdu plymouth openresolv shared-mime-in* tcpd strace tasksel* wireless-* xdg-user-dirs triggerhappy python* v4l-utils traceroute xz-utils ucf xauth zlib1g-dev xml-core aptitude* avahi-daemon rsyslog logrotate man-db manpages vim vim-common vim-runtime vim-tiny mc mc-data -#+Desktop images: +#+Desktop images (Mostly desktop packages, but apply to non-desktop images also): apt-get purge libpod-* libpeas-* isc-dhcp-server gnome-* fonts-dejavu* eject dnsmasq* dns-root-data colord-data libturbojpeg1 libjasper* libjson* libwbclient* libwayland* golang-* libavahi* libtext* libweb* libpcsclite1 libxau6* libvpx1 libxc* dictionaries-* libgtk* miscfiles minicom lrzsz lxmenu-* x11-* zenity* yelp-* #+armbian apt-get purge toilet toilet-fonts w-scan vlan weather-util* sysbench stress apt-transport-* cmake cmake-data device-tree-co* fping hddtemp haveged hostapd i2c-tools iperf ir-keytable libasound2* libmtp* libusb-dev lirc lsof ncurses-term pkg-config unicode-data rfkill pv mtp-tools m4 screen alsa-utils armbian-* autotools-dev bind9-host btrfs-tools bridge-utils cpufrequtils dvb-apps dtv-scan-table* evtest f3 figlet gcc gcc-4.8-* git git-man iozone3 ifenslave apt-get purge -y linux-jessie-root-* -#+RPi -apt-get purge libraspberrypi-doc - #rm /etc/apt/sources.list.d/armbian.list rm /etc/init.d/resize2fs systemctl daemon-reload rm /etc/update-motd.d/* +#+RPi +apt-get purge libraspberrypi-doc #+ dev packages apt-get purge '\-dev$' linux-headers* @@ -107,7 +110,7 @@ apt-get autoremove --purge -y #install packages echo -e "CONF_SWAPSIZE=0" > /etc/dphys-swapfile -apt-get install -y p7zip-full hfsplus iw debconf-utils xz-utils ifmetric fbset wpasupplicant resolvconf bc dbus bzip2 psmisc bash-completion cron whiptail sudo ntp ntfs-3g dosfstools parted hdparm pciutils usbutils zip htop wput wget fake-hwclock dphys-swapfile curl unzip ca-certificates console-setup console-data console-common keyboard-configuration wireless-tools wireless-regdb crda --no-install-recommends +apt-get install -y ethtool p7zip-full hfsplus iw debconf-utils xz-utils ifmetric fbset wpasupplicant resolvconf bc dbus bzip2 psmisc bash-completion cron whiptail sudo ntp ntfs-3g dosfstools parted hdparm pciutils usbutils zip htop wput wget fake-hwclock dphys-swapfile curl unzip ca-certificates console-setup console-data console-common keyboard-configuration wireless-tools wireless-regdb crda --no-install-recommends #??? bluetooth if onboard device apt-get install -y bluetooth @@ -377,6 +380,9 @@ _EOF_ #Finalise system /DietPi/dietpi/finalise +#??? Does this device have a unique HW ID index and file? check /DietPi/dietpi/dietpi-obtain_hw_model +echo ID > /etc/.dietpi_hw_model_identifier + #Power off system #Read image diff --git a/dietpi.txt b/dietpi.txt index 2c0b12d717..a5b08e46bb 100644 --- a/dietpi.txt +++ b/dietpi.txt @@ -26,20 +26,35 @@ Static_DNS=8.8.8.8 #Hostname Hostname=DietPi +#Force ethernet speeds +#NB: This is mainly aimed towards Pine A64's which may have a HW issue that causes unstable 1Gbit link. +# 0=automatic speed | 10 = 10mbit, 100 = 100mbit etc +Ethernet_Force_Speed=0 + # >> Misc Options ----------------------------------- #Size of dphys-swapfile to generate (MB) # 0=Disabled. Swapfile_Size=100 # >> Automation Options ----------------------------- +#NB: Following options are only executed on 1st run of DietPi. + +#Fully automate installation # 1=Automated installation with no user inputs. AUTO_Install_Enable=0 +#Global Password to be applied for the system +# Affects root login password, and, all software installed by dietpi-software, that requires a password +# eg: MySQL, Transmission, Deluge etc. +# WARN: Passwords with the any of the following characters are not supported: \"$ +# WARN: Do NOT change this entry, after 1st run setup of DietPi has been completed. It is always scraped by dietpi-software. +AUTO_Global_Password=dietpi + #DietPi-Software to automatically install. | requires AUTO_Install_Enable=1 -#For a list of software index's (ID's), run '/DietPi/dietpi/dietpi-software list' -#No limit on number entires, add as many as you need and uncomment the line. -#DietPi will automatically install all pre-reqs (eg: ALSA/XSERVER for desktops etc) -# Examples: +# For a list of software index's (ID's), run '/DietPi/dietpi/dietpi-software list' +# No limit on number entires, add as many as you need and uncomment the line. +# DietPi will automatically install all pre-reqs (eg: ALSA/XSERVER for desktops etc) +# - Examples: #AUTO_DietpiSoftware_Install_ID=23 #will install Desktop LXDE #AUTO_DietpiSoftware_Install_ID=74 #will install LAMP webserver stack #AUTO_DietpiSoftware_Install_ID=44 #will install Bittorrent transmission @@ -76,6 +91,10 @@ AUTO_DietpiSoftware_WebserverIndex=-2 # If the file exists, the USB drive will be formatted to ext4. (WARNING: ALL DATA ON /dev/sda WILL BE DELETED. YOU HAVE BEEN WARNED!). # DietPi will configure your software installations to use your dedicated drive for personal data. (eg: owncloud data / bittorrent downloads etc) # NB: Plug in 1 USB drive before powering on system. Use 1 USB drive ONLY. +#eg: touch /boot/Automation_Format_My_Usb_Drive + +# Format filesystem type | 0=ext4 1=ntfs 2=fat32 3=hfs+ 4=btrfs | requires /boot/Automation_Format_My_Usb_Drive +AUTO_Dedicated_Usb_Drive_Format_Filesystem=0 #DietPi-Autostart | Requires AUTO_Install_Enable=1 # After installation is completed, which program should the system boot to? @@ -104,7 +123,7 @@ AUTO_CustomScriptURL=0 rpi_hdmi_output=1 #Cpu Governor | ondemand | powersave | performance | conservative -cpu_governor=ondemand +cpu_governor=interactive cpu_usage_throttle_up=50 #Limit the max cpu frequency (Mhz) for all cores. | 0=disabled | Useful for lowering temp/power usage on your device. @@ -164,6 +183,12 @@ lcdpanel=none #Prefer IPversion (for: apt-get) | auto (let system decide) / ipv4 (force) / ipv6 (force) | eg: force IPv4 with prefer_ipversion=ipv4 prefer_ipversion=auto +#Apt mirrors which are applied to /etc/apt/sources.list | Values here will also be applied during 1st run setup +# Raspbian = https://www.raspbian.org/RaspbianMirrors +# Debian = https://www.debian.org/mirror/official#list +Apt_Raspbian_Mirror=http://mirror.ox.ac.uk/sites/archive.raspbian.org/archive/raspbian +Apt_Debian_Mirror=http://ftp.debian.org/debian + #------------------------------------------------------------------------------------------------------ # D I E T - P I # DietPi-Software settings. @@ -185,6 +210,9 @@ dietpi_vncserver_height=720 dietpi_vncserver_depth=16 dietpi_vncserver_display=1 +#Optional username for nextcloud admin account, default is admin. Applied during installation. +dietpi_nextcloud_username=admin + #------------------------------------------------------------------------------------------------------ # D I E T - P I # Dev settings diff --git a/dietpi/.version b/dietpi/.version index dd1ec209f3..af2132305d 100644 --- a/dietpi/.version +++ b/dietpi/.version @@ -1 +1 @@ -132 \ No newline at end of file +133 \ No newline at end of file diff --git a/dietpi/boot b/dietpi/boot index d70249f128..bfb0ca5361 100644 --- a/dietpi/boot +++ b/dietpi/boot @@ -207,6 +207,9 @@ _EOF_ fi + #Apply forced eth speed if set in dietpi.txt + /DietPi/dietpi/func/dietpi-set_hardware eth-forcespeed $(cat /DietPi/dietpi.txt | grep -m1 '^Ethernet_Force_Speed=' | sed 's/.*=//' ) + #Wait for active connection, then update network details file Wait_For_Valid_Network_Connection @@ -339,20 +342,41 @@ _EOF_ #Set hostname /DietPi/dietpi/func/change_hostname "$(cat /DietPi/dietpi.txt | grep -m1 '^Hostname=' | sed 's/.*=//')" - #Automation - Set auto login for next bootup + #Automation + # - Set auto login for next bootup if (( $(cat /DietPi/dietpi.txt | grep -m1 '^AUTO_Install_Enable=' | sed 's/.*=//') >= 1 )); then /DietPi/dietpi/dietpi-autostart 7 fi - #Enable serial console? + # - Enable serial console? if (( $(cat /DietPi/dietpi.txt | grep -ci -m1 '^serial_console_enabled=1') )); then /DietPi/dietpi/func/dietpi-set_hardware serialconsole enable fi + # - Set root password? + root_password=$(cat /DietPi/dietpi.txt | grep -m1 '^AUTO_Global_Password=' | sed 's/.*=//') + if [ -n "$root_password" ]; then + + chpasswd <<< "root:$root_password" + + fi + + # - Set apt mirror + if (( $HW_MODEL < 10 )); then + + /DietPi/dietpi/func/dietpi-set_software apt-mirror $(cat /DietPi/dietpi.txt | grep -m1 '^Apt_Raspbian_Mirror=' | sed 's/.*=//') + + else + + /DietPi/dietpi/func/dietpi-set_software apt-mirror $(cat /DietPi/dietpi.txt | grep -m1 '^Apt_Debian_Mirror=' | sed 's/.*=//') + + fi + + echo -e " Expanding SD/Flash partition. Please wait..." Partition_SD diff --git a/dietpi/conf/network_interfaces b/dietpi/conf/network_interfaces index ee590c3664..ab51516dfa 100644 --- a/dietpi/conf/network_interfaces +++ b/dietpi/conf/network_interfaces @@ -8,7 +8,6 @@ iface lo inet loopback # Ethernet #allow-hotplug eth0 iface eth0 inet dhcp -metric 0 address 192.168.0.100 netmask 255.255.255.0 gateway 192.168.0.1 @@ -17,7 +16,6 @@ gateway 192.168.0.1 # Wifi #allow-hotplug wlan0 iface wlan0 inet dhcp -metric 1 address 192.168.0.100 netmask 255.255.255.0 gateway 192.168.0.1 diff --git a/dietpi/conf/nginx.conf b/dietpi/conf/nginx.conf index 4fcc3a9d02..a219838973 100644 --- a/dietpi/conf/nginx.conf +++ b/dietpi/conf/nginx.conf @@ -19,8 +19,12 @@ error_log /var/log/nginx/error.log; pid /run/nginx.pid; http { + charset utf-8; + # + Nginx - To avoid 2MB upload error: https://github.com/Fourdee/DietPi/issues/546 + client_max_body_size 2000M; + # Upstream to abstract back-end connection(s) for PHP upstream php { server unix:/run/php5-fpm.sock; diff --git a/dietpi/conf/transmission_settings b/dietpi/conf/transmission_settings deleted file mode 100644 index fad1b11e70..0000000000 --- a/dietpi/conf/transmission_settings +++ /dev/null @@ -1,70 +0,0 @@ -{ - "alt-speed-down": 50, - "alt-speed-enabled": false, - "alt-speed-time-begin": 540, - "alt-speed-time-day": 127, - "alt-speed-time-enabled": false, - "alt-speed-time-end": 1020, - "alt-speed-up": 50, - "bind-address-ipv4": "0.0.0.0", - "bind-address-ipv6": "::", - "blocklist-enabled": false, - "blocklist-url": "http://www.example.com/blocklist", - "cache-size-mb": 48, - "dht-enabled": true, - "download-dir": "/mnt/dietpi_userdata/downloads", - "download-limit": 100, - "download-limit-enabled": false, - "download-queue-enabled": true, - "download-queue-size": 2, - "encryption": 2, - "idle-seeding-limit": 1, - "idle-seeding-limit-enabled": true, - "incomplete-dir": "/mnt/dietpi_userdata/bt-inprogress", - "incomplete-dir-enabled": false, - "lpd-enabled": false, - "max-peers-global": 8, - "message-level": 0, - "peer-congestion-algorithm": "", - "peer-limit-global": 8, - "peer-limit-per-torrent": 5, - "peer-port": 51413, - "peer-port-random-high": 65535, - "peer-port-random-low": 49152, - "peer-port-random-on-start": false, - "peer-socket-tos": "default", - "pex-enabled": true, - "port-forwarding-enabled": true, - "preallocation": 1, - "prefetch-enabled": 1, - "queue-stalled-enabled": true, - "queue-stalled-minutes": 30, - "ratio-limit": 1.1, - "ratio-limit-enabled": true, - "rename-partial-files": true, - "rpc-authentication-required": true, - "rpc-bind-address": "0.0.0.0", - "rpc-enabled": true, - "rpc-password": "dietpi", - "rpc-port": 9091, - "rpc-url": "/transmission/", - "rpc-username": "root", - "rpc-whitelist": "192.*.*.*", - "rpc-whitelist-enabled": false, - "scrape-paused-torrents-enabled": true, - "script-torrent-done-enabled": false, - "script-torrent-done-filename": "", - "seed-queue-enabled": false, - "seed-queue-size": 10, - "speed-limit-down": 100, - "speed-limit-down-enabled": false, - "speed-limit-up": 100, - "speed-limit-up-enabled": false, - "start-added-torrents": true, - "trash-original-torrent-files": true, - "umask": 18, - "upload-limit": 100, - "upload-limit-enabled": false, - "upload-slots-per-torrent": 2, - "utp-enabled": true -} diff --git a/dietpi/dietpi-config b/dietpi/dietpi-config index 02040739e2..880f966006 100644 --- a/dietpi/dietpi-config +++ b/dietpi/dietpi-config @@ -40,6 +40,7 @@ HW_MODEL=$(sed -n 1p /DietPi/dietpi/.hw_model) HW_MODEL_DESCRIPTION=$(sed -n 2p /DietPi/dietpi/.hw_model) DISTRO=$(sed -n 3p /DietPi/dietpi/.hw_model) + HW_CPUID=$(sed -n 9p /DietPi/dietpi/.hw_model) #///////////////////////////////////////////////////////////////////////////////////// #Obtain Install Stage Index @@ -1036,16 +1037,32 @@ #CPU GOV whiptail_menu_array+=("Change CPU Governor" ": $current_cpu_governor") - #Ondemand Throttle up menu - if [ "$current_cpu_governor" = ondemand ] || [ "$current_cpu_governor" = conservative ]; then + #Ondemand/Interactive Throttle up menu + if [ "$current_cpu_governor" = ondemand ] || + [ "$current_cpu_governor" = conservative ] || + [ "$current_cpu_governor" = interactive ]; then local current_cpu_throttle_up=$(cat /DietPi/dietpi.txt | grep -m1 '^cpu_usage_throttle_up' | sed 's/.*=//') whiptail_menu_array+=("CPU Throttle Up" ": $current_cpu_throttle_up%") fi + + #Ondemand extras + if [ "$current_cpu_governor" = ondemand ]; then + + local current_cpu_sample_rate=$(( $(cat /DietPi/dietpi.txt | grep -m1 '^cpu_ondemand_sampling_rate=' | sed 's/.*=//') / 1000 )) #convert to ms + whiptail_menu_array+=("Ondemand Sample Rate" ": $current_cpu_sample_rate ms") + + local current_cpu_down_factor=$(cat /DietPi/dietpi.txt | grep -m1 '^cpu_ondemand_sampling_down_factor=' | sed 's/.*=//') + local current_cpu_down_factor_ms=$(( $current_cpu_down_factor * $current_cpu_sample_rate )) + whiptail_menu_array+=("Ondemand Down Factor" ": $current_cpu_down_factor ($current_cpu_down_factor_ms ms)") + + fi + + # User Scaling Max Freq limit. local user_frequency_max_current=$(cat /DietPi/dietpi.txt | grep -m1 '^cpu_max_frequency=' | sed 's/.*=//') local user_frequency_max_text="$user_frequency_max_current Mhz" - if (( $user_frequency_max_current == 0 )); then + if (( ! $user_frequency_max_current )); then user_frequency_max_text="Disabled" fi @@ -1078,7 +1095,7 @@ fi WHIP_TITLE='DietPi - Performance Options' - OPTION=$(whiptail --title "$WHIP_TITLE" --menu " Hardware : $HW_MODEL_DESCRIPTION \n ARM Temp: $arm_temp\n RAM: $memory_total MB | Used: $memory_usage MB | Free: $memory_free MB" --cancel-button "$TEXT_MENU_BACK" --backtitle "$WHIP_BACKTITLE" 16 60 6 "${whiptail_menu_array[@]}" 3>&1 1>&2 2>&3) + OPTION=$(whiptail --title "$WHIP_TITLE" --menu " Hardware : $HW_MODEL_DESCRIPTION \n ARM Temp: $arm_temp\n RAM: $memory_total MB | Used: $memory_usage MB | Free: $memory_free MB" --cancel-button "$TEXT_MENU_BACK" --backtitle "$WHIP_BACKTITLE" 18 60 8 "${whiptail_menu_array[@]}" 3>&1 1>&2 2>&3) CHOICE=$? @@ -1087,6 +1104,42 @@ if (( $CHOICE == 0 )); then case "$OPTION" in + "Ondemand Down Factor"*) + MIN_VALUE=1 + MAX_VALUE=200 + OPTION=$(whiptail --inputbox "After Ondemand throttles up, how long before the next sample to check if CPU clocks can be reduced.\n\n - This value * 'Ondemand Sample Rate' = total miliseconds\n - Lower values may help reduce power consumption, however, a 500-1000ms value is recommended to prevent excessive sampling.\n - Valid range: $MIN_VALUE - $MAX_VALUE\n\nIf unsure, set any value, 'Ondemand Down Factor' option on the next screen will list the calculated miliseconds." 17 70 "$current_cpu_down_factor" --title "$OPTION" 3>&1 1>&2 2>&3) + CHOICE=$? + if (( $CHOICE == 0 )); then + if [[ $OPTION =~ ^-?[0-9]+$ ]] && (($OPTION <= $MAX_VALUE)) && (($OPTION >= $MIN_VALUE)); then + sed -i "/cpu_ondemand_sampling_down_factor=/c\cpu_ondemand_sampling_down_factor=$OPTION" /DietPi/dietpi.txt + #Apply changes + /DietPi/dietpi/dietpi-cpu_set + else + Info_Input_Not_Valid_Integer + fi + fi + + #Return to this menu + TARGETMENUID=4 + ;; + "Ondemand Sample Rate"*) + MIN_VALUE=$(( $(cat /sys/devices/system/cpu/cpufreq/ondemand/sampling_rate_min) / 1000 )) + MAX_VALUE=300 + OPTION=$(whiptail --inputbox "Sample rate in miliseconds, for Ondemand to check if it needs to increase CPU clocks.\nA lower value will make the system more responsive.\n - valid range: $MIN_VALUE - $MAX_VALUE" 10 70 "$current_cpu_sample_rate" --title "$OPTION (ms)" 3>&1 1>&2 2>&3) + CHOICE=$? + if (( $CHOICE == 0 )); then + if [[ $OPTION =~ ^-?[0-9]+$ ]] && (($OPTION <= $MAX_VALUE)) && (($OPTION >= $MIN_VALUE)); then + sed -i "/cpu_ondemand_sampling_rate=/c\cpu_ondemand_sampling_rate=$(($OPTION * 1000))" /DietPi/dietpi.txt + #Apply changes + /DietPi/dietpi/dietpi-cpu_set + else + Info_Input_Not_Valid_Integer + fi + fi + + #Return to this menu + TARGETMENUID=4 + ;; "Lower Idle Frequencies"*) WHIP_QUESTION="Toggle the use of lower idle frequencies for CPU, CORE and RAM.\n\nAs the lower frequencies are active only when the device is idle, enabling this feature allows for potential power saving without impacting performance.\n\nCurrent Setting: $rpi_freq_min_text\n\nEnable: (Allows for potential power saving)\nSets arm_freq_min=100, core_freq_min=75 and sdram_freq_min=200.\n\nDisable: (Default)\nSets arm_freq_min=700, core_freq_min=250 and sdram_freq_min=400." local whiptail_menu_array=() @@ -1217,7 +1270,7 @@ "CPU Throttle Up"*) MIN_VALUE=30 MAX_VALUE=95 - OPTION=$(whiptail --inputbox "When the CPU usage (%) is greater than this value, the CPU frequency will increase from $frequency_min_cpu_governor Mhz to $frequency_max_cpu_governor Mhz. \n - Recommended value | 60 (server) | 40 (desktop) \n - Valid range $MIN_VALUE - $MAX_VALUE \n - Applied when CPU governor is ondemand or conservative" 11 70 "$current_cpu_throttle_up" --title "CPU Throttle Up %" 3>&1 1>&2 2>&3) + OPTION=$(whiptail --inputbox "When the CPU usage (%) is greater than this value, the CPU frequency will increase from $frequency_min_cpu_governor Mhz to $frequency_max_cpu_governor Mhz.\n - Valid range $MIN_VALUE - $MAX_VALUE\n - Recommended settings: Desktop = 50%, Server = 85%" 10 70 "$current_cpu_throttle_up" --title "CPU Throttle Up %" 3>&1 1>&2 2>&3) CHOICE=$? if (( $CHOICE == 0 )); then if [[ $OPTION =~ ^-?[0-9]+$ ]] && (($OPTION <= $MAX_VALUE)) && (($OPTION >= $MIN_VALUE)); then @@ -1308,28 +1361,6 @@ whiptail --title "$WHIP_TITLE" --msgbox " Password change has been aborted. No changes have been applied" 8 60 fi - ##Whiptail password box always returns exit code 0. No way to obtain if a choice was made. - #local passw1=$(whiptail --passwordbox "Please Enter Your New Password" 8 60 --title "Change PW" 3>&1 1>&2 2>&3) - #CHOICE=$? - #if (( $CHOICE == 0 )); then - # - # local passw2=$(whiptail --passwordbox "Please Confirm Your New Password" 8 60 --title "Confirm PW" 3>&1 1>&2 2>&3) - # CHOICE=$? - # if (( $CHOICE == 0 )); then - # - # #Password Mismatch - # if [ "$passw1" != "$passw2" ]; then - # WHIP_TITLE='Error - Password Mismatch' - # whiptail --title "$WHIP_TITLE" --msgbox " The Passwords you have entered do not match, therefor, no changes have been applied. Please try again" 8 60 - # #Apply Password - # else - # echo -e "$passw1\n$passw1" | passwd -q root - # WHIP_TITLE='Password Applied' - # whiptail --title "$WHIP_TITLE" --msgbox " Your new password has successfully been applied." 8 60 - # fi - # fi - #fi - } Change_Hostname(){ @@ -3349,7 +3380,7 @@ _EOF_ fi #H3 - elif (( $HW_MODEL == 30 || $HW_MODEL == 31 || $HW_MODEL == 50 || $HW_MODEL == 61 )); then + elif (( $HW_CPUID == 1 )); then OPTION=$(whiptail --title "$WHIP_TITLE" --menu "Current : $soundcard_current" --default-item "$soundcard_current" --cancel-button "$TEXT_MENU_BACK" 13 60 2 \ "H3-hdmi" "HDMI (Default)" \ @@ -3507,8 +3538,17 @@ _EOF_ fi + #Apt mirror + local apt_mirror_current=$(sed -n 1p /etc/apt/sources.list | awk '{print $2}') + if [ ! -n "$apt_mirror_current" ]; then + + apt_mirror_current='Unknown, no string from scrape' + + fi + WHIP_TITLE='DietPi - Network Options: NAS/Misc' - OPTION=$(whiptail --title "$WHIP_TITLE" --menu "\n Samba client : $sambaclient_status\n FTP client : $curlftpfs_status\n NFS client : $nfsclient_status\n NoIp status : $noip_status" --cancel-button "$TEXT_MENU_BACK" --backtitle "$WHIP_BACKTITLE" 17 75 4 \ + OPTION=$(whiptail --title "$WHIP_TITLE" --menu "\n Apt mirror : $apt_mirror_current\n Samba client : $sambaclient_status\n FTP client : $curlftpfs_status\n NFS client : $nfsclient_status\n NoIp status : $noip_status" --cancel-button "$TEXT_MENU_BACK" --backtitle "$WHIP_BACKTITLE" 18 100 5 \ + "Apt Mirror" "Select a different Apt mirror for sources.list" \ "Samba Client" "$sambaclient_menutext" \ "FTP Client" "$curlftpfs_menutext" \ "NFS Client" "$nfsclient_menutext" \ @@ -3518,6 +3558,73 @@ _EOF_ if (( $CHOICE == 0 )); then case "$OPTION" in + "Apt Mirror") + + #Create Menu List for Whiptail + local whiptail_menu_array=( + "Custom" "Manually enter Apt mirror" + ) + + # - Raspbian + if (( $HW_MODEL < 10 )); then + + whiptail_menu_array+=("http://mirrordirector.raspbian.org/raspbian" "Global") + whiptail_menu_array+=("http://mirror.ox.ac.uk/sites/archive.raspbian.org/archive/raspbian" "UK") + whiptail_menu_array+=("ftp://ftp.fu-berlin.de/linux/raspbian/raspbian" "Germany") + whiptail_menu_array+=("http://mirror.umd.edu/raspbian/raspbian" "US") + whiptail_menu_array+=("http://mirrors.ustc.edu.cn/raspbian/raspbian" "China") + whiptail_menu_array+=("http://raspbian.mirror.digitalpacific.com.au/raspbian" "Australia") + + # - Debian + else + + whiptail_menu_array+=("http://ftp.debian.org/debian" "Global") + whiptail_menu_array+=("http://ftp.uk.debian.org/debian" "UK") + whiptail_menu_array+=("http://ftp.us.debian.org/debian" "US") + whiptail_menu_array+=("http://ftp.cn.debian.org/debian" "China") + whiptail_menu_array+=("http://ftp.au.debian.org/debian" "Australia") + + fi + + OPTION=$(whiptail --title "Choose Apt Mirror" --menu "Please select a Apt mirror, or choose custom for manual entry." --default-item "$apt_mirror_current" --cancel-button "$TEXT_MENU_BACK" --backtitle "$WHIP_BACKTITLE" 15 100 7 "${whiptail_menu_array[@]}" 3>&1 1>&2 2>&3) + CHOICE=$? + if (( $CHOICE == 0 )); then + case $OPTION in + Custom) + OPTION=$(whiptail --inputbox "Enter Your Apt Mirror\n - eg: http://ftp.debian.org/debian" 9 100 "$apt_mirror_current" --title "Set Apt Mirror" 3>&1 1>&2 2>&3) + CHOICE=$? + if (( $CHOICE == 0 )); then + return_value=$OPTION + fi + ;; + *) + return_value=$OPTION + ;; + esac + + /DietPi/dietpi/func/dietpi-set_software apt-mirror $OPTION + + # - test it + /DietPi/dietpi/func/dietpi-notify 2 "Updating Apt, please wait..." + + apt-get update + local result=$? + if (( $result != 0 )); then + + whiptail --title "Apt Error:" --msgbox "Failed to update apt, exit code: $result\nPlease try another Apt mirror." --backtitle "$WHIP_BACKTITLE" 8 65 + + fi + + #Return to this Menu + TARGETMENUID=16 + + fi + + #delete [] + unset whiptail_menu_array + + ;; + "NFS Client") #Installed? diff --git a/dietpi/dietpi-cpu_set b/dietpi/dietpi-cpu_set index 8cdfe58d86..9dbc925874 100644 --- a/dietpi/dietpi-cpu_set +++ b/dietpi/dietpi-cpu_set @@ -28,8 +28,36 @@ CPU_CORES=$(nproc --all) CPU_GOVERNOR=$(cat /DietPi/dietpi.txt | grep -m1 '^cpu_governor=' | sed 's/.*=//') CPU_MAX_FREQ=$(cat /DietPi/dietpi.txt | grep -m1 '^cpu_max_frequency=' | sed 's/.*=//') - #Add math for working out sampling rate and a set time for down rate. - #EG: regardless of sample rate, always 4 seconds downrate + + Check_GPU_Gov_Available(){ + + #Check if target Gov is available on system. + if (( ! $(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors | grep -ci -m1 "$CPU_GOVERNOR") )); then + + /DietPi/dietpi/func/dietpi-notify 1 "CPU gov: $CPU_GOVERNOR, not supported by kernel" + + if (( $(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors | grep -ci -m1 'interactive') )); then + + CPU_GOVERNOR='interactive' + + elif (( $(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors | grep -ci -m1 'ondemand') )); then + + CPU_GOVERNOR='ondemand' + + else + + CPU_GOVERNOR='performance' + + fi + + /DietPi/dietpi/func/dietpi-notify 2 "Switching to CPU gov: $CPU_GOVERNOR" + + # - Update dietpi.txt + sed -i "/^cpu_governor=/c\cpu_governor=$CPU_GOVERNOR" /DietPi/dietpi.txt + + fi + + } Apply_CPU_Gov(){ @@ -55,51 +83,57 @@ fi + local cpu_throttle_up_percent=$(cat /DietPi/dietpi.txt | grep -m1 '^cpu_usage_throttle_up' | sed 's/.*=//') + + #Set CPU governor interactive settings + if [ "$input_gov_name" = interactive ]; then + + /DietPi/dietpi/func/dietpi-notify 2 "Setting go_hispeed_load: $cpu_throttle_up_percent %" + echo "$cpu_throttle_up_percent" > /sys/devices/system/cpu/cpufreq/interactive/go_hispeed_load + #Set CPU governor ondemand settings - if [ "$input_gov_name" = ondemand ]; then + elif [ "$input_gov_name" = ondemand ]; then + + local cpu_ondemand_sampling_rate=$(cat /DietPi/dietpi.txt | grep -m1 '^cpu_ondemand_sampling_rate' | sed 's/.*=//') + local cpu_ondemand_sampling_down_factor=$(cat /DietPi/dietpi.txt | grep -m1 '^cpu_ondemand_sampling_down_factor' | sed 's/.*=//') - CPU_THROTTLE_UP_PERCENT=$(cat /DietPi/dietpi.txt | grep -m1 '^cpu_usage_throttle_up' | sed 's/.*=//') - CPU_ONDEMAND_SAMPLING_RATE=$(cat /DietPi/dietpi.txt | grep -m1 '^cpu_ondemand_sampling_rate' | sed 's/.*=//') - CPU_ONDEMAND_SAMPLING_DOWN_FACTOR=$(cat /DietPi/dietpi.txt | grep -m1 '^cpu_ondemand_sampling_down_factor' | sed 's/.*=//') + /DietPi/dietpi/func/dietpi-notify 2 "Setting up_threshold: $cpu_throttle_up_percent %" + /DietPi/dietpi/func/dietpi-notify 2 "Setting sampling_rate: $cpu_ondemand_sampling_rate microseconds" + /DietPi/dietpi/func/dietpi-notify 2 "Setting sampling_down_factor: $cpu_ondemand_sampling_down_factor" #XU3/4 different path (must apply to each core) if (( $HW_MODEL == 11 )); then for ((i=$input_core_start; i<$input_core_end; i++)) do - echo "$CPU_THROTTLE_UP_PERCENT" > /sys/devices/system/cpu/cpu"$i"/cpufreq/ondemand/up_threshold - echo "$CPU_ONDEMAND_SAMPLING_RATE" > /sys/devices/system/cpu/cpu"$i"/cpufreq/ondemand/sampling_rate - echo "$CPU_ONDEMAND_SAMPLING_DOWN_FACTOR" > /sys/devices/system/cpu/cpu"$i"/cpufreq/ondemand/sampling_down_factor + echo "$cpu_throttle_up_percent" > /sys/devices/system/cpu/cpu"$i"/cpufreq/ondemand/up_threshold + echo "$cpu_ondemand_sampling_rate" > /sys/devices/system/cpu/cpu"$i"/cpufreq/ondemand/sampling_rate + echo "$cpu_ondemand_sampling_down_factor" > /sys/devices/system/cpu/cpu"$i"/cpufreq/ondemand/sampling_down_factor done else - echo "$CPU_THROTTLE_UP_PERCENT" > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold - echo "$CPU_ONDEMAND_SAMPLING_RATE" > /sys/devices/system/cpu/cpufreq/ondemand/sampling_rate - echo "$CPU_ONDEMAND_SAMPLING_DOWN_FACTOR" > /sys/devices/system/cpu/cpufreq/ondemand/sampling_down_factor + echo "$cpu_throttle_up_percent" > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold + echo "$cpu_ondemand_sampling_rate" > /sys/devices/system/cpu/cpufreq/ondemand/sampling_rate + echo "$cpu_ondemand_sampling_down_factor" > /sys/devices/system/cpu/cpufreq/ondemand/sampling_down_factor fi #Set CPU governor conservative settings elif [ "$input_gov_name" = conservative ]; then - CPU_THROTTLE_UP_PERCENT=$(cat /DietPi/dietpi.txt | grep -m1 '^cpu_usage_throttle_up' | sed 's/.*=//') + cpu_throttle_up_percent=$(cat /DietPi/dietpi.txt | grep -m1 '^cpu_usage_throttle_up' | sed 's/.*=//') #XU3/4 different path (must apply to each core) if (( $HW_MODEL == 11 )); then for ((i=$input_core_start; i<$input_core_end; i++)) do - echo "$CPU_THROTTLE_UP_PERCENT" > /sys/devices/system/cpu/cpu"$i"/cpufreq/conservative/up_threshold + echo "$cpu_throttle_up_percent" > /sys/devices/system/cpu/cpu"$i"/cpufreq/conservative/up_threshold done else - echo "$CPU_THROTTLE_UP_PERCENT" > /sys/devices/system/cpu/cpufreq/conservative/up_threshold + echo "$cpu_throttle_up_percent" > /sys/devices/system/cpu/cpufreq/conservative/up_threshold fi - #Set CPU governor interactive settings - elif [ "$input_gov_name" = interactive ]; then - - echo "nothing here" &> /dev/null - fi } @@ -107,6 +141,10 @@ #///////////////////////////////////////////////////////////////////////////////////// # Main Loop #///////////////////////////////////////////////////////////////////////////////////// + #----------------------------------------------------------------------------------- + /DietPi/dietpi/func/dietpi-notify 3 DietPi-Cpu_Set "Applying CPU gov" + #----------------------------------------------------------------------------------- + Check_GPU_Gov_Available #XU4 Split govs if (( $HW_MODEL == 11 )); then @@ -121,6 +159,7 @@ fi + /DietPi/dietpi/func/dietpi-notify 0 "CPU gov applied: $CPU_GOVERNOR\n" #----------------------------------------------------------------------------------- exit diff --git a/dietpi/dietpi-drive_manager b/dietpi/dietpi-drive_manager index 4c8dab803c..2e5ff2e515 100644 --- a/dietpi/dietpi-drive_manager +++ b/dietpi/dietpi-drive_manager @@ -46,7 +46,7 @@ #EXTERNAL MAX_DRIVES=5 - FORMAT_GPT=0 + FORMAT_GPT=1 # default GPT: https://github.com/Fourdee/DietPi/issues/531. 0=MBR FORMAT_FILESYSTEM_TYPE=0 #0=ext4 1=ntfs 2=fat32 3=hfs+ 4=btrfs INDEX_DRIVE_BEING_EDITED=0 @@ -65,9 +65,10 @@ aDRIVE_ISMOUNTED=() aDRIVE_ISUUIDMOUNT=() - INIT_FSTAB_SLOTS_ENABLED=0 + FP_USERDATA_CURRENT=0 + Init_Drives_and_Refresh(){ /DietPi/dietpi/func/dietpi-notify 2 "Processing drive information, please wait..." @@ -192,6 +193,9 @@ done + #User data location + FP_USERDATA_CURRENT=$(/DietPi/dietpi/func/dietpi-set_userdata return_source) + } Run_Format(){ @@ -212,6 +216,8 @@ fi + /DietPi/dietpi/func/dietpi-notify 2 "Partition table target: $parition_table_type" + parted -s "$drivepath_no_partitions" mklabel "$parition_table_type" parted -a optimal "$drivepath_no_partitions" mkpart primary 0% 100% @@ -376,6 +382,7 @@ systemctl daemon-reload #Move user data location to USBDRIVE + #Done in DietPi-Software under Auto setting # /DietPi/dietpi/func/dietpi-set_userdata "$(/DietPi/dietpi/func/dietpi-set_userdata return_source)" /mnt/usb_1 if (( $INPUT == 2 )); then @@ -497,8 +504,17 @@ fi + # - User data + local userdata_location_text="SD/EMMC ($FP_USERDATA_CURRENT)" + + if [ "$FP_USERDATA_CURRENT" != "/mnt/dietpi_userdata" ]; then + + userdata_location_text="USB ($FP_USERDATA_CURRENT)" + + fi + WHIP_TITLE="$PROGRAM_NAME" - OPTION=$(whiptail --title "$WHIP_TITLE" --menu "Please select a drive to see available options:" --default-item "$MENU_LASTITEM" --cancel-button "Exit" --backtitle "$PROGRAM_NAME" 15 80 7 "${whiptail_menu_array[@]}" 3>&1 1>&2 2>&3) + OPTION=$(whiptail --title "$WHIP_TITLE" --menu "Please select a drive to see available options.\n - User data location: $userdata_location_text" --default-item "$MENU_LASTITEM" --cancel-button "Exit" --backtitle "$PROGRAM_NAME" 16 80 7 "${whiptail_menu_array[@]}" 3>&1 1>&2 2>&3) CHOICE=$? @@ -600,15 +616,14 @@ whiptail_menu_array+=("Unmount" ": Allows you to psychically remove the drive") - local current_userdata_dir=$(/DietPi/dietpi/func/dietpi-set_userdata return_source) - if [[ ${aDRIVE_MOUNT_TARGET[$INDEX_DRIVE_BEING_EDITED]} =~ $current_userdata_dir ]]; then + if [[ ${aDRIVE_MOUNT_TARGET[$INDEX_DRIVE_BEING_EDITED]} =~ $FP_USERDATA_CURRENT ]]; then - whiptail_menu_array+=("Userdata" ": Your user data is currently located on this drive") + whiptail_menu_array+=("User data" ": Your user data is currently located on this drive") drive_contains_userdata=1 else - whiptail_menu_array+=("Move Userdata" ": Move your DietPi userdata to this drive") + whiptail_menu_array+=("Move User data" ": Move your DietPi user data to this drive") fi @@ -656,7 +671,7 @@ # - Disallow if userdata is located on this drive! if (( $drive_contains_userdata )); then - whiptail --title "Info: dismount prevented" --msgbox "Your DietPi user data is currently located on this drive:\n - $current_userdata_dir/dietpi_userdata\n\nDismounting the drive at this time is not possible.\n\nPlease move your user data elsewhere, before trying again:\nhttp://dietpi.com/phpbb/viewtopic.php?f=8&t=478" --backtitle "$PROGRAM_NAME" 13 70 + whiptail --title "Info: dismount prevented" --msgbox "Your DietPi user data is currently located on this drive:\n - $FP_USERDATA_CURRENT/dietpi_userdata\n\nDismounting the drive at this time is not possible.\n\nPlease move your user data elsewhere, before trying again:\nhttp://dietpi.com/phpbb/viewtopic.php?f=8&t=478" --backtitle "$PROGRAM_NAME" 13 70 else @@ -688,7 +703,7 @@ fi - elif [ "$OPTION" = "Move Userdata" ]; then + elif [ "$OPTION" = "Move User data" ]; then if [ "${aDRIVE_FSTYPE[$INDEX_DRIVE_BEING_EDITED]}" = "vfat" ]; then @@ -696,11 +711,11 @@ fi - whiptail --title "Move user data" --yesno "Your user data will be moved:\n - From: $current_userdata_dir\n - To: ${aDRIVE_MOUNT_TARGET[$INDEX_DRIVE_BEING_EDITED]}/dietpi_userdata\n\nDo you wish to continue?" --backtitle "$PROGRAM_NAME" --defaultno 12 70 + whiptail --title "Move user data" --yesno "Your user data will be moved:\n - From: $FP_USERDATA_CURRENT\n - To: ${aDRIVE_MOUNT_TARGET[$INDEX_DRIVE_BEING_EDITED]}/dietpi_userdata\n\nDo you wish to continue?" --backtitle "$PROGRAM_NAME" --defaultno 12 70 CHOICE=$? if (( $CHOICE == 0 )); then - /DietPi/dietpi/func/dietpi-set_userdata "$current_userdata_dir" "${aDRIVE_MOUNT_TARGET[$INDEX_DRIVE_BEING_EDITED]}" + /DietPi/dietpi/func/dietpi-set_userdata "$FP_USERDATA_CURRENT" "${aDRIVE_MOUNT_TARGET[$INDEX_DRIVE_BEING_EDITED]}" sleep 1 fi @@ -710,7 +725,7 @@ # - Disallow if userdata is located on this drive! if (( $drive_contains_userdata )); then - whiptail --title "Info: format prevented" --msgbox "Your DietPi user data is currently located on this drive:\n - $current_userdata_dir/dietpi_userdata\n\nFormatting the drive at this time is not possible.\n\nPlease move your user data elsewhere, before trying again:\nhttp://dietpi.com/phpbb/viewtopic.php?f=8&t=478" --backtitle "$PROGRAM_NAME" 13 70 + whiptail --title "Info: format prevented" --msgbox "Your DietPi user data is currently located on this drive:\n - $FP_USERDATA_CURRENT/dietpi_userdata\n\nFormatting the drive at this time is not possible.\n\nPlease move your user data elsewhere, before trying again:\nhttp://dietpi.com/phpbb/viewtopic.php?f=8&t=478" --backtitle "$PROGRAM_NAME" 13 70 else @@ -749,14 +764,13 @@ whiptail_desc+="Used: $ROOTFS_SIZE_USED"b" ($ROOTFS_SIZE_PERCENTUSED)\n" whiptail_desc+="Status: Drive is online and ready for use (/ (rootfs))" - local current_userdata_dir=$(/DietPi/dietpi/func/dietpi-set_userdata return_source) - if [ "$current_userdata_dir" = "/mnt/dietpi_userdata" ]; then + if [ "$FP_USERDATA_CURRENT" = "/mnt/dietpi_userdata" ]; then - whiptail_menu_array+=("Userdata" ": Your user data is currently located on this drive") + whiptail_menu_array+=("User data" ": Your user data is currently located on this drive") else - whiptail_menu_array+=("Move Userdata" ": Move your DietPi userdata to this drive") + whiptail_menu_array+=("Move User data" ": Move your DietPi user data to this drive") fi @@ -772,13 +786,13 @@ if (( $CHOICE == 0 )); then - if [ "$OPTION" = "Move Userdata" ]; then + if [ "$OPTION" = "Move User data" ]; then - whiptail --title "Move user data" --yesno "Your user data will be moved:\n - From: $current_userdata_dir\n - To: /mnt/dietpi_userdata (SD/EMMC)\n\nDo you wish to continue?" --backtitle "$PROGRAM_NAME" --defaultno 12 70 + whiptail --title "Move user data" --yesno "Your user data will be moved:\n - From: $FP_USERDATA_CURRENT\n - To: /mnt/dietpi_userdata (SD/EMMC)\n\nDo you wish to continue?" --backtitle "$PROGRAM_NAME" --defaultno 12 70 CHOICE=$? if (( $CHOICE == 0 )); then - /DietPi/dietpi/func/dietpi-set_userdata "$current_userdata_dir" "/mnt/dietpi_userdata" + /DietPi/dietpi/func/dietpi-set_userdata "$FP_USERDATA_CURRENT" "/mnt/dietpi_userdata" sleep 1 fi @@ -844,13 +858,13 @@ if [ "$OPTION" = "Partition Type" ]; then WHIP_TITLE='Partition table?' - whiptail --title "$WHIP_TITLE" --yesno "Would you like to use GPT or MBR parition table?\n - GPT is required for 2TB+ drives\n - MBR does NOT support 2TB+ drives\n\nIf unsure, select MBR (default)" --yes-button "GPT" --no-button "MBR" --backtitle "$PROGRAM_NAME" --defaultno 12 70 + whiptail --title "$WHIP_TITLE" --yesno "Would you like to use GPT or MBR parition table?\n - GPT is required for 2TB+ drives\n - MBR does NOT support 2TB+ drives\n\nIf unsure, select GPT (default)" --yes-button "MBR" --no-button "GPT" --backtitle "$PROGRAM_NAME" --defaultno 12 70 CHOICE=$? - FORMAT_GPT=0 + FORMAT_GPT=1 if (( $CHOICE == 0 )); then - FORMAT_GPT=1 - partition_table_text='GPT' + FORMAT_GPT=0 + partition_table_text='MBR' fi @@ -952,9 +966,12 @@ done - #Old system - automated format drive + #Old system - automated format drive elif (( $INPUT == 1 )); then + # - Optional filesystem target + FORMAT_FILESYSTEM_TYPE=$(cat /DietPi/dietpi.txt | grep -m1 '^AUTO_Dedicated_Usb_Drive_Format_Filesystem=' | sed 's/.*=//') + Wait_For_Drive_Connection Run_Format Finish_Setup diff --git a/dietpi/dietpi-obtain_hw_model b/dietpi/dietpi-obtain_hw_model index 3452881e57..9d92c033ae 100644 --- a/dietpi/dietpi-obtain_hw_model +++ b/dietpi/dietpi-obtain_hw_model @@ -20,7 +20,6 @@ # HW_MODEL 42 Pine A64+ (2048mb) # HW_MODEL 41 Pine A64+ (1024mb) # HW_MODEL 40 Pine A64 (512mb) - # ????????? HW_MODEL 32 H3 (ALL) - Sun8i???? Might need to remove ARMbian repo, because packages are HW model specific, could break? # HW_MODEL 31 OrangePi One # HW_MODEL 30 OrangePi PC # HW_MODEL 20 VM x64 (VMware VirtualBox XenServer) @@ -38,6 +37,7 @@ # DISTRO 1 Debian Wheezy (No longer supported, http://dietpi.com/phpbb/viewtopic.php?f=9&t=432#p1898) # DISTRO 2 Ubuntu 14.04 (No longer supported, left in for user message during update) # DISTRO 3 Jessie + # DISTRO 4 Stretch | Reserved # - Line4 - # RootFS device path (eg: /dev/mmc01) # - Line5 - @@ -54,7 +54,7 @@ # HW_ARCH_DESCRIPTION # - Line 8 - # IMAGE_ADDITIONAL_CREDITS (eg: ARMbian, Meveric) - # - Line 9 - NOT ACTIVE + # - Line 9 - Group CPU's # HW_CPUID 0 Not set # HW_CPUID 1 H3 #//////////////////////////////////// @@ -74,18 +74,10 @@ HW_ARCH=0 HW_ARCH_DESCRIPTION='unknown' IMAGE_ADDITIONAL_CREDITS='' - # FP_HW_CPUID_INDENTIFIER='/etc/.dietpi_hw_cpuid_identifier' - # HW_CPUID=0 + HW_CPUID=0 ROOTFS_DEVICE_PATH=$(df | grep -m1 '/$' | awk '{print $1}') - ##Systems that use /etc/.dietpi_hw_cpuid_identifier for HW_CPUID - # if [ -f "$FP_HW_CPUID_INDENTIFIER" ]; then - - # HW_CPUID=$(sed -n 1p "$FP_HW_CPUID_INDENTIFIER") - - # fi - #Systems that use /etc/.dietpi_hw_model_identifier for HW_MODEL if [ -f "$FP_HW_MODEL_INDENTIFIER" ]; then @@ -106,18 +98,21 @@ HW_MODEL_DESCRIPTION='NanoPi Neo' IMAGE_ADDITIONAL_CREDITS='ARMbian' + HW_CPUID=1 #BananaPi M2+ elif (( $HW_MODEL == 50 )); then HW_MODEL_DESCRIPTION='BananaPi M2+' IMAGE_ADDITIONAL_CREDITS='ARMbian' + HW_CPUID=1 #BananaPi Pro elif (( $HW_MODEL == 51 )); then HW_MODEL_DESCRIPTION='BananaPi Pro' IMAGE_ADDITIONAL_CREDITS='ARMbian' + HW_CPUID=1 #PineA64 elif (( $HW_MODEL >= 40 && $HW_MODEL < 50 )); then @@ -147,12 +142,14 @@ HW_MODEL_DESCRIPTION='OrangePi One' IMAGE_ADDITIONAL_CREDITS='ARMbian' + HW_CPUID=1 #OrangePi Pc elif (( $HW_MODEL == 30 )); then HW_MODEL_DESCRIPTION='OrangePi PC' IMAGE_ADDITIONAL_CREDITS='ARMbian' + HW_CPUID=1 #VM elif (( $HW_MODEL == 20 )); then @@ -267,6 +264,7 @@ $HW_UUID $HW_ARCH $HW_ARCH_DESCRIPTION $IMAGE_ADDITIONAL_CREDITS +$HW_CPUID _EOF_ #----------------------------------------------------------------------------------- exit diff --git a/dietpi/dietpi-services b/dietpi/dietpi-services index 94d6ffbdea..a96e18a2e4 100644 --- a/dietpi/dietpi-services +++ b/dietpi/dietpi-services @@ -25,7 +25,8 @@ "cron" "transmission-daemon" "proftpd" - "samba" + "smbd" + "nmbd" "nfs-kernel-server" "vsftpd" "apache2" diff --git a/dietpi/dietpi-software b/dietpi/dietpi-software index cf7159e361..b8bf7e3701 100644 --- a/dietpi/dietpi-software +++ b/dietpi/dietpi-software @@ -168,6 +168,14 @@ _EOF_ #Reboot after installation has finished. DISABLE_REBOOT=0 + #Global Password: Exception to AUTO first run init. + GLOBAL_PW=$(cat /DietPi/dietpi.txt | grep -m1 '^AUTO_Global_Password=' | sed 's/.*=//') + if [ ! -n "$GLOBAL_PW" ]; then + + GLOBAL_PW='dietpi' + + fi + #Run Instalation Flag (1 = run installs) GOSTARTINSTALL=0 INSTALL_URL_ADDRESS="" @@ -216,7 +224,7 @@ _EOF_ # - Software #NB: All software has a unique index that must not be changed (eg: DESKTOP_LXDE = 23) TOTAL_SOFTWARE_INDEXS=0 - TOTAL_SOFTWARE_INDEXS_HARDLIMIT=115 #Increase as needed. Must be higher than TOTAL_SOFTWARE_INDEXS once calculated in Software_Arrays_Init + TOTAL_SOFTWARE_INDEXS_HARDLIMIT=116 #Increase as needed. Must be higher than TOTAL_SOFTWARE_INDEXS once calculated in Software_Arrays_Init INSTALLING_INDEX=0 #Which software index is currently being installed? @@ -675,8 +683,8 @@ _EOF_ aSOFTWARE_REQUIRES_FFMPEG[$index_current]=1 aSOFTWARE_ONLINEDOC_URL[$index_current]='f=8&t=5&p=1789#p1789' - # - Disabled for HW_ARCH - aSOFTWARE_AVAIL_HW_ARCH[$index_current,10]=0 + #disable ARMv6: https://github.com/Fourdee/DietPi/issues/534 + aSOFTWARE_AVAIL_HW_ARCH[$index_current,1]=0 #------------------ index_current=42 @@ -757,7 +765,7 @@ _EOF_ aSOFTWARE_TYPE[$index_current]=0 aSOFTWARE_REQUIRES_WEBSERVER[$index_current]=1 aSOFTWARE_REQUIRES_MYSQL[$index_current]=1 - aSOFTWARE_ONLINEDOC_URL[$index_current]='xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' + aSOFTWARE_ONLINEDOC_URL[$index_current]='f=8&t=5&p=3026#p3026' #------------------ index_current=48 @@ -1076,6 +1084,16 @@ _EOF_ # - Disabled for HW_ARCH aSOFTWARE_AVAIL_HW_ARCH[$index_current,10]=0 + #------------------ + index_current=115 + + aSOFTWARE_WHIP_NAME[$index_current]='Webmin' + aSOFTWARE_WHIP_DESC[$index_current]='web interface system management' + aSOFTWARE_CATEGORY_INDEX[$index_current]=9 + aSOFTWARE_TYPE[$index_current]=0 + aSOFTWARE_ONLINEDOC_URL[$index_current]='f=8&t=5&start=80#p3047' + aSOFTWARE_REQUIRES_RSYSLOG[$index_current]=1 + #------------------ #Remote Access @@ -2276,6 +2294,20 @@ _EOF_ } + #apt-get install -f + AGF(){ + + DEBIAN_FRONTEND=noninteractive apt-get install -f -y --force-yes + + local result=$? + if (( $result != 0 )); then + + Error_AptGet_Failed + + fi + + } + #Return optimization values for BitTorrent servers based on device and hardware capabilities. Optimize_BitTorrent(){ @@ -2541,8 +2573,8 @@ _EOF_ Banner_Installing - echo -e "mysql-server mysql-server/root_password password dietpi" | debconf-set-selections - echo -e "mysql-server mysql-server/root_password_again password dietpi" | debconf-set-selections + debconf-set-selections <<< "mysql-server mysql-server/root_password password $GLOBAL_PW" + debconf-set-selections <<< "mysql-server mysql-server/root_password_again password $GLOBAL_PW" AGI mysql-server mysql-client @@ -2560,8 +2592,8 @@ _EOF_ Banner_Installing - echo -e "mysql-server mysql-server/root_password password dietpi" | debconf-set-selections - echo -e "mysql-server mysql-server/root_password_again password dietpi" | debconf-set-selections + debconf-set-selections <<< "mysql-server mysql-server/root_password password $GLOBAL_PW" + debconf-set-selections <<< "mysql-server mysql-server/root_password_again password $GLOBAL_PW" AGI mariadb-server mariadb-client @@ -2641,26 +2673,27 @@ _EOF_ service mysql restart # Set password parameters before installing - echo "phpmyadmin phpmyadmin/dbconfig-install boolean true" | debconf-set-selections - echo "phpmyadmin phpmyadmin/app-password-confirm password dietpi" | debconf-set-selections - echo "phpmyadmin phpmyadmin/mysql/admin-pass password dietpi" | debconf-set-selections - echo "phpmyadmin phpmyadmin/mysql/app-pass password dietpi" | debconf-set-selections + debconf-set-selections <<< "phpmyadmin phpmyadmin/dbconfig-install boolean true" + debconf-set-selections <<< "phpmyadmin phpmyadmin/app-password-confirm password $GLOBAL_PW" + debconf-set-selections <<< "phpmyadmin phpmyadmin/mysql/admin-pass password $GLOBAL_PW" + debconf-set-selections <<< "phpmyadmin phpmyadmin/mysql/app-pass password $GLOBAL_PW" if (( ${aSOFTWARE_INSTALL_STATE[83]} == 1 )); then - echo "phpmyadmin phpmyadmin/reconfigure-webserver multiselect apache2" | debconf-set-selections + debconf-set-selections <<< "phpmyadmin phpmyadmin/reconfigure-webserver multiselect apache2" elif (( ${aSOFTWARE_INSTALL_STATE[84]} == 1 )); then - echo "phpmyadmin phpmyadmin/reconfigure-webserver multiselect lighttpd" | debconf-set-selections + debconf-set-selections <<< "phpmyadmin phpmyadmin/reconfigure-webserver multiselect lighttpd" else - echo "phpmyadmin phpmyadmin/reconfigure-webserver multiselect none" | debconf-set-selections + debconf-set-selections <<< "phpmyadmin phpmyadmin/reconfigure-webserver multiselect none" fi AGI phpmyadmin + fi #Forums PHPBB @@ -2895,11 +2928,10 @@ _EOF_ fi - #libcurl3-gnutls required for C2. But lets apply to all: https://github.com/Fourdee/DietPi/issues/446 - AGI libcurl3-gnutls - + # - libcurl3-gnutls required for C2. But lets apply to all: https://github.com/Fourdee/DietPi/issues/446 # - Add NFS support for kodi - AGI libnfs4 + # - CEC support | * due to C2 having libcec3v4, rpi has libcec3. + AGI libcurl3-gnutls libnfs4 libcec3* fi @@ -3023,20 +3055,19 @@ _EOF_ if (( $HW_ARCH == 21 )); then - INSTALL_URL_ADDRESS="http://hndl.urbackup.org/Server/2.0.34/urbackup-server_2.0.34_amd64.deb" + INSTALL_URL_ADDRESS="http://hndl.urbackup.org/Server/2.0.36/urbackup-server_2.0.36_amd64.deb" elif (( $HW_ARCH >= 1 && $HW_ARCH < 10 )); then - INSTALL_URL_ADDRESS="http://hndl.urbackup.org/Server/2.0.34/urbackup-server_2.0.34_armhf.deb" + INSTALL_URL_ADDRESS="http://hndl.urbackup.org/Server/2.0.36/urbackup-server_2.0.36_armhf.deb" #ARM64 sourcebuild elif (( $HW_ARCH == 10 )); then - INSTALL_URL_ADDRESS="http://hndl.urbackup.org/Server/2.0.34/urbackup-server-2.0.34.tar.gz" + INSTALL_URL_ADDRESS="http://hndl.urbackup.org/Server/2.0.36/urbackup-server-2.0.36.tar.gz" fi - /DietPi/dietpi/func/check_connection "$INSTALL_URL_ADDRESS" #Install @@ -3046,7 +3077,7 @@ _EOF_ #ARM64 source build if (( $HW_ARCH == 10 )); then - AGI build-essential zlib1g-dev libcurl4-openssl-dev libcrypto++-dev + AGI build-essential zlib1g-dev libcurl4-openssl-dev libcrypto++-dev sqlite3 wget "$INSTALL_URL_ADDRESS" -O package.tar tar xzvf package.tar @@ -3240,6 +3271,31 @@ _EOF_ fi + #WEBMIN + INSTALLING_INDEX=115 + if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then + + Banner_Installing + + INSTALL_URL_ADDRESS='http://www.webmin.com/download/deb/webmin-current.deb' + /DietPi/dietpi/func/check_connection "$INSTALL_URL_ADDRESS" + if (( $? == 0 )); then + + wget "$INSTALL_URL_ADDRESS" -O package.deb + dpkg -i package.deb + + AGF + + rm package.deb + + else + + Error_NoConnection_NoInstall + + fi + + fi + #LINUXDASH INSTALLING_INDEX=63 if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then @@ -4231,8 +4287,7 @@ _EOF_ # - Alternative mono repo: https://github.com/Fourdee/DietPi/issues/310#issuecomment-216247879 apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF - echo -e "deb http://download.mono-project.com/repo/debian wheezy main" > /etc/apt/sources.list.d/mono-xamarin.list - echo -e "deb http://download.mono-project.com/repo/debian wheezy-libjpeg62-compat main" >> /etc/apt/sources.list.d/mono-xamarin.list + echo -e "deb http://download.mono-project.com/repo/debian beta main" > /etc/apt/sources.list.d/mono-xamarin.list # - Emby repo wget http://download.opensuse.org/repositories/home:emby/Debian_8.0/Release.key @@ -4563,7 +4618,7 @@ _EOF_ else - apt-get install -f -y + AGF fi @@ -5006,50 +5061,24 @@ _EOF_ Banner_Installing - #arm64 - Not currently available via nodesource.com or https://raw.githubusercontent.com/taaem/nodejs-linux-installer/master/node-install.sh - if (( $HW_ARCH == 10 )); then - - #check, is online - INSTALL_URL_ADDRESS='http://dietpi.com/downloads/binaries/c2/nodejs_5-1_arm64.deb' - /DietPi/dietpi/func/check_connection "$INSTALL_URL_ADDRESS" - - #Install - if (( $? == 0 )); then + #check, is online + INSTALL_URL_ADDRESS='http://raw.githubusercontent.com/taaem/nodejs-linux-installer/master/node-install.sh' + /DietPi/dietpi/func/check_connection "$INSTALL_URL_ADDRESS" - # - Preqs - wget "$INSTALL_URL_ADDRESS" -O package.deb - dpkg -i package.deb - rm package.deb + #Install + if (( $? == 0 )); then - else + # - Preqs + wget "$INSTALL_URL_ADDRESS" -O node_install.sh + chmod +x node_install.sh + ./node_install.sh - Error_NoConnection_NoInstall + rm node_install.sh - fi - #Everything else else - #check, is online - INSTALL_URL_ADDRESS='http://raw.githubusercontent.com/taaem/nodejs-linux-installer/master/node-install.sh' - /DietPi/dietpi/func/check_connection "$INSTALL_URL_ADDRESS" - - #Install - if (( $? == 0 )); then - - # - Preqs - wget "$INSTALL_URL_ADDRESS" -O node_install.sh - chmod +x node_install.sh - ./node_install.sh - - rm node_install.sh - - - else - - Error_NoConnection_NoInstall - - fi + Error_NoConnection_NoInstall fi @@ -5420,7 +5449,7 @@ _EOF_ INSTALLING_INDEX=89 if (( ${aSOFTWARE_INSTALL_STATE[$INSTALLING_INDEX]} == 1 )); then - # - Apache2 has uses its own PHP module + # - Apache2 has its own PHP module if (( ${aSOFTWARE_INSTALL_STATE[83]} >= 1 )); then echo -e "nothing here" &> /dev/null @@ -5511,6 +5540,12 @@ _EOF_ # - max upload size php_max_upload_size="$(( $(php -r 'print(PHP_INT_MAX);') / 1024 / 1024))M" + # Nginx - Set client_max_body_size to avoid 2MB upload error: https://github.com/Fourdee/DietPi/issues/546 + if (( ${aSOFTWARE_INSTALL_STATE[85]} >= 1 )); then + + sed -i "/client_max_body_size/c\ client_max_body_size $php_max_upload_size;" /etc/nginx/nginx.conf + + fi #Set all PHP.INI for ((i=0; i<${#afp_php_ini[@]}; i++)) @@ -5650,7 +5685,15 @@ _EOF_ service mysql start cd /var/www/nextcloud - sudo -u www-data php occ maintenance:install --no-interaction --database "mysql" --database-name "nextcloud" --database-user "root" --database-pass "dietpi" --admin-user "admin" --admin-pass "dietpi" --data-dir "$FP_DIETPI_USERDATA_DIRECTORY/nextcloud_data" + + local username=$(cat /DietPi/dietpi.txt | grep -m1 '^dietpi_nextcloud_username=' | sed 's/.*=//') + if [ ! -n "$username" ]; then + + username='admin' + + fi + + sudo -u www-data php occ maintenance:install --no-interaction --database "mysql" --database-name "nextcloud" --database-user "root" --database-pass "$GLOBAL_PW" --admin-user "$username" --admin-pass "$GLOBAL_PW" --data-dir "$FP_DIETPI_USERDATA_DIRECTORY/nextcloud_data" cd "$HOME" #Disable trusted_domains. @@ -5704,7 +5747,78 @@ WantedBy=multi-user.target _EOF_ systemctl enable transmission-daemon.service - cp /DietPi/dietpi/conf/transmission_settings /etc/transmission-daemon/settings.json + cat << _EOF_ > /etc/transmission-daemon/settings.json +{ + "alt-speed-down": 50, + "alt-speed-enabled": false, + "alt-speed-time-begin": 540, + "alt-speed-time-day": 127, + "alt-speed-time-enabled": false, + "alt-speed-time-end": 1020, + "alt-speed-up": 50, + "bind-address-ipv4": "0.0.0.0", + "bind-address-ipv6": "::", + "blocklist-enabled": false, + "blocklist-url": "http://www.example.com/blocklist", + "cache-size-mb": 48, + "dht-enabled": true, + "download-dir": "/mnt/dietpi_userdata/downloads", + "download-limit": 100, + "download-limit-enabled": false, + "download-queue-enabled": true, + "download-queue-size": 2, + "encryption": 2, + "idle-seeding-limit": 1, + "idle-seeding-limit-enabled": true, + "incomplete-dir": "/mnt/dietpi_userdata/bt-inprogress", + "incomplete-dir-enabled": false, + "lpd-enabled": false, + "max-peers-global": 8, + "message-level": 0, + "peer-congestion-algorithm": "", + "peer-limit-global": 8, + "peer-limit-per-torrent": 5, + "peer-port": 51413, + "peer-port-random-high": 65535, + "peer-port-random-low": 49152, + "peer-port-random-on-start": false, + "peer-socket-tos": "default", + "pex-enabled": true, + "port-forwarding-enabled": true, + "preallocation": 1, + "prefetch-enabled": 1, + "queue-stalled-enabled": true, + "queue-stalled-minutes": 30, + "ratio-limit": 1.1, + "ratio-limit-enabled": true, + "rename-partial-files": true, + "rpc-authentication-required": true, + "rpc-bind-address": "0.0.0.0", + "rpc-enabled": true, + "rpc-password": "$GLOBAL_PW", + "rpc-port": 9091, + "rpc-url": "/transmission/", + "rpc-username": "root", + "rpc-whitelist": "192.*.*.*", + "rpc-whitelist-enabled": false, + "scrape-paused-torrents-enabled": true, + "script-torrent-done-enabled": false, + "script-torrent-done-filename": "", + "seed-queue-enabled": false, + "seed-queue-size": 10, + "speed-limit-down": 100, + "speed-limit-down-enabled": false, + "speed-limit-up": 100, + "speed-limit-up-enabled": false, + "start-added-torrents": true, + "trash-original-torrent-files": true, + "umask": 18, + "upload-limit": 100, + "upload-limit-enabled": false, + "upload-slots-per-torrent": 2, + "utp-enabled": true +} +_EOF_ Create_UserContent_Folders @@ -6097,7 +6211,9 @@ _EOF_ cp /DietPi/dietpi/conf/deluge_web.conf "$HOME"/.config/deluge/web.conf #Set remote access login details - echo -e "root:dietpi:10" > "$HOME"/.config/deluge/auth + cat << _EOF_ > "$HOME"/.config/deluge/auth +root:$GLOBAL_PW:10 +_EOF_ #Setup data directory Create_UserContent_Folders @@ -6121,10 +6237,10 @@ _EOF_ #Setup login file mkdir -p /etc/raspcontrol -cat << _EOF_ > /etc/raspcontrol/database.aptmnt + cat << _EOF_ > /etc/raspcontrol/database.aptmnt { "user": "root", - "password": "dietpi" + "password": "$GLOBAL_PW" } _EOF_ @@ -7198,7 +7314,7 @@ systemctl daemon-reload #WebUI settings cat << _EOF_ > /etc/cubrite/webadmin.ini [User:root] -Password=dietpi +Password=$GLOBAL_PW [WebAdmin] Ports=1339 @@ -7692,6 +7808,9 @@ _EOF_ #As we have /tmp mounted to RAM, change tmp locations sed -i '/DAEMON_TMPDIR=/c\DAEMON_TMPDIR="/var/tmp"' /etc/default/urbackupsrv + #https://github.com/Fourdee/DietPi/issues/545#issuecomment-252419739 + #sqlite3 /usr/local/var/urbackup/backup_server_settings.db "UPDATE settings SET value = '/mnt/dietpi_userdata/urbackup/' WHERE key = 'backupfolder'" + fi #Chromium @@ -7950,6 +8069,10 @@ _EOF_ mysqladmin -u root -pdietpi drop nextcloud -f rm -R /var/www/nextcloud + elif (( $1 == 115 )); then + + AGP webmin + elif (( $1 == 32 )); then AGP mpd libmpdclient2 @@ -9289,7 +9412,8 @@ _EOF_ fi - echo -e "$string" + #Convert string to lowercase (easier to | grep stuff) + echo -e "${string,,}" #Much faster than echo -e $(echo -e "$string" | tr '[:upper:]' '[:lower:]') done @@ -10812,6 +10936,9 @@ _EOF_ #///////////////////////////////////////////////////////////////////////////////////// # Main Loop #///////////////////////////////////////////////////////////////////////////////////// + #-------------------------------------------------------------------------------------- + /DietPi/dietpi/func/dietpi-notify 2 "Initializing database, please wait..." + #-------------------------------------------------------------------------------------- #Init software arrays Software_Arrays_Init diff --git a/dietpi/finalise b/dietpi/finalise index 0cd3ddb0da..dffb678508 100644 --- a/dietpi/finalise +++ b/dietpi/finalise @@ -66,6 +66,9 @@ apt-get clean rm /var/lib/apt/lists/* -vf + # - Set default apt mirrors + /DietPi/dietpi/func/dietpi-set_software apt-mirror default + #//////////////////////////////////// #Delete documentation folders rm -R /usr/share/man @@ -113,6 +116,9 @@ /DietPi/dietpi/func/dietpi-set_hardware bluetooth disable /DietPi/dietpi/func/dietpi-set_hardware wifi disable + # Disable forced eth speed if set + /DietPi/dietpi/func/dietpi-set_hardware eth-forcespeed disable + # Reset IP version pref /DietPi/dietpi/func/dietpi-set_hardware preferipversion auto @@ -166,19 +172,6 @@ _EOF_ rm /root/DietPi-Automation.log rm /boot/Automation_Format_My_Usb_Drive - if (( $(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors | grep -ci -m1 'ondemand') == 1 )); then - sed -i "/^cpu_governor=/c\cpu_governor=ondemand" /DietPi/dietpi.txt - elif (( $(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors | grep -ci -m1 'interactive') == 1 )); then - sed -i "/^cpu_governor=/c\cpu_governor=interactive" /DietPi/dietpi.txt - else - sed -i "/^cpu_governor=/c\cpu_governor=performance" /DietPi/dietpi.txt - fi - - # - C1 | Override default to interactive: https://github.com/Fourdee/DietPi/issues/248 - if (( $HW_MODEL == 10 )); then - sed -i "/^cpu_governor=/c\cpu_governor=interactive" /DietPi/dietpi.txt - fi - /DietPi/dietpi/dietpi-cpu_set #Update README.MD diff --git a/dietpi/func/dietpi-set_hardware b/dietpi/func/dietpi-set_hardware index b6c591cada..321b2de050 100644 --- a/dietpi/func/dietpi-set_hardware +++ b/dietpi/func/dietpi-set_hardware @@ -10,7 +10,7 @@ #//////////////////////////////////// # # Usage: - # + # - /DietPi/dietpi/func/dietpi-set_hardware eth-forcespeed 10/100/1000/disable # - /DietPi/dietpi/func/dietpi-set_hardware rpi-opengl enable/disable # - /DietPi/dietpi/func/dietpi-set_hardware i2c enable/disable/khz # - /DietPi/dietpi/func/dietpi-set_hardware wificountrycode code @@ -58,6 +58,45 @@ } + #///////////////////////////////////////////////////////////////////////////////////// + #Ethernet force link speed + #///////////////////////////////////////////////////////////////////////////////////// + Eth_Force_Speed_Main(){ + + if (( $INPUT_DEVICE_VALUE > 0 )); then + + local eth_force_speed=$INPUT_DEVICE_VALUE + local eth_adapter="eth$(sed -n 1p /DietPi/dietpi/.network)" + + cat << _EOF_ > /etc/systemd/system/ethtool_force_speed.service +[Unit] +Description=ethtool force speed +After=network-online.target + +[Service] +Type=oneshot +ExecStart=/sbin/ethtool -s $eth_adapter speed $eth_force_speed duplex full autoneg off + +[Install] +WantedBy=ifup@$eth_adapter.service +_EOF_ + systemctl enable ethtool_force_speed.service + systemctl start ethtool_force_speed.service + + elif [ "$INPUT_DEVICE_VALUE" = "disable" ]; then #0 is converted to 'disabled' + + rm /etc/systemd/system/ethtool_force_speed.service &> /dev/null + systemctl daemon-reload + + else + + Unknown_Input_Mode + + fi + + } + + #///////////////////////////////////////////////////////////////////////////////////// #RPi openGL #///////////////////////////////////////////////////////////////////////////////////// @@ -411,8 +450,8 @@ _EOF_ aBLUETOOTH_MODULES+=("btbcm") # rpi3 broadcom onboard - aBLUETOOTH_MODULES+=("rfcomm") # BPi pro - aBLUETOOTH_MODULES+=("hidp") # BPi pro + aBLUETOOTH_MODULES+=("rfcomm") # BPi pro/m2+ and others + aBLUETOOTH_MODULES+=("hidp") # BPi pro/m2+ and others aBLUETOOTH_MODULES+=("hci_uart") @@ -544,7 +583,10 @@ _EOF_ aWIFI_MODULES+=("ap6211") #onboard # + BPi M2+ - #aWIFI_MODULES+=("bcmdhd") #onboard Causes kernel exceptions + #aWIFI_MODULES+=("dhd") #Hangs on v133 image with updated ARMbian build + + # + NanoPi T3 + aWIFI_MODULES+=("bcmdhd") # - Disable if [ "$INPUT_DEVICE_VALUE" = "disable" ]; then @@ -1066,6 +1108,10 @@ _EOF_ RPi_OpenGL_Main + elif [ "$INPUT_DEVICE_NAME" = "eth-forcespeed" ]; then + + Eth_Force_Speed_Main + else Unknown_Input_Name diff --git a/dietpi/func/dietpi-set_software b/dietpi/func/dietpi-set_software new file mode 100644 index 0000000000..195c4f1b1b --- /dev/null +++ b/dietpi/func/dietpi-set_software @@ -0,0 +1,141 @@ +#!/bin/bash +{ + #//////////////////////////////////// + # DietPi Function: + # - Enables control and applies settings for specific software and configs. + # + #//////////////////////////////////// + # Created by Daniel Knight / daniel.knight@dietpi.com / dietpi.com + # + #//////////////////////////////////// + # + # Usage: + # + # - /DietPi/dietpi/func/dietpi-set_software apt-mirror url/default + #//////////////////////////////////// + + #Force en_GB Locale for whole script. Prevents incorrect parsing with non-english locales. + LANG=en_GB.UTF-8 + + INPUT_MODE_NAME="$1" #$(echo -e "$1" | tr '[:upper:]' '[:lower:]') + INPUT_MODE_VALUE="$2" #$(echo -e "$2" | tr '[:upper:]' '[:lower:]') + + #support for 0/1 inputs for enable/disable + if [ "$INPUT_MODE_VALUE" = "1" ]; then + + INPUT_MODE_VALUE='enable' + + elif [ "$INPUT_MODE_VALUE" = "0" ]; then + + INPUT_MODE_VALUE='disable' + + fi + + EXIT_CODE=0 + + HW_MODEL=$(sed -n 1p /DietPi/dietpi/.hw_model) + DISTRO=$(sed -n 3p /DietPi/dietpi/.hw_model) + + Unknown_Input_Name(){ + + EXIT_CODE=1 + /DietPi/dietpi/func/dietpi-notify 2 "Unknown input name ($INPUT_MODE_NAME). Nothing has been applied." + + } + + Unknown_Input_Mode(){ + + EXIT_CODE=1 + /DietPi/dietpi/func/dietpi-notify 2 "Unknown input value ($INPUT_MODE_VALUE). Nothing has been applied." + + } + + #///////////////////////////////////////////////////////////////////////////////////// + # Set Apt Mirror + #///////////////////////////////////////////////////////////////////////////////////// + AptMirror_Main(){ + + if [ -n "$INPUT_MODE_VALUE" ]; then + + local apt_distro='jessie' #3 + if (( $DISTRO == 4 )); then + + apt_distro='stretch' + + fi + + # - Set defaults? + if [ "$INPUT_MODE_VALUE" = "default" ]; then + + if (( $HW_MODEL < 10 )); then + + INPUT_MODE_VALUE='http://mirror.ox.ac.uk/sites/archive.raspbian.org/archive/raspbian' + + else + + INPUT_MODE_VALUE='http://ftp.debian.org/debian' + + fi + + fi + + # - Set raspbian + if (( $HW_MODEL < 10 )); then + + cat << _EOF_ > /etc/apt/sources.list +deb $INPUT_MODE_VALUE $apt_distro main contrib non-free rpi +_EOF_ + + # Update dietpi.txt entry + sed -i "/Apt_Raspbian_Mirror=/c\Apt_Raspbian_Mirror=$INPUT_MODE_VALUE" /DietPi/dietpi.txt + + # - Set debian + else + + cat << _EOF_ > /etc/apt/sources.list +deb $INPUT_MODE_VALUE $apt_distro main contrib non-free +deb $INPUT_MODE_VALUE $apt_distro-updates main contrib non-free +deb http://security.debian.org $apt_distro/updates main contrib non-free +deb $INPUT_MODE_VALUE $apt_distro-backports main contrib non-free +_EOF_ + + # Update dietpi.txt entry + sed -i "/Apt_Debian_Mirror=/c\Apt_Debian_Mirror=$INPUT_MODE_VALUE" /DietPi/dietpi.txt + + fi + + + + else + + Unknown_Input_Mode + + fi + + } + + #///////////////////////////////////////////////////////////////////////////////////// + # Main Loop + #///////////////////////////////////////////////////////////////////////////////////// + #----------------------------------------------------------------------------------- + #info + + /DietPi/dietpi/func/dietpi-notify 3 DietPi-Set_Software "$INPUT_MODE_NAME ($INPUT_MODE_VALUE)" + + #----------------------------------------------------------------------------------- + if [ "$INPUT_MODE_NAME" = "apt-mirror" ]; then + + AptMirror_Main + + else + + Unknown_Input_Name + + fi + + #----------------------------------------------------------------------------------- + /DietPi/dietpi/func/dietpi-notify -1 $EXIT_CODE "$INPUT_MODE_NAME $INPUT_MODE_VALUE |" + #----------------------------------------------------------------------------------- + exit $EXIT_CODE + #----------------------------------------------------------------------------------- +} \ No newline at end of file diff --git a/dietpi/misc/rpi_boardinfo b/dietpi/misc/rpi_boardinfo index d3c01b0787..e50dea7cef 100644 --- a/dietpi/misc/rpi_boardinfo +++ b/dietpi/misc/rpi_boardinfo @@ -127,37 +127,37 @@ HW_PCB_REVISION='1.2' MEMORY=512 MANUFACTURER='Unknown' - elif [[ "$HW_REVISION" = "a01041" ]]; then + elif [[ "$HW_REVISION" = *"a01041" ]]; then HW_RELEASE_DATE='Q1 2015' HW_MODEL_NAME='2 Model B' HW_PCB_REVISION='1.1' MEMORY=1024 MANUFACTURER='Sony' - elif [[ "$HW_REVISION" = "a21041" ]]; then + elif [[ "$HW_REVISION" = *"a21041" ]]; then HW_RELEASE_DATE='Q1 2015' HW_MODEL_NAME='2 Model B' HW_PCB_REVISION='1.1' MEMORY=1024 MANUFACTURER='Embest, China' - elif [[ "$HW_REVISION" = "a02082" ]]; then + elif [[ "$HW_REVISION" = *"a02082" ]]; then HW_RELEASE_DATE='Q1 2016' HW_MODEL_NAME='3 Model B' HW_PCB_REVISION='1.2' MEMORY=1024 MANUFACTURER='Sony' - elif [[ "$HW_REVISION" = "a22082" ]]; then + elif [[ "$HW_REVISION" = *"a22082" ]]; then HW_RELEASE_DATE='Q1 2016' HW_MODEL_NAME='3 Model B' HW_PCB_REVISION='1.2' MEMORY=1024 MANUFACTURER='Embest, China' - elif [[ "$HW_REVISION" = "900092" ]]; then + elif [[ "$HW_REVISION" = *"900092" ]]; then HW_RELEASE_DATE='Q4 2015' HW_MODEL_NAME='Zero' HW_PCB_REVISION='1.2' MEMORY=512 MANUFACTURER='Sony' - elif [[ "$HW_REVISION" = "900093" ]]; then + elif [[ "$HW_REVISION" = *"900093" ]]; then HW_RELEASE_DATE='Q2 2016' HW_MODEL_NAME='Zero' HW_PCB_REVISION='1.3' diff --git a/dietpi/patch_file b/dietpi/patch_file index 44b584e583..20cd90bccf 100644 --- a/dietpi/patch_file +++ b/dietpi/patch_file @@ -1574,6 +1574,58 @@ _EOF_ apt-get install -y p7zip-full #------------------------------------------------------------------------------- + elif (( $VERSION_CURRENT == 132 )); then + #------------------------------------------------------------------------------- + #Interactive CPU gov by default: + CPU_GOVERNOR_CURRENT=$(cat /DietPi/dietpi.txt | grep -m1 '^cpu_governor=' | sed 's/.*=//') + if [ "$CPU_GOVERNOR_CURRENT" = "ondemand" ]; then + + sed -i "/^cpu_governor=/c\cpu_governor=interactive" /DietPi/dietpi.txt + /DietPi/dietpi/dietpi-cpu_set + + fi + #------------------------------------------------------------------------------- + #dietpi.txt entries : https://github.com/Fourdee/DietPi/issues/533 + if (( ! $(cat /DietPi/dietpi.txt | grep -ci -m1 '^AUTO_Global_Password=') )); then + + echo -e "\nAUTO_Global_Password=dietpi\n" >> /DietPi/dietpi.txt + + fi + if (( ! $(cat /DietPi/dietpi.txt | grep -ci -m1 '^Apt_Raspbian_Mirror=') )); then + + echo -e "\nApt_Raspbian_Mirror=http://mirror.ox.ac.uk/sites/archive.raspbian.org/archive/raspbian\n" >> /DietPi/dietpi.txt + + fi + if (( ! $(cat /DietPi/dietpi.txt | grep -ci -m1 '^Apt_Debian_Mirror=') )); then + + echo -e "\nApt_Debian_Mirror=http://ftp.debian.org/debian\n" >> /DietPi/dietpi.txt + + fi + if (( ! $(cat /DietPi/dietpi.txt | grep -ci -m1 '^AUTO_Dedicated_Usb_Drive_Format_Filesystem=') )); then + + echo -e "\nAUTO_Dedicated_Usb_Drive_Format_Filesystem=0\n" >> /DietPi/dietpi.txt + + fi + if (( ! $(cat /DietPi/dietpi.txt | grep -ci -m1 '^dietpi_nextcloud_username=') )); then + + echo -e "\ndietpi_nextcloud_username=admin\n" >> /DietPi/dietpi.txt + + fi + #------------------------------------------------------------------------------- + #FriendlyARM images, remove custom services: + if (( $HW_MODEL == 61 || $HW_MODEL == 62 )); then + + rm /lib/systemd/system/lcd4linux.service + rm /lib/systemd/system/hwservice.service + rm /lib/systemd/system/hwservice_monitor.service + systemctl daemon-reload + + fi + #------------------------------------------------------------------------------- + #ethtool: + apt-get install -y ethtool + #------------------------------------------------------------------------------- + fi #------------------------------------------------------------------------------- diff --git a/dietpi/server_version b/dietpi/server_version index 7085ca7389..f62d1066c5 100644 --- a/dietpi/server_version +++ b/dietpi/server_version @@ -1,2 +1,2 @@ -132 +133 5 \ No newline at end of file