diff --git a/README.md b/README.md index c2d8db40e5..979b5a366c 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,9 @@ -# Nextcloud VM -[![irc](https://img.shields.io/badge/irc%20channel-%23nextcloud--vm%20on%20freenode-blue.svg)](https://webchat.freenode.net/?channels=techandme) +# Nextcloud for your RaspberryPI 2 or 3 + +[![irc](https://img.shields.io/badge/irc%20channel-%23techandme%20on%20freenode-blue.svg)](https://webchat.freenode.net/?channels=techandme) + +## What is NextBerry? +[More info](https://www.techandme.se/nextberry-vm/) ## Maintainers * [Daniel Hanson](https://github.com/enoch85) @ [Tech and Me](https://www.techandme.se) @@ -7,54 +11,19 @@ * [Luis Guzman](https://github.com/Ark74) @ [SwITNet](https://switnet.net) * You? :) +## Image +[Image link](https://cloud.waaromzomoeilijk.nl/s/dxFxgOqs6crjQYe) -## Build Requirements -These requirements are only applied if you build from the scripts: -* Ubuntu Server 16.04.X Server -* OpenSSH (preferred) +## Documentation +[How to](https://github.com/ezraholm50/NextBerry/wiki) -If you install this on a clean Ubuntu 16.04.X VM, the only script you need to run is "nextcloud_install_production.sh". All the other scripts are fetched from this repository during the installation. - -It would be really nice if someone could develop the scripts so that they worked "out of the box", without having to use a "base VM" with Ubuntu 16.04 pre-installed. Vagrant is an option. +## Version info +[Versions](https://github.com/ezraholm50/NextBerry/wiki/Versions) ## Machine configuration Please check the configuration here: https://www.techandme.se/machine-setup-nextcloud/ -## FAQ - -Keep asking questions so that we can add them here. - -**Q:** The script says: "WARNING: apt does not have a stable CLI interface yet. Use with caution in scripts" -
-**A:** http://askubuntu.com/a/463966 - -**Q:** I get NETWORK NOT OK when booting the VM. How do I solve that? -
-**A:** There are a few causes to this error, most of them are your own network or firewall settings. -
-- Remove the VM NIC adapter in settings on VMware/Virtualbox and then re-adding a NIC adapter. -![alt_tag](https://goo.gl/gWg9JN) -
-- Check your firewall so that it doesn't block this specific IP -
-- Check your router/firewall that you have DHCP enabled. +Note: this build does not inlude Webmin. -**Q:** Which Hyper-V generation should we chose when creating a machine to load this image? -
-**A:** You currently need to use a 1st generation machine. - -**Q:** Do you have a pre-configured Hyper-V VM? -
-**A:** Yes we have, you can download it here: https://shop.techandme.se/index.php/product/nextcloud-vm-microsoft-hyper-v-vhd/ - -**Q:** I want a bigger version of this VM, where can I find that? -
-**A:** You can download it here: https://shop.techandme.se/index.php/product/nextcloud-vm-500gb/ - -**Q:** I have found a bug that I want to report, where do I do that? -
-**A:** Just submit your report here: https://github.com/nextcloud/vm/issues/new - -## First look - -![alt tag](https://raw.githubusercontent.com/nextcloud/screenshots/master/vm/first-look.jpg) +## FAQ +[FAQ](https://github.com/ezraholm50/NextBerry/wiki/FAQ) diff --git a/_config.yml b/_config.yml new file mode 100644 index 0000000000..c4192631f2 --- /dev/null +++ b/_config.yml @@ -0,0 +1 @@ +theme: jekyll-theme-cayman \ No newline at end of file diff --git a/initial-root.profile b/initial-root.profile new file mode 100644 index 0000000000..a5780af040 --- /dev/null +++ b/initial-root.profile @@ -0,0 +1,51 @@ +# ~/.profile: executed by Bourne-compatible login shells. + +if [ "$BASH" ]; then + if [ -f ~/.bashrc ]; then + . ~/.bashrc + fi +fi + +mesg n || true + +# Resize or use hd +mkdir -p /var/scripts + +if [ -f bash /var/scripts/resize-sd.sh ]; then + + rm bash /var/scripts/resize-sd.sh +else + wget https://raw.githubusercontent.com/ezraholm50/NextBerry/master/static/resize-sd.sh -P /var/scripts + chmod +x /var/scripts/resize-sd.sh +fi +if [[ $? > 0 ]] +then + echo "Download of scripts failed. System will reboot in 10 seconds..." + sleep 10 + reboot +else + clear +fi + +bash /var/scripts/resize-sd.sh + +# Grab install scripts +mkdir -p /var/scripts + +if [ -f /var/scripts/nextcloud_install_production.sh ]; then + + rm /var/scripts/nextcloud_install_production.sh +else + wget https://raw.githubusercontent.com/ezraholm50/NextBerry/master/nextcloud_install_production.sh -P /var/scripts + chmod +x /var/scripts/nextcloud_install_production.sh +fi +if [[ $? > 0 ]] +then + echo "Download of scripts failed. System will reboot in 10 seconds..." + sleep 10 + reboot +else + clear +fi + +bash /var/scripts/nextcloud_install_production.sh diff --git a/issue_template.md b/issue_template.md index 462fa1b7d1..9870553287 100644 --- a/issue_template.md +++ b/issue_template.md @@ -1,7 +1,7 @@ ## Steps to reproduce @@ -19,7 +19,7 @@ Tell us what happens instead **Server version:** (see your admin page) -**VM version** +**Raspberry 2 or 3?** **Updated from an older installed version or fresh install:** diff --git a/nextcloud-startup-script.sh b/nextcloud-startup-script.sh index 565119e4d3..b06f960ea9 100644 --- a/nextcloud-startup-script.sh +++ b/nextcloud-startup-script.sh @@ -14,9 +14,10 @@ SCRIPTS=/var/scripts IFACE=$(lshw -c network | grep "logical name" | awk '{print $3; exit}') CLEARBOOT=$(dpkg -l linux-* | awk '/^ii/{ print $2}' | grep -v -e `uname -r | cut -f1,2 -d"-"` | grep -e [0-9] | xargs sudo apt -y purge) PHPMYADMIN_CONF="/etc/apache2/conf-available/phpmyadmin.conf" -GITHUB_REPO="https://raw.githubusercontent.com/nextcloud/vm/master" -STATIC="https://raw.githubusercontent.com/nextcloud/vm/master/static" -LETS_ENC="https://raw.githubusercontent.com/nextcloud/vm/master/lets-encrypt" +TECHANDTOOL="https://raw.githubusercontent.com/ezraholm50/techandtool/master" +GITHUB_REPO="https://raw.githubusercontent.com/ezraholm50/NextBerry/master" +STATIC="https://raw.githubusercontent.com/ezraholm50/NextBerry/master/static" +LETS_ENC="https://raw.githubusercontent.com/ezraholm50/NextBerry/master/lets-encrypt" UNIXUSER=ncadmin UNIXPASS=nextcloud @@ -29,6 +30,34 @@ else sleep 1 fi +# Whiptail size +WT_HEIGHT=17 +WT_WIDTH=$(tput cols) + +if [ -z "$WT_WIDTH" ] || [ "$WT_WIDTH" -lt 60 ]; then + WT_WIDTH=80 +fi +if [ "$WT_WIDTH" -gt 178 ]; then + WT_WIDTH=120 +fi +WT_MENU_HEIGHT=$((WT_HEIGHT-7)) + +# Whiptail check +if [ $(dpkg-query -W -f='${Status}' whiptail 2>/dev/null | grep -c "ok installed") -eq 1 ]; then + echo "Whiptail is already installed..." + clear +else + + { + i=1 + while read -r line; do + i=$(( i + 1 )) + echo $i + done < <(apt update; apt install whiptail -y) +} | whiptail --title "Progress" --gauge "Please wait while installing Whiptail..." 6 60 0 + +fi + # Check if root if [ "$(whoami)" != "root" ] then @@ -110,7 +139,7 @@ then sleep 0.1 else echo "nextant failed" - echo "Script failed to download. Please run: 'sudo bash /var/scripts/nextcloud-startup-script.sh' again." + echo "Script failed to download. Please run: 'sudo bash /var/scripts/nextcloud-startup-script.sh' again." exit 1 fi @@ -401,7 +430,7 @@ clear echo -e "\e[0m" # Set keyboard layout -echo "Current keyboard layout is Swedish" +echo "Current keyboard layout is English" echo "You must change keyboard layout to your language" echo -e "\e[32m" read -p "Press any key to change keyboard layout... " -n1 -s @@ -595,7 +624,7 @@ fi clear # Change Timezone -echo "Current timezone is $(cat /etc/timezone)" +echo "Current timezone is Europe/Stockholm" echo "You must change timezone to your timezone" echo -e "\e[32m" read -p "Press any key to change timezone... " -n1 -s @@ -730,24 +759,8 @@ echo "+--------------------------------------------------------------------+" echo echo -e "\e[0m" +#### Needs testing # VPS? -function ask_yes_or_no() { - read -p "$1 ([y]es or [N]o): " - case $(echo $REPLY | tr '[A-Z]' '[a-z]') in - y|yes) echo "yes" ;; - *) echo "no" ;; - esac -} -if [[ "yes" == $(ask_yes_or_no "Do you run this on a *remote* VPS?") ]] -then - echo "Ok, then your IP are probably wrong, we will use the backup file to recover it so that you can connect after reboot" - echo -e "\e[32m" - read -p "Press any key to continue... " -n1 -s - echo -e "\e[0m" - mv /etc/network/interfaces.backup /etc/network/interfaces -else - sleep 1 -fi clear cat << LETSENC diff --git a/nextcloud_install_production.sh b/nextcloud_install_production.sh index 76737c3527..4cd053d022 100644 --- a/nextcloud_install_production.sh +++ b/nextcloud_install_production.sh @@ -11,13 +11,15 @@ DEBUG=0 # Repositories -GITHUB_REPO="https://raw.githubusercontent.com/nextcloud/vm/master" -STATIC="https://raw.githubusercontent.com/nextcloud/vm/master/static" -NCREPO="https://download.nextcloud.com/server/releases/" +GITHUB_REPO="https://raw.githubusercontent.com/ezraholm50/NextBerry/master" +STATIC="https://raw.githubusercontent.com/ezraholm50/NextBerry/master/static" +NCREPO="https://download.nextcloud.com/server/releases" +TECHANDTOOL="https://raw.githubusercontent.com/ezraholm50/techandtool/master/techandtool.sh" OpenPGP_fingerprint='28806A878AE423A28372792ED75899B9A724937A' # Nextcloud version -NCVERSION=$(curl -s $NCREPO | tac | grep unknown.gif | sed 's/.*"nextcloud-\([^"]*\).zip.sha512".*/\1/;q') +NCVERSION=$(curl -s --max-time 900 $NCREPO/ | tac | grep unknown.gif | sed 's/.*"nextcloud-\([^"]*\).zip.sha512".*/\1/;q') STABLEVERSION="nextcloud-$NCVERSION" +NEXTBERRYVERSION="010" # Needs to be this format for if [ x -gt x ] then... # Ubuntu version OS=$(grep -ic "Ubuntu" /etc/issue.net) # Passwords @@ -30,17 +32,20 @@ HTML=/var/www NCPATH=$HTML/nextcloud GPGDIR=/tmp/gpg NCDATA=/var/ncdata - # Apache vhosts SSL_CONF="/etc/apache2/sites-available/nextcloud_ssl_domain_self_signed.conf" HTTP_CONF="/etc/apache2/sites-available/nextcloud_http_domain_self_signed.conf" # Network IFACE=$(lshw -c network | grep "logical name" | awk '{print $3; exit}') ADDRESS=$(hostname -I | cut -d ' ' -f 1) - # Linux user, and Nextcloud user UNIXUSER=ncadmin UNIXPASS=nextcloud +# Devices +DEVICE="/dev/mmcblk0" +DEV="/dev/sda" +DEVHD="/dev/sda2" +DEVSP="/dev/sda1" # DEBUG mode if [ $DEBUG -eq 1 ] @@ -60,6 +65,21 @@ then exit 1 fi +# Set /etc/hosts +sed -i 's|127.0.0.1 localhost|127.0.0.1 localhost nextcloud|' /etc/hosts + +# Setup firewall-rules +wget -q "$STATIC/firewall-rules" -P /usr/sbin/ +chmod +x /usr/sbin/firewall-rules +echo "y" | sudo ufw enable +ufw default deny incoming +ufw limit 22/tcp +ufw allow 80/tcp +ufw allow 443/tcp + +# Set NextBerry version for the updater tool +echo "$NEXTBERRYVERSION" > $SCRIPTS/.version-nc + # Prefer IPv4 sed -i "s|#precedence ::ffff:0:0/96 100|precedence ::ffff:0:0/96 100|g" /etc/gai.conf @@ -188,34 +208,42 @@ else echo "Network OK." fi +# Erase some dev tracks +cat /dev/null > /var/log/syslog + # Set locales apt install language-pack-en-base -y -sudo locale-gen "sv_SE.UTF-8" && sudo dpkg-reconfigure --frontend=noninteractive locales - -# Check where the best mirrors are and update -echo "Locating the best mirrors..." -apt update -q2 -apt install python-pip -y -pip install \ - --upgrade pip \ - apt-select -apt-select -sudo cp /etc/apt/sources.list /etc/apt/sources.list.backup && \ -sudo mv sources.list /etc/apt/ -clear +sudo dpkg-reconfigure --frontend=noninteractive locales # Set keyboard layout -echo "Current keyboard layout is Swedish" -echo "You must change keyboard layout to your language" -echo -e "\e[32m" -read -p "Press any key to change keyboard layout... " -n1 -s -echo -e "\e[0m" dpkg-reconfigure keyboard-configuration -echo clear -# Update system -apt update -q2 +# Update and upgrade +apt autoclean +apt autoremove -y +apt update +apt full-upgrade -y +apt install -fy +dpkg --configure --pending + +# Install various packages +apt install -y ntpdate \ + module-init-tools \ + miredo \ + rsync \ + zram-config \ + ca-certificates \ + unzip \ + landscape-common \ + libminiupnpc10 + +# Fix time issues +ntpdate -u ntp.ubuntu.com + +# Only use swap to prevent out of memory. Speed and less tear on SD +echo "vm.swappiness = 0" >> /etc/sysctl.conf +sysctl -p # Write MySQL pass to file and keep it safe echo "$MYSQL_PASS" > $PW_FILE @@ -268,7 +296,7 @@ sudo hostnamectl set-hostname nextcloud service apache2 restart # Install PHP 7.0 -apt update -q2 +apt update apt install -y \ libapache2-mod-php7.0 \ php7.0-common \ @@ -292,12 +320,6 @@ apt install -y \ # echo '# This enables php-smbclient' >> /etc/php/7.0/apache2/php.ini # echo 'extension="smbclient.so"' >> /etc/php/7.0/apache2/php.ini -# Install Unzip -apt install unzip -y - -# Install VM-tools -apt install open-vm-tools -y - # Download and validate Nextcloud package wget -q $NCREPO/$STABLEVERSION.zip -P $HTML mkdir -p $GPGDIR @@ -326,6 +348,9 @@ bash $SCRIPTS/setup_secure_permissions_nextcloud.sh # Install Nextcloud cd $NCPATH +clear +echo "Installing Nextcloud, this can take a while please hold on..." +echo sudo -u www-data php occ maintenance:install \ --data-dir "$NCDATA" \ --database "mysql" \ @@ -487,15 +512,6 @@ sudo -u www-data php $NCPATH/occ config:system:set mail_smtppassword --value="vi # Install Libreoffice Writer to be able to read MS documents. sudo apt install --no-install-recommends libreoffice-writer -y -# Install packages for Webmin -apt install -y zip perl libnet-ssleay-perl openssl libauthen-pam-perl libpam-runtime libio-pty-perl apt-show-versions python - -# Install Webmin -sed -i '$a deb http://download.webmin.com/download/repository sarge contrib' /etc/apt/sources.list -wget -q http://www.webmin.com/jcameron-key.asc -O- | sudo apt-key add - -apt update -q2 -apt install webmin -y - # Nextcloud apps CONVER=$(curl -s https://api.github.com/repos/nextcloud/contacts/releases/latest | grep "tag_name" | cut -d\" -f4 | sed -e "s|v||g") CONVER_FILE=contacts.tar.gz @@ -504,18 +520,8 @@ CALVER=$(curl -s https://api.github.com/repos/nextcloud/calendar/releases/latest CALVER_FILE=calendar.tar.gz CALVER_REPO=https://github.com/nextcloud/calendar/releases/download -# Get spreedme script -if [ -f $SCRIPTS/spreedme.sh ] -then - rm $SCRIPTS/spreedme.sh - wget -q $STATIC/spreedme.sh -P $SCRIPTS -else - wget -q $STATIC/spreedme.sh -P $SCRIPTS -fi - sudo -u www-data php $NCPATH/occ config:system:set preview_libreoffice_path --value="/usr/bin/libreoffice" -function calendar { # Download and install Calendar if [ -d $NCPATH/apps/calendar ] then @@ -533,9 +539,6 @@ then sudo -u www-data php $NCPATH/occ app:enable calendar fi -} - -function contacts { # Download and install Contacts if [ -d $NCPATH/apps/contacts ] then @@ -552,34 +555,6 @@ if [ -d $NCPATH/apps/contacts ] then sudo -u www-data php $NCPATH/occ app:enable contacts fi -} - - -function spreedme { - bash $SCRIPTS/spreedme.sh - rm $SCRIPTS/spreedme.sh - -} - -whiptail --title "Which apps do you want to install?" --checklist --separate-output "" 10 40 3 \ -"Calendar" " " on \ -"Contacts" " " on \ -"Spreed.Me" " " on 2>results - -while read choice -do - case $choice in - Calendar) calendar - ;; - Contacts) contacts - ;; - Spreed.Me) spreedme - ;; - *) - ;; - esac -done < results - # Change roots .bash_profile if [ -f $SCRIPTS/change-root-profile.sh ] @@ -671,12 +646,16 @@ bash $SCRIPTS/redis-server-ubuntu16.sh rm $SCRIPTS/redis-server-ubuntu16.sh # Upgrade -apt update -q2 +apt update apt full-upgrade -y # Remove LXD (always shows up as failed during boot) apt purge lxd -y +# Cleanup login screen +rm /etc/update-motd.d/00-header +rm /etc/update-motd.d/10-help-text + # Cleanup CLEARBOOT=$(dpkg -l linux-* | awk '/^ii/{ print $2}' | grep -v -e `uname -r | cut -f1,2 -d"-"` | grep -e [0-9] | xargs sudo apt -y purge) echo "$CLEARBOOT" diff --git a/static/cmdline.txt b/static/cmdline.txt new file mode 100644 index 0000000000..5cc07263dd --- /dev/null +++ b/static/cmdline.txt @@ -0,0 +1 @@ +smsc95xx.turbo_mode=N dwc_otg.fiq_fix_enable=1 net.ifnames=0 biosdevname=0 dwc_otg.lpm_enable=0 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait quiet splash diff --git a/static/config.txt b/static/config.txt new file mode 100644 index 0000000000..e79a518f4a --- /dev/null +++ b/static/config.txt @@ -0,0 +1,1192 @@ +## Tech and me 2016 RPI config - If you overclock, we can't be held +## responsible for any damage or loss what so ever. +## Ubuntu Core 16.04 (should work on any OS, place in BOOT partition) +################################################################################ +## Raspberry Pi Configuration Settings +## +## Revision 16, 2013/06/22 +## +## Details taken from the eLinux wiki +## For up-to-date information please refer to wiki page. +## +## Wiki Location : http://elinux.org/RPiconfig +## +## +## Description: +## Details of each setting are described with each section that begins with +## a double hashed comment ('##') +## It is up to the user to remove the single hashed comment ('#') from each +## option they want to enable, and to set the specific value of that option. +## +## Overclock settings will be disabled at runtime if the SoC reaches temp_limit +## +################################################################################ + +################################################################################ +## Standard Definition Video Settings +################################################################################ + +## sdtv_mode +## defines the TV standard for composite output +## +## Value Description +## ------------------------------------------------------------------------- +## 0 Normal NTSC (Default) +## 1 Japanese version of NTSC - no pedestal +## 2 Normal PAL +## 3 Brazilian version of PAL - 525/60 rather than 625/50, different +## subcarrier +## +#sdtv_mode=0 + +## sdtv_aspect +## defines the aspect ratio for composite output +## +## Value Description +## ------------------------------------------------------------------------- +## 1 4:3 (Default) +## 2 14:9 +## 3 16:9 +## +#sdtv_aspect=1 + +## sdtv_disable_colourburst +## Disables colour burst on composite output. The picture will be +## monochrome, but possibly sharper +## +## Value Description +## ------------------------------------------------------------------------- +## 0 Colour burst is enabled (Default) +## 1 Colour burst is disabled +## +#sdtv_disable_colourburst=1 + +################################################################################ +## High Definition Video Settings +################################################################################ + +## hdmi_safe +## Use "safe mode" settings to try to boot with maximum hdmi compatibility. +## +## Value Description +## ------------------------------------------------------------------------- +## 0 Disabled (Default) +## 1 Enabled (this does: hdmi_force_hotplug=1, +## hdmi_ignore_edid=0xa5000080, +## config_hdmi_boost=4, hdmi_group=2, +## hdmi_mode=4, disable_overscan=0, +## overscan_left=24, overscan_right=24, +## overscan_top=24, overscan_bottom=24) +## +#hdmi_safe=1 + +## hdmi_force_hotplug +## Pretends HDMI hotplug signal is asserted so it appears a HDMI display +## is attached +## +## Value Description +## ------------------------------------------------------------------------- +## 0 Disabled (Default) +## 1 Use HDMI mode even if no HDMI monitor is detected +## +#hdmi_force_hotplug=1 + +## hdmi_ignore_hotplug +## Pretends HDMI hotplug signal is not asserted so it appears a HDMI +## display is not attached +## +## Value Description +## ------------------------------------------------------------------------- +## 0 Disabled (Default) +## 1 Use composite mode even if HDMI monitor is detected +## +#hdmi_ignore_hotplug=1 + +## hdmi_drive +## chooses between HDMI and DVI modes +## +## Value Description +## ------------------------------------------------------------------------- +## 1 Normal DVI mode (No sound) +## 2 Normal HDMI mode (Sound will be sent if supported and enabled) +## +#hdmi_drive=2 + +## hdmi_ignore_edid +## Enables the ignoring of EDID/display data +## +#hdmi_ignore_edid=0xa5000080 + +## hdmi_edid_file +## Read the EDID data from the edid.dat file instead of from the attached +## device +## +## Value Description +## ------------------------------------------------------------------------- +## 0 Read EDID data from attached device (Default) +## 1 Read EDID data from edid.txt file +## +#hdmi_edid_file=1 + +## hdmi_ignore_edid_audio +## Pretends all audio formats are unsupported by display. This means ALSA +## will default to analogue. +## +## Value Description +## ------------------------------------------------------------------------- +## 0 Use EDID provided values (Default) +## 1 Pretend all audio formats are unsupported +## +#hdmi_ignore_edid_audio=1 + +## hdmi_force_edid_audio +## Pretends all audio formats are supported by display, allowing +## passthrough of DTS/AC3 even when not reported as supported. +## +## Value Description +## ------------------------------------------------------------------------- +## 0 Use EDID provided values (Default) +## 1 Pretend all audio formats are supported +## +#hdmi_force_edid_audio=1 + +## hdmi_force_edid_3d +## Pretends all CEA modes support 3D even when edid doesn't indicate +## support for them. +## +## Value Description +## ------------------------------------------------------------------------- +## 0 Use EDID provided values (Default) +## 1 Pretend 3D mode is supported +## +#hdmi_force_edid_3d=1 + +## avoid_edid_fuzzy_match +## Avoid fuzzy matching of modes described in edid. +## +## Value Description +## ------------------------------------------------------------------------- +## 0 Use fuzzy matching (Default) +## 1 Avoid fuzzy matching +## +#avoid_edid_fuzzy_match=1 + +## hdmi_pixel_encoding +## Force the pixel encoding mode. +## By default it will use the mode requested from edid so shouldn't +## need changing. +## +## Value Description +## ------------------------------------------------------------------------- +## 0 Use EDID provided values (Default) +## 1 RGB limited (16-235) +## 2 RGB full ( 0-255) +## 3 YCbCr limited (16-235) +## 4 YCbCr limited ( 0-255) +## +#hdmi_pixel_encoding=1 + +## hdmi_group +## Defines the HDMI type +## +## Value Description +## ------------------------------------------------------------------------- +## 0 Use the preferred group reported by the edid (Default) +## 1 CEA +## 2 DMT +## +#hdmi_group=1 + +## hdmi_mode +## defines screen resolution in CEA or DMT format +## +## H means 16:9 variant (of a normally 4:3 mode). +## 2x means pixel doubled (i.e. higher clock rate, with each pixel repeated +## twice) +## 4x means pixel quadrupled (i.e. higher clock rate, with each pixel +## repeated four times) +## reduced blanking means fewer bytes are used for blanking within the data +## stream (i.e. lower clock rate, with fewer wasted bytes) +## +## Value hdmi_group=CEA hdmi_group=DMT +## ------------------------------------------------------------------------- +## 1 VGA 640x350 85Hz +## 2 480p 60Hz 640x400 85Hz +## 3 480p 60Hz H 720x400 85Hz +## 4 720p 60Hz 640x480 60Hz +## 5 1080i 60Hz 640x480 72Hz +## 6 480i 60Hz 640x480 75Hz +## 7 480i 60Hz H 640x480 85Hz +## 8 240p 60Hz 800x600 56Hz +## 9 240p 60Hz H 800x600 60Hz +## 10 480i 60Hz 4x 800x600 72Hz +## 11 480i 60Hz 4x H 800x600 75Hz +## 12 240p 60Hz 4x 800x600 85Hz +## 13 240p 60Hz 4x H 800x600 120Hz +## 14 480p 60Hz 2x 848x480 60Hz +## 15 480p 60Hz 2x H 1024x768 43Hz DO NOT USE +## 16 1080p 60Hz 1024x768 60Hz +## 17 576p 50Hz 1024x768 70Hz +## 18 576p 50Hz H 1024x768 75Hz +## 19 720p 50Hz 1024x768 85Hz +## 20 1080i 50Hz 1024x768 120Hz +## 21 576i 50Hz 1152x864 75Hz +## 22 576i 50Hz H 1280x768 reduced blanking +## 23 288p 50Hz 1280x768 60Hz +## 24 288p 50Hz H 1280x768 75Hz +## 25 576i 50Hz 4x 1280x768 85Hz +## 26 576i 50Hz 4x H 1280x768 120Hz reduced blanking +## 27 288p 50Hz 4x 1280x800 reduced blanking +## 28 288p 50Hz 4x H 1280x800 60Hz +## 29 576p 50Hz 2x 1280x800 75Hz +## 30 576p 50Hz 2x H 1280x800 85Hz +## 31 1080p 50Hz 1280x800 120Hz reduced blanking +## 32 1080p 24Hz 1280x960 60Hz +## 33 1080p 25Hz 1280x960 85Hz +## 34 1080p 30Hz 1280x960 120Hz reduced blanking +## 35 480p 60Hz 4x 1280x1024 60Hz +## 36 480p 60Hz 4x H 1280x1024 75Hz +## 37 576p 50Hz 4x 1280x1024 85Hz +## 38 576p 50Hz 4x H 1280x1024 120Hz reduced blanking +## 39 1080i 50Hz reduced blanking 1360x768 60Hz +## 40 1080i 100Hz 1360x768 120Hz reduced blanking +## 41 720p 100Hz 1400x1050 reduced blanking +## 42 576p 100Hz 1400x1050 60Hz +## 43 576p 100Hz H 1400x1050 75Hz +## 44 576i 100Hz 1400x1050 85Hz +## 45 576i 100Hz H 1400x1050 120Hz reduced blanking +## 46 1080i 120Hz 1440x900 reduced blanking +## 47 720p 120Hz 1440x900 60Hz +## 48 480p 120Hz 1440x900 75Hz +## 49 480p 120Hz H 1440x900 85Hz +## 50 480i 120Hz 1440x900 120Hz reduced blanking +## 51 480i 120Hz H 1600x1200 60Hz +## 52 576p 200Hz 1600x1200 65Hz +## 53 576p 200Hz H 1600x1200 70Hz +## 54 576i 200Hz 1600x1200 75Hz +## 55 576i 200Hz H 1600x1200 85Hz +## 56 480p 240Hz 1600x1200 120Hz reduced blanking +## 57 480p 240Hz H 1680x1050 reduced blanking +## 58 480i 240Hz 1680x1050 60Hz +## 59 480i 240Hz H 1680x1050 75Hz +## 60 1680x1050 85Hz +## 61 1680x1050 120Hz reduced blanking +## 62 1792x1344 60Hz +## 63 1792x1344 75Hz +## 64 1792x1344 120Hz reduced blanking +## 65 1856x1392 60Hz +## 66 1856x1392 75Hz +## 67 1856x1392 120Hz reduced blanking +## 68 1920x1200 reduced blanking +## 69 1920x1200 60Hz +## 70 1920x1200 75Hz +## 71 1920x1200 85Hz +## 72 1920x1200 120Hz reduced blanking +## 73 1920x1440 60Hz +## 74 1920x1440 75Hz +## 75 1920x1440 120Hz reduced blanking +## 76 2560x1600 reduced blanking +## 77 2560x1600 60Hz +## 78 2560x1600 75Hz +## 79 2560x1600 85Hz +## 80 2560x1600 120Hz reduced blanking +## 81 1366x768 60Hz +## 82 1080p 60Hz +## 83 1600x900 reduced blanking +## 84 2048x1152 reduced blanking +## 85 720p 60Hz +## 86 1366x768 reduced blanking +## +#hdmi_mode=1 + +## config_hdmi_boost +## configure the signal strength of the HDMI interface. +## +## Value Description +## ------------------------------------------------------------------------- +## 0 (Default) +## 1 +## 2 +## 3 +## 4 Try if you have interference issues with HDMI +## 5 +## 6 +## 7 Maximum +## +#config_hdmi_boost=0 + +## hdmi_ignore_cec_init +## Doesn't sent initial active source message. Avoids bringing +## (CEC enabled) TV out of standby and channel switch when rebooting. +## +## Value Description +## ------------------------------------------------------------------------- +## 0 Normal behaviour (Default) +## 1 Doesn't sent initial active source message +## +#hdmi_ignore_cec_init=1 + +## hdmi_ignore_cec +## Pretends CEC is not supported at all by TV. +## No CEC functions will be supported. +## +## Value Description +## ------------------------------------------------------------------------- +## 0 Normal behaviour (Default) +## 1 Pretend CEC is not supported by TV +## +#hdmi_ignore_cec=1 + +################################################################################ +## Overscan Video Settings +################################################################################ + +## overscan_left +## Number of pixels to skip on left +## +#overscan_left=0 + +## overscan_right +## Number of pixels to skip on right +## +#overscan_right=0 + +## overscan_top +## Number of pixels to skip on top +## +#overscan_top=0 + +## overscan_bottom +## Number of pixels to skip on bottom +## +#overscan_bottom=0 + +## disable_overscan +## Set to 1 to disable overscan +## +## Value Description +## ------------------------------------------------------------------------- +## 0 Overscan Enabled (Default) +## 1 Overscan Disabled +## +#disable_overscan=1 + +################################################################################ +## Framebuffer Video Settings +################################################################################ + +## framebuffer_width +## Console framebuffer width in pixels. Default is display width minus +## overscan. +## +#framebuffer_width=0 + +## framebuffer_height +## Console framebuffer height in pixels. Default is display height minus +## overscan. +## +#framebuffer_height=0 + +## framebuffer_depth +## Console framebuffer depth in bits per pixel. +## +## Value Description +## ------------------------------------------------------------------------- +## 8 Valid, but default RGB palette makes an unreadable screen +## 16 (Default) +## 24 Looks better but has corruption issues as of 2012/06/15 +## 32 Has no corruption issues but needs framebuffer_ignore_alpha=1 +## and shows the wrong colors as of 2012/06/15 +## +#framebuffer_depth=16 + +## framebuffer_ignore_alpha +## Set to 1 to disable alpha channel. Helps with 32bit. +## +## Value Description +## ------------------------------------------------------------------------- +## 0 Enable Alpha Channel (Default) +## 1 Disable Alpha Channel +## +#framebuffer_ignore_alpha=0 + +################################################################################ +## General Video Settings +################################################################################ + +## display_rotate +## Rotate the display clockwise or flip the display. +## The 90 and 270 degrees rotation options require additional memory on GPU, +## so won't work with the 16M GPU split. +## +## Value Description +## ------------------------------------------------------------------------- +## 0 0 degrees (Default) +## 1 90 degrees +## 2 180 degrees +## 3 270 degrees +## 0x10000 Horizontal flip +## 0x20000 Vertical flip +## +#display_rotate=0 + +## dispmanx_offline +## Set to "1" to enable offline compositing +## +## Default 0 +## +#dispmanx_offline=0 + +################################################################################ +## Licensed Codecs +## +## Hardware decoding of additional codecs can be enabled by purchasing a +## license that is locked to the CPU serial number of your Raspberry Pi. +## +## Up to 8 licenses per CODEC can be specified as a comma seperated list. +## +################################################################################ + +## decode_MPG2 +## License key to allow hardware MPEG-2 decoding. +## +#decode_MPG2=0x12345678 + +## decode_WVC1 +## License key to allow hardware VC-1 decoding. +## +#decode_WVC1=0x12345678 + +################################################################################ +## Camera Settings +################################################################################ + +## start_x +## Set to "1" to enable the camera module. +## +## Enabling the camera requires gpu_mem option to be specified with a value +## of at least 128. +## +## Default 0 +## +#start_x=0 + +## disable_camera_led +## Turn off the red camera led when recording video or taking a still +## picture. +## +## Value Description +## ------------------------------------------------------------------------- +## 0 LED enabled (Default) +## 1 LED disabled +## +#disable_camera_led=1 + +################################################################################ +## Test Settings +################################################################################ + +## test_mode +## Enable test sound/image during boot for manufacturing test. +## +## Value Description +## ------------------------------------------------------------------------- +## 0 Disable Test Mod (Default) +## 1 Enable Test Mode +## +#test_mode=0 + +################################################################################ +## Memory Settings +################################################################################ + +## disable_l2cache +## Disable arm access to GPU's L2 cache. Needs corresponding L2 disabled +## kernel. +## +## Value Description +## ------------------------------------------------------------------------- +## 0 Enable L2 Cache (Default) +## 1 Disable L2 cache +## +#disable_l2cache=0 + +## gpu_mem +## GPU memory allocation in MB for all board revisions. +## +## Default 64 +## +gpu_mem=16 + +## gpu_mem_256 +## GPU memory allocation in MB for 256MB board revision. +## This option overrides gpu_mem. +## +#gpu_mem_256=128 + +## gpu_mem_512 +## GPU memory allocation in MB for 512MB board revision. +## This option overrides gpu_mem. +## +#gpu_mem_512=128 + +## disable_pvt +## Disable adjusting the refresh rate of RAM every 500ms +## (measuring RAM temparature). +## +#disable_pvt=1 + +################################################################################ +## CMA - Dynamic Memory Split +## +## CMA enables dynamic management of the ARM and GPU memory split at runtime. +## +## The following options need to be in cmdline.txt for CMA to work: +## coherent_pool=6M smsc95xx.turbo_mode=N +## +################################################################################ + +## cma_lwm +## When GPU has less than cma_lwm (low water mark) memory available it +## will request some from ARM. +## +#cma_lwm=16 + +## cma_hwm +## When GPU has more than cma_hwm (high water mark) memory available it +## will release some to ARM. +## +#cma_hwm=32 + +################################################################################ +## Boot Option Settings +################################################################################ + +## disable_commandline_tags +## Stop start.elf from filling in ATAGS (memory from 0x100) before +## launching kernel +## +#disable_commandline_tags=0 + +## cmdline (string) +## Command line parameters. Can be used instead of cmdline.txt file +## +#cmdline="" + +## kernel (string) +## Alternative name to use when loading kernel. +## +#kernel="" + +## kernel_address +## Address to load kernel.img file at +## +#kernel_address=0x00000000 + +## kernel_old +## Support loading old kernels +## +## Value Description +## ------------------------------------------------------------------------- +## 0 Disabled (Default) +## 1 Load kernel at address 0x00000000 +## +#kernel_old=1 + +## ramfsfile (string) +## ramfs file to load +## +#ramfsfile="" + +## ramfsaddr +## Address to load ramfs file at +## +#ramfsaddr=0x00000000 + +## initramfs (string address) +## ramfs file and address to load it at (it's like ramfsfile+ramfsaddr in +## one option). +## +## NOTE: this option uses different syntax than all other options - you +## should not use "=" character here. +## +#initramfs initramf.gz 0x00800000 + +## device_tree_address +## Address to load device_tree at +## +#device_tree_address=0x00000000 + +## init_uart_baud +## Initial uart baud rate. +## +## Default 115200 +## +#init_uart_baud=115200 + +## init_uart_clock +## Initial uart clock. +## +## Default 3000000 (3MHz) +## +#init_uart_clock=3000000 + +## init_emmc_clock +## Initial emmc clock, increasing this can speedup your SD-card. +## +## Default 100000000 (100mhz) +## +#init_emmc_clock=100000000 + +## boot_delay +## Wait for a given number of seconds in start.elf before loading +## kernel.img. +## +## delay = (1000 * boot_delay) + boot_delay_ms +## +## Default 1 +## +#boot_delay=0 + +## boot_delay_ms +## Wait for a given number of milliseconds in start.elf before loading +## kernel.img. +## +## delay = (1000 * boot_delay) + boot_delay_ms +## +## Default 0 +## +#boot_delay_ms=0 + +## avoid_safe_mode +## Adding a jumper between pins 5 & 6 of P1 enables a recovery Safe Mode. +## If pins 5 & 6 are used for connecting to external devices (e.g. GPIO), +## then this setting can be used to ensure Safe Mode is not triggered. +## +## Value Description +## ------------------------------------------------------------------------- +## 0 Respect Safe Mode input (Default) +## 1 Ignore Safe Mode input +## +#avoid_safe_mode=1 + +## disable_splash +## Avoids the rainbow splash screen on boot. +## +## Value Description +## ------------------------------------------------------------------------- +## 0 Splash screen enabled (Default) +## 1 Splash screen disabled +## +disable_splash=1 + +################################################################################ +## Overclocking Settings +## +## ARM, SDRAM and GPU each have their own PLLs and can have unrelated +## frequencies. +## +## The GPU core, h264, v3d and isp share a PLL, so need to have related +## frequencies. +## pll_freq = floor(2400 / (2 * core_freq)) * (2 * core_freq) +## gpu_freq = pll_freq / [even number] +## +## The effective gpu_freq is automatically rounded to nearest even integer, so +## asking for core_freq = 500 and gpu_freq = 300 will result in divisor of +## 2000/300 = 6.666 => 6 and so 333.33MHz. +## +## +## Standard Profiles: +## arm_freq core_freq sdram_freq over_voltage +## ------------------------------------------------------------------------- +## None 700 250 400 0 +## Modest 800 300 400 0 +## Medium 900 333 450 2 +## High 950 450 450 6 +## Turbo 1000 500 500 6 +## +################################################################################ + +## force_turbo +## Control the kernel "ondemand" governor. It has no effect if no overclock +## settings are specified. +## May set warrany bit. +## +## Value Description +## ------------------------------------------------------------------------- +## 0 Enable dynamic clocks and voltage for the ARM core, GPU core and +## SDRAM (Default). +## Overclocking of h264_freq, v3d_freq and isp_freq is ignored. +## 1 Disable dynamic clocks and voltage for the ARM core, GPU core +## and SDRAM. +## Overclocking of h264_freq, v3d_freq and isp_freq is allowed. +## +#force_turbo=0 + +## initial_turbo +## Enables turbo mode from boot for the given value in seconds (up to 60) +## or until cpufreq sets a frequency. Can help with sdcard corruption if +## overclocked. +## +## Default 0 +## +initial_turbo=60 + +## temp_limit +## Overheat protection. Sets clocks and voltages to default when the SoC +## reaches this Celsius value. +## Setting this higher than default voids warranty. +## +## Default 85 +## +temp_limit=85 + +## arm_freq +## Frequency of ARM in MHz. +## +## Default 700. +## +[pi2] +arm_freq=1000 +[pi3] +arm_freq=1200 +[all] + +## arm_freq_min +## Minimum frequency of ARM in MHz (used for dynamic clocking). +## +## Default 700. +## +[pi2] +arm_freq_min=700 +[pi3] +arm_freq_min=900 +[all] + +## gpu_freq +## Sets core_freq, h264_freq, isp_freq, v3d_freq together. +## +## Default 250. +## +#gpu_freq=250 + +## core_freq +## Frequency of GPU processor core in MHz. It has an impact on ARM +## performance since it drives L2 cache. +## +## Default 250. +## +core_freq=500 + +## core_freq_min +## Minimum frequency of GPU processor core in MHz (used for dynamic +## clocking). It has an impact on ARM performance since it drives L2 cache. +## +## Default 250. +## +core_freq_min=250 + +## h264_freq +## Frequency of hardware video block in MHz. +## +## Default 250. +## +#h264_freq=250 + +## isp_freq +## Frequency of image sensor pipeline block in MHz. +## +## Default 250. +## +#isp_freq=250 + +## v3d_freq +## Frequency of 3D block in MHz. +## +## Default 250. +## +#v3d_freq=250 + +## sdram_freq +## Frequency of SDRAM in MHz. +## +## Default 400. +## +sdram_freq=500 + +## sdram_freq_min +## Minimum frequency of SDRAM in MHz (used for dynamic clocking). +## +## Default 400. +## +sdram_freq_min=400 + +## avoid_pwm_pll +## Don't dedicate a pll to PWM audio. This will reduce analogue audio +## quality slightly. The spare PLL allows the core_freq to be set +## independently from the rest of the gpu allowing more control over +## overclocking. +## +## Value Description +## ------------------------------------------------------------------------- +## 0 Linked core_freq (Default) +## 1 Unlinked core_freq +## +#avoid_pwm_pll=1 + +################################################################################ +## Voltage Settings +################################################################################ + +## current_limit_override +## Disables SMPS current limit protection. Can help if you are currently +## hitting a reboot failure when overclocking too high. +## May set warrany bit. +## +#current_limit_override=0x5A000020 + +## over_voltage +## ARM/GPU core voltage adjust. +## May set warrany bit. +## +## Value Description +## ------------------------------------------------------------------------- +## -16 0.8 V +## -15 0.825 V +## -14 0.85 V +## -13 0.875 V +## -12 0.9 V +## -11 0.925 V +## -10 0.95 V +## -9 0.975 V +## -8 1.0 V +## -7 1.025 V +## -6 1.05 V +## -5 1.075 V +## -4 1.1 V +## -3 1.125 V +## -2 1.15 V +## -1 1.175 V +## 0 1.2 V (Default) +## 1 1.225 V +## 2 1.25 V +## 3 1.275 V +## 4 1.3 V +## 5 1.325 V +## 6 1.35 V +## 7 1.375 V (requires force_turbo=1 or current_limit_override) +## 8 1.4 V (requires force_turbo=1 or current_limit_override) +## +over_voltage=6 + +## over_voltage_min +## Minimum ARM/GPU core voltage adjust (used for dynamic clocking). +## +## Value Description +## ------------------------------------------------------------------------- +## -16 0.8 V +## -15 0.825 V +## -14 0.85 V +## -13 0.875 V +## -12 0.9 V +## -11 0.925 V +## -10 0.95 V +## -9 0.975 V +## -8 1.0 V +## -7 1.025 V +## -6 1.05 V +## -5 1.075 V +## -4 1.1 V +## -3 1.125 V +## -2 1.15 V +## -1 1.175 V +## 0 1.2 V (Default) +## 1 1.225 V +## 2 1.25 V +## 3 1.275 V +## 4 1.3 V +## 5 1.325 V +## 6 1.35 V +## 7 1.375 V (requires force_turbo=1) +## 8 1.4 V (requires force_turbo=1) +## +over_voltage_min=0 + +## over_voltage_sdram +## Sets over_voltage_sdram_c, over_voltage_sdram_i, over_voltage_sdram_p +## together +## +## Value Description +## ------------------------------------------------------------------------- +## -16 0.8 V +## -15 0.825 V +## -14 0.85 V +## -13 0.875 V +## -12 0.9 V +## -11 0.925 V +## -10 0.95 V +## -9 0.975 V +## -8 1.0 V +## -7 1.025 V +## -6 1.05 V +## -5 1.075 V +## -4 1.1 V +## -3 1.125 V +## -2 1.15 V +## -1 1.175 V +## 0 1.2 V (Default) +## 1 1.225 V +## 2 1.25 V +## 3 1.275 V +## 4 1.3 V +## 5 1.325 V +## 6 1.35 V +## 7 1.375 V +## 8 1.4 V +## +over_voltage_sdram=6 + +## over_voltage_sdram_c +## SDRAM controller voltage adjust. +## +## Value Description +## ------------------------------------------------------------------------- +## -16 0.8 V +## -15 0.825 V +## -14 0.85 V +## -13 0.875 V +## -12 0.9 V +## -11 0.925 V +## -10 0.95 V +## -9 0.975 V +## -8 1.0 V +## -7 1.025 V +## -6 1.05 V +## -5 1.075 V +## -4 1.1 V +## -3 1.125 V +## -2 1.15 V +## -1 1.175 V +## 0 1.2 V (Default) +## 1 1.225 V +## 2 1.25 V +## 3 1.275 V +## 4 1.3 V +## 5 1.325 V +## 6 1.35 V +## 7 1.375 V +## 8 1.4 V +## +#over_voltage_sdram_c=0 + +## over_voltage_sdram_i +## SDRAM I/O voltage adjust. +## +## Value Description +## ------------------------------------------------------------------------- +## -16 0.8 V +## -15 0.825 V +## -14 0.85 V +## -13 0.875 V +## -12 0.9 V +## -11 0.925 V +## -10 0.95 V +## -9 0.975 V +## -8 1.0 V +## -7 1.025 V +## -6 1.05 V +## -5 1.075 V +## -4 1.1 V +## -3 1.125 V +## -2 1.15 V +## -1 1.175 V +## 0 1.2 V (Default) +## 1 1.225 V +## 2 1.25 V +## 3 1.275 V +## 4 1.3 V +## 5 1.325 V +## 6 1.35 V +## 7 1.375 V +## 8 1.4 V +## +#over_voltage_sdram_i=0 + +## over_voltage_sdram_p +## SDRAM phy voltage adjust. +## +## Value Description +## ------------------------------------------------------------------------- +## -16 0.8 V +## -15 0.825 V +## -14 0.85 V +## -13 0.875 V +## -12 0.9 V +## -11 0.925 V +## -10 0.95 V +## -9 0.975 V +## -8 1.0 V +## -7 1.025 V +## -6 1.05 V +## -5 1.075 V +## -4 1.1 V +## -3 1.125 V +## -2 1.15 V +## -1 1.175 V +## 0 1.2 V (Default) +## 1 1.225 V +## 2 1.25 V +## 3 1.275 V +## 4 1.3 V +## 5 1.325 V +## 6 1.35 V +## 7 1.375 V +## 8 1.4 V +## +#over_voltage_sdram_p=0 + +################################################################################ +## USB Power +################################################################################ + +## max_usb_current +## When set to 1, change the output current limit (for all 4 USB +## ports combined) from 600mA to double that, 1200mA. +## +## This option is not available for Model A/B boards. +## +## Default 0. +## +#max_usb_current=1 + +################################################################################ +## Base Device Tree Parameters +################################################################################ + +## audio +## Enable the onboard ALSA audio +## +## Default off. +## +#dtparam=audio=off + +## i2c_arm +## Enable the ARM's i2c interface +## +## Default off. +## +#dtparam=i2c_arm=off + +## i2c_vc +## Enable the i2c interface +## +## Usually reserved for the VideoCore processor +## +## Default off. +## +#dtparam=i2c_vc=off + +## i2c_arm_baudrate +## Set the baudrate of the ARM's i2c interface +## +## Default 100000. +## +#dtparam=i2c_arm_baudrate=100000 + +## i2c_vc_baudrate +## Set the baudrate of the VideoCore i2c interface +## +## Default 100000. +## +#dtparam=i2c_vc_baudrate=100000 + +## i2s +## Set to "on" to enable the i2s interface +## +## Default off. +## +#dtparam=i2s=off + +## spi +## Set to "on" to enable the spi interfaces +## +## Default off. +## +#dtparam=spi=off + +## random +## Set to "on" to enable the hardware random +## +## Default off. +## +#dtparam=random=off + +## uart0 +## Set to "off" to disable uart0 +## +## Default on. +## +#dtparam=uart0=on + +## watchdog +## Set to "on" to enable the hardware watchdog +## +## Default off. +## +#dtparam=watchdog=off + +## act_led_trigger +## Choose which activity the LED tracks. +## +## Use "heartbeat" for a nice load indicator. +## +## Default mmc. +## +dtparam=act_led_trigger=heartbeat + +## act_led_activelow +## Set to "on" to invert the sense of the LED +## +## Default off. +## +#dtparam=act_led_activelow=off + +## act_led_gpio +## Set which GPIO to use for the activity LED +## +## In case you want to connect it to an external device +## +## Default 16 on a non-Plus board, 47 on a Plus or Pi 2. +## +#dtparam=act_led_gpio=47 + +## pwr_led_trigger +## Choose which activity the LED tracks. +## +## Use "heartbeat" for a nice load indicator. +## +## Not available on Model A/B boards. +## +## Default mmc. +## +#dtparam=pwr_led_trigger=mmc + +## pwr_led_activelow +## Set to "on" to invert the sense of the LED +## +## Not available on Model A/B boards. +## +## Default off. +## +#dtparam=pwr_led_activelow=off + +## pwr_led_gpio +## Set which GPIO to use for the PWR LED +## +## In case you want to connect it to an external device +## +## Not available on Model A/B boards. +## +## Default 35. +## +#dtparam=pwr_led_gpio=35 diff --git a/static/firewall-rules b/static/firewall-rules new file mode 100644 index 0000000000..2d21f185c7 --- /dev/null +++ b/static/firewall-rules @@ -0,0 +1,18 @@ +#!/bin/bash +FW=$(ufw status) + +# Whiptail auto-size +calc_wt_size() { + WT_HEIGHT=17 + WT_WIDTH=$(tput cols) + + if [ -z "$WT_WIDTH" ] || [ "$WT_WIDTH" -lt 60 ]; then + WT_WIDTH=80 + fi + if [ "$WT_WIDTH" -gt 178 ]; then + WT_WIDTH=120 + fi + WT_MENU_HEIGHT=$((WT_HEIGHT-7)) +} + +whiptail --msgbox "$FW" --scrolltext --title "Firewall rules" "$WT_HEIGHT" "$WT_WIDTH" diff --git a/static/initial-root.profile b/static/initial-root.profile new file mode 100644 index 0000000000..a5780af040 --- /dev/null +++ b/static/initial-root.profile @@ -0,0 +1,51 @@ +# ~/.profile: executed by Bourne-compatible login shells. + +if [ "$BASH" ]; then + if [ -f ~/.bashrc ]; then + . ~/.bashrc + fi +fi + +mesg n || true + +# Resize or use hd +mkdir -p /var/scripts + +if [ -f bash /var/scripts/resize-sd.sh ]; then + + rm bash /var/scripts/resize-sd.sh +else + wget https://raw.githubusercontent.com/ezraholm50/NextBerry/master/static/resize-sd.sh -P /var/scripts + chmod +x /var/scripts/resize-sd.sh +fi +if [[ $? > 0 ]] +then + echo "Download of scripts failed. System will reboot in 10 seconds..." + sleep 10 + reboot +else + clear +fi + +bash /var/scripts/resize-sd.sh + +# Grab install scripts +mkdir -p /var/scripts + +if [ -f /var/scripts/nextcloud_install_production.sh ]; then + + rm /var/scripts/nextcloud_install_production.sh +else + wget https://raw.githubusercontent.com/ezraholm50/NextBerry/master/nextcloud_install_production.sh -P /var/scripts + chmod +x /var/scripts/nextcloud_install_production.sh +fi +if [[ $? > 0 ]] +then + echo "Download of scripts failed. System will reboot in 10 seconds..." + sleep 10 + reboot +else + clear +fi + +bash /var/scripts/nextcloud_install_production.sh diff --git a/static/ip.sh b/static/ip.sh index 5af243dc38..4545cb7738 100644 --- a/static/ip.sh +++ b/static/ip.sh @@ -13,17 +13,16 @@ source /etc/network/interfaces.d/* # The loopback network interface auto lo $IFACE +allow-hotplug $IFACE iface lo inet loopback # The primary network interface iface $IFACE inet static -pre-up /sbin/ethtool -K $IFACE tso off -pre-up /sbin/ethtool -K $IFACE gso off # If you are experiencing issues with loading web frontend, you should # enable this by removing the hash infront of 'mtu 1400'. # Fixes https://github.com/nextcloud/vm/issues/92 -# mtu 1400 +# mtu 1400 # Best practice is to change the static address # to something outside your DHCP range. diff --git a/static/nextberry-upgrade.sh b/static/nextberry-upgrade.sh new file mode 100644 index 0000000000..611923a01e --- /dev/null +++ b/static/nextberry-upgrade.sh @@ -0,0 +1,207 @@ +#!/bin/bash +VERSIONFILE="/var/scripts/.version-nc" +SCRIPTS="/var/scripts" + +# Check if root +if [ "$(whoami)" != "root" ] +then + echo + echo -e "\e[31mSorry, you are not root.\n\e[0mYou must type: \e[36msudo \e[0mbash $SCRIPTS/nextberry-upgrade.sh" + echo + exit 1 +fi + +# Whiptail auto-size +calc_wt_size() { + WT_HEIGHT=17 + WT_WIDTH=$(tput cols) + + if [ -z "$WT_WIDTH" ] || [ "$WT_WIDTH" -lt 60 ]; then + WT_WIDTH=80 + fi + if [ "$WT_WIDTH" -gt 178 ]; then + WT_WIDTH=120 + fi + WT_MENU_HEIGHT=$((WT_HEIGHT-7)) +} + +################### V1.1 #################### +if grep -q "11 applied" "$VERSIONFILE"; then + echo "11 already applied..." +else + # Update and upgrade + apt autoclean + apt autoremove -y + apt update + apt full-upgrade -y + apt install -fy + dpkg --configure --pending + bash /var/scripts/update.sh + + # Actual version additions + apt install -y unattended-upgrades \ + update-notifier-common \ + python-pip \ + build-essential \ + python-dev \ + lm-sensors \ + landscape-common \ + ncdu + #wicd-curses + + # NextBerry stats + pip install --upgrade pip + pip install psutil logutils bottle batinfo https://bitbucket.org/gleb_zhulik/py3sensors/get/tip.tar.gz zeroconf netifaces pymdstat influxdb elasticsearch potsdb statsd pystache docker-py pysnmp pika py-cpuinfo bernhard + pip install glances + echo "sudo glances" > /usr/sbin/nextberry-stats + chmod +x /usr/sbin/nextberry-stats + + # NCDU + echo "sudo ncdu /" > /usr/sbin/fs-size + chmod +x /usr/sbin/fs-size + + # Wicd-curses + #echo "whiptail --msgbox "To see how to use this tool see: http://blog.ubidots.com/setup-wifi-on-raspberry-pi-using-wicd" 20 60" > /usr/sbin/wireless + #echo "sudo wicd-curses" >> /usr/sbin/wireless + #echo "whiptail --msgbox "If you are connected to a wireless network please set a static IP in your router.\n\n You can find your IP.\n\n https://www.techandme.se/open-port-80-443/" 20 60" >> /usr/sbin/wireless + #echo "clear" >> /usr/sbin/wireless + #echo "bash $SCRIPTS/nextcloud.sh" >> /usr/sbin/wireless + #chmod +x /usr/sbin/wireless + + # Wpa_supplicant + CAT << WIRELESS > "/usr/sbin/wireless" + #!/bin/bash + WIFACE=$(lshw -c network | grep "wl" | awk '{print $3; exit}') + clear + + # Check if root + if [ "$(whoami)" != "root" ] + then + echo + echo -e "\e[31mSorry, you are not root.\n\e[0mYou must type: \e[36msudo \e[0mbash $SCRIPTS/nextberry-upgrade.sh" + echo + exit 1 + fi + + a=0 + b=0 + x=0 + while read line + do + case $line in + *ESSID* ) + line=${line#*ESSID:} + essid[$a]=${line//\"/} + a=$((a + 1)) + ;; + *Address*) + line=${line#*Address:} + address[$b]=$line + b=$((b + 1)) + ;; + esac + done < <(iwlist scan 2>/dev/null) #the redirect gets rid of "lo Interface doesn't support scanning." + + while [ $x -lt ${#essid[@]} ];do + echo "======================================" + echo ${essid[$x]} --- ${address[$x]} + echo "======================================" + (( x++ )) + done + + # Ask for SSID + echo + echo "Please copy/paste (select text and hit CTRL+C and then CTRL+V) your wifi network:" + read SSID + + # Ask for PASS + clear + echo + echo "Please enter the password for network: $SSID" + read PASSWORD + + # Create config file + cat << WPA > "/etc/wpa_supplicant.conf" + # /etc/wpa_supplicant.conf + + ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev + update_config=1 + + network={ + ssid="$SSID" + psk="$PASSWORD" + proto=RSN + key_mgmt=WPA-PSK + pairwise=CCMP + auth_alg=OPEN + } + WPA + + # Bringdown eth0 before removing and backing up old config + ifdown eth0 + mv /etc/network/interfaces /etc/network/interfaces.bak + + IP=$(grep address /etc/network/interfaces.bak) + MASK=$(grep netmask /etc/network/interfaces.bak) + GW=$(grep gateway /etc/network/interfaces.bak) + + # New interface config without IPV6 + cat << NETWORK > "/etc/network/interfaces" + auto lo + "$WIFACE" lo inet loopback + + allow-hotplug "$WIFACE" + auto "$WIFACE" + WIFACE "$WIFACE" inet static + "$IP" + "$MASK" + "$GW" + dns-nameservers 8.8.8.8 8.8.4.4 + wpa-conf /etc/wpa_supplicant.conf + "$WIFACE" default inet dhcp + NETWORK + + # Bring up Wifi + ifup "$WIFACE" + + # Create a revert script + cat << REVERT > "/usr/sbin/revert-wifi" + ifdown "$WIFACE" + rm /etc/network/interfaces + mv /etc/network/interfaces.bak /etc/network/interfaces + ifup eth0 + REVERT + chmod +x /usr/sbin/revert-wifi + WIRELESS + + chmod +x /usr/sbin/wireless + + # Set what version is installed + echo "11 applied" >> "$VERSIONFILE" + # Change current version var + sed -i 's|010|011|g' "$VERSIONFILE" +fi + +################### V1.2 #################### +#if grep -q "12 applied" "$VERSIONFILE"; then +# echo "12 already applied..." +#else +# # Update and upgrade +# apt autoclean +# apt autoremove -y +# apt update +# apt full-upgrade -y +# apt install -fy +# dpkg --configure --pending +# bash /var/scripts/update.sh +# +# # Actual version additions +# # Unattended-upgrades +# +# # Set what version is installed +# echo "12 applied" >> "$VERSIONFILE" +# # Change current version var +# sed -i 's|010|011|g' "$VERSIONFILE" +#fi + +exit diff --git a/static/nextcloud.sh b/static/nextcloud.sh index 4198a835e5..ed45a5a3f7 100644 --- a/static/nextcloud.sh +++ b/static/nextcloud.sh @@ -1,15 +1,52 @@ #!/bin/bash +REPO="https://raw.githubusercontent.com/ezraholm50/NextBerry/master/" +CURRENTVERSION=$(sed '1q;d' /var/scripts/.version-nc) +GITHUBVERSION=$(curl -s $REPO/version) +SCRIPTS="/var/scripts" +TEMP=$(vcgencmd measure_temp) +CPUFREQ=$(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq) +COREVOLT=$(vcgencmd measure_volts core) +MEMARM=$(vcgencmd get_mem arm) +MEMGPU=$(vcgencmd get_mem gpu) WANIP4=$(curl -s ipinfo.io/ip -m 5) WANIP6=$(curl -s 6.ifcfg.me -m 5) ADDRESS=$(hostname -I | cut -d ' ' -f 1) +RELEASE=$(lsb_release -s -d) clear -figlet -f small Nextcloud -echo " https://www.nextcloud.com" -echo -echo -echo -echo "WAN IPv4: $WANIP4" -echo "WAN IPv6: $WANIP6" +figlet -f small NextBerry +echo "https://www.techandme.se" +echo "===============================================================================" +echo "RPI: $TEMP - CPU freq: $CPUFREQ - $COREVOLT - MEM: $MEMGPU $MEMARM" +echo "===============================================================================" +printf "Operating system: %s (%s %s %s)\n" "$RELEASE" "$(uname -o)" "$(uname -r)" "$(uname -m)" +echo "===============================================================================" +/usr/bin/landscape-sysinfo +echo "===============================================================================" +echo "WAN IPv4: $WANIP4 - WAN IPv6: $WANIP6" echo "LAN IPv4: $ADDRESS" -echo +echo "===============================================================================" +echo "To view your firewall rules, type: sudo firewall-rules" +echo "To connect to a wifi network type: sudo wireless" +echo "To revert the wifi settings and use a wire: sudo revert-wifi" +echo "To monitor your system, type: sudo nextberry-stats" +echo " sudo htop" +echo " sudo fs-size" +echo "===============================================================================" +if [ "$GITHUBVERSION" -gt "$CURRENTVERSION" ]; then + echo + echo "NextBerry update available, run: sudo nextberry-upgrade" + echo "===============================================================================" + + if [ -f /var/scripts/nextberry-upgrade.sh ]; then + rm /var/scripts/nextcloud_install_production.sh + fi + wget -q https://raw.githubusercontent.com/ezraholm50/NextBerry/master/static/nextberry-upgrade.sh -P "$SCRIPTS" + mv "$SCRIPTS"/nextberry-upgrade.sh /usr/sbin/nextberry-upgrade + chmod +x /usr/sbin/nextberry-upgrade + if [[ $? > 0 ]] + then + echo "Download of update script failed. Please file a bug report on https://www.github.com/ezraholm50/NextBerry/" + echo "===============================================================================" + fi +fi exit 0 diff --git a/static/phpmyadmin_install_ubuntu16.sh b/static/phpmyadmin_install_ubuntu16.sh index cf019d980d..5c6b8496d0 100644 --- a/static/phpmyadmin_install_ubuntu16.sh +++ b/static/phpmyadmin_install_ubuntu16.sh @@ -28,7 +28,6 @@ then sleep 1 else echo "Ubuntu Server is required to run this script." - echo "Please install that distro and try again." exit 1 fi @@ -175,7 +174,7 @@ CONFIG_CREATE service apache2 restart if [[ $? > 0 ]] -then +then echo "Apache2 could not restart..." echo "The script will exit." exit 1 diff --git a/static/recover_apps.py b/static/recover_apps.py deleted file mode 100644 index fc2d7eeb36..0000000000 --- a/static/recover_apps.py +++ /dev/null @@ -1,15 +0,0 @@ -import glob, json, os, subprocess, urllib2 - -nc_path = '/var/www/nextcloud/apps/' -backup_path = '/var/NCBACKUP/apps/' -shipped_url = 'http://raw.githubusercontent.com/nextcloud/server/master/core/shipped.json' - -json_data = json.load(urllib2.urlopen(shipped_url)) -shipped_apps = json_data['shippedApps'] + json_data['alwaysEnabled'] - -installed_dirs = set(os.path.basename(path) for path in glob.glob(backup_path + '*')) -missing_dirs = installed_dirs.difference(shipped_apps) - -for d in missing_dirs: - subprocess.call(['rsync', '-Aax', os.path.join(backup_path, d), nc_path]) - subprocess.call(['sudo', '-u', 'www-data', '/var/www/nextcloud/occ', 'app:enable', d]) diff --git a/static/resize-sd.sh b/static/resize-sd.sh new file mode 100644 index 0000000000..16f6899c3a --- /dev/null +++ b/static/resize-sd.sh @@ -0,0 +1,349 @@ +#!/bin/sh +# Part of raspi-config https://github.com/RPi-Distro/raspi-config +# +# See LICENSE file for copyright and license details + +INTERACTIVE=True +ASK_TO_REBOOT=0 + +is_live() { + grep -q "boot=live" $CMDLINE + return $? +} + +get_init_sys() { + if command -v systemctl > /dev/null && systemctl | grep -q '\-\.mount'; then + SYSTEMD=1 + elif [ -f /etc/init.d/cron ] && [ ! -h /etc/init.d/cron ]; then + SYSTEMD=0 + else + echo "Unrecognised init system" + return 1 + fi +} + +calc_wt_size() { + # NOTE: it's tempting to redirect stderr to /dev/null, so supress error + # output from tput. However in this case, tput detects neither stdout or + # stderr is a tty and so only gives default 80, 24 values + WT_HEIGHT=17 + WT_WIDTH=$(tput cols) + + if [ -z "$WT_WIDTH" ] || [ "$WT_WIDTH" -lt 60 ]; then + WT_WIDTH=80 + fi + if [ "$WT_WIDTH" -gt 178 ]; then + WT_WIDTH=120 + fi + WT_MENU_HEIGHT=$(($WT_HEIGHT-7)) +} + +do_usb() { + get_init_sys + whiptail --msgbox "Please use an external power supply (USB HUB) to power your HDD/SSD. This will increase the RPI's performance at peaks.)\n\n All of your data will be deleted if you continue please backup/save your files on the HD/SSD that we are going to use first\n\n Now please connect the HD/SSD to the RPI and make sure its the only storage device (USB keyboard dongle is fine, just no other USB STORAGE or HD's.\n\n Having multiple devices plugged in will mess up the installation and you will have to start over." $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT + +# Check if /dev/sda is present +lsblk | grep sda +if [ $? -eq 0 ]; then # yes +# Disable swap file, if it is setup before. +if [ -f /swapfile ]; then + swapoff -a + rm /swapfile + sed -i 's|.*swapfile.*||g' /etc/fstab +fi + +# Wipe disk and create new partition +DEV="/dev/sda" +DEVHD="/dev/sda2" + +fdisk $DEV << EOF +wipefs +EOF + +fdisk $DEV << EOF +o +n +p +1 + ++10M +w +EOF + +fdisk $DEV << EOF +n +p +2 + + +w +EOF +sync +partprobe + +# Swap +fallocate -l 2G /swapfile +chmod 600 /swapfile +mkswap /swapfile +echo "/swapfile none swap sw 0 0" >> /etc/fstab +sync +partprobe + +# External HD + { + i=1 + while read -r line; do + i=$(( $i + 1 )) + echo $i + done < <(echo -ne '\n' | sudo mke2fs -t ext4 -b 4096 -L 'PI_ROOT' $DEVHD) + } | whiptail --title "Progress" --gauge "Please wait while creating ext4 filesystem" 6 60 0 + + sed -i 's|/dev/mmcblk0p2|#/dev/mmcblk0p2|g' /etc/fstab + echo "PARTUUID=$GDEVHDUUID / ext4 defaults,noatime 0 1" >> /etc/fstab + mount $DEVHD /mnt + +clear +echo "Moving from SD to HD/SSD, this can take a while! Sit back and relax..." +echo +rsync -aAXv --exclude={"/boot/*","/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*","/lost+found"} / /mnt + + touch /var/scripts/HD + umount /mnt + + # Previous line is more prone to errors: sed -e '10,31d' /root/.profile +cat < /root/.profile +# ~/.profile: executed by Bourne-compatible login shells. + +if [ "$BASH" ]; then + if [ -f ~/.bashrc ]; then + . ~/.bashrc + fi +fi + +mesg n || true + +mkdir -p /var/scripts + +if [ -f /var/scripts/nextcloud_install_production.sh ]; then + + rm /var/scripts/nextcloud_install_production.sh +else + wget https://raw.githubusercontent.com/ezraholm50/NextBerry/master/nextcloud_install_production.sh -P /var/scripts + chmod +x /var/scripts/nextcloud_install_production.sh +fi +if [[ $? > 0 ]] +then + echo "Download of scripts failed. System will reboot in 10 seconds..." + sleep 10 + reboot +else + clear +fi + +bash /var/scripts/nextcloud_install_production.sh +EOF + +# Overclock +if [ -f /boot/cmdline.txt ] +then + echo "cmdline.txt exists" +else + mount /dev/mmcblk0p1 /boot +fi + +if [ -f /boot/config.txt ] +then + echo "config.txt exists" +else + mount /dev/mmcblk0p1 /boot +fi + +echo "smsc95xx.turbo_mode=N dwc_otg.fiq_fix_enable=1 net.ifnames=0 biosdevname=0 dwc_otg.lpm_enable=0 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait quiet splash" > /boot/cmdline.txt +GDEVHDUUID=$(blkid -o value -s PARTUUID $DEVHD) +sed -i "s|root=/dev/mmcblk0p2|root=PARTUUID=$GDEVHDUUID|g" /boot/cmdline.txt + +rm /boot/config.txt +wget -q https://raw.githubusercontent.com/ezraholm50/NextBerry/master/static/config.txt -P /boot/ + + whiptail --msgbox "Success, we will now reboot to finish switching /root..." 20 60 1 + reboot +else + whiptail --msgbox "Could not detect external storage, please start over..." 20 60 1 +fi +} + +do_expand_rootfs() { + get_init_sys + if [ $SYSTEMD -eq 1 ]; then + ROOT_PART=$(mount | sed -n 's|^/dev/\(.*\) on / .*|\1|p') + else + if ! [ -h /dev/root ]; then + whiptail --msgbox "/dev/root does not exist or is not a symlink. Don't know how to expand" 20 60 2 + return 0 + fi + ROOT_PART=$(readlink /dev/root) + fi + + PART_NUM=${ROOT_PART#mmcblk0p} + if [ "$PART_NUM" = "$ROOT_PART" ]; then + whiptail --msgbox "$ROOT_PART is not an SD card. Don't know how to expand" 20 60 2 + return 0 + fi + + # NOTE: the NOOBS partition layout confuses parted. For now, let's only + # agree to work with a sufficiently simple partition layout + if [ "$PART_NUM" -ne 2 ]; then + whiptail --msgbox "Your partition layout is not currently supported by this tool. You are probably using NOOBS, in which case your root filesystem is already expanded anyway." 20 60 2 + return 0 + fi + + LAST_PART_NUM=$(parted /dev/mmcblk0 -ms unit s p | tail -n 1 | cut -f 1 -d:) + if [ $LAST_PART_NUM -ne $PART_NUM ]; then + whiptail --msgbox "$ROOT_PART is not the last partition. Don't know how to expand" 20 60 2 + return 0 + fi + + # Get the starting offset of the root partition + PART_START=$(parted /dev/mmcblk0 -ms unit s p | grep "^${PART_NUM}" | cut -f 2 -d: | sed 's/[^0-9]//g') + [ "$PART_START" ] || return 1 + # Return value will likely be error for fdisk as it fails to reload the + # partition table because the root fs is mounted + fdisk /dev/mmcblk0 < /etc/init.d/resize2fs_once && +#!/bin/sh +### BEGIN INIT INFO +# Provides: resize2fs_once +# Required-Start: +# Required-Stop: +# Default-Start: 3 +# Default-Stop: +# Short-Description: Resize the root filesystem to fill partition +# Description: +### END INIT INFO + +. /lib/lsb/init-functions + +case "\$1" in + start) + log_daemon_msg "Starting resize2fs_once" && + resize2fs /dev/$ROOT_PART && + update-rc.d resize2fs_once remove && + rm /etc/init.d/resize2fs_once && + log_end_msg \$? + ;; + *) + echo "Usage: \$0 start" >&2 + exit 3 + ;; +esac +EOF + +# Previous line is more prone to errors: sed -e '10,31d' /root/.profile +cat < /root/.profile +# ~/.profile: executed by Bourne-compatible login shells. + +if [ "$BASH" ]; then + if [ -f ~/.bashrc ]; then + . ~/.bashrc + fi +fi + +mesg n || true + +mkdir -p /var/scripts + +if [ -f /var/scripts/nextcloud_install_production.sh ]; then + + rm /var/scripts/nextcloud_install_production.sh +else + wget https://raw.githubusercontent.com/ezraholm50/NextBerry/master/nextcloud_install_production.sh -P /var/scripts + chmod +x /var/scripts/nextcloud_install_production.sh +fi +if [[ $? > 0 ]] +then + echo "Download of scripts failed. System will reboot in 10 seconds..." + sleep 10 + reboot +else + clear +fi + +bash /var/scripts/nextcloud_install_production.sh +EOF + + chmod +x /etc/init.d/resize2fs_once && + update-rc.d resize2fs_once defaults && + + # Swap + fallocate -l 1G /swapfile + chmod 600 /swapfile + mkswap /swapfile + echo "/swapfile none swap sw 0 0" >> /etc/fstab + sync + partprobe + + # Overclock + if [ -f /boot/cmdline.txt ] + then + echo "cmdline.txt exists" + else + mount /dev/mmcblk0p1 /boot + fi + + if [ -f /boot/config.txt ] + then + echo "config.txt exists" + else + mount /dev/mmcblk0p1 /boot + fi + + echo "smsc95xx.turbo_mode=N net.ifnames=0 biosdevname=0 dwc_otg.lpm_enable=0 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait quiet splash" > /boot/cmdline.txt + rm /boot/config.txt + wget -q https://raw.githubusercontent.com/ezraholm50/NextBerry/master/static/config.txt -P /boot/ + + whiptail --msgbox "Success, we will now reboot to finish resizing..." 20 60 1 + reboot +} + +# Everything else needs to be run as root +if [ $(id -u) -ne 0 ]; then + printf "Script must be run as root. Try 'sudo bash resize-sd.sh'\n" + exit 1 +fi + +# Interactive use loop +if [ "$INTERACTIVE" = True ]; then + get_init_sys + calc_wt_size + while true; do + FUN=$(whiptail --title "NextBerry MicroSD/External drive selection" --menu "Setup Options" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT --nocancel --ok-button Select \ + "A Expand Filesystem" "Ensures that all of the SD storage is available" \ + "B Use HDD/SSD/USB" "/root on external drive /boot on SD (recommended)" \ + 3>&1 1>&2 2>&3) + RET=$? + if [ $RET -eq 1 ]; then + do_finish + elif [ $RET -eq 0 ]; then + case "$FUN" in + A\ *) do_expand_rootfs ;; + B\ *) do_usb ;; + *) whiptail --msgbox "Programmer error: unrecognized option" 20 60 1 ;; + esac || whiptail --msgbox "There was an error running option $FUN" 20 60 1 + else + exit 1 + fi + done +fi diff --git a/version b/version new file mode 100644 index 0000000000..2f7afa6beb --- /dev/null +++ b/version @@ -0,0 +1 @@ +011