├── LICENSE ├── autologin@.service ├── debian ├── .gitignore ├── changelog ├── compat ├── conffiles ├── control ├── copyright ├── gbp.conf ├── raspi-config.install ├── raspi-config.postinst ├── raspi-config.postrm ├── raspi-config.prerm ├── rules └── source │ └── format ├── etc └── sudoers.d │ └── 010_proxy ├── raspi-config └── usr ├── lib └── raspi-config │ ├── cmstart.sh │ └── init_resize.sh └── share └── raspi-config └── 10-blanking.conf /LICENSE: -------------------------------------------------------------------------------- 1 | raspi-config is licensed under the terms of the MIT license reproduced below. 2 | 3 | ##################################################### 4 | 5 | Copyright (c) 2012 Alex Bradbury 6 | 7 | Permission is hereby granted, free of charge, to any person 8 | obtaining a copy of this software and associated documentation 9 | files (the "Software"), to deal in the Software without 10 | restriction, including without limitation the rights to use, 11 | copy, modify, merge, publish, distribute, sublicense, and/or sell 12 | copies of the Software, and to permit persons to whom the 13 | Software is furnished to do so, subject to the following 14 | conditions: 15 | 16 | The above copyright notice and this permission notice shall be 17 | included in all copies or substantial portions of the Software. 18 | 19 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 20 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 21 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 22 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 23 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 24 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 25 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 26 | OTHER DEALINGS IN THE SOFTWARE. 27 | -------------------------------------------------------------------------------- /autologin@.service: -------------------------------------------------------------------------------- 1 | # This file is part of systemd. 2 | # 3 | # systemd is free software; you can redistribute it and/or modify it 4 | # under the terms of the GNU Lesser General Public License as published by 5 | # the Free Software Foundation; either version 2.1 of the License, or 6 | # (at your option) any later version. 7 | 8 | [Unit] 9 | Description=Getty on %I 10 | Documentation=man:agetty(8) man:systemd-getty-generator(8) 11 | Documentation=http://0pointer.de/blog/projects/serial-console.html 12 | After=systemd-user-sessions.service plymouth-quit-wait.service 13 | After=rc-local.service 14 | 15 | # If additional gettys are spawned during boot then we should make 16 | # sure that this is synchronized before getty.target, even though 17 | # getty.target didn't actually pull it in. 18 | Before=getty.target 19 | IgnoreOnIsolate=yes 20 | 21 | # On systems without virtual consoles, don't start any getty. Note 22 | # that serial gettys are covered by serial-getty@.service, not this 23 | # unit. 24 | ConditionPathExists=/dev/tty0 25 | 26 | [Service] 27 | # the VT is cleared by TTYVTDisallocate 28 | ExecStart=-/sbin/agetty --autologin pi --noclear %I $TERM 29 | Type=idle 30 | Restart=always 31 | RestartSec=0 32 | UtmpIdentifier=%I 33 | TTYPath=/dev/%I 34 | TTYReset=yes 35 | TTYVHangup=yes 36 | TTYVTDisallocate=yes 37 | KillMode=process 38 | IgnoreSIGPIPE=no 39 | SendSIGHUP=yes 40 | 41 | # Unset locale for the console getty since the console has problems 42 | # displaying some internationalized messages. 43 | Environment=LANG= LANGUAGE= LC_CTYPE= LC_NUMERIC= LC_TIME= LC_COLLATE= LC_MONETARY= LC_MESSAGES= LC_PAPER= LC_NAME= LC_ADDRESS= LC_TELEPHONE= LC_MEASUREMENT= LC_IDENTIFICATION= 44 | 45 | [Install] 46 | WantedBy=getty.target 47 | DefaultInstance=tty1 48 | -------------------------------------------------------------------------------- /debian/.gitignore: -------------------------------------------------------------------------------- 1 | debhelper-build-stamp 2 | files 3 | *.debhelper.log 4 | *.debhelper 5 | *.substvars 6 | raspi-config/ 7 | -------------------------------------------------------------------------------- /debian/changelog: -------------------------------------------------------------------------------- 1 | raspi-config (20250513) bookworm; urgency=medium 2 | 3 | [ Simon Long ] 4 | * Make compatible with new and old session files 5 | 6 | -- Simon Long Tue, 13 May 2025 11:48:36 +0100 7 | 8 | raspi-config (20250312) bookworm; urgency=medium 9 | 10 | [ Simon Long ] 11 | * Add function to identify Pi 500 12 | 13 | -- Simon Long Wed, 12 Mar 2025 11:32:11 +0000 14 | 15 | raspi-config (20250306) bookworm; urgency=medium 16 | 17 | [ Simon Long ] 18 | * Allow console and desktop autologin to be set independently 19 | 20 | -- Simon Long Thu, 06 Mar 2025 16:16:11 +0000 21 | 22 | raspi-config (20250210) bookworm; urgency=medium 23 | 24 | [ Simon Long ] 25 | * Support new labwc greeter config file location 26 | 27 | -- Simon Long Mon, 10 Feb 2025 10:05:53 +0000 28 | 29 | raspi-config (20250203) bookworm; urgency=medium 30 | 31 | [ Simon Long ] 32 | * Menu tidiness and consistency 33 | 34 | -- Simon Long Mon, 03 Feb 2025 15:20:30 +0000 35 | 36 | raspi-config (20250129) bookworm; urgency=medium 37 | 38 | [ Simon Long ] 39 | * Add squeek output get function 40 | 41 | [ Thomas Böhler ] 42 | * fix: permission of created .config dir in labwc 43 | 44 | [ David Turner ] 45 | * Add libliftoff enable/disable option 46 | 47 | [ timg236 ] 48 | * bootloader: Add configuration for POWER_OFF_ON_HALT (#270) 49 | 50 | [ Serge Schneider ] 51 | * Remove no-response bot config 52 | 53 | -- Serge Schneider Wed, 29 Jan 2025 17:27:43 +0000 54 | 55 | raspi-config (20241210) bookworm; urgency=medium 56 | 57 | [ Simon Long ] 58 | * Add option to set output for onscreen keyboard 59 | 60 | -- Simon Long Tue, 10 Dec 2024 11:47:27 +0000 61 | 62 | raspi-config (20241202) bookworm; urgency=medium 63 | 64 | [ Richard Oliver ] 65 | * Add 'Logging' to 'System Options' (#262) 66 | * init: Remove 'shift' key cpu governor behaviour 67 | 68 | -- Serge Schneider Mon, 02 Dec 2024 08:41:05 +0000 69 | 70 | raspi-config (20241129) bookworm; urgency=medium 71 | 72 | [ Simon Long ] 73 | * Correctly set ownership of labwc file 74 | 75 | -- Simon Long Fri, 29 Nov 2024 10:21:38 +0000 76 | 77 | raspi-config (20241128) bookworm; urgency=medium 78 | 79 | [ Simon Long ] 80 | * Write labwc keymap to user file, not system global 81 | 82 | -- Simon Long Thu, 28 Nov 2024 13:50:31 +0000 83 | 84 | raspi-config (20241119) bookworm; urgency=medium 85 | 86 | * do_wifi_country: Update NM state file if NM service if not running 87 | * do_boot_behaviour: check for existance of autologin.conf before deleting it 88 | and parent directory 89 | 90 | -- Serge Schneider Tue, 19 Nov 2024 13:14:05 +0000 91 | 92 | raspi-config (20241111) bookworm; urgency=medium 93 | 94 | * autologin: ensure drop-in directory exists, remove when not needed 95 | 96 | -- Serge Schneider Mon, 11 Nov 2024 13:48:55 +0000 97 | 98 | raspi-config (20241105) bookworm; urgency=medium 99 | 100 | [ Tim Gover ] 101 | * Add option to control when network install UI is displayed 102 | * Pick latest firmware by default 103 | * Improve bootloader version checks 104 | 105 | -- Simon Long Tue, 05 Nov 2024 10:21:01 +0000 106 | 107 | raspi-config (20241030) bookworm; urgency=medium 108 | 109 | [ Simon Long ] 110 | * Make blanking control files owned by user 111 | 112 | -- Simon Long Wed, 30 Oct 2024 09:13:27 +0000 113 | 114 | raspi-config (20241029) bookworm; urgency=medium 115 | 116 | [ Simon Long ] 117 | * Use dconf system defaults for Squeekboard layout 118 | 119 | -- Simon Long Tue, 29 Oct 2024 11:54:04 +0000 120 | 121 | raspi-config (20241028) bookworm; urgency=medium 122 | 123 | [ Simon Long ] 124 | * Add Squeekboard layout setting 125 | 126 | -- Simon Long Mon, 28 Oct 2024 07:30:02 +0000 127 | 128 | raspi-config (20241025) bookworm; urgency=medium 129 | 130 | [ Simon Long ] 131 | * Add check for CM5 132 | 133 | -- Simon Long Fri, 25 Oct 2024 12:42:47 +0100 134 | 135 | raspi-config (20241017) bookworm; urgency=medium 136 | 137 | [ Paul Mucur ] 138 | * Update version check for rpi-connect 139 | 140 | -- Simon Long Thu, 17 Oct 2024 11:27:16 +0100 141 | 142 | raspi-config (20241016) bookworm; urgency=medium 143 | 144 | [ Simon Long ] 145 | * Use rpi-connect CLI to enable and disable 146 | 147 | -- Simon Long Wed, 16 Oct 2024 07:28:19 +0100 148 | 149 | raspi-config (20241014) bookworm; urgency=medium 150 | 151 | [ Simon Long ] 152 | * New control logic for Raspberry Pi Connect 153 | 154 | -- Simon Long Mon, 14 Oct 2024 10:01:17 +0100 155 | 156 | raspi-config (20240923) bookworm; urgency=medium 157 | 158 | [ Simon Long ] 159 | * Use global environment file for labwc keyboard settings 160 | * Add auto detect option for squeekboard 161 | 162 | -- Simon Long Mon, 23 Sep 2024 13:26:40 +0100 163 | 164 | raspi-config (20240918) bookworm; urgency=medium 165 | 166 | [ Simon Long ] 167 | * Check labwc autostart file exists before trying to edit it 168 | 169 | -- Simon Long Wed, 18 Sep 2024 07:55:09 +0100 170 | 171 | raspi-config (20240917) bookworm; urgency=medium 172 | 173 | [ Simon Long ] 174 | * Update name of Chromium package 175 | 176 | -- Simon Long Tue, 17 Sep 2024 13:57:24 +0100 177 | 178 | raspi-config (20240802) bookworm; urgency=medium 179 | 180 | [ Simon Long ] 181 | * Create labwc config directory when enabling screen blanking 182 | 183 | -- Simon Long Fri, 02 Aug 2024 14:22:31 +0100 184 | 185 | raspi-config (20240715) bookworm; urgency=medium 186 | 187 | [ Simon Long ] 188 | * Add squeekboard switching 189 | 190 | -- Simon Long Mon, 15 Jul 2024 13:02:39 +0100 191 | 192 | raspi-config (20240708) bookworm; urgency=medium 193 | 194 | [ Paul Mucur ] 195 | * Compatibility with RPi Connect 1.3.0 196 | 197 | -- Simon Long Mon, 08 Jul 2024 11:24:56 +0100 198 | 199 | raspi-config (20240625) bookworm; urgency=medium 200 | 201 | [ Simon Long ] 202 | * Enable and disable RPi Connect for all users 203 | 204 | -- Simon Long Tue, 25 Jun 2024 09:13:26 +0100 205 | 206 | raspi-config (20240624+1) bookworm; urgency=medium 207 | 208 | * Add RAM check for overlay filesystem 209 | * Add gbp.conf 210 | 211 | -- Serge Schneider Mon, 24 Jun 2024 15:51:27 +0100 212 | 213 | raspi-config (20240624) bookworm; urgency=medium 214 | 215 | [ Simon Long] 216 | * Add RPi Connect for 32 bit and X 217 | 218 | -- Simon Long Mon, 24 Jun 2024 13:16:59 +0100 219 | 220 | raspi-config (20240618) bookworm; urgency=medium 221 | 222 | [ Simon Long ] 223 | * Do not offer RPi Connect on 32-bit 224 | 225 | -- Simon Long Tue, 18 Jun 2024 14:54:01 +0100 226 | 227 | raspi-config (20240612) bookworm; urgency=medium 228 | 229 | * Strip null byte from os_prefix 230 | 231 | -- Serge Schneider Wed, 12 Jun 2024 11:10:46 +0100 232 | 233 | raspi-config (20240521) bookworm; urgency=medium 234 | 235 | [ Simon Long ] 236 | * Add Raspberry Pi Connect switching 237 | 238 | -- Simon Long Tue, 21 May 2024 10:19:02 +0100 239 | 240 | raspi-config (20240510) bookworm; urgency=medium 241 | 242 | [ Simon Long ] 243 | * Do not enable fallback sessions for X or labwc 244 | 245 | -- Simon Long Fri, 10 May 2024 15:57:25 +0100 246 | 247 | raspi-config (20240508) bookworm; urgency=medium 248 | 249 | [ Simon Long ] 250 | * Add PCIe speed setting 251 | 252 | -- Simon Long Wed, 08 May 2024 11:19:15 +0100 253 | 254 | raspi-config (20240424) bookworm; urgency=medium 255 | 256 | [ Franck Talbart ] 257 | * Fix for incorrect parsing of pulseaudio status in non-English locales 258 | 259 | [ Simon Long ] 260 | * Add setting of keyboard options 261 | * Fix grep warning of non-existent file 262 | 263 | -- Simon Long Wed, 24 Apr 2024 09:52:18 +0100 264 | 265 | raspi-config (20240313) bookworm; urgency=medium 266 | 267 | * Fix typo 268 | * postinst: HandlePowerKey change is only needed once 269 | * do_wifi_country: don't run panel netman cset in a chroot environment 270 | 271 | -- Serge Schneider Wed, 13 Mar 2024 15:28:34 +0000 272 | 273 | raspi-config (20240228) bookworm; urgency=medium 274 | 275 | [ Tim Gover ] 276 | * Allow EEPROM upgrades 277 | 278 | [ Simon Long ] 279 | * Check wayvnc service to determine status 280 | 281 | -- Simon Long Wed, 28 Feb 2024 14:54:21 +0000 282 | 283 | raspi-config (20240216) bookworm; urgency=medium 284 | 285 | [ Simon Long ] 286 | * Call panel functions to update wifi country status when setting 287 | 288 | -- Simon Long Fri, 16 Feb 2024 13:18:03 +0000 289 | 290 | raspi-config (20240214) bookworm; urgency=medium 291 | 292 | [ Simon Long ] 293 | * Remove VNC resolution setting for Wayland 294 | 295 | -- Simon Long Wed, 14 Feb 2024 13:04:45 +0000 296 | 297 | raspi-config (20240213) bookworm; urgency=medium 298 | 299 | [ Simon Long ] 300 | * Add Wayland switching for x86 images 301 | 302 | -- Simon Long Tue, 13 Feb 2024 07:37:56 +0000 303 | 304 | raspi-config (20240131) bookworm; urgency=medium 305 | 306 | [ Simon Long ] 307 | * Remove logind power key settings in do_boot_behaviour 308 | 309 | -- Simon Long Wed, 31 Jan 2024 12:48:28 +0000 310 | 311 | raspi-config (20240130) bookworm; urgency=medium 312 | 313 | [ Simon Long ] 314 | * Add labwc screen blanking 315 | 316 | -- Simon Long Tue, 30 Jan 2024 07:43:59 +0000 317 | 318 | raspi-config (20240111) bookworm; urgency=medium 319 | 320 | [ Simon Long ] 321 | * Add labwc switching 322 | 323 | -- Simon Long Thu, 11 Jan 2024 14:39:54 +0000 324 | 325 | raspi-config (20240108) bookworm; urgency=medium 326 | 327 | [ Andri Yngvason ] 328 | * Updates to wayvnc system service 329 | 330 | -- Simon Long Mon, 08 Jan 2024 14:38:07 +0000 331 | 332 | raspi-config (20240104) bookworm; urgency=medium 333 | 334 | * d/c: remove initramfs-tools dependency 335 | 336 | -- Serge Schneider Thu, 04 Jan 2024 15:02:17 +0000 337 | 338 | raspi-config (20231216) bookworm; urgency=medium 339 | 340 | * Revert "Merge pull request #226 from any1/wayvnc-system-service" 341 | 342 | -- Serge Schneider Sat, 16 Dec 2023 15:38:37 +0000 343 | 344 | raspi-config (20231214) bookworm; urgency=medium 345 | 346 | [ Andri Yngvason ] 347 | * Use wayvnc system service 348 | 349 | [ timg236 ] 350 | * raspi-config: Remove references to stable/critical bootloader releases (#227) 351 | * raspi-config: Enable NVMe in BOOT_ORDER on Pi5 (#228) 352 | 353 | -- Serge Schneider Thu, 14 Dec 2023 14:28:32 +0000 354 | 355 | raspi-config (20231108) bookworm; urgency=medium 356 | 357 | [ Simon Long ] 358 | * Configure wayvnc for RSA 359 | 360 | -- Simon Long Wed, 08 Nov 2023 07:33:16 +0000 361 | 362 | raspi-config (20231018) bookworm; urgency=medium 363 | 364 | [ Simon Long ] 365 | * Serial port switching for Raspberry Pi 5 366 | 367 | -- Simon Long Wed, 18 Oct 2023 11:45:19 +0100 368 | 369 | raspi-config (20231017+1) bookworm; urgency=medium 370 | 371 | [ Simon Long ] 372 | * Fix possible ALSA configuration error 373 | 374 | -- Simon Long Tue, 17 Oct 2023 15:16:09 +0100 375 | 376 | raspi-config (20231017) bookworm; urgency=medium 377 | 378 | [ Simon Long ] 379 | * Delete config.txt line when USB current limit enabled 380 | 381 | -- Simon Long Tue, 17 Oct 2023 11:07:31 +0100 382 | 383 | raspi-config (20231016) bookworm; urgency=medium 384 | 385 | [ Simon Long ] 386 | * Add functions to detect Pi 5 387 | * Fix bug in greeter keyboard configuration 388 | 389 | -- Simon Long Mon, 16 Oct 2023 14:10:03 +0100 390 | 391 | raspi-config (20231013) bookworm; urgency=medium 392 | 393 | * Fix desktop autologin settings 394 | 395 | -- Serge Schneider Fri, 13 Oct 2023 12:12:23 +0100 396 | 397 | raspi-config (20231009) bookworm; urgency=medium 398 | 399 | [ Simon Long ] 400 | * Set keyboard layout for wayvnc 401 | 402 | -- Simon Long Mon, 09 Oct 2023 07:58:21 +0100 403 | 404 | raspi-config (20231006) bookworm; urgency=medium 405 | 406 | [ Simon Long ] 407 | * Modify for default Wayfire blanking disabled 408 | 409 | -- Simon Long Fri, 06 Oct 2023 22:55:11 +0100 410 | 411 | raspi-config (20231005) bookworm; urgency=medium 412 | 413 | [ Simon Long ] 414 | * Show warning message if no audio subsytems installed when using Audio Config option 415 | 416 | -- Simon Long Thu, 05 Oct 2023 14:08:32 +0100 417 | 418 | raspi-config (20231004) bookworm; urgency=medium 419 | 420 | [ Simon Long ] 421 | * Add newlines when setting blanking and VNC resolution 422 | 423 | -- Simon Long Wed, 04 Oct 2023 08:31:14 +0100 424 | 425 | raspi-config (20231002) bookworm; urgency=medium 426 | 427 | [ Simon Long ] 428 | * Add --render-cursor for immediately-started wayvnc as well 429 | 430 | -- Simon Long Mon, 02 Oct 2023 08:40:56 +0100 431 | 432 | raspi-config (20230929) bookworm; urgency=medium 433 | 434 | [ Simon Long ] 435 | * Add --render-cursor to wayvnc command line 436 | 437 | -- Simon Long Fri, 29 Sep 2023 10:35:53 +0100 438 | 439 | raspi-config (20230927) bookworm; urgency=medium 440 | 441 | [ Simon Long ] 442 | * Change blanking logic to assume enabled by default 443 | 444 | -- Serge Schneider Wed, 27 Sep 2023 11:56:45 +0100 445 | 446 | raspi-config (20230919) bookworm; urgency=medium 447 | 448 | [ Simon Long ] 449 | * Reinstate overclock function 450 | 451 | -- Serge Schneider Tue, 19 Sep 2023 11:34:04 +0100 452 | 453 | raspi-config (20230918) bookworm; urgency=medium 454 | 455 | * do_boot_behaviour: update HandlePowerKey 456 | 457 | -- Serge Schneider Mon, 18 Sep 2023 13:53:04 +0100 458 | 459 | raspi-config (20230914) bookworm; urgency=medium 460 | 461 | [ Tim Gover ] 462 | * Use rpi-eeprom-update output to resolve the current RELEASE directory 463 | 464 | -- Serge Schneider Thu, 14 Sep 2023 12:49:44 +0100 465 | 466 | raspi-config (20230913) bookworm; urgency=medium 467 | 468 | [ Simon Long ] 469 | * Fix warnings when setting keyboard without Wayfire files 470 | * Add username parameter to do_browser to correctly set in wizard 471 | * Do not attempt to switch audio configuration on-the-fly 472 | 473 | -- Serge Schneider Wed, 13 Sep 2023 14:08:52 +0100 474 | 475 | raspi-config (20230912) bookworm; urgency=medium 476 | 477 | [ Simon Long ] 478 | * Add switching for wayfire, pipewire, wayvnc 479 | * Add Wayfire-compatible settings for screen blanking, VNC resolution, keyboard country 480 | * Add compatibility with WayVNC for VNC over Wayland 481 | * Remove various obsolete options 482 | * Add browser selection 483 | * Add wrapper functions for internationalisation for use by rc-gui and piwiz 484 | * Configure fallback sessions for Wayfire 485 | * Add compatibility with pipewire to audio select 486 | * Various shellcheck and other tidying 487 | * Fix selection of locales with no character set defined 488 | * Modifications for new /boot directory structure 489 | * Update names of LEDs to match new standard 490 | * Add switch for USB current limit 491 | * Remove obsolete options 492 | 493 | [ Tim Gover ] 494 | * raspi-config: Use rpi-eeprom-config instead of lower level command 495 | 496 | [ Serge Schneider ] 497 | * Set WLAN regulatory domain without relying on crda 498 | * Use overlayroot to set up filesystem overlay 499 | * Remove boot_wait options 500 | 501 | -- Serge Schneider Tue, 12 Sep 2023 17:42:40 +0100 502 | 503 | raspi-config (20230214) bullseye; urgency=medium 504 | 505 | * do_wifi_ssid_passphrase: set scan_ssid on hidden network in dhcpcd case 506 | - https://github.com/RPi-Distro/raspi-config/issues/209 507 | 508 | -- Serge Schneider Tue, 14 Feb 2023 14:39:41 +0000 509 | 510 | raspi-config (20221214) bullseye; urgency=medium 511 | 512 | [ Viacheslav Vasilyev ] 513 | * Allow to change cpu governor settings by using default file (#203) 514 | 515 | [ Jorge Capona ] 516 | * Filter wlan interfaces before using wpa_cli (#162) 517 | * Specify wlan interface when setting wifi country (#205) 518 | 519 | [ platinum95 ] 520 | * Add unit to fan temperature selection text (#201) 521 | 522 | [ Simon Long ] 523 | * Check os_prefix when locating cmdline.txt 524 | 525 | [ Serge Schneider ] 526 | * do_expand_rootfs: remove partition number check 527 | * Avoid spam if os_prefix is not found 528 | * Avoid raspi-config erroring out when setting wifi country in chroot 529 | 530 | -- Serge Schneider Wed, 14 Dec 2022 16:57:10 +0000 531 | 532 | raspi-config (20221018) bullseye; urgency=medium 533 | 534 | * do_hostname: add fallback for cases when hostnamectl isn't suitable 535 | 536 | -- Serge Schneider Tue, 18 Oct 2022 12:28:15 +0100 537 | 538 | raspi-config (20220920) bullseye; urgency=medium 539 | 540 | * Fix keymap setup 541 | 542 | -- Serge Schneider Tue, 20 Sep 2022 12:45:40 +0100 543 | 544 | raspi-config (20220915) bullseye; urgency=medium 545 | 546 | * Don't attempt to run hostnamectl if dbus is not active 547 | 548 | -- Serge Schneider Thu, 15 Sep 2022 12:25:36 +0100 549 | 550 | raspi-config (20220914) bullseye; urgency=medium 551 | 552 | * Make get_boot_cli work when systemd is not running 553 | 554 | -- Serge Schneider Wed, 14 Sep 2022 16:45:35 +0100 555 | 556 | raspi-config (20220907+1) bullseye; urgency=medium 557 | 558 | * Remove /2, which was created by the typo in 20220901 559 | 560 | -- Serge Schneider Wed, 07 Sep 2022 17:04:52 +0100 561 | 562 | raspi-config (20220907) bullseye; urgency=medium 563 | 564 | * do_netconf: fix typo 565 | 566 | -- Serge Schneider Wed, 07 Sep 2022 10:04:56 +0100 567 | 568 | raspi-config (20220901) bullseye; urgency=medium 569 | 570 | * Rework do_netconf 571 | * Silence options used by firstboot 572 | 573 | -- Serge Schneider Thu, 01 Sep 2022 12:35:47 +0100 574 | 575 | raspi-config (20220809) bullseye; urgency=medium 576 | 577 | [ Simon Long ] 578 | * Modify ALSA switching to work with non-BCM devices 579 | 580 | [ Serge Schneider ] 581 | * Make WLAN settings work with NetworkManager 582 | * Migrate to crda-based regulatory domain management on upgrade 583 | * do_wifi_ssid_passphrase: add flag to allow hashed passphrase input 584 | * Switch to dhcpcd here if Imager < v1.7.3 was used to generate firstrun.sh 585 | 586 | -- Serge Schneider Tue, 09 Aug 2022 12:05:54 +0100 587 | 588 | raspi-config (20220705) bullseye; urgency=medium 589 | 590 | * Add network config switching 591 | 592 | -- Simon Long Tue, 05 Jul 2022 14:12:28 +0100 593 | 594 | raspi-config (20220506) bullseye; urgency=medium 595 | 596 | * Modify Wayland switching to work with AccountSettings 597 | 598 | -- Simon Long Fri, 06 May 2022 14:07:57 +0100 599 | 600 | raspi-config (20220425) bullseye; urgency=medium 601 | 602 | * Tidy hardware detection functions 603 | 604 | -- Simon Long Mon, 25 Apr 2022 17:38:35 +0100 605 | 606 | raspi-config (20220419) bullseye; urgency=medium 607 | 608 | * Reinstate -R parameter for xcompmgr 609 | 610 | -- Simon Long Tue, 19 Apr 2022 10:36:34 +0100 611 | 612 | raspi-config (20220331) bullseye; urgency=medium 613 | 614 | [ Serge Schneider ] 615 | * Remove nonint whiptail msgbox in do_overlayfs 616 | * Update get_boot_cli 617 | * Remove legacy autologin cruft 618 | * Run systemctl daemon-reload after boot behaviour changes 619 | * Make autologin changes quieter 620 | 621 | [ Simon Long ] 622 | * Add switching for experimental Wayland backend 623 | * Fix incorrect detection of read-only boot partition 624 | * Force xrandr to reload on non-mutter systems when overscan changed 625 | 626 | -- Serge Schneider Mon, 07 Mar 2022 09:26:38 +0000 627 | 628 | raspi-config (20220303) bullseye; urgency=medium 629 | 630 | * Use wildcards for KMS test 631 | 632 | -- Simon Long Thu, 03 Mar 2022 13:44:04 +0000 633 | 634 | raspi-config (20220301) bullseye; urgency=medium 635 | 636 | [ Serge Schneider ] 637 | * pass -f flag to rm 638 | * Fix init_resize.sh on Bullseye NOOBS images 639 | 640 | [ Simon Long ] 641 | * Rename is_fkms function to is_kms 642 | * Remove pixel doubling for KMS systems 643 | * Add on-the-fly overscan setting for KMS systems 644 | * Use in-built is_kms function for cmstart script 645 | 646 | -- Simon Long Tue, 01 Mar 2022 11:56:27 +0000 647 | 648 | raspi-config (20220126) bullseye; urgency=medium 649 | 650 | * Modify overlay functions to match format of other nonint calls 651 | 652 | -- Simon Long Wed, 26 Jan 2022 14:55:17 +0000 653 | 654 | raspi-config (20220112) bullseye; urgency=medium 655 | 656 | * Run apt-get with '-y' flag when in nonint mode 657 | - https://github.com/RPi-Distro/raspi-config/issues/177 658 | 659 | -- Serge Schneider Wed, 12 Jan 2022 09:04:54 +0000 660 | 661 | raspi-config (20220110) bullseye; urgency=medium 662 | 663 | * Add -q flag to wait.conf 664 | - https://github.com/RPi-Distro/raspi-config/issues/173 665 | 666 | -- Serge Schneider Mon, 10 Jan 2022 11:54:26 +0000 667 | 668 | raspi-config (20220106) bullseye; urgency=medium 669 | 670 | [ garyk10 ] 671 | * Make nonint do_change_locale work with encoding field as well (#167) 672 | 673 | [ Aristo Chen ] 674 | * Fix inconsistent indent (#165) 675 | 676 | -- Serge Schneider Thu, 06 Jan 2022 08:24:02 +0000 677 | 678 | raspi-config (20211203) bullseye; urgency=medium 679 | 680 | * Correct labelling for x86 version as well 681 | 682 | -- Simon Long Thu, 02 Dec 2021 18:39:04 +0000 683 | 684 | raspi-config (20211202) bullseye; urgency=medium 685 | 686 | * Correct labelling of entries in the interface menu 687 | 688 | -- Simon Long Thu, 02 Dec 2021 11:51:10 +0000 689 | 690 | raspi-config (20211124) bullseye; urgency=medium 691 | 692 | * Legacy camera mode switch added 693 | 694 | -- Simon Long Wed, 24 Nov 2021 16:45:14 +0000 695 | 696 | raspi-config (20211111) bullseye; urgency=medium 697 | 698 | * Changes to configuring of composite output under KMS 699 | 700 | -- Simon Long Thu, 11 Nov 2021 16:41:28 +0000 701 | 702 | raspi-config (20211110) bullseye; urgency=medium 703 | 704 | * Add VNC resolution option 705 | 706 | -- Simon Long Wed, 10 Nov 2021 11:28:55 +0000 707 | 708 | raspi-config (20211103) bullseye; urgency=medium 709 | 710 | * Use 'reboot' on initial resize instead of sysrq emergency reboot 711 | 712 | -- Serge Schneider Wed, 03 Nov 2021 17:50:52 +0000 713 | 714 | raspi-config (20211019) bullseye; urgency=medium 715 | 716 | * Add switching of glamor acceleration 717 | 718 | -- Simon Long Tue, 19 Oct 2021 18:35:03 +0100 719 | 720 | raspi-config (20210927) bullseye; urgency=medium 721 | 722 | * Remove resolution setting option under KMS 723 | 724 | -- Simon Long Mon, 27 Sep 2021 18:19:23 +0100 725 | 726 | raspi-config (20210924) bullseye; urgency=medium 727 | 728 | * Remove fake KMS option 729 | 730 | -- Simon Long Fri, 24 Sep 2021 14:32:52 +0100 731 | 732 | raspi-config (20210923) bullseye; urgency=medium 733 | 734 | * Updated the the wait.conf drop-in for the new dhcpcd5 package 735 | 736 | -- Serge Schneider Thu, 23 Sep 2021 18:24:05 +0100 737 | 738 | raspi-config (20210922) bullseye; urgency=medium 739 | 740 | * Handle 73-usb-net-by-mac.link when toggling network names 741 | - https://github.com/RPi-Distro/raspi-config/issues/166 742 | 743 | -- Serge Schneider Wed, 22 Sep 2021 16:13:52 +0100 744 | 745 | raspi-config (20210827) bullseye; urgency=medium 746 | 747 | * Add switching for new camera detection in firmware 748 | 749 | -- Simon Long Fri, 27 Aug 2021 16:13:49 +0100 750 | 751 | raspi-config (20210816) bullseye; urgency=medium 752 | 753 | * Enable xcompmgr with full KMS as well as fKMS on all platforms 754 | 755 | -- Simon Long Mon, 16 Aug 2021 14:02:06 +0100 756 | 757 | raspi-config (20210610) bullseye; urgency=medium 758 | 759 | * Remove redundant xcompmgr parameter 760 | 761 | -- Simon Long Thu, 10 Jun 2021 17:02:43 +0100 762 | 763 | raspi-config (20210604) bullseye; urgency=medium 764 | 765 | * Disable xcompmgr when openbox not running 766 | 767 | -- Simon Long Fri, 04 Jun 2021 13:53:42 +0100 768 | 769 | raspi-config (20210212) buster; urgency=medium 770 | 771 | * Update boot order menu 772 | 773 | -- Simon Long Fri, 12 Feb 2021 12:07:27 +0000 774 | 775 | raspi-config (20210119) buster; urgency=medium 776 | 777 | * Move Pi 4 video output setting to advanced menu 778 | 779 | -- Simon Long Tue, 19 Jan 2021 14:51:58 +0000 780 | 781 | raspi-config (20201108) buster; urgency=medium 782 | 783 | * Fix typo in fan controller 784 | 785 | -- Simon Long Sun, 08 Nov 2020 11:37:08 +0000 786 | 787 | raspi-config (20201027) buster; urgency=medium 788 | 789 | * Add function to check whether board has an analog output jack 790 | 791 | -- Simon Long Tue, 27 Oct 2020 17:29:53 +0000 792 | 793 | raspi-config (20201014) buster; urgency=medium 794 | 795 | * Add PulseAudio output control 796 | * Restructure menus to match GUI application 797 | 798 | -- Simon Long Wed, 14 Oct 2020 14:59:35 +0100 799 | 800 | raspi-config (20201006) buster; urgency=medium 801 | 802 | * Add fan control 803 | 804 | -- Simon Long Tue, 06 Oct 2020 15:17:39 +0100 805 | 806 | raspi-config (20200902) buster; urgency=medium 807 | 808 | * Add option to control power LED on Pi Zero 809 | 810 | -- Simon Long Wed, 02 Sep 2020 11:46:19 +0100 811 | 812 | raspi-config (20200817) buster; urgency=medium 813 | 814 | * Use processor ID to detect Pi 4 rather than board ID 815 | 816 | -- Simon Long Mon, 17 Aug 2020 09:24:09 +0100 817 | 818 | raspi-config (20200727) buster; urgency=medium 819 | 820 | * Disable initial rfkill for all platforms when setting wireless country 821 | 822 | -- Simon Long Mon, 27 Jul 2020 15:47:29 +0100 823 | 824 | raspi-config (20200707) buster; urgency=medium 825 | 826 | * Add boot ROM and boot order selection 827 | 828 | -- Simon Long Tue, 07 Jul 2020 09:24:56 +0100 829 | 830 | raspi-config (20200601) buster; urgency=medium 831 | 832 | * Fix audio device check bug when used in non-English locale 833 | 834 | -- Simon Long Mon, 01 Jun 2020 10:28:35 +0100 835 | 836 | raspi-config (20200515) buster; urgency=medium 837 | 838 | * Update initial resize script 839 | - Change disk ID to avoid clashes 840 | * Add support for USB resize 841 | 842 | -- Serge Schneider Fri, 15 May 2020 08:47:17 +0100 843 | 844 | raspi-config (20200504) buster; urgency=medium 845 | 846 | * Replace references to wifi 847 | 848 | -- Simon Long Mon, 04 May 2020 11:47:53 +0100 849 | 850 | raspi-config (20200226) buster; urgency=medium 851 | 852 | * Sync FKMS check with gldriver-test 853 | * Fix is_pi check 854 | 855 | -- Serge Schneider Wed, 26 Feb 2020 17:51:20 +0000 856 | 857 | raspi-config (20200207) buster; urgency=medium 858 | 859 | * Fix bug preventing VNC from being disabled 860 | 861 | -- Serge Schneider Fri, 07 Feb 2020 12:59:29 +0000 862 | 863 | raspi-config (20200205) buster; urgency=medium 864 | 865 | * Add filter parameter to xrandr when setting pixel doubling 866 | 867 | -- Simon Long Wed, 05 Feb 2020 07:46:42 +0000 868 | 869 | raspi-config (20200203) buster; urgency=medium 870 | 871 | * Add pixel doubling option for FKMS using xrandr 872 | 873 | -- Simon Long Mon, 03 Feb 2020 09:36:38 +0000 874 | 875 | raspi-config (20200120) buster; urgency=medium 876 | 877 | * Add audio switching for discrete internal ALSA devices 878 | 879 | -- Simon Long Mon, 20 Jan 2020 11:38:37 +0000 880 | 881 | raspi-config (20200117) buster; urgency=medium 882 | 883 | * Add proxy configuration 884 | * Handle cases where SUDO_USER is unset 885 | * Fix VNC options 886 | * Install required packages when changing GL settings 887 | * Add warning when enabling SSH 888 | * OverlayFS - try loading module from rootfs 889 | * OverlayFS - remove initramfs when disabled 890 | 891 | -- Serge Schneider Fri, 17 Jan 2020 11:50:54 +0000 892 | 893 | raspi-config (20191210) buster; urgency=medium 894 | 895 | * Fix postrm script 896 | 897 | -- Serge Schneider Tue, 10 Dec 2019 14:22:08 +0000 898 | 899 | raspi-config (20191209) buster; urgency=medium 900 | 901 | * Add option to enable/disable screen blanking 902 | * Simplify source package 903 | 904 | -- Serge Schneider Mon, 09 Dec 2019 16:20:44 +0000 905 | 906 | raspi-config (20191021) buster; urgency=medium 907 | 908 | * Add initramfs as dependency for overlayfs 909 | 910 | -- Simon Long Mon, 21 Oct 2019 14:44:54 +0100 911 | 912 | raspi-config (20191008) buster; urgency=medium 913 | 914 | * Remove pixel doubling option for x86 915 | 916 | -- Simon Long Tue, 08 Oct 2019 10:19:48 +0100 917 | 918 | raspi-config (20191005) buster; urgency=medium 919 | 920 | * Add overlay file system functions 921 | 922 | -- Simon Long Fri, 05 Oct 2019 10:13:58 +0100 923 | 924 | raspi-config (20190917) buster; urgency=medium 925 | 926 | * Enable overscan for FKMS 927 | 928 | -- Simon Long Tue, 17 Sep 2019 15:34:56 +0100 929 | 930 | raspi-config (20190709) buster; urgency=medium 931 | 932 | * Rename hdmi_enable_4k to hdmi_enable_4kp60 933 | 934 | -- Simon Long Tue, 09 Jul 2019 13:48:03 +0100 935 | 936 | raspi-config (20190620) buster; urgency=medium 937 | 938 | * get_wifi_country: call save_config instead of reconfigure 939 | - Prevents WiFi from disconnecting 940 | 941 | -- Serge Schneider Thu, 20 Jun 2019 20:01:06 +0100 942 | 943 | raspi-config (20190619) buster; urgency=medium 944 | 945 | [ Simon Long ] 946 | * Fix composite output options for Pi 4 947 | * Keep splash screen settings when changing GPU options 948 | 949 | -- Serge Schneider Wed, 19 Jun 2019 15:49:38 +0100 950 | 951 | raspi-config (20190607) buster; urgency=medium 952 | 953 | [ Simon Long ] 954 | * Only run xcompmgr if FKMS is enabled 955 | 956 | -- Serge Schneider Fri, 07 Jun 2019 16:11:11 +0100 957 | 958 | raspi-config (20190520) buster; urgency=medium 959 | 960 | [ Simon Long ] 961 | * Add Pi 4 video options 962 | 963 | -- Serge Schneider Mon, 20 May 2019 11:01:12 +0100 964 | 965 | raspi-config (20190514) buster; urgency=medium 966 | 967 | [ Simon Long ] 968 | * Add FKMS check 969 | * Disable pixel doubling when FKMS is enabled 970 | 971 | -- Serge Schneider Tue, 14 May 2019 15:38:17 +0100 972 | 973 | raspi-config (20190509) buster; urgency=medium 974 | 975 | * init_resize.sh: Remove sdhci.debug_quirks2=4 from /boot/cmdline.txt 976 | 977 | -- Serge Schneider Thu, 09 May 2019 13:38:34 +0100 978 | 979 | raspi-config (20190507) buster; urgency=medium 980 | 981 | [ Simon Long ] 982 | * Switch from compton to xcompmgr 983 | * Tweak get_wifi_country to work with the desktop applet 984 | 985 | -- Serge Schneider Tue, 07 May 2019 16:03:15 +0100 986 | 987 | raspi-config (20190502) buster; urgency=medium 988 | 989 | * Use wpa_cli to check WiFi country setting 990 | 991 | -- Serge Schneider Thu, 02 May 2019 13:22:49 +0100 992 | 993 | raspi-config (20190429) buster; urgency=medium 994 | 995 | * Update do_wifi_country 996 | - Enable wifi regardless of whether /run/wifi-country-unset exists 997 | * Make sure SSH host keys are generated when SSH is enabled 998 | -- Serge Schneider Mon, 29 Apr 2019 14:52:56 +0100 999 | 1000 | raspi-config (20190424) stretch; urgency=medium 1001 | 1002 | * Add Compton option to advanced options 1003 | 1004 | -- Simon Long Wed, 24 Apr 2019 13:45:54 +0100 1005 | 1006 | raspi-config (20190423) stretch; urgency=medium 1007 | 1008 | * Change autologin $TERM; tweaks to overclock wording 1009 | 1010 | -- Simon Long Tue, 23 Apr 2019 08:19:08 +0100 1011 | 1012 | raspi-config (20190219) stretch; urgency=medium 1013 | 1014 | * Update autologin behaviour for compatibility with buster 1015 | 1016 | -- Simon Long Tue, 19 Feb 2019 10:07:01 +0000 1017 | 1018 | raspi-config (20181118) stretch; urgency=medium 1019 | 1020 | * Set TTY autologin correctly when using desktop autologin 1021 | 1022 | -- Simon Long Sun, 18 Nov 2018 10:59:01 +0000 1023 | 1024 | raspi-config (20180518) stretch; urgency=medium 1025 | 1026 | * Add separate settings for serial hardware and console 1027 | 1028 | -- Simon Long Fri, 18 May 2018 07:29:57 +0100 1029 | 1030 | raspi-config (20180406+1) stretch; urgency=medium 1031 | 1032 | * Fix Wi-Fi country setting 1033 | 1034 | -- Serge Schneider Fri, 06 Apr 2018 14:28:02 +0100 1035 | 1036 | raspi-config (20180406) stretch; urgency=medium 1037 | 1038 | * Set Wi-Fi country while connecting to SSID 1039 | 1040 | -- Serge Schneider Fri, 06 Apr 2018 13:40:21 +0100 1041 | 1042 | raspi-config (20180228) stretch; urgency=medium 1043 | 1044 | * Setting Wi-Fi country no longer requires a reboot 1045 | 1046 | -- Serge Schneider Wed, 28 Feb 2018 17:28:50 +0000 1047 | 1048 | raspi-config (20171201) stretch; urgency=medium 1049 | 1050 | * Add pixel doubling option 1051 | 1052 | -- Simon Long Fri, 01 Dec 2017 08:05:53 +0000 1053 | 1054 | raspi-config (20171127) stretch; urgency=medium 1055 | 1056 | * Allow entering SSID and passphrase (#68) 1057 | * Console keyboard layout changes effective immediately (#67) 1058 | * Formatting fixes (#70) 1059 | * Add non-interactive timezone, locale and keyboard configuration 1060 | * Modify architecture test for piserver 1061 | 1062 | -- Simon Long Mon, 27 Nov 2017 10:14:37 +0000 1063 | 1064 | raspi-config (20170926) stretch; urgency=medium 1065 | 1066 | * Add option to enable predictable network interface names 1067 | 1068 | -- Serge Schneider Tue, 26 Sep 2017 12:32:25 +0100 1069 | 1070 | raspi-config (20170811) stretch; urgency=medium 1071 | 1072 | * Only restart pigpio daemon if it is running 1073 | 1074 | -- Simon Long Fri, 11 Aug 2017 14:40:50 +0100 1075 | 1076 | raspi-config (20170803) stretch; urgency=medium 1077 | 1078 | * Allow splash screen with fake KMS. 1079 | 1080 | -- Simon Long Thu, 03 Aug 2017 10:11:08 +0100 1081 | 1082 | raspi-config (20170714) stretch; urgency=medium 1083 | 1084 | [Simon Long] 1085 | * Autologin operations now all use current user rather than defaulting to pi 1086 | * initd support removed 1087 | [Serge Schneider] 1088 | * Add pi model as backtitle 1089 | * Define memory split units 1090 | * Fix NOOBS config keyboard setup 1091 | 1092 | -- Serge Schneider Fri, 14 Jul 2017 12:34:21 +0100 1093 | 1094 | raspi-config (20170711) stretch; urgency=medium 1095 | 1096 | * Fix wait for network option 1097 | * Bump compat level to 9 1098 | 1099 | -- Serge Schneider Tue, 11 Jul 2017 11:47:34 +0100 1100 | 1101 | raspi-config (20170704) stretch; urgency=medium 1102 | 1103 | * Remove unnecessary sudo from apt-get 1104 | 1105 | -- Simon Long Tue, 04 Jul 2017 10:28:55 +0100 1106 | 1107 | raspi-config (20170627) stretch; urgency=medium 1108 | 1109 | * Change configuration for GL driver - no compton, keep fbturbo, allow on Pi 1 and Pi 0 1110 | 1111 | -- Simon Long Tue, 27 Jun 2017 11:56:21 +0100 1112 | 1113 | raspi-config (20170619) stretch; urgency=medium 1114 | 1115 | * Start service on all runlevels 1116 | 1117 | -- Serge Schneider Mon, 19 Jun 2017 09:14:40 +0000 1118 | 1119 | raspi-config (20170518) jessie; urgency=medium 1120 | 1121 | * Improve x86 splash screen command line handling to remove spurious arguments and spaces 1122 | 1123 | -- Simon Long Thu, 18 May 2017 13:19:27 +0100 1124 | 1125 | raspi-config (20170503) jessie; urgency=medium 1126 | 1127 | * Correctly handle GRUB command line options for splash screen on x86 1128 | 1129 | -- Simon Long Wed, 03 May 2017 11:30:57 +0100 1130 | 1131 | raspi-config (20170307) jessie; urgency=medium 1132 | 1133 | * Run init_resize.sh through shellcheck 1134 | * Improve init_resize.sh reliability 1135 | 1136 | -- Serge Schneider Tue, 07 Mar 2017 13:49:57 +0000 1137 | 1138 | raspi-config (20170228) jessie; urgency=medium 1139 | 1140 | * Added detection of 0 W boards 1141 | 1142 | -- Simon Long Tue, 28 Feb 2017 10:06:36 +0000 1143 | 1144 | raspi-config (20170214) jessie; urgency=medium 1145 | 1146 | * Allow compton with fake KMS driver; modified check for ARM architecture 1147 | 1148 | -- Simon Long Tue, 14 Feb 2017 14:47:58 +0000 1149 | 1150 | raspi-config (20170127) jessie; urgency=medium 1151 | 1152 | * Prevent keyboard language from being configured over SSH 1153 | 1154 | -- Simon Long Fri, 27 Jan 2017 16:15:56 +0000 1155 | 1156 | raspi-config (20170120) jessie; urgency=medium 1157 | 1158 | * Mods to support use on x86; fake KMS option added for GL driver 1159 | 1160 | -- Simon Long Fri, 20 Jan 2017 14:19:18 +0000 1161 | 1162 | raspi-config (20161207) jessie; urgency=medium 1163 | 1164 | * Use compton for compositing with GL driver instead of xcompmgr 1165 | 1166 | -- Simon Long Wed, 07 Dec 2016 12:43:26 +0000 1167 | 1168 | raspi-config (20161206) jessie; urgency=medium 1169 | 1170 | * Menus reorganised; resolution setting added 1171 | 1172 | -- Simon Long Tue, 06 Dec 2016 13:43:32 +0000 1173 | 1174 | raspi-config (20161114) jessie; urgency=medium 1175 | 1176 | * Restore -a option for xcompmgr; disable splash screen with GL driver 1177 | 1178 | -- Simon Long Mon, 14 Nov 2016 14:25:19 +0000 1179 | 1180 | raspi-config (20161108) jessie; urgency=medium 1181 | 1182 | * init_resize.sh: Remove clash with pix-plym-splash 1183 | 1184 | -- Serge Schneider Tue, 08 Nov 2016 17:34:00 +0000 1185 | 1186 | raspi-config (20161102) jessie; urgency=medium 1187 | 1188 | * Sed processing of autologin options modified to improve robustness 1189 | 1190 | -- Simon Long Wed, 02 Nov 2016 15:02:45 +0000 1191 | 1192 | raspi-config (20161013) jessie; urgency=medium 1193 | 1194 | * Rastrack option removed 1195 | * Splash screen control added 1196 | 1197 | -- Simon Long Thu, 13 Oct 2016 13:53:54 +0100 1198 | 1199 | raspi-config (20160527) jessie; urgency=medium 1200 | 1201 | [ Simon Long ] 1202 | * Function to read hostname added 1203 | * Function added to get wifi country 1204 | * Functions to detect boot behaviour added 1205 | * Test functions added for remote GPIO and slow boot 1206 | * Added some functions to read current state for use by rc_gui 1207 | * Requirement for reboot removed from SPI and I2C settings 1208 | * A lot of NOTs taken out of serial test 1209 | * Status indications moved to end of some functions 1210 | * Overscan description amended 1211 | * Check for fs expandability added; overscan function matches others 1212 | * Added more success / fail feedback to settings 1213 | * Global check for mountpoint and existence of /boot/config.txt 1214 | * Checking of initial state added for camera and 1-wire 1215 | * Unnecessary reboots removed 1216 | * Some function names changed for consistency 1217 | * GL driver setting aligned with other functions 1218 | * Functions to control remote GPIO and boot wait for network aligned 1219 | * Tidied function to control remote GPIO access 1220 | 1221 | -- Serge Schneider Fri, 27 May 2016 11:10:11 +0100 1222 | 1223 | raspi-config (20160506) jessie; urgency=medium 1224 | 1225 | [ Axel Beckert ] 1226 | * Downgrade hard dependency on triggerhappy to recommendation. 1227 | + init script: Check if thd is present before using it. 1228 | 1229 | [ Simon Long ] 1230 | * New method for testing whether serial is enabled. 1231 | * Current state of serial i/f reflected in raspi-config. 1232 | * Menu option to toggle device tree removed. 1233 | 1234 | -- Serge Schneider Fri, 06 May 2016 18:41:58 +0100 1235 | 1236 | raspi-config (20160428) jessie; urgency=medium 1237 | 1238 | * [Simon Long] 1239 | - dtparam used instead of modprobe for SPI and I2C 1240 | 1241 | -- Serge Schneider Thu, 28 Apr 2016 15:42:42 +0100 1242 | 1243 | raspi-config (20160425) jessie; urgency=medium 1244 | 1245 | * [Simon Long] 1246 | - Merge - Prevent errors when enabling "Fast" network boot multiple times 1247 | - UART switch added to serial; GPIO server public access finished 1248 | - Skeleton added for setting security state of GPIO server 1249 | - Reads in gpu_mem_ settings and clears them when writing 1250 | * [Serge Schneider] 1251 | - Remove io_is_busy 1252 | 1253 | -- Serge Schneider Mon, 25 Apr 2016 11:58:48 +0100 1254 | 1255 | raspi-config (20160322) jessie; urgency=medium 1256 | 1257 | * [Simon Long] 1258 | - 1-wire interface control added 1259 | - Wifi country code setting now creates wpa_supplicant.conf 1260 | if it doesn't exist 1261 | * [Serge Schneider] 1262 | - Add first boot resize script 1263 | 1264 | -- Serge Schneider Tue, 22 Mar 2016 16:45:29 +0000 1265 | 1266 | raspi-config (20160225) jessie; urgency=medium 1267 | 1268 | * Added wi-fi country setting to raspi-config 1269 | * Wifi setting in raspi-config can now be called in non-interactive mode. 1270 | * Mods to support new serial device alias in cmdline.txt. 1271 | 1272 | -- Serge Schneider Thu, 25 Feb 2016 07:48:56 +0000 1273 | 1274 | raspi-config (20160210) jessie; urgency=medium 1275 | 1276 | * Pi board checks now take account of warranty bits. 1277 | 1278 | -- Serge Schneider Tue, 09 Feb 2016 16:16:58 +0000 1279 | 1280 | raspi-config (20160209) jessie; urgency=medium 1281 | 1282 | * Check for mesa driver before allowing GL driver to be enabled 1283 | 1284 | -- Serge Schneider Tue, 09 Feb 2016 13:56:44 +0000 1285 | 1286 | raspi-config (20160201) jessie; urgency=medium 1287 | 1288 | * Compute Module added to is_pione 1289 | 1290 | -- Serge Schneider Mon, 01 Feb 2016 12:28:22 +0000 1291 | 1292 | raspi-config (20160125) jessie; urgency=medium 1293 | 1294 | * Do not allow GL driver to be enabled on 2835-based Pis - it needs at least 1GB of RAM. 1295 | * Overclocking behaviour made board-specific. 1296 | 1297 | -- Serge Schneider Mon, 25 Jan 2016 12:29:54 +0000 1298 | 1299 | raspi-config (20160121) jessie; urgency=medium 1300 | 1301 | * GPU memory reset to default when GL driver enabled 1302 | * Launch of simple compositor added when GL driver is enabled 1303 | * Filename of V3d overlay corrected 1304 | 1305 | -- Serge Schneider Thu, 21 Jan 2016 11:12:49 +0000 1306 | 1307 | raspi-config (20160119) jessie; urgency=medium 1308 | 1309 | * Option added to select experimental GL driver 1310 | 1311 | -- Serge Schneider Tue, 19 Jan 2016 13:56:53 +0000 1312 | 1313 | raspi-config (20160108) jessie; urgency=medium 1314 | 1315 | * Update URL 1316 | * Remove first boot auto-login files 1317 | * Fix auto-login 1318 | * Fix typos 1319 | 1320 | -- Serge Schneider Fri, 08 Jan 2016 10:44:05 +0000 1321 | 1322 | raspi-config (20151117) jessie; urgency=medium 1323 | 1324 | * raspi-config modified to remove config variables rather than set default 1325 | values when overclocking 1326 | 1327 | -- Serge Schneider Tue, 17 Nov 2015 11:35:14 +0000 1328 | 1329 | raspi-config (20151019) jessie; urgency=medium 1330 | 1331 | * Add alsa-utils dependency 1332 | * Remove unnecessary sudo in init script 1333 | * Add wait for network option 1334 | 1335 | -- Serge Schneider Mon, 19 Oct 2015 13:01:26 +0100 1336 | 1337 | raspi-config (20150923) jessie; urgency=medium 1338 | 1339 | * Auto-login to desktop and console option for rc_gui 1340 | 1341 | -- Serge Schneider Wed, 23 Sep 2015 21:25:52 +0100 1342 | 1343 | raspi-config (20150915) jessie; urgency=medium 1344 | 1345 | * Add support for rc_gui from spl 1346 | 1347 | -- Serge Schneider Tue, 15 Sep 2015 10:23:52 +0100 1348 | 1349 | raspi-config (20150706) jessie; urgency=low 1350 | 1351 | * Include io_is_busy in cpufreq settings 1352 | * Bump standards version to 3.9.6 1353 | 1354 | -- Serge Schneider Mon, 06 Jul 2015 08:59:56 +0100 1355 | 1356 | raspi-config (20150603) jessie; urgency=low 1357 | 1358 | * systemd compatibility 1359 | * Add udevadm command to notify Xorg after change of keyboard layout - jojopi 1360 | * Remove boot to scratch 1361 | 1362 | -- Serge Schneider Fri, 29 May 2015 11:31:46 +0100 1363 | 1364 | raspi-config (20150131-4) stable; urgency=low 1365 | 1366 | * Use dh_installinit --no-start instead of --noscripts to ensure raspi-config runs 1367 | 1368 | -- Serge Schneider Thu, 14 May 2015 18:09:47 +0100 1369 | 1370 | raspi-config (20150131-3) unstable; urgency=low 1371 | 1372 | * Add prerm failed-upgrade to allow upgrades 1373 | 1374 | -- Serge Schneider Wed, 06 May 2015 15:33:35 +0100 1375 | 1376 | raspi-config (20150131-2) unstable; urgency=low 1377 | 1378 | * Prevent postinstall from trying to stop /etc/init.d/raspi-config 1379 | dh_installinit --noscripts 1380 | 1381 | -- Serge Schneider Wed, 06 May 2015 14:23:57 +0100 1382 | 1383 | raspi-config (20150131-1) unstable; urgency=low 1384 | 1385 | * Add Pi2 overclock preset 1386 | * Ask whether to reboot after changing devicetree 1387 | * Remove old switch_cpu_governor init script upon install 1388 | 1389 | -- Alex Bradbury Sat, 31 Jan 2015 20:17:40 +0000 1390 | 1391 | raspi-config (20150129-1) unstable; urgency=low 1392 | 1393 | * Add devicetree support (thanks Phil Elwell) 1394 | * Always include the ondemand governor init script 1395 | * Tweak ondemand cpu scaling governor settings 1396 | 1397 | -- Alex Bradbury Thu, 29 Jan 2015 23:40:15 +0000 1398 | 1399 | raspi-config (20140902-1) unstable; urgency=low 1400 | 1401 | * Add option to toggle i2c and serial 1402 | 1403 | -- Alexander Bradbury Tue, 02 Sep 2014 17:26:06 +0100 1404 | 1405 | raspi-config (20131216-1) unstable; urgency=low 1406 | 1407 | * Add option to configure audio out 1408 | * Fail boot to scratch or boot to desktop setting when pi user was removed 1409 | * When enabling camera, only set gpu mem if it's unset or < 128MiB 1410 | 1411 | -- Alexander Bradbury Mon, 16 Dec 2013 21:50:38 +0000 1412 | 1413 | raspi-config (20130925-1) unstable; urgency=low 1414 | 1415 | * Fix issue inheriting language settings from NOOBS 1416 | * Add ability to toggle spi module blacklisting 1417 | 1418 | -- Alex Bradbury Wed, 25 Sep 2013 20:55:34 +0100 1419 | 1420 | raspi-config (20130910-1) unstable; urgency=low 1421 | 1422 | * Bugfix for boot to scratch 1423 | * Bugfix for detecting flavour set by NOOBS 1424 | 1425 | -- Alexander Bradbury Tue, 10 Sep 2013 14:36:14 +0100 1426 | 1427 | raspi-config (20130909-1) unstable; urgency=low 1428 | 1429 | * Support boot to scratch and applying language/keyboard settings from noobs 1430 | 1431 | -- Alexander Bradbury Mon, 09 Sep 2013 23:53:58 +0100 1432 | 1433 | raspi-config (20130525-1) unstable; urgency=low 1434 | 1435 | * Use start_x rather than startx in config.txt for enabling camera to reduce 1436 | confusion 1437 | 1438 | -- Alex Bradbury Sat, 25 May 2013 17:15:07 +0100 1439 | 1440 | raspi-config (20130525) unstable; urgency=low 1441 | 1442 | * Tweak height of whiptail display (thanks Rob Bishop) 1443 | * Fix issue of gpu_mem=16 not working when camera is enabled 1444 | 1445 | -- Alex Bradbury Sat, 25 May 2013 16:49:19 +0100 1446 | 1447 | raspi-config (20130522) unstable; urgency=low 1448 | 1449 | * Re-organise menus and give better explanations for options (thanks Rob 1450 | Bishop) 1451 | * Refuse to expand_rootfs on NOOBS partition layouts. 1452 | 1453 | -- Alex Bradbury Wed, 22 May 2013 20:51:07 +0100 1454 | 1455 | raspi-config (20130520) unstable; urgency=low 1456 | 1457 | * Make expand_rootfs work if /dev/root is not second partition 1458 | 1459 | -- Alex Bradbury Mon, 20 May 2013 19:48:02 +0100 1460 | 1461 | raspi-config (20130515) unstable; urgency=low 1462 | 1463 | * Lower cpufreq threshold when overclocking 1464 | 1465 | -- Alex Bradbury Wed, 15 May 2013 19:47:40 +0100 1466 | 1467 | raspi-config (20130510) unstable; urgency=low 1468 | 1469 | * Added support for registering on rastrack (thanks Ryan Walmsley) 1470 | * Added ability to set hostname (thanks Andrew Stone) 1471 | * Added --expand-rootfs option (thanks Viktor Petersson) 1472 | * Added ability to enable Raspberry Pi camera support 1473 | 1474 | -- Alex Bradbury Fri, 10 May 2013 12:19:42 +0100 1475 | 1476 | raspi-config (20121028) unstable; urgency=low 1477 | 1478 | * Update overclocking options 1479 | * Disable command-line options for non-interactive use 1480 | * Support new gpu_mem config option 1481 | 1482 | -- Alex Bradbury Sun, 28 Oct 2012 21:11:34 +0000 1483 | 1484 | raspi-config (20120918) unstable; urgency=low 1485 | 1486 | * Add overclocking options 1487 | * Add command-line options for non-interactive use (James Hewitt) 1488 | 1489 | -- Alexander Bradbury Tue, 18 Sep 2012 12:02:13 +0100 1490 | 1491 | raspi-config (20120815) unstable; urgency=low 1492 | 1493 | * Various updates, recognise 240M memory split 1494 | 1495 | -- Alex Bradbury Wed, 15 Aug 2012 23:10:03 +0000 1496 | 1497 | raspi-config (20120715) unstable; urgency=low 1498 | 1499 | * Various updates 1500 | 1501 | -- Alex Bradbury Sun, 15 Jul 2012 19:47:39 +0100 1502 | 1503 | raspi-config (20120617) unstable; urgency=low 1504 | 1505 | * Fix keyboard configuration, misc other enhancements 1506 | * See git log for full changelog 1507 | 1508 | -- Alex Bradbury Sun, 17 Jun 2012 19:36:20 +0100 1509 | 1510 | raspi-config (20120610) unstable; urgency=low 1511 | 1512 | * Initial release 1513 | 1514 | -- Alex Bradbury Sun, 10 Jun 2012 15:59:17 +0000 1515 | -------------------------------------------------------------------------------- /debian/compat: -------------------------------------------------------------------------------- 1 | 10 2 | -------------------------------------------------------------------------------- /debian/conffiles: -------------------------------------------------------------------------------- 1 | remove-on-upgrade /etc/init.d/raspi-config 2 | remove-on-upgrade /etc/default/cpu_governor 3 | -------------------------------------------------------------------------------- /debian/control: -------------------------------------------------------------------------------- 1 | Source: raspi-config 2 | Section: utils 3 | Priority: optional 4 | Maintainer: Serge Schneider 5 | Build-Depends: debhelper (>= 8.0.0) 6 | Standards-Version: 4.3.0 7 | Vcs-Git: git://git@github.com:RPi-Distro/raspi-config.git 8 | Vcs-Browser: https://github.com/RPi-Distro/raspi-config 9 | 10 | Package: raspi-config 11 | Architecture: all 12 | Depends: ${misc:Depends}, whiptail, parted, lua5.1, alsa-utils, psmisc, raspi-utils, dconf-cli 13 | Recommends: triggerhappy, iw 14 | Description: Raspberry Pi configuration tool 15 | A simple configuration tool for common Raspberry Pi administrative tasks 16 | -------------------------------------------------------------------------------- /debian/copyright: -------------------------------------------------------------------------------- 1 | Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ 2 | Source: https://github.com/RPi-Distro/raspi-config 3 | 4 | Files: * 5 | Copyright: 2012 Alex Bradbury 6 | License: MIT 7 | 8 | License: MIT 9 | Permission is hereby granted, free of charge, to any person obtaining a copy 10 | of this software and associated documentation files (the "Software"), to 11 | deal in the Software without restriction, including without limitation the 12 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 13 | sell copies of the Software, and to permit persons to whom the Software is 14 | furnished to do so, subject to the following conditions: 15 | . 16 | The above copyright notice and this permission notice shall be included in 17 | all copies or substantial portions of the Software. 18 | . 19 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 25 | SOFTWARE. 26 | -------------------------------------------------------------------------------- /debian/gbp.conf: -------------------------------------------------------------------------------- 1 | [DEFAULT] 2 | debian-branch = bookworm 3 | -------------------------------------------------------------------------------- /debian/raspi-config.install: -------------------------------------------------------------------------------- 1 | raspi-config /usr/bin 2 | usr/ 3 | etc/ 4 | -------------------------------------------------------------------------------- /debian/raspi-config.postinst: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | if [ -e /etc/init.d/switch_cpu_governor ]; then 4 | update-rc.d switch_cpu_governor remove >/dev/null 5 | fi 6 | 7 | if dpkg --compare-versions "${2}" lt-nl "20170619"; then 8 | update-rc.d -f raspi-config remove 9 | fi 10 | 11 | if dpkg --compare-versions "${2}" lt-nl "20220804"; then 12 | echo "Moving to crda for regulatory domain management..." 13 | if [ -f /etc/wpa_supplicant/wpa_supplicant.conf ]; then 14 | REGDOMAIN="$(sed -n 's/^country=\(.*\)$/\1/p' /etc/wpa_supplicant/wpa_supplicant.conf)" 15 | if [ -n "$REGDOMAIN" ]; then 16 | echo "Setting to $REGDOMAIN..." 17 | raspi-config nonint do_wifi_country "$REGDOMAIN" 18 | else 19 | echo "Regulatory domain was unset" 20 | fi 21 | else 22 | echo "wpa_supplicant.conf not found" 23 | fi 24 | fi 25 | 26 | if dpkg --compare-versions "${2}" lt-nl "20220907+1"; then 27 | IMG_VER="$(grep -s -m1 -o '[[:digit:]]\{4\}-[[:digit:]]\{2\}-[[:digit:]]\{2\}' /etc/rpi-issue)" 28 | if [ "$IMG_VER" = "2022-09-06" ] && [ -f /2 ]; then 29 | rm -f /2 30 | fi 31 | fi 32 | 33 | if dpkg --compare-versions "${2}" lt "20240313"; then 34 | if grep -q ^HandlePowerKey= /etc/systemd/logind.conf; then 35 | sed -i 's/^.*HandlePowerKey=.*$/#HandlePowerKey=poweroff/' /etc/systemd/logind.conf 36 | fi 37 | fi 38 | 39 | #DEBHELPER# 40 | -------------------------------------------------------------------------------- /debian/raspi-config.postrm: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | case "$1" in 5 | remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear) 6 | ;; 7 | purge) 8 | if [ -d /etc/X11/xorg.conf.d/ ]; then 9 | rmdir --ignore-fail-on-non-empty /etc/X11/xorg.conf.d/ 10 | fi 11 | ;; 12 | *) 13 | echo "postrm called with unknown argument \`$1'" >&2 14 | exit 1 15 | ;; 16 | esac 17 | 18 | #DEBHELPER# 19 | 20 | exit 0 21 | -------------------------------------------------------------------------------- /debian/raspi-config.prerm: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | # prerm script for raspi-config 3 | # 4 | # see: dh_installdeb(1) 5 | 6 | set -e 7 | 8 | # summary of how this script can be called: 9 | # * `remove' 10 | # * `purge' 11 | # * `upgrade' 12 | # * `failed-upgrade' 13 | # * `abort-install' 14 | # * `abort-install' 15 | # * `abort-upgrade' 16 | # * `disappear' 17 | # for details, see http://www.debian.org/doc/debian-policy/ or 18 | # the debian-policy package 19 | 20 | 21 | case "$1" in 22 | purge|remove|upgrade) 23 | ;; 24 | 25 | failed-upgrade|abort-install|abort-upgrade|disappear) 26 | ;; 27 | 28 | *) 29 | echo "prerm called with unknown argument \`$1'" >&2 30 | exit 1 31 | ;; 32 | esac 33 | 34 | #DEBHELPER# 35 | 36 | exit 0 37 | -------------------------------------------------------------------------------- /debian/rules: -------------------------------------------------------------------------------- 1 | #!/usr/bin/make -f 2 | # -*- makefile -*- 3 | # Sample debian/rules that uses debhelper. 4 | # This file was originally written by Joey Hess and Craig Small. 5 | # As a special exception, when this file is copied by dh-make into a 6 | # dh-make output file, you may use that output file without restriction. 7 | # This special exception was added by Craig Small in version 0.37 of dh-make. 8 | 9 | # Uncomment this to turn on verbose mode. 10 | #export DH_VERBOSE=1 11 | 12 | override_dh_installinit: 13 | dh_installinit --no-start 14 | 15 | %: 16 | dh $@ 17 | -------------------------------------------------------------------------------- /debian/source/format: -------------------------------------------------------------------------------- 1 | 3.0 (native) 2 | -------------------------------------------------------------------------------- /etc/sudoers.d/010_proxy: -------------------------------------------------------------------------------- 1 | Defaults env_keep += "http_proxy HTTP_PROXY" 2 | Defaults env_keep += "https_proxy HTTPS_PROXY" 3 | Defaults env_keep += "ftp_proxy FTP_PROXY" 4 | Defaults env_keep += "RSYNC_PROXY" 5 | Defaults env_keep += "no_proxy NO_PROXY" 6 | -------------------------------------------------------------------------------- /raspi-config: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Part of raspi-config https://github.com/RPi-Distro/raspi-config 3 | # 4 | # See LICENSE file for copyright and license details 5 | 6 | INTERACTIVE=True 7 | ASK_TO_REBOOT=0 8 | BLACKLIST=/etc/modprobe.d/raspi-blacklist.conf 9 | 10 | if [ -e /boot/firmware/config.txt ] ; then 11 | FIRMWARE=/firmware 12 | else 13 | FIRMWARE= 14 | fi 15 | CONFIG=/boot${FIRMWARE}/config.txt 16 | 17 | USER=${SUDO_USER:-$(who -m | awk '{ print $1 }')} 18 | if [ -z "$USER" ] && [ -n "$HOME" ]; then 19 | USER=$(getent passwd | awk -F: "\$6 == \"$HOME\" {print \$1}") 20 | fi 21 | if [ -z "$USER" ] || [ "$USER" = "root" ]; then 22 | USER=$(getent passwd | awk -F: '$3 == "1000" {print $1}') 23 | fi 24 | 25 | INIT="$(ps --no-headers -o comm 1)" 26 | 27 | HOMEDIR="$(getent passwd "$USER" | cut -d: -f6)" 28 | WAYFIRE_FILE="$HOMEDIR/.config/wayfire.ini" 29 | LABWCENV_FILE="$HOMEDIR/.config/labwc/environment" 30 | LABWCAST_FILE="$HOMEDIR/.config/labwc/autostart" 31 | 32 | is_pi () { 33 | ARCH=$(dpkg --print-architecture) 34 | if [ "$ARCH" = "armhf" ] || [ "$ARCH" = "arm64" ] ; then 35 | return 0 36 | else 37 | return 1 38 | fi 39 | } 40 | 41 | is_64bit () { 42 | ARCH=$(dpkg --print-architecture) 43 | if [ "$ARCH" = "arm64" ] ; then 44 | return 0 45 | else 46 | return 1 47 | fi 48 | } 49 | 50 | if is_pi ; then 51 | if [ -e /proc/device-tree/chosen/os_prefix ]; then 52 | PREFIX="$(tr -d '\0' < /proc/device-tree/chosen/os_prefix)" 53 | fi 54 | CMDLINE="/boot${FIRMWARE}/${PREFIX}cmdline.txt" 55 | else 56 | CMDLINE=/proc/cmdline 57 | fi 58 | 59 | # tests for Pi 1, 2 and 0 all test for specific boards... 60 | 61 | is_pione() { 62 | if grep -q "^Revision\s*:\s*00[0-9a-fA-F][0-9a-fA-F]$" /proc/cpuinfo; then 63 | return 0 64 | elif grep -q "^Revision\s*:\s*[ 123][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]0[0-36][0-9a-fA-F]$" /proc/cpuinfo ; then 65 | return 0 66 | else 67 | return 1 68 | fi 69 | } 70 | 71 | is_pitwo() { 72 | grep -q "^Revision\s*:\s*[ 123][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]04[0-9a-fA-F]$" /proc/cpuinfo 73 | return $? 74 | } 75 | 76 | is_pizero() { 77 | grep -q "^Revision\s*:\s*[ 123][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]0[9cC][0-9a-fA-F]$" /proc/cpuinfo 78 | return $? 79 | } 80 | 81 | # ...while tests for Pi 3 and 4 just test processor type, so will also find CM3, CM4, Zero 2 etc. 82 | 83 | is_pithree() { 84 | grep -q "^Revision\s*:\s*[ 123][0-9a-fA-F][0-9a-fA-F]2[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]$" /proc/cpuinfo 85 | return $? 86 | } 87 | 88 | is_pifour() { 89 | grep -q "^Revision\s*:\s*[ 123][0-9a-fA-F][0-9a-fA-F]3[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]$" /proc/cpuinfo 90 | return $? 91 | } 92 | 93 | is_pifive() { 94 | grep -q "^Revision\s*:\s*[ 123][0-9a-fA-F][0-9a-fA-F]4[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]$" /proc/cpuinfo 95 | return $? 96 | } 97 | 98 | is_cmfive() { 99 | grep -q "^Revision\s*:\s*[ 123][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]1[8aA][0-9a-fA-F]$" /proc/cpuinfo 100 | return $? 101 | } 102 | 103 | is_pi500() { 104 | grep -q "^Revision\s*:\s*[ 123][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]19[0-9a-fA-F]$" /proc/cpuinfo 105 | return $? 106 | } 107 | 108 | get_pi_type() { 109 | if is_pione; then 110 | echo 1 111 | elif is_pitwo; then 112 | echo 2 113 | elif is_pithree; then 114 | echo 3 115 | elif is_pifour; then 116 | echo 4 117 | elif is_pifive; then 118 | echo 5 119 | elif is_pizero; then 120 | echo 0 121 | else 122 | echo -1 123 | fi 124 | } 125 | 126 | gpu_has_mmu() { 127 | if is_pifour || is_pifive ; then 128 | return 0 129 | else 130 | return 1 131 | fi 132 | } 133 | 134 | is_live() { 135 | grep -q "boot=live" $CMDLINE 136 | return $? 137 | } 138 | 139 | is_ssh() { 140 | if pstree -p | grep -qE ".*sshd.*\($$\)"; then 141 | return 0 142 | else 143 | return 1 144 | fi 145 | } 146 | 147 | is_kms() { 148 | return 0 149 | } 150 | 151 | is_pulseaudio() { 152 | pgrep pulseaudio > /dev/null || pgrep pipewire-pulse > /dev/null 153 | return $? 154 | } 155 | 156 | is_wayfire() { 157 | pgrep wayfire > /dev/null 158 | return $? 159 | } 160 | 161 | is_labwc() { 162 | pgrep labwc > /dev/null 163 | return $? 164 | } 165 | 166 | is_wayland() { 167 | if is_wayfire; then 168 | return 0 169 | elif is_labwc; then 170 | return 0 171 | else 172 | return 1 173 | fi 174 | } 175 | 176 | has_analog() { 177 | if [ $(get_leds) -eq -1 ] ; then 178 | return 0 179 | else 180 | return 1 181 | fi 182 | } 183 | 184 | is_installed() { 185 | if [ "$(dpkg -l "$1" 2> /dev/null | tail -n 1 | cut -d ' ' -f 1)" != "ii" ]; then 186 | return 1 187 | else 188 | return 0 189 | fi 190 | } 191 | 192 | deb_ver () { 193 | ver=$(cut -d . -f 1 < /etc/debian_version) 194 | echo $ver 195 | } 196 | 197 | get_package_version() { 198 | dpkg-query --showformat='${Version}' --show "$1" 199 | } 200 | 201 | can_configure() { 202 | if [ ! -e /etc/init.d/lightdm ]; then 203 | return 1 204 | fi 205 | if ! is_pi; then 206 | return 0 207 | fi 208 | if [ ! -e /boot${FIRMWARE}/start_x.elf ]; then 209 | return 1 210 | fi 211 | if [ -e $CONFIG ] && grep -q "^device_tree=$" $CONFIG; then 212 | return 1 213 | fi 214 | if ! mountpoint -q /boot${FIRMWARE}; then 215 | return 1 216 | fi 217 | if [ ! -e $CONFIG ]; then 218 | touch $CONFIG 219 | fi 220 | return 0 221 | } 222 | 223 | calc_wt_size() { 224 | # NOTE: it's tempting to redirect stderr to /dev/null, so supress error 225 | # output from tput. However in this case, tput detects neither stdout or 226 | # stderr is a tty and so only gives default 80, 24 values 227 | WT_HEIGHT=18 228 | WT_WIDTH=$(tput cols) 229 | 230 | if [ -z "$WT_WIDTH" ] || [ "$WT_WIDTH" -lt 60 ]; then 231 | WT_WIDTH=80 232 | fi 233 | if [ "$WT_WIDTH" -gt 178 ]; then 234 | WT_WIDTH=120 235 | fi 236 | WT_MENU_HEIGHT=$((WT_HEIGHT - 7)) 237 | } 238 | 239 | do_about() { 240 | whiptail --msgbox "\ 241 | This tool provides a straightforward way of doing initial 242 | configuration of the Raspberry Pi. Although it can be run 243 | at any time, some of the options may have difficulties if 244 | you have heavily customised your installation. 245 | 246 | $(dpkg -s raspi-config 2> /dev/null | grep Version)\ 247 | " 20 70 1 248 | return 0 249 | } 250 | 251 | get_can_expand() { 252 | ROOT_PART="$(findmnt / -o source -n)" 253 | ROOT_DEV="/dev/$(lsblk -no pkname "$ROOT_PART")" 254 | 255 | PART_NUM="$(echo "$ROOT_PART" | grep -o "[[:digit:]]*$")" 256 | 257 | if [ "$PART_NUM" -ne 2 ]; then 258 | echo 1 259 | exit 260 | fi 261 | 262 | LAST_PART_NUM=$(parted "$ROOT_DEV" -ms unit s p | tail -n 1 | cut -f 1 -d:) 263 | if [ "$LAST_PART_NUM" -ne "$PART_NUM" ]; then 264 | echo 1 265 | exit 266 | fi 267 | echo 0 268 | } 269 | 270 | do_expand_rootfs() { 271 | ROOT_PART="$(findmnt / -o source -n)" 272 | ROOT_DEV="/dev/$(lsblk -no pkname "$ROOT_PART")" 273 | 274 | PART_NUM="$(echo "$ROOT_PART" | grep -o "[[:digit:]]*$")" 275 | 276 | LAST_PART_NUM=$(parted "$ROOT_DEV" -ms unit s p | tail -n 1 | cut -f 1 -d:) 277 | if [ "$LAST_PART_NUM" -ne "$PART_NUM" ]; then 278 | whiptail --msgbox "$ROOT_PART is not the last partition. Don't know how to expand" 20 60 2 279 | return 0 280 | fi 281 | 282 | # Get the starting offset of the root partition 283 | PART_START=$(parted "$ROOT_DEV" -ms unit s p | grep "^${PART_NUM}" | cut -f 2 -d: | sed 's/[^0-9]//g') 284 | [ "$PART_START" ] || return 1 285 | # Return value will likely be error for fdisk as it fails to reload the 286 | # partition table because the root fs is mounted 287 | fdisk "$ROOT_DEV" < /etc/init.d/resize2fs_once && 303 | #!/bin/sh 304 | ### BEGIN INIT INFO 305 | # Provides: resize2fs_once 306 | # Required-Start: 307 | # Required-Stop: 308 | # Default-Start: 3 309 | # Default-Stop: 310 | # Short-Description: Resize the root filesystem to fill partition 311 | # Description: 312 | ### END INIT INFO 313 | 314 | . /lib/lsb/init-functions 315 | 316 | case "\$1" in 317 | start) 318 | log_daemon_msg "Starting resize2fs_once" && 319 | resize2fs "$ROOT_PART" && 320 | update-rc.d resize2fs_once remove && 321 | rm /etc/init.d/resize2fs_once && 322 | log_end_msg \$? 323 | ;; 324 | *) 325 | echo "Usage: \$0 start" >&2 326 | exit 3 327 | ;; 328 | esac 329 | EOF 330 | chmod +x /etc/init.d/resize2fs_once && 331 | update-rc.d resize2fs_once defaults && 332 | if [ "$INTERACTIVE" = True ]; then 333 | whiptail --msgbox "Root partition has been resized.\nThe filesystem will be enlarged upon the next reboot" 20 60 2 334 | fi 335 | } 336 | 337 | set_config_var() { 338 | lua - "$1" "$2" "$3" < "$3.bak" 339 | local key=assert(arg[1]) 340 | local value=assert(arg[2]) 341 | local fn=assert(arg[3]) 342 | local file=assert(io.open(fn)) 343 | local made_change=false 344 | for line in file:lines() do 345 | if line:match("^#?%s*"..key.."=.*$") then 346 | line=key.."="..value 347 | made_change=true 348 | end 349 | print(line) 350 | end 351 | 352 | if not made_change then 353 | print(key.."="..value) 354 | end 355 | EOF 356 | mv "$3.bak" "$3" 357 | } 358 | 359 | clear_config_var() { 360 | lua - "$1" "$2" < "$2.bak" 361 | local key=assert(arg[1]) 362 | local fn=assert(arg[2]) 363 | local file=assert(io.open(fn)) 364 | for line in file:lines() do 365 | if line:match("^%s*"..key.."=.*$") then 366 | line="#"..line 367 | end 368 | print(line) 369 | end 370 | EOF 371 | mv "$2.bak" "$2" 372 | } 373 | 374 | get_config_var() { 375 | lua - "$1" "$2" < /dev/null | grep margin | rev | cut -d ' ' -f 1 | rev) 442 | if [ -z $RES ] ; then 443 | echo 1 444 | elif [ $RES -eq 0 ] ; then 445 | echo 1 446 | else 447 | echo 0 448 | fi 449 | } 450 | 451 | do_overscan_kms() { 452 | if [ "$INTERACTIVE" = True ]; then 453 | NDEVS=$(xrandr -q | grep -c connected) 454 | if [ $NDEVS -gt 1 ] ; then 455 | DEV=$(whiptail --menu "Select the output for which overscan compensation is to be set" 20 60 10 "1" "HDMI-1" "2" "HDMI-2" 3>&1 1>&2 2>&3) 456 | if [ $? -eq 1 ] ; then 457 | return 458 | fi 459 | else 460 | DEV=1 461 | fi 462 | if [ $(get_overscan_kms $DEV) -eq 1 ]; then 463 | DEFAULT=--defaultno 464 | else 465 | DEFAULT= 466 | fi 467 | if whiptail --yesno "Would you like to enable overscan compensation for HDMI-$DEV?" $DEFAULT 20 60 2 ; then 468 | PIX=16 469 | STATUS="enabled" 470 | else 471 | PIX=0 472 | STATUS="disabled" 473 | fi 474 | else 475 | DEV=$1 476 | if [ $2 -eq 1 ] ; then 477 | PIX=0 478 | else 479 | PIX=16 480 | fi 481 | fi 482 | xrandr --output HDMI-$DEV --set "left margin" $PIX --set "right margin" $PIX --set "top margin" $PIX --set "bottom margin" $PIX 483 | # hack to force reload when not using mutter 484 | if ! pgrep mutter > /dev/null ; then 485 | xrandr --output HDMI-$DEV --reflect x 486 | xrandr --output HDMI-$DEV --reflect normal 487 | fi 488 | sed $CONFIG -i -e "s/^overscan_/#overscan_/" 489 | set_config_var disable_overscan 1 $CONFIG 490 | if [ -e /usr/share/ovscsetup.sh ] ; then 491 | if grep "HDMI-$DEV" /usr/share/ovscsetup.sh 2> /dev/null | grep -q margin ; then 492 | sed /usr/share/ovscsetup.sh -i -e "s/xrandr --output HDMI-$DEV.*margin.*/xrandr --output HDMI-$DEV --set \"left margin\" $PIX --set \"right margin\" $PIX --set \"top margin\" $PIX --set \"bottom margin\" $PIX/" 493 | else 494 | echo "xrandr --output HDMI-$DEV --set \"left margin\" $PIX --set \"right margin\" $PIX --set \"top margin\" $PIX --set \"bottom margin\" $PIX" >> /usr/share/ovscsetup.sh 495 | fi 496 | else 497 | echo "#!/bin/sh" > /usr/share/ovscsetup.sh 498 | echo "xrandr --output HDMI-$DEV --set \"left margin\" $PIX --set \"right margin\" $PIX --set \"top margin\" $PIX --set \"bottom margin\" $PIX" >> /usr/share/ovscsetup.sh 499 | fi 500 | if ! grep -q ovscsetup /usr/share/dispsetup.sh 2> /dev/null ; then 501 | sed /usr/share/dispsetup.sh -i -e "s#exit#if [ -e /usr/share/ovscsetup.sh ] ; then\n. /usr/share/ovscsetup.sh\nfi\nexit#" 502 | fi 503 | if [ "$INTERACTIVE" = True ]; then 504 | whiptail --msgbox "Display overscan compensation for HDMI-$DEV is $STATUS" 20 60 1 505 | fi 506 | } 507 | 508 | get_blanking() { 509 | if is_wayfire; then 510 | if ! grep -q dpms_timeout $WAYFIRE_FILE ; then 511 | echo 1 512 | elif ! grep -q "dpms_timeout.*-1" $WAYFIRE_FILE ; then 513 | echo 0 514 | else 515 | echo 1 516 | fi 517 | elif is_labwc; then 518 | if [ -e $LABWCAST_FILE ] && grep -q swayidle $LABWCAST_FILE ; then 519 | echo 0 520 | else 521 | echo 1 522 | fi 523 | else 524 | if ! [ -f "/etc/X11/xorg.conf.d/10-blanking.conf" ]; then 525 | echo 0 526 | else 527 | echo 1 528 | fi 529 | fi 530 | } 531 | 532 | do_blanking() { 533 | DEFAULT=--defaultno 534 | CURRENT=0 535 | if [ "$(get_blanking)" -eq 0 ]; then 536 | DEFAULT= 537 | CURRENT=1 538 | fi 539 | if is_wayfire; then 540 | if [ "$INTERACTIVE" = True ]; then 541 | whiptail --yesno "Would you like to enable screen blanking?" $DEFAULT 20 60 2 542 | RET=$? 543 | else 544 | RET=$1 545 | fi 546 | if [ "$RET" -eq 0 ] ; then 547 | if grep -q dpms_timeout $WAYFIRE_FILE ; then 548 | sed -i 's/dpms_timeout.*/dpms_timeout=600/' $WAYFIRE_FILE 549 | else 550 | if grep -q "\[idle\]" $WAYFIRE_FILE ; then 551 | sed -i 's/\[idle]/[idle]\ndpms_timeout=600/' $WAYFIRE_FILE 552 | else 553 | echo '\n[idle]\ndpms_timeout=600' >> $WAYFIRE_FILE 554 | chown $USER:$USER $WAYFIRE_FILE 555 | fi 556 | fi 557 | STATUS=enabled 558 | elif [ "$RET" -eq 1 ]; then 559 | if grep -q dpms_timeout $WAYFIRE_FILE ; then 560 | sed -i 's/dpms_timeout.*/dpms_timeout=-1/' $WAYFIRE_FILE 561 | else 562 | if grep -q "\[idle\]" $WAYFIRE_FILE ; then 563 | sed -i 's/\[idle]/[idle]\ndpms_timeout=-1/' $WAYFIRE_FILE 564 | else 565 | echo '\n[idle]\ndpms_timeout=-1' >> $WAYFIRE_FILE 566 | chown $USER:$USER $WAYFIRE_FILE 567 | fi 568 | fi 569 | STATUS=disabled 570 | else 571 | return "$RET" 572 | fi 573 | elif is_labwc; then 574 | if [ "$INTERACTIVE" = True ]; then 575 | whiptail --yesno "Would you like to enable screen blanking?" $DEFAULT 20 60 2 576 | RET=$? 577 | else 578 | RET=$1 579 | fi 580 | if [ "$RET" -eq "$CURRENT" ]; then 581 | ASK_TO_REBOOT=1 582 | fi 583 | ensure_user_conf_dir 584 | mkdir -p "$HOMEDIR/.config/labwc/" 585 | chown -R $USER:$USER "$HOMEDIR/.config/labwc/" 586 | if [ "$RET" -eq 0 ] ; then 587 | echo "swayidle -w timeout 600 'wlopm --off \\*' resume 'wlopm --on \\*' &" >> $LABWCAST_FILE 588 | chown $USER:$USER $LABWCAST_FILE 589 | STATUS=enabled 590 | elif [ "$RET" -eq 1 ]; then 591 | if [ -e $LABWCAST_FILE ] ; then 592 | sed -i '/swayidle/d' $LABWCAST_FILE 593 | fi 594 | STATUS=disabled 595 | else 596 | return "$RET" 597 | fi 598 | else 599 | if [ "$INTERACTIVE" = True ]; then 600 | if [ "$(dpkg -l xscreensaver | tail -n 1 | cut -d ' ' -f 1)" = "ii" ]; then 601 | whiptail --msgbox "Warning: xscreensaver is installed and may override raspi-config settings" 20 60 2 602 | fi 603 | whiptail --yesno "Would you like to enable screen blanking?" $DEFAULT 20 60 2 604 | RET=$? 605 | else 606 | RET=$1 607 | fi 608 | if [ "$RET" -eq "$CURRENT" ]; then 609 | ASK_TO_REBOOT=1 610 | fi 611 | rm -f /etc/X11/xorg.conf.d/10-blanking.conf 612 | sed -i '/^\o033/d' /etc/issue 613 | if [ "$RET" -eq 0 ] ; then 614 | STATUS=enabled 615 | elif [ "$RET" -eq 1 ]; then 616 | mkdir -p /etc/X11/xorg.conf.d/ 617 | cp /usr/share/raspi-config/10-blanking.conf /etc/X11/xorg.conf.d/ 618 | printf "\\033[9;0]" >> /etc/issue 619 | STATUS=disabled 620 | else 621 | return "$RET" 622 | fi 623 | fi 624 | if [ "$INTERACTIVE" = True ]; then 625 | whiptail --msgbox "Screen blanking is $STATUS" 20 60 1 626 | fi 627 | } 628 | 629 | do_change_pass() { 630 | whiptail --msgbox "You will now be asked to enter a new password for the $USER user" 20 60 1 631 | passwd $USER && 632 | whiptail --msgbox "Password changed successfully" 20 60 1 633 | } 634 | 635 | update_wayfire_keyboard() { 636 | if ! is_wayfire ; then 637 | return 638 | fi 639 | MODEL=$(grep XKBMODEL /etc/default/keyboard | cut -d= -f2 | tr -d '"') 640 | LAYOUT=$(grep XKBLAYOUT /etc/default/keyboard | cut -d= -f2 | tr -d '"') 641 | VARIANT=$(grep XKBVARIANT /etc/default/keyboard | cut -d= -f2 | tr -d '"') 642 | OPTIONS=$(grep XKBOPTIONS /etc/default/keyboard | cut -d= -f2 | tr -d '"') 643 | UFILE=$WAYFIRE_FILE 644 | if [ ! -e $UFILE ] && [ -e /etc/wayfire/template.ini ] ; then 645 | CONFIG_DIR="$(dirname "$UFILE")" 646 | if ! [ -d "$CONFIG_DIR" ]; then 647 | install -o "$USER" -g "$USER" -d "$CONFIG_DIR" 648 | fi 649 | cp /etc/wayfire/template.ini $UFILE 650 | chown $USER:$USER $UFILE 651 | fi 652 | if [ -e $UFILE ] ; then 653 | grep -q "\\[input\\]" $UFILE || printf "\n[input]" >> $UFILE 654 | if grep -q xkb_model $UFILE ; then sed -i s/xkb_model.*/xkb_model=$MODEL/ $UFILE ; else sed -i s/\\[input\\]/[input]\\nxkb_model=$MODEL/ $UFILE ; fi 655 | if grep -q xkb_layout $UFILE ; then sed -i s/xkb_layout.*/xkb_layout=$LAYOUT/ $UFILE ; else sed -i s/\\[input\\]/[input]\\nxkb_layout=$LAYOUT/ $UFILE ; fi 656 | if grep -q xkb_variant $UFILE ; then sed -i s/xkb_variant.*/xkb_variant=$VARIANT/ $UFILE ; else sed -i s/\\[input\\]/[input]\\nxkb_variant=$VARIANT/ $UFILE ; fi 657 | if grep -q xkb_options $UFILE ; then sed -i s/xkb_options.*/xkb_options=$OPTIONS/ $UFILE ; else sed -i s/\\[input\\]/[input]\\nxkb_options=$OPTIONS/ $UFILE ; fi 658 | fi 659 | UFILE="/usr/share/greeter.ini" 660 | if [ ! -e $UFILE ] && [ -e /etc/wayfire/gtemplate.ini ] ; then 661 | cp /etc/wayfire/gtemplate.ini $UFILE 662 | fi 663 | if [ -e $UFILE ] ; then 664 | grep -q "\\[input\\]" $UFILE || printf "\n[input]" >> $UFILE 665 | if grep -q xkb_model $UFILE ; then sed -i s/xkb_model.*/xkb_model=$MODEL/ $UFILE ; else sed -i s/\\[input\\]/[input]\\nxkb_model=$MODEL/ $UFILE ; fi 666 | if grep -q xkb_layout $UFILE ; then sed -i s/xkb_layout.*/xkb_layout=$LAYOUT/ $UFILE ; else sed -i s/\\[input\\]/[input]\\nxkb_layout=$LAYOUT/ $UFILE ; fi 667 | if grep -q xkb_variant $UFILE ; then sed -i s/xkb_variant.*/xkb_variant=$VARIANT/ $UFILE ; else sed -i s/\\[input\\]/[input]\\nxkb_variant=$VARIANT/ $UFILE ; fi 668 | if grep -q xkb_options $UFILE ; then sed -i s/xkb_options.*/xkb_options=$OPTIONS/ $UFILE ; else sed -i s/\\[input\\]/[input]\\nxkb_options=$OPTIONS/ $UFILE ; fi 669 | fi 670 | } 671 | 672 | update_labwc_keyboard() { 673 | MODEL=$(grep XKBMODEL /etc/default/keyboard | cut -d= -f2 | tr -d '"') 674 | LAYOUT=$(grep XKBLAYOUT /etc/default/keyboard | cut -d= -f2 | tr -d '"') 675 | VARIANT=$(grep XKBVARIANT /etc/default/keyboard | cut -d= -f2 | tr -d '"') 676 | OPTIONS=$(grep XKBOPTIONS /etc/default/keyboard | cut -d= -f2 | tr -d '"') 677 | UFILE=$LABWCENV_FILE 678 | ensure_user_conf_dir 679 | mkdir -p "$HOMEDIR/.config/labwc/" 680 | chown -R $USER:$USER "$HOMEDIR/.config/labwc/" 681 | if [ -e $UFILE ] ; then 682 | if grep -q XKB_DEFAULT_MODEL $UFILE ; then sed -i s/XKB_DEFAULT_MODEL.*/XKB_DEFAULT_MODEL=$MODEL/ $UFILE ; else echo XKB_DEFAULT_MODEL=$MODEL >> $UFILE ; fi 683 | if grep -q XKB_DEFAULT_LAYOUT $UFILE ; then sed -i s/XKB_DEFAULT_LAYOUT.*/XKB_DEFAULT_LAYOUT=$LAYOUT/ $UFILE ; else echo XKB_DEFAULT_LAYOUT=$LAYOUT >> $UFILE ; fi 684 | if grep -q XKB_DEFAULT_VARIANT $UFILE ; then sed -i s/XKB_DEFAULT_VARIANT.*/XKB_DEFAULT_VARIANT=$VARIANT/ $UFILE ; else echo XKB_DEFAULT_VARIANT=$VARIANT >> $UFILE ; fi 685 | if grep -q XKB_DEFAULT_OPTIONS $UFILE ; then sed -i s/XKB_DEFAULT_OPTIONS.*/XKB_DEFAULT_OPTIONS=$OPTIONS/ $UFILE ; else echo XKB_DEFAULT_OPTIONS=$OPTIONS >> $UFILE ; fi 686 | else 687 | echo XKB_DEFAULT_MODEL=$MODEL >> $UFILE 688 | echo XKB_DEFAULT_LAYOUT=$LAYOUT >> $UFILE 689 | echo XKB_DEFAULT_VARIANT=$VARIANT >> $UFILE 690 | echo XKB_DEFAULT_OPTIONS=$OPTIONS >> $UFILE 691 | fi 692 | chown $USER:$USER $UFILE 693 | UFILE="/etc/xdg/labwc-greeter/environment" 694 | if [ ! -e $UFILE ] ; then 695 | UFILE="/usr/share/labwc/environment" 696 | fi 697 | if [ -e $UFILE ] ; then 698 | if grep -q XKB_DEFAULT_MODEL $UFILE ; then sed -i s/XKB_DEFAULT_MODEL.*/XKB_DEFAULT_MODEL=$MODEL/ $UFILE ; else echo XKB_DEFAULT_MODEL=$MODEL >> $UFILE ; fi 699 | if grep -q XKB_DEFAULT_LAYOUT $UFILE ; then sed -i s/XKB_DEFAULT_LAYOUT.*/XKB_DEFAULT_LAYOUT=$LAYOUT/ $UFILE ; else echo XKB_DEFAULT_LAYOUT=$LAYOUT >> $UFILE ; fi 700 | if grep -q XKB_DEFAULT_VARIANT $UFILE ; then sed -i s/XKB_DEFAULT_VARIANT.*/XKB_DEFAULT_VARIANT=$VARIANT/ $UFILE ; else echo XKB_DEFAULT_VARIANT=$VARIANT >> $UFILE ; fi 701 | if grep -q XKB_DEFAULT_OPTIONS $UFILE ; then sed -i s/XKB_DEFAULT_OPTIONS.*/XKB_DEFAULT_OPTIONS=$OPTIONS/ $UFILE ; else echo XKB_DEFAULT_OPTIONS=$OPTIONS >> $UFILE ; fi 702 | fi 703 | if is_labwc ; then 704 | kill -HUP `pgrep -x labwc` # does the equivalent of labwc --reconfigure, but works as sudo... 705 | fi 706 | } 707 | 708 | update_squeekboard() { 709 | PREFIX="" 710 | if [ -n "$SUDO_USER" ] ; then 711 | PREFIX="sudo -u $USER XDG_RUNTIME_DIR=/run/user/$SUDO_UID DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$SUDO_UID/bus " 712 | fi 713 | LAYOUT1=$(grep XKBLAYOUT /etc/default/keyboard | cut -d= -f2 | tr -d '"' | cut -d, -f1) 714 | VARIANT1=$(grep XKBVARIANT /etc/default/keyboard | cut -d= -f2 | tr -d '"' | cut -d, -f1) 715 | LAYOUT2=$(grep XKBLAYOUT /etc/default/keyboard | cut -d= -f2 | tr -d '"' | cut -d, -f2 -s) 716 | VARIANT2=$(grep XKBVARIANT /etc/default/keyboard | cut -d= -f2 | tr -d '"' | cut -d, -f2 -s) 717 | GSET="[('xkb', '$LAYOUT1" 718 | if [ -z "$VARIANT1" ] ; then 719 | GSET=$GSET"')" 720 | else 721 | GSET=$GSET"+$VARIANT1')" 722 | fi 723 | if ! [ -z "$LAYOUT2" ] ; then 724 | GSET=$GSET", ('xkb', '$LAYOUT2" 725 | if [ -z "$VARIANT2" ] ; then 726 | GSET=$GSET"')" 727 | else 728 | GSET=$GSET"+$VARIANT2')" 729 | fi 730 | fi 731 | GSET=$GSET"]" 732 | if ! [ -e /etc/dconf/profile/user ] ; then 733 | mkdir -p "/etc/dconf/profile/" 734 | echo "user-db:user\nsystem-db:local" >> /etc/dconf/profile/user 735 | fi 736 | FILE=/etc/dconf/db/local.d/00_keyboard 737 | if [ -e $FILE ] ; then 738 | if grep -q "^sources" $FILE ; then 739 | sed $FILE -i -e "s/^sources=.*/sources=$GSET/" 740 | else 741 | if grep -q "\[org/gnome/desktop/input-sources\]" $FILE ; then 742 | sed $FILE -i -e "s#\[org/gnome/desktop/input-sources\]#\[org/gnome/desktop/input-sources\]\nsources=$GSET#" 743 | else 744 | echo "[org/gnome/desktop/input-sources]\nsources=$GSET" >> $FILE 745 | fi 746 | fi 747 | else 748 | mkdir -p "/etc/dconf/db/local.d/" 749 | echo "[org/gnome/desktop/input-sources]\nsources=$GSET" > $FILE 750 | fi 751 | dconf update 752 | if [ "$1" = restart ] ; then 753 | if pgrep squeekboard > /dev/null ; then 754 | pkill squeekboard 755 | $PREFIX squeekboard > /dev/null 2> /dev/null & 756 | fi 757 | fi 758 | } 759 | 760 | do_configure_keyboard() { 761 | printf "Reloading keymap. This may take a short while\n" 762 | rm -f /etc/console-setup/cached_* 763 | if [ "$INTERACTIVE" = True ]; then 764 | dpkg-reconfigure keyboard-configuration 765 | else 766 | KEYMAP="$1" 767 | sed -i /etc/default/keyboard -e "s/^XKBLAYOUT.*/XKBLAYOUT=\"$KEYMAP\"/" 768 | dpkg-reconfigure -f noninteractive keyboard-configuration 769 | fi 770 | update_wayfire_keyboard 771 | update_labwc_keyboard 772 | update_squeekboard restart 773 | if [ "$INIT" = "systemd" ]; then 774 | systemctl restart keyboard-setup 775 | fi 776 | setsid sh -c 'exec setupcon --save -k --force <> /dev/tty1 >&0 2>&1' 777 | udevadm trigger --subsystem-match=input --action=change 778 | return 0 779 | } 780 | 781 | do_change_keyboard_rc_gui () { 782 | grep -q XKBMODEL /etc/default/keyboard && sed -i "s/XKBMODEL=.*/XKBMODEL=\"$1\"/g" /etc/default/keyboard || echo "XKBMODEL=\"$1\"" >> /etc/default/keyboard 783 | grep -q XKBLAYOUT /etc/default/keyboard && sed -i "s/XKBLAYOUT=.*/XKBLAYOUT=\"$2\"/g" /etc/default/keyboard || echo "XKBLAYOUT=\"$2\"" >> /etc/default/keyboard 784 | grep -q XKBVARIANT /etc/default/keyboard && sed -i "s/XKBVARIANT=.*/XKBVARIANT=\"$3\"/g" /etc/default/keyboard || echo "XKBVARIANT=\"$3\"" >> /etc/default/keyboard 785 | grep -q XKBOPTIONS /etc/default/keyboard && sed -i "s/XKBOPTIONS=.*/XKBOPTIONS=\"$4\"/g" /etc/default/keyboard || echo "XKBOPTIONS=\"$4\"" >> /etc/default/keyboard 786 | update_wayfire_keyboard 787 | update_labwc_keyboard 788 | update_squeekboard restart 789 | if ! is_wayland ; then 790 | invoke-rc.d keyboard-setup start 791 | fi 792 | setsid sh -c 'exec setupcon -k --force <> /dev/tty1 >&0 2>&1' 793 | if ! is_wayland ; then 794 | udevadm trigger --subsystem-match=input --action=change 795 | udevadm settle 796 | KBSTR="-model $1 -layout $2" 797 | if [ -n "$3" ] ; then 798 | KBSTR="$KBSTR -variant $3" 799 | fi 800 | if [ -n "$4" ] ; then 801 | KBSTR="$KBSTR -option -option $4" 802 | fi 803 | setxkbmap "$KBSTR" 804 | fi 805 | } 806 | 807 | do_change_locale() { 808 | if [ "$INTERACTIVE" = True ]; then 809 | dpkg-reconfigure locales 810 | else 811 | if ! LOCALE_LINE="$(grep -E "^$1( |$)" /usr/share/i18n/SUPPORTED)"; then 812 | return 1 813 | fi 814 | export LC_ALL=C 815 | export LANG=C 816 | LG="/etc/locale.gen" 817 | NEW_LANG="$(echo $LOCALE_LINE | cut -f1 -d " ")" 818 | [ -L "$LG" ] && [ "$(readlink $LG)" = "/usr/share/i18n/SUPPORTED" ] && rm -f "$LG" 819 | echo "$LOCALE_LINE" > /etc/locale.gen 820 | update-locale --no-checks LANG 821 | update-locale --no-checks "LANG=$NEW_LANG" 822 | dpkg-reconfigure -f noninteractive locales 823 | fi 824 | } 825 | 826 | do_change_locale_rc_gui() { 827 | sed -i "s/^\([^#].*\)/# \1/g" /etc/locale.gen 828 | if grep -q "$1 " /etc/locale.gen ; then 829 | LOC="$1" 830 | else 831 | LOC="$1.UTF-8" 832 | fi 833 | sed -i "s/^# \($LOC\s\)/\1/g" /etc/locale.gen 834 | locale-gen 835 | LC_ALL=$LOC LANG=$LOC LANGUAGE=$LOC update-locale LANG=$LOC LC_ALL=$LOC LANGUAGE=$LOC 836 | } 837 | 838 | do_change_timezone() { 839 | if [ "$INTERACTIVE" = True ]; then 840 | dpkg-reconfigure tzdata 841 | else 842 | TIMEZONE="$1" 843 | if [ ! -f "/usr/share/zoneinfo/$TIMEZONE" ]; then 844 | return 1; 845 | fi 846 | rm /etc/localtime 847 | echo "$TIMEZONE" > /etc/timezone 848 | dpkg-reconfigure -f noninteractive tzdata 2> /dev/null 849 | fi 850 | } 851 | 852 | do_change_timezone_rc_gui() { 853 | echo $1 | tee /etc/timezone 854 | rm /etc/localtime 855 | dpkg-reconfigure --frontend noninteractive tzdata 856 | } 857 | 858 | get_wifi_country() { 859 | CODE=${1:-0} 860 | if is_installed crda && [ -e /etc/default/crda ]; then 861 | . /etc/default/crda 862 | elif grep -q "cfg80211.ieee80211_regdom=" "$CMDLINE"; then 863 | REGDOMAIN="$(sed -n 's/.*cfg80211.ieee80211_regdom=\(\S*\).*/\1/p' "$CMDLINE")" 864 | elif systemctl -q is-active dhcpcd; then 865 | REGDOMAIN="$(wpa_cli get country | tail -n 1)" 866 | else 867 | REGDOMAIN="$(iw reg get | sed -n "0,/country/s/^country \(.\+\):.*$/\1/p")" 868 | fi 869 | if [ -z "$REGDOMAIN" ] \ 870 | || ! grep -q "^${REGDOMAIN}[[:space:]]" /usr/share/zoneinfo/iso3166.tab; then 871 | return 1 872 | fi 873 | if [ "$CODE" = 0 ]; then 874 | echo "$REGDOMAIN" 875 | fi 876 | return 0 877 | } 878 | 879 | do_wifi_country() { 880 | if [ "$INTERACTIVE" = True ]; then 881 | value=$(sed '/^#/d' /usr/share/zoneinfo/iso3166.tab | tr '\t\n' '/') 882 | oIFS="$IFS" 883 | IFS="/" 884 | #shellcheck disable=2086 885 | REGDOMAIN=$(whiptail --menu "Select the country in which the Pi is to be used" 20 60 10 ${value} 3>&1 1>&2 2>&3) 886 | IFS="$oIFS" 887 | else 888 | REGDOMAIN=$1 889 | fi 890 | if ! grep -q "^${REGDOMAIN}[[:space:]]" /usr/share/zoneinfo/iso3166.tab; then 891 | if [ "$INTERACTIVE" = True ]; then 892 | whiptail --msgbox "$REGDOMAIN is not a valid ISO/IEC 3166-1 alpha2 code" 20 60 893 | fi 894 | return 1 895 | fi 896 | sed -i \ 897 | -e "s/\s*cfg80211.ieee80211_regdom=\S*//" \ 898 | -e "s/\(.*\)/\1 cfg80211.ieee80211_regdom=$REGDOMAIN/" \ 899 | "$CMDLINE" 900 | if is_installed crda && [ -e /etc/default/crda ]; then 901 | # This mechanism has been removed from Bookworm and should no longer be used 902 | rm -f /etc/default/crda 903 | fi 904 | if ! ischroot; then 905 | iw reg set "$REGDOMAIN" 906 | fi 907 | 908 | IFACE="$(list_wlan_interfaces | head -n 1)" 909 | if [ "$INIT" = "systemd" ] && [ -n "$IFACE" ] && systemctl -q is-active dhcpcd; then 910 | wpa_cli -i "$IFACE" set country "$REGDOMAIN" > /dev/null 2>&1 911 | wpa_cli -i "$IFACE" save_config > /dev/null 2>&1 912 | fi 913 | 914 | if [ "$INIT" = "systemd" ] && ! ischroot && systemctl -q is-active NetworkManager; then 915 | nmcli radio wifi on 916 | elif hash rfkill 2> /dev/null; then 917 | rfkill unblock wifi 918 | if [ -f /var/lib/NetworkManager/NetworkManager.state ]; then 919 | sed -i 's/^WirelessEnabled=.*/WirelessEnabled=true/' /var/lib/NetworkManager/NetworkManager.state 920 | fi 921 | fi 922 | if is_pi; then 923 | for filename in /var/lib/systemd/rfkill/*:wlan ; do 924 | if ! [ -e "$filename" ]; then 925 | continue 926 | fi 927 | echo 0 > "$filename" 928 | done 929 | fi 930 | if [ "$INTERACTIVE" = True ]; then 931 | whiptail --msgbox "Wireless LAN country set to $REGDOMAIN" 20 60 1 932 | fi 933 | if ! ischroot && pgrep wf-panel-pi > /dev/null; then 934 | wfpanelctl netman cset 935 | fi 936 | if ! ischroot && pgrep lxpanel > /dev/null; then 937 | lxpanelctl command netman cset 938 | fi 939 | } 940 | 941 | get_hostname() { 942 | tr -d " \t\n\r" < /etc/hostname 943 | } 944 | 945 | do_hostname() { 946 | if [ "$INTERACTIVE" = True ]; then 947 | whiptail --msgbox "\ 948 | Please note: RFCs mandate that a hostname's labels \ 949 | may contain only the ASCII letters 'a' through 'z' (case-insensitive), 950 | the digits '0' through '9', and the hyphen. 951 | Hostname labels cannot begin or end with a hyphen. 952 | No other symbols, punctuation characters, or blank spaces are permitted.\ 953 | " 20 70 1 954 | fi 955 | CURRENT_HOSTNAME=$(get_hostname) 956 | if [ "$INTERACTIVE" = True ]; then 957 | NEW_HOSTNAME=$(whiptail --inputbox "Please enter a hostname" 20 60 "$CURRENT_HOSTNAME" 3>&1 1>&2 2>&3) 958 | else 959 | NEW_HOSTNAME="$1" 960 | true 961 | fi 962 | if [ $? -eq 0 ]; then 963 | if [ "$INIT" = "systemd" ] && systemctl -q is-active dbus && ! ischroot; then 964 | hostnamectl set-hostname "$NEW_HOSTNAME" 2> /dev/null 965 | else 966 | echo "$NEW_HOSTNAME" > /etc/hostname 967 | fi 968 | sed -i "s/127\.0\.1\.1.*$CURRENT_HOSTNAME/127.0.1.1\t$NEW_HOSTNAME/g" /etc/hosts 969 | ASK_TO_REBOOT=1 970 | fi 971 | } 972 | 973 | do_overclock() { 974 | if ! is_pione && ! is_pitwo; then 975 | whiptail --msgbox "Only Pi 1 or Pi 2 can be overclocked with this tool." 20 60 2 976 | return 1 977 | fi 978 | if [ "$INTERACTIVE" = True ]; then 979 | whiptail --msgbox "\ 980 | Be aware that overclocking may reduce the lifetime of your 981 | Raspberry Pi. If overclocking at a certain level causes 982 | system instability, try a more modest overclock. Hold down 983 | shift during boot to temporarily disable overclock. 984 | See https://www.raspberrypi.org/documentation/configuration/config-txt/overclocking.md for more information.\ 985 | " 20 70 1 986 | if is_pione; then 987 | OVERCLOCK=$(whiptail --menu "Choose overclock preset" 20 60 10 \ 988 | "None" "700MHz ARM, 250MHz core, 400MHz SDRAM, 0 overvolt" \ 989 | "Modest" "800MHz ARM, 250MHz core, 400MHz SDRAM, 0 overvolt" \ 990 | "Medium" "900MHz ARM, 250MHz core, 450MHz SDRAM, 2 overvolt" \ 991 | "High" "950MHz ARM, 250MHz core, 450MHz SDRAM, 6 overvolt" \ 992 | "Turbo" "1000MHz ARM, 500MHz core, 600MHz SDRAM, 6 overvolt" \ 993 | 3>&1 1>&2 2>&3) 994 | elif is_pitwo; then 995 | OVERCLOCK=$(whiptail --menu "Choose overclock preset" 20 60 10 \ 996 | "None" "900MHz ARM, 250MHz core, 450MHz SDRAM, 0 overvolt" \ 997 | "High" "1000MHz ARM, 500MHz core, 500MHz SDRAM, 2 overvolt" \ 998 | 3>&1 1>&2 2>&3) 999 | fi 1000 | else 1001 | OVERCLOCK=$1 1002 | true 1003 | fi 1004 | if [ $? -eq 0 ]; then 1005 | case "$OVERCLOCK" in 1006 | None) 1007 | clear_overclock 1008 | ;; 1009 | Modest) 1010 | set_overclock Modest 800 250 400 0 1011 | ;; 1012 | Medium) 1013 | set_overclock Medium 900 250 450 2 1014 | ;; 1015 | High) 1016 | if is_pione; then 1017 | set_overclock High 950 250 450 6 1018 | else 1019 | set_overclock High 1000 500 500 2 1020 | fi 1021 | ;; 1022 | Turbo) 1023 | set_overclock Turbo 1000 500 600 6 1024 | ;; 1025 | *) 1026 | whiptail --msgbox "Programmer error, unrecognised overclock preset" 20 60 2 1027 | return 1 1028 | ;; 1029 | esac 1030 | ASK_TO_REBOOT=1 1031 | fi 1032 | } 1033 | 1034 | set_overclock() { 1035 | set_config_var arm_freq $2 $CONFIG && 1036 | set_config_var core_freq $3 $CONFIG && 1037 | set_config_var sdram_freq $4 $CONFIG && 1038 | set_config_var over_voltage $5 $CONFIG && 1039 | if [ "$INTERACTIVE" = True ]; then 1040 | whiptail --msgbox "Set overclock to preset '$1'" 20 60 2 1041 | fi 1042 | } 1043 | 1044 | clear_overclock () { 1045 | clear_config_var arm_freq $CONFIG && 1046 | clear_config_var core_freq $CONFIG && 1047 | clear_config_var sdram_freq $CONFIG && 1048 | clear_config_var over_voltage $CONFIG && 1049 | if [ "$INTERACTIVE" = True ]; then 1050 | whiptail --msgbox "Set overclock to preset 'None'" 20 60 2 1051 | fi 1052 | } 1053 | 1054 | get_ssh() { 1055 | if service ssh status | grep -q inactive; then 1056 | echo 1 1057 | else 1058 | echo 0 1059 | fi 1060 | } 1061 | 1062 | do_ssh() { 1063 | if [ -e /var/log/regen_ssh_keys.log ] && ! grep -q "^finished" /var/log/regen_ssh_keys.log; then 1064 | whiptail --msgbox "Initial ssh key generation still running. Please wait and try again." 20 60 2 1065 | return 1 1066 | fi 1067 | DEFAULT=--defaultno 1068 | if [ $(get_ssh) -eq 0 ]; then 1069 | DEFAULT= 1070 | fi 1071 | if [ "$INTERACTIVE" = True ]; then 1072 | whiptail --yesno \ 1073 | "Would you like the SSH server to be enabled?\n\nCaution: Default and weak passwords are a security risk when SSH is enabled!" \ 1074 | $DEFAULT 20 60 2 1075 | RET=$? 1076 | else 1077 | RET=$1 1078 | fi 1079 | if [ $RET -eq 0 ]; then 1080 | ssh-keygen -A && 1081 | update-rc.d ssh enable && 1082 | invoke-rc.d ssh start && 1083 | STATUS=enabled 1084 | elif [ $RET -eq 1 ]; then 1085 | update-rc.d ssh disable && 1086 | invoke-rc.d ssh stop && 1087 | STATUS=disabled 1088 | else 1089 | return $RET 1090 | fi 1091 | if [ "$INTERACTIVE" = True ]; then 1092 | whiptail --msgbox "The SSH server is $STATUS" 20 60 1 1093 | fi 1094 | } 1095 | 1096 | get_vnc() { 1097 | if is_wayland; then 1098 | if systemctl status wayvnc.service | grep -q -w active; then 1099 | echo 0 1100 | else 1101 | echo 1 1102 | fi 1103 | else 1104 | if systemctl status vncserver-x11-serviced.service | grep -q -w active; then 1105 | echo 0 1106 | else 1107 | echo 1 1108 | fi 1109 | fi 1110 | } 1111 | 1112 | do_vnc() { 1113 | DEFAULT=--defaultno 1114 | if [ $(get_vnc) -eq 0 ]; then 1115 | DEFAULT= 1116 | fi 1117 | APT_GET_FLAGS="" 1118 | if [ "$INTERACTIVE" = True ]; then 1119 | whiptail --yesno "Would you like the VNC Server to be enabled?" $DEFAULT 20 60 2 1120 | RET=$? 1121 | else 1122 | RET=$1 1123 | APT_GET_FLAGS="-y" 1124 | fi 1125 | if [ $RET -eq 0 ]; then 1126 | if is_installed wayvnc; then 1127 | wayvnc_version="$(get_package_version wayvnc)" 1128 | if dpkg --compare-versions "$wayvnc_version" lt 0.8; then 1129 | whiptail --msgbox "WayVNC version 0.8 or greater is required (have $wayvnc_version)" 20 60 1 1130 | return 1 1131 | fi 1132 | 1133 | systemctl stop wayvnc.service 1134 | 1135 | # In case wayvnc is already running via older xdg-autostart machanism 1136 | if [ -e /etc/xdg/autostart/wayvnc.desktop ] ; then 1137 | rm /etc/xdg/autostart/wayvnc.desktop 1138 | fi 1139 | fi 1140 | if is_installed realvnc-vnc-server; then 1141 | systemctl disable vncserver-x11-serviced.service 1142 | systemctl stop vncserver-x11-serviced.service 1143 | fi 1144 | if is_wayland; then 1145 | if is_installed wayvnc; then 1146 | systemctl enable wayvnc.service && 1147 | systemctl start wayvnc.service && 1148 | STATUS=enabled 1149 | else 1150 | return 1 1151 | fi 1152 | else 1153 | if is_installed realvnc-vnc-server || apt-get install "$APT_GET_FLAGS" realvnc-vnc-server; then 1154 | systemctl enable vncserver-x11-serviced.service && 1155 | systemctl start vncserver-x11-serviced.service && 1156 | STATUS=enabled 1157 | else 1158 | return 1 1159 | fi 1160 | fi 1161 | elif [ $RET -eq 1 ]; then 1162 | if is_installed wayvnc; then 1163 | systemctl disable wayvnc.service 1164 | systemctl stop wayvnc.service 1165 | fi 1166 | if is_installed realvnc-vnc-server; then 1167 | systemctl disable vncserver-x11-serviced.service 1168 | systemctl stop vncserver-x11-serviced.service 1169 | fi 1170 | STATUS=disabled 1171 | else 1172 | return $RET 1173 | fi 1174 | if [ "$INTERACTIVE" = True ]; then 1175 | whiptail --msgbox "The VNC Server is $STATUS" 20 60 1 1176 | fi 1177 | } 1178 | 1179 | get_rpi_connect() { 1180 | PREFIX="" 1181 | if [ -n "$SUDO_USER" ] ; then 1182 | PREFIX="sudo -u $USER XDG_RUNTIME_DIR=/run/user/$SUDO_UID DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$SUDO_UID/bus " 1183 | fi 1184 | if $PREFIX systemctl --user -q status rpi-connect.service | grep -q -w active; then 1185 | echo 0 1186 | else 1187 | echo 1 1188 | fi 1189 | } 1190 | 1191 | do_rpi_connect() { 1192 | PREFIX="" 1193 | if [ -n "$SUDO_USER" ] ; then 1194 | PREFIX="sudo -u $USER XDG_RUNTIME_DIR=/run/user/$SUDO_UID DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$SUDO_UID/bus " 1195 | fi 1196 | APT_GET_FLAGS="" 1197 | if [ "$INTERACTIVE" = True ]; then 1198 | whiptail --yesno "Would you like to enable screen sharing over Raspberry Pi Connect?" --defaultno 20 60 2 1199 | RET=$? 1200 | else 1201 | APT_GET_FLAGS="-y" 1202 | RET=$1 1203 | fi 1204 | rpi_connect_version="$(get_package_version rpi-connect)" 1205 | if [ $RET -eq 0 ]; then 1206 | if is_installed rpi-connect || apt-get install "$APT_GET_FLAGS" rpi-connect; then 1207 | if dpkg --compare-versions "$rpi_connect_version" lt 1.3; then 1208 | $PREFIX systemctl --user -q enable rpi-connect.service rpi-connect-wayvnc.service 1209 | $PREFIX systemctl --user -q start rpi-connect.service rpi-connect-wayvnc.service 1210 | elif dpkg --compare-versions "$rpi_connect_version" lt 2.0; then 1211 | $PREFIX systemctl --user -q enable rpi-connect.service rpi-connect-wayvnc.service rpi-connect-wayvnc-watcher.path 1212 | $PREFIX systemctl --user -q start rpi-connect.service 1213 | else 1214 | $PREFIX rpi-connect on > /dev/null 2>&1 1215 | fi 1216 | STATUS="Screen sharing via Raspberry Pi Connect is enabled" 1217 | else 1218 | return 1 1219 | fi 1220 | elif [ $RET -eq 1 ]; then 1221 | if [ "$INTERACTIVE" = True ]; then 1222 | whiptail --yesno "Would you like to enable remote shell access over Raspberry Pi Connect?" --defaultno 20 60 2 1223 | RET=$? 1224 | fi 1225 | if [ $RET -eq 0 ]; then 1226 | if is_installed rpi-connect || is_installed rpi-connect-lite || apt-get install "$APT_GET_FLAGS" rpi-connect-lite; then 1227 | if dpkg --compare-versions "$rpi_connect_version" lt 2.0; then 1228 | $PREFIX systemctl --user -q enable rpi-connect.service 1229 | $PREFIX systemctl --user -q start rpi-connect.service 1230 | else 1231 | $PREFIX rpi-connect on > /dev/null 2>&1 1232 | fi 1233 | STATUS="Remote shell access via Raspberry Pi Connect is enabled" 1234 | else 1235 | return 1 1236 | fi 1237 | elif [ $RET -eq 1 ]; then 1238 | if dpkg --compare-versions "$rpi_connect_version" lt 1.3; then 1239 | $PREFIX systemctl --user -q stop rpi-connect.service rpi-connect-wayvnc.service 1240 | $PREFIX systemctl --user -q disable rpi-connect-wayvnc.service rpi-connect.service 1241 | elif dpkg --compare-versions "$rpi_connect_version" lt 2.0; then 1242 | $PREFIX systemctl --user -q stop rpi-connect.service 1243 | $PREFIX systemctl --user -q disable rpi-connect.service rpi-connect-wayvnc.service rpi-connect-wayvnc-watcher.path 1244 | else 1245 | $PREFIX rpi-connect off > /dev/null 2>&1 1246 | fi 1247 | STATUS="Raspberry Pi Connect is disabled" 1248 | else 1249 | return $RET 1250 | fi 1251 | else 1252 | return $RET 1253 | fi 1254 | if [ "$INTERACTIVE" = True ]; then 1255 | whiptail --msgbox "$STATUS" 20 60 1 1256 | fi 1257 | } 1258 | 1259 | get_spi() { 1260 | if grep -q -E "^(device_tree_param|dtparam)=([^,]*,)*spi(=(on|true|yes|1))?(,.*)?$" $CONFIG; then 1261 | echo 0 1262 | else 1263 | echo 1 1264 | fi 1265 | } 1266 | 1267 | do_spi() { 1268 | DEFAULT=--defaultno 1269 | if [ $(get_spi) -eq 0 ]; then 1270 | DEFAULT= 1271 | fi 1272 | if [ "$INTERACTIVE" = True ]; then 1273 | whiptail --yesno "Would you like the SPI interface to be enabled?" $DEFAULT 20 60 2 1274 | RET=$? 1275 | else 1276 | RET=$1 1277 | fi 1278 | if [ $RET -eq 0 ]; then 1279 | SETTING=on 1280 | STATUS=enabled 1281 | elif [ $RET -eq 1 ]; then 1282 | SETTING=off 1283 | STATUS=disabled 1284 | else 1285 | return $RET 1286 | fi 1287 | 1288 | set_config_var dtparam=spi $SETTING $CONFIG && 1289 | if ! [ -e $BLACKLIST ]; then 1290 | touch $BLACKLIST 1291 | fi 1292 | sed $BLACKLIST -i -e "s/^\(blacklist[[:space:]]*spi[-_]bcm2708\)/#\1/" 1293 | dtparam spi=$SETTING 1294 | 1295 | if [ "$INTERACTIVE" = True ]; then 1296 | whiptail --msgbox "The SPI interface is $STATUS" 20 60 1 1297 | fi 1298 | } 1299 | 1300 | get_i2c() { 1301 | if grep -q -E "^(device_tree_param|dtparam)=([^,]*,)*i2c(_arm)?(=(on|true|yes|1))?(,.*)?$" $CONFIG; then 1302 | echo 0 1303 | else 1304 | echo 1 1305 | fi 1306 | } 1307 | 1308 | do_i2c() { 1309 | DEFAULT=--defaultno 1310 | if [ $(get_i2c) -eq 0 ]; then 1311 | DEFAULT= 1312 | fi 1313 | if [ "$INTERACTIVE" = True ]; then 1314 | whiptail --yesno "Would you like the ARM I2C interface to be enabled?" $DEFAULT 20 60 2 1315 | RET=$? 1316 | else 1317 | RET=$1 1318 | fi 1319 | if [ $RET -eq 0 ]; then 1320 | SETTING=on 1321 | STATUS=enabled 1322 | elif [ $RET -eq 1 ]; then 1323 | SETTING=off 1324 | STATUS=disabled 1325 | else 1326 | return $RET 1327 | fi 1328 | 1329 | set_config_var dtparam=i2c_arm $SETTING $CONFIG && 1330 | if ! [ -e $BLACKLIST ]; then 1331 | touch $BLACKLIST 1332 | fi 1333 | sed $BLACKLIST -i -e "s/^\(blacklist[[:space:]]*i2c[-_]bcm2708\)/#\1/" 1334 | sed /etc/modules -i -e "s/^#[[:space:]]*\(i2c[-_]dev\)/\1/" 1335 | if ! grep -q "^i2c[-_]dev" /etc/modules; then 1336 | printf "i2c-dev\n" >> /etc/modules 1337 | fi 1338 | dtparam i2c_arm=$SETTING 1339 | modprobe i2c-dev 1340 | 1341 | if [ "$INTERACTIVE" = True ]; then 1342 | whiptail --msgbox "The ARM I2C interface is $STATUS" 20 60 1 1343 | fi 1344 | } 1345 | 1346 | get_serial_cons() { 1347 | if grep -q -E "console=(serial0|ttyAMA0|ttyS0)" $CMDLINE ; then 1348 | echo 0 1349 | else 1350 | echo 1 1351 | fi 1352 | } 1353 | 1354 | get_serial_hw() { 1355 | if is_pifive ; then 1356 | if grep -q -E "dtparam=uart0=off" $CONFIG ; then 1357 | echo 1 1358 | elif grep -q -E "dtparam=uart0" $CONFIG ; then 1359 | echo 0 1360 | else 1361 | echo 1 1362 | fi 1363 | else 1364 | if grep -q -E "^enable_uart=1" $CONFIG ; then 1365 | echo 0 1366 | elif grep -q -E "^enable_uart=0" $CONFIG ; then 1367 | echo 1 1368 | elif [ -e /dev/serial0 ] ; then 1369 | echo 0 1370 | else 1371 | echo 1 1372 | fi 1373 | fi 1374 | } 1375 | 1376 | do_serial_cons() { 1377 | if [ $1 -eq 0 ] ; then 1378 | if grep -q "console=ttyAMA0" $CMDLINE ; then 1379 | if [ -e /proc/device-tree/aliases/serial0 ]; then 1380 | sed -i $CMDLINE -e "s/console=ttyAMA0/console=serial0/" 1381 | fi 1382 | elif ! grep -q "console=ttyAMA0" $CMDLINE && ! grep -q "console=serial0" $CMDLINE ; then 1383 | if [ -e /proc/device-tree/aliases/serial0 ]; then 1384 | sed -i $CMDLINE -e "s/root=/console=serial0,115200 root=/" 1385 | else 1386 | sed -i $CMDLINE -e "s/root=/console=ttyAMA0,115200 root=/" 1387 | fi 1388 | fi 1389 | else 1390 | sed -i $CMDLINE -e "s/console=ttyAMA0,[0-9]\+ //" 1391 | sed -i $CMDLINE -e "s/console=serial0,[0-9]\+ //" 1392 | fi 1393 | } 1394 | 1395 | do_serial_hw() { 1396 | if [ $1 -eq 0 ] ; then 1397 | if is_pifive ; then 1398 | set_config_var dtparam=uart0 on $CONFIG 1399 | else 1400 | set_config_var enable_uart 1 $CONFIG 1401 | fi 1402 | else 1403 | if is_pifive ; then 1404 | sed $CONFIG -i -e "/dtparam=uart0.*/d" 1405 | else 1406 | set_config_var enable_uart 0 $CONFIG 1407 | fi 1408 | fi 1409 | } 1410 | 1411 | do_serial() { 1412 | DEFAULTS=--defaultno 1413 | DEFAULTH=--defaultno 1414 | CURRENTS=0 1415 | CURRENTH=0 1416 | if [ $(get_serial_cons) -eq 0 ]; then 1417 | DEFAULTS= 1418 | CURRENTS=1 1419 | fi 1420 | if [ $(get_serial_hw) -eq 0 ]; then 1421 | DEFAULTH= 1422 | CURRENTH=1 1423 | fi 1424 | whiptail --yesno "Would you like a login shell to be accessible over serial?" $DEFAULTS 20 60 2 1425 | RET=$? 1426 | if [ $RET -eq $CURRENTS ]; then 1427 | ASK_TO_REBOOT=1 1428 | fi 1429 | if [ $RET -eq 0 ]; then 1430 | do_serial_cons 0 1431 | SSTATUS=enabled 1432 | do_serial_hw 0 1433 | HSTATUS=enabled 1434 | elif [ $RET -eq 1 ]; then 1435 | do_serial_cons 1 1436 | SSTATUS=disabled 1437 | whiptail --yesno "Would you like the serial port hardware to be enabled?" $DEFAULTH 20 60 2 1438 | RET=$? 1439 | if [ $RET -eq $CURRENTH ]; then 1440 | ASK_TO_REBOOT=1 1441 | fi 1442 | if [ $RET -eq 0 ]; then 1443 | do_serial_hw 0 1444 | HSTATUS=enabled 1445 | elif [ $RET -eq 1 ]; then 1446 | do_serial_hw 1 1447 | HSTATUS=disabled 1448 | else 1449 | return $RET 1450 | fi 1451 | else 1452 | return $RET 1453 | fi 1454 | whiptail --msgbox "The serial login shell is $SSTATUS\nThe serial interface is $HSTATUS" 20 60 1 1455 | } 1456 | 1457 | do_serial_pi5() { 1458 | DEFAULTS=--defaultno 1459 | DEFAULTH=--defaultno 1460 | CURRENTS=0 1461 | CURRENTH=0 1462 | if [ $(get_serial_cons) -eq 0 ]; then 1463 | DEFAULTS= 1464 | CURRENTS=1 1465 | fi 1466 | if [ $(get_serial_hw) -eq 0 ]; then 1467 | DEFAULTH= 1468 | CURRENTH=1 1469 | fi 1470 | whiptail --yesno "Would you like a login shell to be accessible over serial?" $DEFAULTS 20 60 2 1471 | RET=$? 1472 | if [ $RET -eq $CURRENTS ]; then 1473 | ASK_TO_REBOOT=1 1474 | fi 1475 | if [ $RET -eq 0 ]; then 1476 | do_serial_cons 0 1477 | SSTATUS=enabled 1478 | elif [ $RET -eq 1 ]; then 1479 | do_serial_cons 1 1480 | SSTATUS=disabled 1481 | else 1482 | return $RET 1483 | fi 1484 | whiptail --yesno "Would you like the serial port hardware to be enabled?" $DEFAULTH 20 60 2 1485 | RET=$? 1486 | if [ $RET -eq $CURRENTH ]; then 1487 | ASK_TO_REBOOT=1 1488 | fi 1489 | if [ $RET -eq 0 ]; then 1490 | do_serial_hw 0 1491 | HSTATUS=enabled 1492 | elif [ $RET -eq 1 ]; then 1493 | do_serial_hw 1 1494 | HSTATUS=disabled 1495 | else 1496 | return $RET 1497 | fi 1498 | whiptail --msgbox "The serial login shell is $SSTATUS\nThe serial interface is $HSTATUS" 20 60 1 1499 | } 1500 | 1501 | get_pci() { 1502 | if grep -q -E "^dtparam=pciex1_gen=3$" $CONFIG; then 1503 | echo 0 1504 | else 1505 | echo 1 1506 | fi 1507 | } 1508 | 1509 | do_pci() { 1510 | DEFAULT=--defaultno 1511 | CURRENT=1 1512 | if [ $(get_pci) -eq 0 ]; then 1513 | DEFAULT= 1514 | CURRENT=0 1515 | fi 1516 | if [ "$INTERACTIVE" = True ]; then 1517 | whiptail --yesno "Would you like PCIe Gen 3 to be enabled?" $DEFAULT 20 60 2 1518 | RET=$? 1519 | else 1520 | RET=$1 1521 | fi 1522 | if [ $RET -eq 0 ]; then 1523 | set_config_var dtparam=pciex1_gen 3 $CONFIG 1524 | STATUS=enabled 1525 | elif [ $RET -eq 1 ]; then 1526 | clear_config_var dtparam=pciex1_gen $CONFIG 1527 | STATUS=disabled 1528 | else 1529 | return $RET 1530 | fi 1531 | if [ $RET -ne $CURRENT ]; then 1532 | ASK_TO_REBOOT=1 1533 | fi 1534 | 1535 | if [ "$INTERACTIVE" = True ]; then 1536 | whiptail --msgbox "PCIe Gen 3 is $STATUS" 20 60 1 1537 | fi 1538 | } 1539 | 1540 | disable_raspi_config_at_boot() { 1541 | if [ -e /etc/profile.d/raspi-config.sh ]; then 1542 | rm -f /etc/profile.d/raspi-config.sh 1543 | if [ -e /etc/systemd/system/getty@tty1.service.d/raspi-config-override.conf ]; then 1544 | rm /etc/systemd/system/getty@tty1.service.d/raspi-config-override.conf 1545 | fi 1546 | telinit q 1547 | fi 1548 | } 1549 | 1550 | get_boot_cli() { 1551 | if [ "$(basename $(readlink -f /etc/systemd/system/default.target))" = graphical.target ] \ 1552 | && systemctl is-enabled lightdm > /dev/null 2>&1; then 1553 | echo 1 1554 | else 1555 | echo 0 1556 | fi 1557 | } 1558 | 1559 | get_autologin() { 1560 | if [ $(get_boot_cli) -eq 0 ]; then 1561 | # booting to CLI 1562 | if [ -e /etc/systemd/system/getty@tty1.service.d/autologin.conf ] ; then 1563 | echo 0 1564 | else 1565 | echo 1 1566 | fi 1567 | else 1568 | # booting to desktop - check the autologin for lightdm 1569 | if grep -q "^autologin-user=" /etc/lightdm/lightdm.conf ; then 1570 | echo 0 1571 | else 1572 | echo 1 1573 | fi 1574 | fi 1575 | } 1576 | 1577 | get_autologin_cli() { 1578 | if [ -e /etc/systemd/system/getty@tty1.service.d/autologin.conf ] ; then 1579 | echo 0 1580 | else 1581 | echo 1 1582 | fi 1583 | } 1584 | 1585 | get_autologin_desktop() { 1586 | if grep -q "^autologin-user=" /etc/lightdm/lightdm.conf ; then 1587 | echo 0 1588 | else 1589 | echo 1 1590 | fi 1591 | } 1592 | 1593 | get_pi4video () { 1594 | if grep -q "^hdmi_enable_4kp60=1" $CONFIG ; then 1595 | echo 0 1596 | else 1597 | echo 1 1598 | fi 1599 | } 1600 | 1601 | do_pi4video() { 1602 | CURRENT=$(get_pi4video) 1603 | DEFAULT=--defaultno 1604 | if [ $CURRENT -eq 0 ]; then 1605 | DEFAULT= 1606 | fi 1607 | if [ "$INTERACTIVE" = True ]; then 1608 | whiptail --yesno "Would you like to enable 4Kp60 output on HDMI0?" $DEFAULT 20 60 2 1609 | RET=$? 1610 | else 1611 | RET=$1 1612 | fi 1613 | if [ $RET -eq 0 ]; then 1614 | sed $CONFIG -i -e "s/^#\?hdmi_enable_4kp60=.*/hdmi_enable_4kp60=1/" 1615 | if ! grep -q "hdmi_enable_4kp60" $CONFIG ; then 1616 | sed $CONFIG -i -e "\$ahdmi_enable_4kp60=1" 1617 | fi 1618 | sed $CONFIG -i -e "s/^enable_tvout=/#enable_tvout=/" 1619 | sed $CONFIG -i -e "s/^dtoverlay=vc4-kms-v3d.*/dtoverlay=vc4-kms-v3d/" 1620 | STATUS=enabled 1621 | elif [ $RET -eq 1 ]; then 1622 | sed $CONFIG -i -e "s/^hdmi_enable_4kp60=/#hdmi_enable_4kp60=/" 1623 | sed $CONFIG -i -e "s/^enable_tvout=/#enable_tvout=/" 1624 | sed $CONFIG -i -e "s/^dtoverlay=vc4-kms-v3d.*/dtoverlay=vc4-kms-v3d/" 1625 | STATUS=disabled 1626 | else 1627 | return $RET 1628 | fi 1629 | if [ $RET -ne $CURRENT ]; then 1630 | ASK_TO_REBOOT=1 1631 | fi 1632 | if [ "$INTERACTIVE" = True ]; then 1633 | whiptail --msgbox "4Kp60 is $STATUS" 20 60 1 1634 | fi 1635 | } 1636 | 1637 | get_composite() { 1638 | if grep -q "^dtoverlay=vc4-kms-v3d,composite" $CONFIG ; then 1639 | echo 0 1640 | else 1641 | echo 1 1642 | fi 1643 | } 1644 | 1645 | do_composite() { 1646 | CURRENT=$(get_composite) 1647 | DEFAULT=--defaultno 1648 | if [ $CURRENT -eq 0 ]; then 1649 | DEFAULT= 1650 | fi 1651 | if [ "$INTERACTIVE" = True ]; then 1652 | whiptail --yesno "Would you like composite video output to be enabled? Warning - this will disable the HDMI outputs." $DEFAULT 20 60 2 1653 | RET=$? 1654 | else 1655 | RET=$1 1656 | fi 1657 | if [ $RET -eq 0 ]; then 1658 | sed $CONFIG -i -e "s/^dtoverlay=vc4-kms-v3d.*/dtoverlay=vc4-kms-v3d,composite/" 1659 | sed $CONFIG -i -e "s/^#\?enable_tvout=.*/enable_tvout=1/" 1660 | sed $CONFIG -i -e "s/^hdmi_enable_4kp60=/#hdmi_enable_4kp60=/" 1661 | STATUS=enabled 1662 | elif [ $RET -eq 1 ]; then 1663 | sed $CONFIG -i -e "s/^dtoverlay=vc4-kms-v3d.*/dtoverlay=vc4-kms-v3d/" 1664 | sed $CONFIG -i -e "s/^enable_tvout=/#enable_tvout=/" 1665 | STATUS=disabled 1666 | else 1667 | return $RET 1668 | fi 1669 | if [ $RET -ne $CURRENT ]; then 1670 | ASK_TO_REBOOT=1 1671 | fi 1672 | if [ "$INTERACTIVE" = True ]; then 1673 | whiptail --msgbox "Composite video output is $STATUS" 20 60 1 1674 | fi 1675 | } 1676 | 1677 | get_leds () { 1678 | if [ ! -e /sys/class/leds/ACT/trigger ] ; then 1679 | echo -1 1680 | elif grep -q "\\[actpwr\\]" /sys/class/leds/ACT/trigger ; then 1681 | echo 0 1682 | elif grep -q "\\[default-on\\]" /sys/class/leds/ACT/trigger ; then 1683 | echo 1 1684 | else 1685 | echo -1 1686 | fi 1687 | } 1688 | 1689 | do_leds() { 1690 | CURRENT=$(get_leds) 1691 | if [ $CURRENT -eq -1 ] ; then 1692 | if [ "$INTERACTIVE" = True ]; then 1693 | whiptail --msgbox "The LED behaviour cannot be changed on this model of Raspberry Pi" 20 60 1 1694 | fi 1695 | return 1 1696 | fi 1697 | DEFAULT=--defaultno 1698 | if [ $CURRENT -eq 0 ]; then 1699 | DEFAULT= 1700 | fi 1701 | if [ "$INTERACTIVE" = True ]; then 1702 | whiptail --yesno "Would you like the power LED to flash during disk activity?" $DEFAULT 20 60 2 1703 | RET=$? 1704 | else 1705 | RET=$1 1706 | fi 1707 | if [ $RET -eq 0 ]; then 1708 | LEDSET="actpwr" 1709 | STATUS="flash for disk activity" 1710 | elif [ $RET -eq 1 ]; then 1711 | LEDSET="default-on" 1712 | STATUS="be on constantly" 1713 | else 1714 | return $RET 1715 | fi 1716 | sed $CONFIG -i -e "s/dtparam=act_led_trigger=.*/dtparam=act_led_trigger=$LEDSET/" 1717 | if ! grep -q "dtparam=act_led_trigger" $CONFIG ; then 1718 | sed $CONFIG -i -e "\$adtparam=act_led_trigger=$LEDSET" 1719 | fi 1720 | echo $LEDSET | tee /sys/class/leds/ACT/trigger > /dev/null 1721 | if [ "$INTERACTIVE" = True ]; then 1722 | whiptail --msgbox "The power LED will $STATUS" 20 60 1 1723 | fi 1724 | } 1725 | 1726 | get_fan() { 1727 | if grep -q ^dtoverlay=gpio-fan $CONFIG ; then 1728 | echo 0 1729 | else 1730 | echo 1 1731 | fi 1732 | } 1733 | 1734 | get_fan_gpio() { 1735 | GPIO=$(grep ^dtoverlay=gpio-fan $CONFIG | cut -d, -f2 | cut -d= -f2) 1736 | if [ -z $GPIO ]; then 1737 | GPIO=14 1738 | fi 1739 | echo $GPIO 1740 | } 1741 | 1742 | get_fan_temp() { 1743 | TEMP=$(grep ^dtoverlay=gpio-fan $CONFIG | cut -d, -f3 | cut -d= -f2) 1744 | if [ -z $TEMP ]; then 1745 | TEMP=80000 1746 | fi 1747 | echo $((TEMP / 1000)) 1748 | } 1749 | 1750 | do_fan() { 1751 | GNOW=$(get_fan_gpio) 1752 | TNOW=$(get_fan_temp) 1753 | if [ "$INTERACTIVE" = True ]; then 1754 | whiptail --yesno "Would you like to enable fan temperature control?" $DEFAULT 20 60 2 1755 | RET=$? 1756 | else 1757 | RET=$1 1758 | fi 1759 | if [ $RET -eq 0 ] ; then 1760 | if [ "$INTERACTIVE" = True ]; then 1761 | GPIO=$(whiptail --inputbox "To which GPIO is the fan connected?" 20 60 "$GNOW" 3>&1 1>&2 2>&3) 1762 | else 1763 | if [ -z $2 ]; then 1764 | GPIO=14 1765 | else 1766 | GPIO=$2 1767 | fi 1768 | fi 1769 | if [ $? -ne 0 ] ; then 1770 | return 0 1771 | fi 1772 | if ! echo "$GPIO" | grep -q "^[[:digit:]]*$" ; then 1773 | if [ "$INTERACTIVE" = True ]; then 1774 | whiptail --msgbox "GPIO must be a number between 2 and 27" 20 60 1 1775 | fi 1776 | return 1 1777 | fi 1778 | if [ "$GPIO" -lt 2 ] || [ "$GPIO" -gt 27 ] ; then 1779 | if [ "$INTERACTIVE" = True ]; then 1780 | whiptail --msgbox "GPIO must be a number between 2 and 27" 20 60 1 1781 | fi 1782 | return 1 1783 | fi 1784 | if [ "$INTERACTIVE" = True ]; then 1785 | TIN=$(whiptail --inputbox "At what temperature in degrees Celsius should the fan turn on?" 20 60 "$TNOW" 3>&1 1>&2 2>&3) 1786 | else 1787 | if [ -z $3 ]; then 1788 | TIN=80 1789 | else 1790 | TIN=$3 1791 | fi 1792 | fi 1793 | if [ $? -ne 0 ] ; then 1794 | return 0 1795 | fi 1796 | if ! echo "$TIN" | grep -q "^[[:digit:]]*$" ; then 1797 | if [ "$INTERACTIVE" = True ]; then 1798 | whiptail --msgbox "Temperature must be a number between 60 and 120" 20 60 1 1799 | fi 1800 | return 1 1801 | fi 1802 | if [ "$TIN" -lt 60 ] || [ "$TIN" -gt 120 ] ; then 1803 | if [ "$INTERACTIVE" = True ]; then 1804 | whiptail --msgbox "Temperature must be a number between 60 and 120" 20 60 1 1805 | fi 1806 | return 1 1807 | fi 1808 | TEMP=$((TIN * 1000)) 1809 | fi 1810 | if [ $RET -eq 0 ]; then 1811 | if ! grep -q "dtoverlay=gpio-fan" $CONFIG ; then 1812 | if ! tail -1 $CONFIG | grep -q "\\[all\\]" ; then 1813 | sed $CONFIG -i -e "\$a[all]" 1814 | fi 1815 | sed $CONFIG -i -e "\$adtoverlay=gpio-fan,gpiopin=$GPIO,temp=$TEMP" 1816 | else 1817 | sed $CONFIG -i -e "s/^.*dtoverlay=gpio-fan.*/dtoverlay=gpio-fan,gpiopin=$GPIO,temp=$TEMP/" 1818 | fi 1819 | ASK_TO_REBOOT=1 1820 | if [ "$INTERACTIVE" = True ]; then 1821 | whiptail --msgbox "The fan on GPIO $GPIO is enabled and will turn on at $TIN degrees Celsius" 20 60 1 1822 | fi 1823 | else 1824 | if grep -q "^dtoverlay=gpio-fan" $CONFIG ; then 1825 | ASK_TO_REBOOT=1 1826 | fi 1827 | sed $CONFIG -i -e "/^.*dtoverlay=gpio-fan.*/d" 1828 | if [ "$INTERACTIVE" = True ]; then 1829 | whiptail --msgbox "The fan is disabled" 20 60 1 1830 | fi 1831 | fi 1832 | } 1833 | 1834 | get_browser() { 1835 | echo $(update-alternatives --display x-www-browser | grep currently | cut -d " " -f 7 | cut -d / -f 4) 1836 | } 1837 | 1838 | do_browser() { 1839 | if [ "$INTERACTIVE" = True ]; then 1840 | RES=$(whiptail --title "Raspberry Pi Software Configuration Tool (raspi-config)" --menu "Select Browser" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT \ 1841 | "1" "Chromium" \ 1842 | "2" "Firefox" \ 1843 | 3>&1 1>&2 2>&3) 1844 | else 1845 | RES="" 1846 | BROWSER=$1 1847 | true 1848 | fi 1849 | if [ $? -eq 0 ]; then 1850 | if [ "$RES" = "1" ] ; then 1851 | BROWSER="chromium" 1852 | BSTRING="Chromium" 1853 | elif [ "$RES" = "2" ] ; then 1854 | BROWSER="firefox" 1855 | BSTRING="Firefox" 1856 | fi 1857 | update-alternatives --set x-www-browser /usr/bin/$BROWSER > /dev/null 1858 | if [ -z $2 ] ; then 1859 | sudo -u $USER xdg-settings set default-web-browser $BROWSER.desktop 1860 | else 1861 | sudo -u $2 xdg-settings set default-web-browser $BROWSER.desktop 1862 | fi 1863 | if [ "$INTERACTIVE" = True ]; then 1864 | whiptail --msgbox "Default browser set to $BSTRING" 20 60 1 1865 | fi 1866 | fi 1867 | } 1868 | 1869 | do_journald_storage() { 1870 | if [ "$INTERACTIVE" = True ]; then 1871 | RES=$(whiptail --title "Raspberry Pi Software Configuration Tool (raspi-config)" --menu "Select Log Location" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT \ 1872 | "1" "Default" \ 1873 | "2" "Volatile" \ 1874 | "3" "Persistent" \ 1875 | "4" "Auto" \ 1876 | "5" "None" \ 1877 | 3>&1 1>&2 2>&3) 1878 | else 1879 | RES="" 1880 | true 1881 | fi 1882 | if [ $? -eq 0 ]; then 1883 | case $RES in 1884 | 2) JSTRING="volatile" 1885 | ;; 1886 | 3) JSTRING="persistent" 1887 | ;; 1888 | 4) JSTRING="auto" 1889 | ;; 1890 | 5) JSTRING="none" 1891 | ;; 1892 | *) JSTRING="" 1893 | ;; 1894 | esac 1895 | REPLACEMENT="$([ ! -z $JSTRING ] && echo "Storage=$JSTRING" || echo "#Storage=auto")" 1896 | sed --in-place -E "s/^#?Storage=.*/${REPLACEMENT}/" /etc/systemd/journald.conf 1897 | if [ "$INTERACTIVE" = True ]; then 1898 | whiptail --msgbox "Logging location set to ${JSTRING:-default}" 20 60 1 1899 | fi 1900 | fi 1901 | } 1902 | 1903 | do_boot_target(){ 1904 | if [ "$INTERACTIVE" = True ]; then 1905 | BOOTOPT=$(whiptail --title "Raspberry Pi Software Configuration Tool (raspi-config)" --menu "Boot Options" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT \ 1906 | "B1 Console" "Text console" \ 1907 | "B2 Desktop" "Desktop GUI" \ 1908 | 3>&1 1>&2 2>&3) 1909 | else 1910 | BOOTOPT=$1 1911 | true 1912 | fi 1913 | if [ $? -eq 0 ]; then 1914 | case "$BOOTOPT" in # Handle default target 1915 | B1*) # Console 1916 | systemctl --quiet set-default multi-user.target 1917 | ;; 1918 | B2*) # Desktop 1919 | if [ -e /etc/init.d/lightdm ]; then 1920 | systemctl --quiet set-default graphical.target 1921 | else 1922 | whiptail --msgbox "Do 'sudo apt-get install lightdm' to allow configuration of boot to desktop" 20 60 2 1923 | return 1 1924 | fi 1925 | ;; 1926 | *) 1927 | whiptail --msgbox "Programmer error, unrecognised boot option" 20 60 2 1928 | return 1 1929 | ;; 1930 | esac 1931 | fi 1932 | ASK_TO_REBOOT=1 1933 | } 1934 | 1935 | do_autologin(){ 1936 | if [ "$INTERACTIVE" = True ]; then 1937 | whiptail --yesno "Would you like to automatically log in to the console?" $DEFAULT 20 60 2 1938 | RET=$? 1939 | else 1940 | if [ $1 -eq 1 ] || [ $1 -eq 3 ] ; then 1941 | RET=0 1942 | else 1943 | RET=1 1944 | fi 1945 | fi 1946 | if [ $RET -eq 0 ] ; then 1947 | mkdir -p /etc/systemd/system/getty@tty1.service.d 1948 | cat > /etc/systemd/system/getty@tty1.service.d/autologin.conf << EOF 1949 | [Service] 1950 | ExecStart= 1951 | ExecStart=-/sbin/agetty --autologin $USER --noclear %I \$TERM 1952 | EOF 1953 | STATUS=enabled 1954 | elif [ $RET -eq 1 ]; then 1955 | if [ -f /etc/systemd/system/getty@tty1.service.d/autologin.conf ]; then 1956 | rm -f /etc/systemd/system/getty@tty1.service.d/autologin.conf 1957 | rmdir --ignore-fail-on-non-empty /etc/systemd/system/getty@tty1.service.d 1958 | fi 1959 | STATUS=disabled 1960 | else 1961 | return $RET 1962 | fi 1963 | if [ "$INTERACTIVE" = True ]; then 1964 | whiptail --msgbox "Console autologin is $STATUS" 20 60 1 1965 | if [ $(get_boot_cli) -eq 0 ]; then 1966 | return 0 1967 | fi 1968 | whiptail --yesno "Would you like to automatically log in to the desktop?" $DEFAULT 20 60 2 1969 | RET=$? 1970 | else 1971 | if [ $1 -eq 2 ] || [ $1 -eq 3 ] ; then 1972 | RET=0 1973 | else 1974 | RET=1 1975 | fi 1976 | fi 1977 | if [ $RET -eq 0 ] ; then 1978 | sed /etc/lightdm/lightdm.conf -i -e "s/^\(#\|\)autologin-user=.*/autologin-user=$USER/" 1979 | STATUS=enabled 1980 | elif [ $RET -eq 1 ]; then 1981 | sed /etc/lightdm/lightdm.conf -i -e "s/^autologin-user=.*/#autologin-user=/" 1982 | STATUS=disabled 1983 | else 1984 | return $RET 1985 | fi 1986 | if [ "$INTERACTIVE" = True ]; then 1987 | whiptail --msgbox "Desktop autologin is $STATUS" 20 60 1 1988 | fi 1989 | ASK_TO_REBOOT=1 1990 | } 1991 | 1992 | do_boot_behaviour() { 1993 | if [ "$INTERACTIVE" = True ]; then 1994 | BOOTOPT=$(whiptail --title "Raspberry Pi Software Configuration Tool (raspi-config)" --menu "Boot Options" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT \ 1995 | "B1 Console" "Text console, requiring user to login" \ 1996 | "B2 Console Autologin" "Text console, automatically logged in as '$USER' user" \ 1997 | "B3 Desktop" "Desktop GUI, requiring user to login" \ 1998 | "B4 Desktop Autologin" "Desktop GUI, automatically logged in as '$USER' user" \ 1999 | 3>&1 1>&2 2>&3) 2000 | else 2001 | BOOTOPT=$1 2002 | true 2003 | fi 2004 | if [ $? -eq 0 ]; then 2005 | case "$BOOTOPT" in # Handle default target 2006 | B1*|B2*) # Console 2007 | systemctl --quiet set-default multi-user.target 2008 | ;; 2009 | B3*|B4*) # Desktop 2010 | if [ -e /etc/init.d/lightdm ]; then 2011 | systemctl --quiet set-default graphical.target 2012 | else 2013 | whiptail --msgbox "Do 'sudo apt-get install lightdm' to allow configuration of boot to desktop" 20 60 2 2014 | return 1 2015 | fi 2016 | ;; 2017 | *) 2018 | whiptail --msgbox "Programmer error, unrecognised boot option" 20 60 2 2019 | return 1 2020 | ;; 2021 | esac 2022 | case "$BOOTOPT" in # Handle autologin 2023 | B1*|B3*) # Autologin disabled 2024 | if [ -z "${BOOTOPT%%B3*}" ]; then 2025 | sed /etc/lightdm/lightdm.conf -i -e "s/^autologin-user=.*/#autologin-user=/" 2026 | fi 2027 | if [ -f /etc/systemd/system/getty@tty1.service.d/autologin.conf ]; then 2028 | rm -f /etc/systemd/system/getty@tty1.service.d/autologin.conf 2029 | rmdir --ignore-fail-on-non-empty /etc/systemd/system/getty@tty1.service.d 2030 | fi 2031 | ;; 2032 | B2*|B4*) # Autologin enabled 2033 | if [ -z "${BOOTOPT%%B4*}" ]; then 2034 | sed /etc/lightdm/lightdm.conf -i -e "s/^\(#\|\)autologin-user=.*/autologin-user=$USER/" 2035 | fi 2036 | mkdir -p /etc/systemd/system/getty@tty1.service.d 2037 | cat > /etc/systemd/system/getty@tty1.service.d/autologin.conf << EOF 2038 | [Service] 2039 | ExecStart= 2040 | ExecStart=-/sbin/agetty --autologin $USER --noclear %I \$TERM 2041 | EOF 2042 | ;; 2043 | esac 2044 | if [ "$INIT" = "systemd" ]; then 2045 | systemctl daemon-reload 2046 | fi 2047 | ASK_TO_REBOOT=1 2048 | fi 2049 | } 2050 | 2051 | get_bootloader_filename() { 2052 | CURDATE=$(date -d "$(vcgencmd bootloader_version | head -n 1)" +%Y%m%d) 2053 | FILNAME="" 2054 | EEBASE=$(rpi-eeprom-update | grep RELEASE | sed 's/.*(//g' | sed 's/[^\/]*)//g') 2055 | if grep FIRMWARE_RELEASE_STATUS /etc/default/rpi-eeprom-update | egrep -Eq "stable|latest"; then 2056 | EEPATH="${EEBASE}/latest/pieeprom*.bin" 2057 | else 2058 | EEPATH="${EEBASE}/default/pieeprom*.bin" 2059 | fi 2060 | EXACT_MATCH=0 2061 | for filename in $(find $EEPATH -name "pieeprom*.bin" 2>/dev/null | sort); do 2062 | FILDATE=$(date -d "$(echo $filename | sed 's/.*\///g' | cut -d - -f 2- | cut -d . -f 1)" +%Y%m%d) 2063 | FILNAME=$filename 2064 | if [ $FILDATE -eq $CURDATE ]; then 2065 | EXACT_MATCH=1 2066 | break 2067 | fi 2068 | done 2069 | if [ $EXACT_MATCH != 1 ]; then 2070 | if [ "$INTERACTIVE" = True ]; then 2071 | whiptail --yesno "Current EEPROM version $(date -d $CURDATE +%Y-%m-%d) or newer not found.\n\nTry updating the rpi-eeprom APT package.\n\nInstall latest local $(basename $FILNAME) anyway?" 20 70 3 2072 | DEFAULTS=$? 2073 | if [ "$DEFAULTS" -ne 0 ]; then 2074 | FILNAME="none" # no 2075 | fi 2076 | fi 2077 | fi 2078 | } 2079 | 2080 | do_network_install_ui() { 2081 | if [ "$INTERACTIVE" = True ]; then 2082 | BOOTOPT=$(whiptail --title "Raspberry Pi Software Configuration Tool (raspi-config)" --menu "Bootloader network install UI" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT \ 2083 | "B1 Always" "Always display the UI for a few seconds after power on." \ 2084 | "B2 On demand" "Display the UI if the SHIFT key is presssed or if an error occurs." \ 2085 | 3>&1 1>&2 2>&3) 2086 | else 2087 | BOOTOPT=$1 2088 | true 2089 | fi 2090 | 2091 | if [ $? -eq 0 ]; then 2092 | get_bootloader_filename 2093 | if [ "${FILNAME}" = "none" ]; then 2094 | if [ "$INTERACTIVE" = True ]; then 2095 | return 0 2096 | else 2097 | return 1 2098 | fi 2099 | fi 2100 | EECFG=$(mktemp) 2101 | rpi-eeprom-config > $EECFG 2102 | sed $EECFG -i -e "/NET_INSTALL_AT_POWER_ON/d" 2103 | case "$BOOTOPT" in 2104 | B1*) 2105 | echo "NET_INSTALL_AT_POWER_ON=1" >> $EECFG 2106 | ;; 2107 | B2*) 2108 | # NET_INSTALL_AT_POWER_ON default value is 0 2109 | true 2110 | ;; 2111 | *) 2112 | whiptail --msgbox "Programmer error, unrecognised boot option" 20 60 2 2113 | return 1 2114 | ;; 2115 | esac 2116 | rpi-eeprom-config --apply $EECFG $FILNAME 2117 | ASK_TO_REBOOT=1 2118 | fi 2119 | } 2120 | 2121 | do_libliftoff() { 2122 | if [ "$INTERACTIVE" = True ]; then 2123 | RET=$(whiptail --title "Raspberry Pi Software Configuration Tool (raspi-config)" --menu "libliftoff Options" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT \ 2124 | "L1 Disable" "Disable libliftoff hardware overlays" \ 2125 | "L2 Enable" "Enable libliftoff hardware overlays" \ 2126 | 3>&1 1>&2 2>&3) 2127 | else 2128 | RET=$1 2129 | true 2130 | fi 2131 | if [ $? -eq 0 ]; then 2132 | case "$RET" in 2133 | L1*) 2134 | LIBLIFTOFF_ENABLED=0 2135 | STATUS="disabled" 2136 | ;; 2137 | L2*) 2138 | LIBLIFTOFF_ENABLED=1 2139 | STATUS="enabled" 2140 | ;; 2141 | *) 2142 | whiptail --msgbox "Programmer error, unrecognised libliftoff option" 20 60 2 2143 | return 1 2144 | ;; 2145 | esac 2146 | 2147 | # Create the config dir and/or environment file, if needed 2148 | if [ -z $HOMEDIR ]; then 2149 | whiptail --msgbox "Unknown user home directory" 20 60 2 2150 | return 1 2151 | fi 2152 | LABWC_DIR="$HOMEDIR/.config/labwc" 2153 | if [ ! -e $LABWC_DIR ]; then 2154 | mkdir -p $LABWC_DIR 2155 | chown $USER:$USER $HOMEDIR/.config $LABWC_DIR 2156 | fi 2157 | if [ ! -e $LABWCENV_FILE ]; then 2158 | touch $LABWCENV_FILE 2159 | chown $USER:$USER $LABWCENV_FILE 2160 | fi 2161 | 2162 | # If there is already a libliftoff line in the env file, replace it. 2163 | # Otherwise, add one. 2164 | if grep -q WLR_DRM_FORCE_LIBLIFTOFF $LABWCENV_FILE; then 2165 | sed -i "s/^.*WLR_DRM_FORCE_LIBLIFTOFF.*$/WLR_DRM_FORCE_LIBLIFTOFF=$LIBLIFTOFF_ENABLED/" $LABWCENV_FILE 2166 | else 2167 | echo "WLR_DRM_FORCE_LIBLIFTOFF=$LIBLIFTOFF_ENABLED" >>$LABWCENV_FILE 2168 | fi 2169 | 2170 | ASK_TO_REBOOT=1 2171 | else 2172 | return 0 2173 | fi 2174 | if [ "$INTERACTIVE" = True ]; then 2175 | whiptail --msgbox "libliftoff is $STATUS" 20 60 1 2176 | fi 2177 | } 2178 | 2179 | # shellcheck disable=SC2120 2180 | do_power_off_on_halt() { 2181 | if [ "$INTERACTIVE" = True ]; then 2182 | BOOTOPT=$(whiptail --title "Raspberry Pi Software Configuration Tool (raspi-config)" --menu "Configure shutdown behaviour." "$WT_HEIGHT" "$WT_WIDTH" "$WT_MENU_HEIGHT" \ 2183 | "B1 Full power off" "Switch off Pi power management (PMIC) outputs on Pi4 / Pi5 (recommended)." \ 2184 | "B2 VPU sleep mode" "Compatibility mode for HATs (e.g. POE HAT) and GPIO power buttons (Pi4)." \ 2185 | 3>&1 1>&2 2>&3) 2186 | else 2187 | BOOTOPT=$1 2188 | true 2189 | fi 2190 | 2191 | # shellcheck disable=SC2181 2192 | if [ $? -eq 0 ]; then 2193 | get_bootloader_filename 2194 | if [ "${FILNAME}" = "none" ]; then 2195 | if [ "$INTERACTIVE" = True ]; then 2196 | return 0 2197 | else 2198 | return 1 2199 | fi 2200 | fi 2201 | EECFG=$(mktemp) 2202 | rpi-eeprom-config > "$EECFG" 2203 | sed "$EECFG" -i -e "/POWER_OFF_ON_HALT/d" 2204 | sed "$EECFG" -i -e "/WAKE_ON_GPIO/d" 2205 | case "$BOOTOPT" in 2206 | B1*) 2207 | echo "POWER_OFF_ON_HALT=1" >> "$EECFG" 2208 | echo "WAKE_ON_GPIO=0" >> "$EECFG" 2209 | ;; 2210 | B2*) 2211 | echo "POWER_OFF_ON_HALT=0" >> "$EECFG" 2212 | echo "WAKE_ON_GPIO=1" >> "$EECFG" 2213 | true 2214 | ;; 2215 | *) 2216 | whiptail --msgbox "Programmer error, unrecognised boot option" 20 60 2 2217 | return 1 2218 | ;; 2219 | esac 2220 | rpi-eeprom-config --apply "$EECFG" "$FILNAME" 2221 | ASK_TO_REBOOT=1 2222 | fi 2223 | } 2224 | 2225 | do_boot_order() { 2226 | if [ "$INTERACTIVE" = True ]; then 2227 | BOOTOPT=$(whiptail --title "Raspberry Pi Software Configuration Tool (raspi-config)" --menu "Boot Device Order" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT \ 2228 | "B1 SD Card Boot " "Boot from SD Card before trying NVMe and then USB (RECOMMENDED)" \ 2229 | "B2 NVMe/USB Boot" "Boot from NVMe before trying USB and then SD Card" \ 2230 | "B3 Network Boot " "Boot from Network unless override by SD Card" \ 2231 | 3>&1 1>&2 2>&3) 2232 | else 2233 | BOOTOPT=$1 2234 | true 2235 | fi 2236 | if [ $? -eq 0 ]; then 2237 | EECFG=$(mktemp) 2238 | rpi-eeprom-config > $EECFG 2239 | sed $EECFG -i -e "/SD_BOOT_MAX_RETRIES/d" 2240 | sed $EECFG -i -e "/NET_BOOT_MAX_RETRIES/d" 2241 | case "$BOOTOPT" in 2242 | B1*) 2243 | if is_pifive; then 2244 | ORD=0xf461 2245 | else 2246 | ORD=0xf41 2247 | fi 2248 | if ! grep -q "BOOT_ORDER" $EECFG ; then 2249 | sed $EECFG -i -e "\$a[all]\nBOOT_ORDER=${ORD}" 2250 | else 2251 | sed $EECFG -i -e "s/^BOOT_ORDER=.*/BOOT_ORDER=${ORD}/" 2252 | fi 2253 | STATUS="SD Card" 2254 | ;; 2255 | B2*) 2256 | if is_pifive; then 2257 | ORD=0xf146 2258 | else 2259 | ORD=0xf14 2260 | fi 2261 | if ! grep -q "BOOT_ORDER" $EECFG ; then 2262 | sed $EECFG -i -e "\$a[all]\nBOOT_ORDER=${ORD}" 2263 | else 2264 | sed $EECFG -i -e "s/^BOOT_ORDER=.*/BOOT_ORDER=${ORD}/" 2265 | fi 2266 | STATUS="NVMe/USB" 2267 | ;; 2268 | B3*) 2269 | if ! grep -q "BOOT_ORDER" $EECFG ; then 2270 | sed $EECFG -i -e "\$a[all]\nBOOT_ORDER=0xf21" 2271 | else 2272 | sed $EECFG -i -e "s/^BOOT_ORDER=.*/BOOT_ORDER=0xf21/" 2273 | fi 2274 | STATUS="Network" 2275 | ;; 2276 | *) 2277 | whiptail --msgbox "Programmer error, unrecognised boot option" 20 60 2 2278 | return 1 2279 | ;; 2280 | esac 2281 | get_bootloader_filename 2282 | if [ "${FILNAME}" = "none" ]; then 2283 | if [ "$INTERACTIVE" = True ]; then 2284 | return 0 2285 | else 2286 | return 1 2287 | fi 2288 | fi 2289 | rpi-eeprom-config --apply $EECFG $FILNAME 2290 | ASK_TO_REBOOT=1 2291 | if [ "$INTERACTIVE" = True ]; then 2292 | whiptail --msgbox "$STATUS is default boot device" 20 60 1 2293 | fi 2294 | fi 2295 | } 2296 | 2297 | 2298 | do_boot_rom() { 2299 | if [ "$INTERACTIVE" = True ]; then 2300 | BOOTOPT=$(whiptail --title "Raspberry Pi Software Configuration Tool (raspi-config)" --menu "Bootloader Options" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT \ 2301 | "E1 Latest" "Use the latest bootloader image" \ 2302 | "E2 Default" "Use the factory default bootloader image" \ 2303 | 3>&1 1>&2 2>&3) 2304 | else 2305 | BOOTOPT=$1 2306 | true 2307 | fi 2308 | if [ $? -eq 0 ]; then 2309 | case "$BOOTOPT" in 2310 | E1*) 2311 | sed /etc/default/rpi-eeprom-update -i -e "s/^FIRMWARE_RELEASE_STATUS.*/FIRMWARE_RELEASE_STATUS=\"latest\"/" 2312 | EETYPE="Latest version" 2313 | ;; 2314 | E2*) 2315 | sed /etc/default/rpi-eeprom-update -i -e "s/^FIRMWARE_RELEASE_STATUS.*/FIRMWARE_RELEASE_STATUS=\"default\"/" 2316 | EETYPE="Factory default" 2317 | ;; 2318 | *) 2319 | whiptail --msgbox "Programmer error, unrecognised bootloader option" 20 60 2 2320 | return 1 2321 | ;; 2322 | esac 2323 | if [ "$INTERACTIVE" = True ]; then 2324 | whiptail --yesno "$EETYPE bootloader selected - will be loaded at next reboot.\n\nReset bootloader to default configuration?" 20 60 2 2325 | DEFAULTS=$? 2326 | else 2327 | DEFAULTS=$2 2328 | fi 2329 | if [ "$DEFAULTS" -eq 0 ]; then # yes 2330 | get_bootloader_filename 2331 | if [ "${FILNAME}" = "none" ]; then 2332 | if [ "$INTERACTIVE" = True ]; then 2333 | return 0 2334 | else 2335 | return 1 2336 | fi 2337 | fi 2338 | rpi-eeprom-update -d -f $FILNAME 2339 | if [ "$INTERACTIVE" = True ]; then 2340 | whiptail --msgbox "Bootloader reset to default configuration" 20 60 2 2341 | fi 2342 | else 2343 | if [ "$INTERACTIVE" = True ]; then 2344 | whiptail --msgbox "Bootloader not reset to defaults" 20 60 2 2345 | fi 2346 | fi 2347 | ASK_TO_REBOOT=1 2348 | fi 2349 | } 2350 | 2351 | get_boot_splash() { 2352 | if is_pi ; then 2353 | if grep -q "splash" $CMDLINE ; then 2354 | echo 0 2355 | else 2356 | echo 1 2357 | fi 2358 | else 2359 | if grep -q "GRUB_CMDLINE_LINUX_DEFAULT.*splash" /etc/default/grub ; then 2360 | echo 0 2361 | else 2362 | echo 1 2363 | fi 2364 | fi 2365 | } 2366 | 2367 | do_boot_splash() { 2368 | if [ ! -e /usr/share/plymouth/themes/pix/pix.script ]; then 2369 | if [ "$INTERACTIVE" = True ]; then 2370 | whiptail --msgbox "The splash screen is not installed so cannot be activated" 20 60 2 2371 | fi 2372 | return 1 2373 | fi 2374 | DEFAULT=--defaultno 2375 | if [ $(get_boot_splash) -eq 0 ]; then 2376 | DEFAULT= 2377 | fi 2378 | if [ "$INTERACTIVE" = True ]; then 2379 | whiptail --yesno "Would you like to show the splash screen at boot?" $DEFAULT 20 60 2 2380 | RET=$? 2381 | else 2382 | RET=$1 2383 | fi 2384 | if [ $RET -eq 0 ]; then 2385 | if is_pi ; then 2386 | if ! grep -q "splash" $CMDLINE ; then 2387 | sed -i $CMDLINE -e "s/$/ quiet splash plymouth.ignore-serial-consoles/" 2388 | fi 2389 | else 2390 | sed -i /etc/default/grub -e "s/GRUB_CMDLINE_LINUX_DEFAULT=\"\(.*\)\"/GRUB_CMDLINE_LINUX_DEFAULT=\"\1 quiet splash plymouth.ignore-serial-consoles\"/" 2391 | sed -i /etc/default/grub -e "s/ \+/ /g" 2392 | sed -i /etc/default/grub -e "s/GRUB_CMDLINE_LINUX_DEFAULT=\" /GRUB_CMDLINE_LINUX_DEFAULT=\"/" 2393 | update-grub 2394 | fi 2395 | STATUS=enabled 2396 | elif [ $RET -eq 1 ]; then 2397 | if is_pi ; then 2398 | if grep -q "splash" $CMDLINE ; then 2399 | sed -i $CMDLINE -e "s/ quiet//" 2400 | sed -i $CMDLINE -e "s/ splash//" 2401 | sed -i $CMDLINE -e "s/ plymouth.ignore-serial-consoles//" 2402 | fi 2403 | else 2404 | sed -i /etc/default/grub -e "s/GRUB_CMDLINE_LINUX_DEFAULT=\"\(.*\)quiet\(.*\)\"/GRUB_CMDLINE_LINUX_DEFAULT=\"\1\2\"/" 2405 | sed -i /etc/default/grub -e "s/GRUB_CMDLINE_LINUX_DEFAULT=\"\(.*\)splash\(.*\)\"/GRUB_CMDLINE_LINUX_DEFAULT=\"\1\2\"/" 2406 | sed -i /etc/default/grub -e "s/GRUB_CMDLINE_LINUX_DEFAULT=\"\(.*\)plymouth.ignore-serial-consoles\(.*\)\"/GRUB_CMDLINE_LINUX_DEFAULT=\"\1\2\"/" 2407 | sed -i /etc/default/grub -e "s/ \+/ /g" 2408 | sed -i /etc/default/grub -e "s/GRUB_CMDLINE_LINUX_DEFAULT=\" /GRUB_CMDLINE_LINUX_DEFAULT=\"/" 2409 | update-grub 2410 | fi 2411 | STATUS=disabled 2412 | else 2413 | return $RET 2414 | fi 2415 | if [ "$INTERACTIVE" = True ]; then 2416 | whiptail --msgbox "Splash screen at boot is $STATUS" 20 60 1 2417 | fi 2418 | } 2419 | 2420 | get_rgpio() { 2421 | if test -e /etc/systemd/system/pigpiod.service.d/public.conf; then 2422 | echo 0 2423 | else 2424 | echo 1 2425 | fi 2426 | } 2427 | 2428 | do_rgpio() { 2429 | DEFAULT=--defaultno 2430 | if [ $(get_rgpio) -eq 0 ]; then 2431 | DEFAULT= 2432 | fi 2433 | if [ "$INTERACTIVE" = True ]; then 2434 | whiptail --yesno "Would you like the GPIO server to be accessible over the network?" $DEFAULT 20 60 2 2435 | RET=$? 2436 | else 2437 | RET=$1 2438 | fi 2439 | if [ $RET -eq 0 ]; then 2440 | mkdir -p /etc/systemd/system/pigpiod.service.d/ 2441 | cat > /etc/systemd/system/pigpiod.service.d/public.conf << EOF 2442 | [Service] 2443 | ExecStart= 2444 | ExecStart=/usr/bin/pigpiod 2445 | EOF 2446 | STATUS=enabled 2447 | elif [ $RET -eq 1 ]; then 2448 | rm -f /etc/systemd/system/pigpiod.service.d/public.conf 2449 | STATUS=disabled 2450 | else 2451 | return $RET 2452 | fi 2453 | systemctl daemon-reload 2454 | if systemctl -q is-enabled pigpiod ; then 2455 | systemctl restart pigpiod 2456 | fi 2457 | if [ "$INTERACTIVE" = True ]; then 2458 | whiptail --msgbox "Remote access to the GPIO server is $STATUS" 20 60 1 2459 | fi 2460 | } 2461 | 2462 | get_camera() { 2463 | if [ $(deb_ver) -le 10 ]; then 2464 | CAM=$(get_config_var start_x $CONFIG) 2465 | if [ $CAM -eq 1 ]; then 2466 | echo 0 2467 | else 2468 | echo 1 2469 | fi 2470 | else 2471 | if grep -q camera_auto_detect $CONFIG ; then 2472 | CAM=$(get_config_var camera_auto_detect $CONFIG) 2473 | if [ $CAM -eq 1 ]; then 2474 | echo 0 2475 | else 2476 | echo 1 2477 | fi 2478 | else 2479 | echo 0 2480 | fi 2481 | fi 2482 | } 2483 | 2484 | do_camera() { 2485 | if [ $(deb_ver) -le 10 ] && [ ! -e /boot${FIRMWARE}/start_x.elf ]; then 2486 | whiptail --msgbox "Your firmware appears to be out of date (no start_x.elf). Please update" 20 60 2 2487 | return 1 2488 | fi 2489 | sed $CONFIG -i -e "s/^startx/#startx/" 2490 | sed $CONFIG -i -e "s/^fixup_file/#fixup_file/" 2491 | 2492 | DEFAULT=--defaultno 2493 | CURRENT=0 2494 | if [ $(get_camera) -eq 0 ]; then 2495 | DEFAULT= 2496 | CURRENT=1 2497 | fi 2498 | if [ "$INTERACTIVE" = True ]; then 2499 | whiptail --yesno "Would you like the camera interface to be enabled?" $DEFAULT 20 60 2 2500 | RET=$? 2501 | else 2502 | RET=$1 2503 | fi 2504 | if [ $RET -eq $CURRENT ]; then 2505 | ASK_TO_REBOOT=1 2506 | fi 2507 | if [ $RET -eq 0 ]; then 2508 | if [ $(deb_ver) -le 10 ] ; then 2509 | set_config_var start_x 1 $CONFIG 2510 | CUR_GPU_MEM=$(get_config_var gpu_mem $CONFIG) 2511 | if [ -z "$CUR_GPU_MEM" ] || [ "$CUR_GPU_MEM" -lt 128 ]; then 2512 | set_config_var gpu_mem 128 $CONFIG 2513 | fi 2514 | else 2515 | set_config_var camera_auto_detect 1 $CONFIG 2516 | fi 2517 | STATUS=enabled 2518 | elif [ $RET -eq 1 ]; then 2519 | if [ $(deb_ver) -le 10 ] ; then 2520 | set_config_var start_x 0 $CONFIG 2521 | sed $CONFIG -i -e "s/^start_file/#start_file/" 2522 | else 2523 | set_config_var camera_auto_detect 0 $CONFIG 2524 | fi 2525 | STATUS=disabled 2526 | else 2527 | return $RET 2528 | fi 2529 | if [ "$INTERACTIVE" = True ]; then 2530 | whiptail --msgbox "The camera interface is $STATUS" 20 60 1 2531 | fi 2532 | } 2533 | 2534 | get_onewire() { 2535 | if grep -q -E "^dtoverlay=w1-gpio" $CONFIG; then 2536 | echo 0 2537 | else 2538 | echo 1 2539 | fi 2540 | } 2541 | 2542 | do_onewire() { 2543 | DEFAULT=--defaultno 2544 | CURRENT=0 2545 | if [ $(get_onewire) -eq 0 ]; then 2546 | DEFAULT= 2547 | CURRENT=1 2548 | fi 2549 | if [ "$INTERACTIVE" = True ]; then 2550 | whiptail --yesno "Would you like the one-wire interface to be enabled?" $DEFAULT 20 60 2 2551 | RET=$? 2552 | else 2553 | RET=$1 2554 | fi 2555 | if [ $RET -eq $CURRENT ]; then 2556 | ASK_TO_REBOOT=1 2557 | fi 2558 | if [ $RET -eq 0 ]; then 2559 | sed $CONFIG -i -e "s/^#dtoverlay=w1-gpio/dtoverlay=w1-gpio/" 2560 | if ! grep -q -E "^dtoverlay=w1-gpio" $CONFIG; then 2561 | printf "dtoverlay=w1-gpio\n" >> $CONFIG 2562 | fi 2563 | STATUS=enabled 2564 | elif [ $RET -eq 1 ]; then 2565 | sed $CONFIG -i -e "s/^dtoverlay=w1-gpio/#dtoverlay=w1-gpio/" 2566 | STATUS=disabled 2567 | else 2568 | return $RET 2569 | fi 2570 | if [ "$INTERACTIVE" = True ]; then 2571 | whiptail --msgbox "The one-wire interface is $STATUS" 20 60 1 2572 | fi 2573 | } 2574 | 2575 | get_legacy() { 2576 | if sed -n '/\[pi4\]/,/\[/ !p' $CONFIG | grep -q '^dtoverlay=vc4-kms-v3d' ; then 2577 | echo 1 2578 | else 2579 | echo 0 2580 | fi 2581 | } 2582 | 2583 | do_legacy() { 2584 | DEFAULT=--defaultno 2585 | CURRENT=0 2586 | if [ $(get_legacy) -eq 0 ]; then 2587 | DEFAULT= 2588 | CURRENT=1 2589 | fi 2590 | if [ "$INTERACTIVE" = True ]; then 2591 | whiptail --yesno "Would you like to enable legacy camera support?" $DEFAULT 20 60 2 2592 | RET=$? 2593 | else 2594 | RET=$1 2595 | fi 2596 | if [ $RET -eq $CURRENT ]; then 2597 | ASK_TO_REBOOT=1 2598 | fi 2599 | if [ $RET -eq 0 ]; then 2600 | sed $CONFIG -i -e '/\[pi4\]/,/\[/ s/^#\?dtoverlay=vc4-f\?kms-v3d/dtoverlay=vc4-fkms-v3d/g' 2601 | sed $CONFIG -i -e '/\[pi4\]/,/\[/ !s/^dtoverlay=vc4-kms-v3d/#dtoverlay=vc4-kms-v3d/g' 2602 | sed $CONFIG -i -e '/\[pi4\]/,/\[/ !s/^dtoverlay=vc4-fkms-v3d/#dtoverlay=vc4-fkms-v3d/g' 2603 | if ! sed -n '/\[pi4\]/,/\[/ p' $CONFIG | grep -q '^dtoverlay=vc4-fkms-v3d' ; then 2604 | if grep -q '[pi4]' $CONFIG ; then 2605 | sed $CONFIG -i -e 's/\[pi4\]/\[pi4\]\ndtoverlay=vc4-fkms-v3d/' 2606 | else 2607 | printf "[pi4]\ndtoverlay=vc4-fkms-v3d\n" >> $CONFIG 2608 | fi 2609 | fi 2610 | CUR_GPU_MEM=$(get_config_var gpu_mem $CONFIG) 2611 | if [ -z "$CUR_GPU_MEM" ] || [ "$CUR_GPU_MEM" -lt 128 ]; then 2612 | set_config_var gpu_mem 128 $CONFIG 2613 | fi 2614 | sed $CONFIG -i -e 's/^camera_auto_detect.*/start_x=1/g' 2615 | sed $CONFIG -i -e 's/^dtoverlay=camera/#dtoverlay=camera/g' 2616 | STATUS="Legacy camera support is enabled.\n\nPlease note that this functionality is deprecated and will not be supported for future development." 2617 | else 2618 | sed $CONFIG -i -e 's/^#\?dtoverlay=vc4-f\?kms-v3d/dtoverlay=vc4-kms-v3d/g' 2619 | sed $CONFIG -i -e '/\[pi4\]/,/\[/ {/dtoverlay=vc4-kms-v3d/d}' 2620 | if ! sed -n '/\[pi4\]/,/\[/ !p' $CONFIG | grep -q '^dtoverlay=vc4-kms-v3d' ; then 2621 | if grep -q '[all]' $CONFIG ; then 2622 | sed $CONFIG -i -e 's/\[all\]/\[all\]\ndtoverlay=vc4-kms-v3d/' 2623 | else 2624 | printf "[all]\ndtoverlay=vc4-kms-v3d\n" >> $CONFIG 2625 | fi 2626 | fi 2627 | sed $CONFIG -i -e 's/^start_x.*/camera_auto_detect=1/g' 2628 | sed $CONFIG -i -e 's/^#dtoverlay=camera/dtoverlay=camera/g' 2629 | STATUS="Legacy camera support is disabled." 2630 | fi 2631 | if [ "$INTERACTIVE" = True ]; then 2632 | whiptail --msgbox "$STATUS" 20 60 1 2633 | fi 2634 | } 2635 | 2636 | do_gldriver() { 2637 | if [ ! -e /boot${FIRMWARE}/overlays/vc4-kms-v3d.dtbo ]; then 2638 | whiptail --msgbox "Driver and kernel not present on your system. Please update" 20 60 2 2639 | return 1 2640 | fi 2641 | for package in gldriver-test libgl1-mesa-dri; do 2642 | if [ "$(dpkg -l "$package" 2> /dev/null | tail -n 1 | cut -d ' ' -f 1)" != "ii" ]; then 2643 | missing_packages="$package $missing_packages" 2644 | fi 2645 | done 2646 | if [ -n "$missing_packages" ] && ! apt-get install $missing_packages; then 2647 | whiptail --msgbox "Required packages not found, please install: ${missing_packages}" 20 60 2 2648 | return 1 2649 | fi 2650 | GLOPT=$(whiptail --title "Raspberry Pi Software Configuration Tool (raspi-config)" --menu "GL Driver" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT \ 2651 | "G1 Legacy" "Original non-GL desktop driver" \ 2652 | "G2 GL (Full KMS)" "OpenGL desktop driver with full KMS" \ 2653 | 3>&1 1>&2 2>&3) 2654 | if [ $? -eq 0 ]; then 2655 | case "$GLOPT" in 2656 | G1*) 2657 | if sed -n "/\[pi4\]/,/\[/ !p" $CONFIG | grep -q -E "^dtoverlay=vc4-f?kms-v3d" ; then 2658 | ASK_TO_REBOOT=1 2659 | fi 2660 | sed $CONFIG -i -e "s/^dtoverlay=vc4-fkms-v3d/#dtoverlay=vc4-fkms-v3d/g" 2661 | sed $CONFIG -i -e "s/^dtoverlay=vc4-kms-v3d/#dtoverlay=vc4-kms-v3d/g" 2662 | STATUS="The GL driver is disabled." 2663 | ;; 2664 | G2*) 2665 | if ! sed -n "/\[pi4\]/,/\[/ !p" $CONFIG | grep -q "^dtoverlay=vc4-kms-v3d" ; then 2666 | ASK_TO_REBOOT=1 2667 | fi 2668 | sed $CONFIG -i -e "s/^dtoverlay=vc4-fkms-v3d/#dtoverlay=vc4-fkms-v3d/g" 2669 | sed $CONFIG -i -e "s/^#dtoverlay=vc4-kms-v3d/dtoverlay=vc4-kms-v3d/g" 2670 | if ! sed -n "/\[pi4\]/,/\[/ !p" $CONFIG | grep -q "^dtoverlay=vc4-kms-v3d" ; then 2671 | printf "[all]\ndtoverlay=vc4-kms-v3d\n" >> $CONFIG 2672 | fi 2673 | STATUS="The full KMS GL driver is enabled." 2674 | ;; 2675 | *) 2676 | whiptail --msgbox "Programmer error, unrecognised boot option" 20 60 2 2677 | return 1 2678 | ;; 2679 | esac 2680 | else 2681 | return 0 2682 | fi 2683 | whiptail --msgbox "$STATUS" 20 60 1 2684 | } 2685 | 2686 | do_xcompmgr() { 2687 | DEFAULT=--defaultno 2688 | CURRENT=0 2689 | if [ -e /etc/xdg/autostart/xcompmgr.desktop ]; then 2690 | DEFAULT= 2691 | CURRENT=1 2692 | fi 2693 | if [ "$INTERACTIVE" = True ]; then 2694 | whiptail --yesno "Would you like the xcompmgr composition manager to be enabled?" $DEFAULT 20 60 2 2695 | RET=$? 2696 | else 2697 | RET=$1 2698 | fi 2699 | if [ $RET -eq $CURRENT ]; then 2700 | ASK_TO_REBOOT=1 2701 | fi 2702 | if [ $RET -eq 0 ]; then 2703 | if [ ! -e /usr/bin/xcompmgr ] ; then 2704 | apt-get -y install xcompmgr 2705 | fi 2706 | cat << EOF > /etc/xdg/autostart/xcompmgr.desktop 2707 | [Desktop Entry] 2708 | Type=Application 2709 | Name=xcompmgr 2710 | Comment=Start xcompmgr compositor 2711 | NoDisplay=true 2712 | Exec=/usr/lib/raspi-config/cmstart.sh 2713 | EOF 2714 | STATUS=enabled 2715 | elif [ $RET -eq 1 ]; then 2716 | rm -f /etc/xdg/autostart/xcompmgr.desktop 2717 | STATUS=disabled 2718 | else 2719 | return $RET 2720 | fi 2721 | if [ "$INTERACTIVE" = True ]; then 2722 | whiptail --msgbox "The xcompmgr composition manager is $STATUS" 20 60 1 2723 | fi 2724 | } 2725 | 2726 | do_glamor() { 2727 | DEFAULT= 2728 | CURRENT=1 2729 | if [ -e /usr/share/X11/xorg.conf.d/20-noglamor.conf ] ; then 2730 | DEFAULT=--defaultno 2731 | CURRENT=0 2732 | fi 2733 | if [ "$INTERACTIVE" = True ]; then 2734 | whiptail --yesno "Would you like glamor acceleration to be enabled?" $DEFAULT 20 60 2 2735 | RET=$? 2736 | else 2737 | RET=$1 2738 | fi 2739 | if [ $RET -eq $CURRENT ]; then 2740 | ASK_TO_REBOOT=1 2741 | fi 2742 | if [ $RET -eq 0 ]; then 2743 | systemctl disable glamor-test.service 2744 | systemctl stop glamor-test.service 2745 | rm -f /usr/share/X11/xorg.conf.d/20-noglamor.conf 2746 | STATUS=enabled 2747 | elif [ $RET -eq 1 ]; then 2748 | systemctl enable glamor-test.service && 2749 | systemctl start glamor-test.service && 2750 | STATUS=disabled 2751 | else 2752 | return $RET 2753 | fi 2754 | if [ "$INTERACTIVE" = True ]; then 2755 | whiptail --msgbox "Glamor acceleration is $STATUS" 20 60 1 2756 | fi 2757 | } 2758 | 2759 | do_wayland() { 2760 | if [ "$INTERACTIVE" = True ]; then 2761 | if [ -f /usr/bin/labwc ]; then 2762 | RET=$(whiptail --title "Raspberry Pi Software Configuration Tool (raspi-config)" --menu "Wayland Options" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT \ 2763 | "W1 X11" "Openbox window manager with X11 backend" \ 2764 | "W2 Wayfire" "Wayfire window manager with Wayland backend" \ 2765 | "W3 Labwc" "Labwc window manager with Wayland backend" \ 2766 | 3>&1 1>&2 2>&3) 2767 | else 2768 | RET=$(whiptail --title "Raspberry Pi Software Configuration Tool (raspi-config)" --menu "Wayland Options" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT \ 2769 | "W1 X11" "Openbox window manager with X11 backend" \ 2770 | "W2 Wayfire" "Wayfire window manager with Wayland backend" \ 2771 | 3>&1 1>&2 2>&3) 2772 | fi 2773 | else 2774 | RET=$1 2775 | true 2776 | fi 2777 | if [ $? -eq 0 ]; then 2778 | if [ -f /usr/share/xsessions/rpd-x.desktop ] ; then 2779 | XSESSION=rpd-x 2780 | WSESSION=rpd-labwc 2781 | else 2782 | XSESSION=LXDE-pi-x 2783 | WSESSION=LXDE-pi-labwc 2784 | fi 2785 | case "$RET" in 2786 | W1*) 2787 | sed /etc/lightdm/lightdm.conf -i -e "s/^#\\?user-session.*/user-session=$XSESSION/" 2788 | sed /etc/lightdm/lightdm.conf -i -e "s/^#\\?autologin-session.*/autologin-session=$XSESSION/" 2789 | sed /etc/lightdm/lightdm.conf -i -e "s/^#\\?greeter-session.*/greeter-session=pi-greeter/" 2790 | sed /etc/lightdm/lightdm.conf -i -e "s/^fallback-test.*/#fallback-test=/" 2791 | sed /etc/lightdm/lightdm.conf -i -e "s/^fallback-session.*/#fallback-session=/" 2792 | sed /etc/lightdm/lightdm.conf -i -e "s/^fallback-greeter.*/#fallback-greeter=/" 2793 | if [ -e "/var/lib/AccountsService/users/$USER" ] ; then 2794 | sed "/var/lib/AccountsService/users/$USER" -i -e "s/XSession=.*/XSession=$XSESSION/" 2795 | fi 2796 | STATUS="Openbox on X11" 2797 | ;; 2798 | W2*) 2799 | sed /etc/lightdm/lightdm.conf -i -e "s/^#\\?user-session.*/user-session=LXDE-pi-wayfire/" 2800 | sed /etc/lightdm/lightdm.conf -i -e "s/^#\\?autologin-session.*/autologin-session=LXDE-pi-wayfire/" 2801 | sed /etc/lightdm/lightdm.conf -i -e "s/^#\\?greeter-session.*/greeter-session=pi-greeter-wayfire/" 2802 | sed /etc/lightdm/lightdm.conf -i -e "s/^#\\?fallback-test.*/fallback-test=\/usr\/bin\/xfallback.sh/" 2803 | sed /etc/lightdm/lightdm.conf -i -e "s/^#\\?fallback-session.*/fallback-session=LXDE-pi-x/" 2804 | sed /etc/lightdm/lightdm.conf -i -e "s/^#\\?fallback-greeter.*/fallback-greeter=pi-greeter/" 2805 | if [ -e "/var/lib/AccountsService/users/$USER" ] ; then 2806 | sed "/var/lib/AccountsService/users/$USER" -i -e "s/XSession=.*/XSession=LXDE-pi-wayfire/" 2807 | fi 2808 | STATUS="Wayfire on Wayland" 2809 | ;; 2810 | W3*) 2811 | sed /etc/lightdm/lightdm.conf -i -e "s/^#\\?user-session.*/user-session=$WSESSION/" 2812 | sed /etc/lightdm/lightdm.conf -i -e "s/^#\\?autologin-session.*/autologin-session=$WSESSION/" 2813 | sed /etc/lightdm/lightdm.conf -i -e "s/^#\\?greeter-session.*/greeter-session=pi-greeter-labwc/" 2814 | sed /etc/lightdm/lightdm.conf -i -e "s/^fallback-test.*/#fallback-test=/" 2815 | sed /etc/lightdm/lightdm.conf -i -e "s/^fallback-session.*/#fallback-session=/" 2816 | sed /etc/lightdm/lightdm.conf -i -e "s/^fallback-greeter.*/#fallback-greeter=/" 2817 | if [ -e "/var/lib/AccountsService/users/$USER" ] ; then 2818 | sed "/var/lib/AccountsService/users/$USER" -i -e "s/XSession=.*/XSession=$WSESSION/" 2819 | fi 2820 | STATUS="Labwc on Wayland" 2821 | ;; 2822 | *) 2823 | whiptail --msgbox "Programmer error, unrecognised boot option" 20 60 2 2824 | return 1 2825 | ;; 2826 | esac 2827 | ASK_TO_REBOOT=1 2828 | else 2829 | return 0 2830 | fi 2831 | if [ "$INTERACTIVE" = True ]; then 2832 | whiptail --msgbox "$STATUS is active" 20 60 1 2833 | fi 2834 | } 2835 | 2836 | do_audioconf() { 2837 | sudo -u $USER XDG_RUNTIME_DIR=/run/user/$SUDO_UID DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$SUDO_UID/bus systemctl --user -q is-enabled pipewire-pulse > /dev/null 2>&1 2838 | PPENABLED=$? 2839 | sudo -u $USER XDG_RUNTIME_DIR=/run/user/$SUDO_UID DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$SUDO_UID/bus systemctl --user -q is-enabled pulseaudio > /dev/null 2>&1 2840 | PAENABLED=$? 2841 | if [ "$INTERACTIVE" = True ]; then 2842 | DEFAULT=1 2843 | if [ "$PPENABLED" = 0 ] ; then 2844 | DEFAULT=2 2845 | fi 2846 | if ! is_installed pulseaudio && ! is_installed pipewire-pulse ; then 2847 | whiptail --msgbox "No audio systems installed" 20 60 1 2848 | RET=1 2849 | else 2850 | if is_installed pulseaudio ; then 2851 | OPTIONS="1 PulseAudio" 2852 | fi 2853 | if is_installed pipewire-pulse ; then 2854 | OPTIONS="$OPTIONS 2 Pipewire" 2855 | fi 2856 | #shellcheck disable=2086 2857 | PPOPT=$(whiptail --menu "Select the audio configuration to use" 20 60 10 $OPTIONS --default-item "$DEFAULT" 3>&1 1>&2 2>&3) 2858 | RET="$?" 2859 | fi 2860 | else 2861 | PPOPT="$1" 2862 | RET=0 2863 | fi 2864 | if [ "$RET" -ne 0 ] ; then 2865 | return 2866 | fi 2867 | 2868 | if [ "$PPOPT" -eq 2 ] ; then # pipewire selected 2869 | systemctl --global -q disable pulseaudio 2870 | systemctl --global -q enable pipewire-pulse 2871 | systemctl --global -q enable wireplumber 2872 | if [ -e /usr/share/doc/pipewire/examples/alsa.conf.d/99-pipewire-default.conf ] ; then 2873 | cp /usr/share/doc/pipewire/examples/alsa.conf.d/99-pipewire-default.conf /etc/alsa/conf.d/ 2874 | fi 2875 | AUDCON="Pipewire" 2876 | if [ "$PAENABLED" = 0 ] ; then 2877 | ASK_TO_REBOOT=1 2878 | fi 2879 | else # pulse selected 2880 | systemctl --global -q disable pipewire-pulse 2881 | systemctl --global -q disable wireplumber 2882 | systemctl --global -q enable pulseaudio 2883 | if [ -e /etc/alsa/conf.d/99-pipewire-default.conf ] ; then 2884 | rm /etc/alsa/conf.d/99-pipewire-default.conf 2885 | fi 2886 | AUDCON="PulseAudio" 2887 | if [ "$PPENABLED" = 0 ] ; then 2888 | ASK_TO_REBOOT=1 2889 | fi 2890 | fi 2891 | 2892 | if [ "$INTERACTIVE" = True ]; then 2893 | whiptail --msgbox "$AUDCON is active" 20 60 1 2894 | fi 2895 | } 2896 | 2897 | get_net_names() { 2898 | if grep -q "net.ifnames=0" $CMDLINE || \ 2899 | ( [ "$(readlink -f /etc/systemd/network/99-default.link)" = "/dev/null" ] && \ 2900 | [ "$(readlink -f /etc/systemd/network/73-usb-net-by-mac.link)" = "/dev/null" ] ); then 2901 | echo 1 2902 | else 2903 | echo 0 2904 | fi 2905 | } 2906 | 2907 | do_net_names () { 2908 | DEFAULT=--defaultno 2909 | CURRENT=0 2910 | if [ $(get_net_names) -eq 0 ]; then 2911 | DEFAULT= 2912 | CURRENT=1 2913 | fi 2914 | if [ "$INTERACTIVE" = True ]; then 2915 | whiptail --yesno "Would you like to enable predictable network interface names?" $DEFAULT 20 60 2 2916 | RET=$? 2917 | else 2918 | RET=$1 2919 | fi 2920 | if [ $RET -eq $CURRENT ]; then 2921 | ASK_TO_REBOOT=1 2922 | fi 2923 | if [ $RET -eq 0 ]; then 2924 | sed -i $CMDLINE -e "s/net.ifnames=0 *//" 2925 | rm -f /etc/systemd/network/99-default.link 2926 | rm -f /etc/systemd/network/73-usb-net-by-mac.link 2927 | STATUS=enabled 2928 | elif [ $RET -eq 1 ]; then 2929 | ln -sf /dev/null /etc/systemd/network/99-default.link 2930 | ln -sf /dev/null /etc/systemd/network/73-usb-net-by-mac.link 2931 | STATUS=disabled 2932 | else 2933 | return $RET 2934 | fi 2935 | if [ "$INTERACTIVE" = True ]; then 2936 | whiptail --msgbox "Predictable network interface names are $STATUS" 20 60 1 2937 | fi 2938 | } 2939 | 2940 | do_update() { 2941 | apt-get update && 2942 | apt-get install raspi-config && 2943 | printf "Sleeping 5 seconds before reloading raspi-config\n" && 2944 | sleep 5 && 2945 | exec raspi-config 2946 | } 2947 | 2948 | do_audio() { 2949 | if is_pulseaudio ; then 2950 | oIFS="$IFS" 2951 | if [ "$INTERACTIVE" = True ]; then 2952 | list=$(sudo -u $USER XDG_RUNTIME_DIR=/run/user/$SUDO_UID LANG=C pactl list sinks | grep -e "Sink #" -e "alsa.card_name" | sed s/*//g | sed s/^[' '\\t]*//g | sed s/'Sink #'//g | sed s/'alsa.card_name = '//g | sed s/'bcm2835 '//g | sed s/\"//g | tr '\n' '/') 2953 | if [ -n "$list" ] ; then 2954 | IFS="/" 2955 | AUDIO_OUT=$(whiptail --menu "Choose the audio output" 20 60 10 ${list} 3>&1 1>&2 2>&3) 2956 | else 2957 | whiptail --msgbox "No internal audio devices found" 20 60 1 2958 | return 1 2959 | fi 2960 | else 2961 | AUDIO_OUT=$1 2962 | true 2963 | fi 2964 | if [ $? -eq 0 ]; then 2965 | sudo -u $USER XDG_RUNTIME_DIR=/run/user/$SUDO_UID pactl set-default-sink $AUDIO_OUT 2966 | fi 2967 | IFS="$oIFS" 2968 | else 2969 | if aplay -l | grep -q "bcm2835 ALSA"; then 2970 | if [ "$INTERACTIVE" = True ]; then 2971 | AUDIO_OUT=$(whiptail --menu "Choose the audio output" 20 60 10 \ 2972 | "0" "Auto" \ 2973 | "1" "Force 3.5mm ('headphone') jack" \ 2974 | "2" "Force HDMI" \ 2975 | 3>&1 1>&2 2>&3) 2976 | else 2977 | AUDIO_OUT=$1 2978 | fi 2979 | if [ "$?" -eq 0 ] && [ -n "$AUDIO_OUT" ]; then 2980 | amixer cset numid=3 "$AUDIO_OUT" 2981 | fi 2982 | else 2983 | ASPATH=$(getent passwd $USER | cut -d : -f 6)/.asoundrc 2984 | if [ "$INTERACTIVE" = True ]; then 2985 | n=0 2986 | array="" 2987 | while [ $n -le 9 ] 2988 | do 2989 | CARD=$(LC_ALL=C aplay -l | grep "card $n" | cut -d [ -f 2 | cut -d ] -f 1) 2990 | if [ -z "$CARD" ] ; then 2991 | break 2992 | else 2993 | if [ -z "$array" ] ; then 2994 | array=$n"/"$CARD 2995 | else 2996 | #shellcheck disable=2027 2997 | array=$array"/"$n"/"$CARD 2998 | fi 2999 | fi 3000 | n=$(( n+1 )) 3001 | done 3002 | if [ $n -eq 0 ] ; then 3003 | whiptail --msgbox "No audio devices found" 20 60 1 3004 | false 3005 | else 3006 | oIFS="$IFS" 3007 | IFS="/" 3008 | AUDIO_OUT=$(whiptail --menu "Choose the audio output" 20 60 10 ${array} 3>&1 1>&2 2>&3) 3009 | IFS="$oIFS" 3010 | fi 3011 | else 3012 | AUDIO_OUT=$1 3013 | fi 3014 | if [ "$?" -eq 0 ] && [ -n "$AUDIO_OUT" ]; then 3015 | cat << EOF > $ASPATH 3016 | pcm.!default { 3017 | type asym 3018 | playback.pcm { 3019 | type plug 3020 | slave.pcm "output" 3021 | } 3022 | capture.pcm { 3023 | type plug 3024 | slave.pcm "input" 3025 | } 3026 | } 3027 | 3028 | pcm.output { 3029 | type hw 3030 | card $AUDIO_OUT 3031 | } 3032 | 3033 | ctl.!default { 3034 | type hw 3035 | card $AUDIO_OUT 3036 | } 3037 | EOF 3038 | fi 3039 | fi 3040 | fi 3041 | } 3042 | 3043 | do_resolution() { 3044 | if [ "$INTERACTIVE" = True ]; then 3045 | CMODE=$(get_config_var hdmi_mode $CONFIG) 3046 | CGROUP=$(get_config_var hdmi_group $CONFIG) 3047 | if [ $CMODE -eq 0 ] ; then 3048 | CSET="Default" 3049 | elif [ $CGROUP -eq 2 ] ; then 3050 | CSET="DMT Mode "$CMODE 3051 | else 3052 | CSET="CEA Mode "$CMODE 3053 | fi 3054 | oIFS="$IFS" 3055 | IFS="/" 3056 | if tvservice -d /dev/null | grep -q Nothing ; then 3057 | value="Default/720x480/DMT Mode 4/640x480 60Hz 4:3/DMT Mode 9/800x600 60Hz 4:3/DMT Mode 16/1024x768 60Hz 4:3/DMT Mode 85/1280x720 60Hz 16:9/DMT Mode 35/1280x1024 60Hz 5:4/DMT Mode 51/1600x1200 60Hz 4:3/DMT Mode 82/1920x1080 60Hz 16:9/" 3058 | else 3059 | value="Default/Monitor preferred resolution/" 3060 | value=$value$(tvservice -m CEA | grep progressive | cut -b 12- | sed 's/mode \([0-9]\+\): \([0-9]\+\)x\([0-9]\+\) @ \([0-9]\+\)Hz \([0-9]\+\):\([0-9]\+\), clock:[0-9]\+MHz progressive/CEA Mode \1\/\2x\3 \4Hz \5:\6/' | tr '\n' '/') 3061 | value=$value$(tvservice -m DMT | grep progressive | cut -b 12- | sed 's/mode \([0-9]\+\): \([0-9]\+\)x\([0-9]\+\) @ \([0-9]\+\)Hz \([0-9]\+\):\([0-9]\+\), clock:[0-9]\+MHz progressive/DMT Mode \1\/\2x\3 \4Hz \5:\6/' | tr '\n' '/') 3062 | fi 3063 | RES=$(whiptail --default-item $CSET --menu "Choose screen resolution" 20 60 10 ${value} 3>&1 1>&2 2>&3) 3064 | STATUS=$? 3065 | IFS="$oIFS" 3066 | if [ $STATUS -eq 0 ] ; then 3067 | GRS=$(echo "$RES" | cut -d ' ' -f 1) 3068 | MODE=$(echo "$RES" | cut -d ' ' -f 3) 3069 | if [ $GRS = "Default" ] ; then 3070 | MODE=0 3071 | elif [ $GRS = "DMT" ] ; then 3072 | GROUP=2 3073 | else 3074 | GROUP=1 3075 | fi 3076 | fi 3077 | else 3078 | GROUP=$1 3079 | MODE=$2 3080 | STATUS=0 3081 | fi 3082 | if [ $STATUS -eq 0 ]; then 3083 | if [ $MODE -eq 0 ]; then 3084 | clear_config_var hdmi_force_hotplug $CONFIG 3085 | clear_config_var hdmi_group $CONFIG 3086 | clear_config_var hdmi_mode $CONFIG 3087 | else 3088 | set_config_var hdmi_force_hotplug 1 $CONFIG 3089 | set_config_var hdmi_group $GROUP $CONFIG 3090 | set_config_var hdmi_mode $MODE $CONFIG 3091 | fi 3092 | if [ "$INTERACTIVE" = True ]; then 3093 | if [ $MODE -eq 0 ] ; then 3094 | whiptail --msgbox "The resolution is set to default" 20 60 1 3095 | else 3096 | whiptail --msgbox "The resolution is set to $GRS mode $MODE" 20 60 1 3097 | fi 3098 | fi 3099 | if [ $MODE -eq 0 ] ; then 3100 | TSET="Default" 3101 | elif [ $GROUP -eq 2 ] ; then 3102 | TSET="DMT Mode "$MODE 3103 | else 3104 | TSET="CEA Mode "$MODE 3105 | fi 3106 | if [ "$TSET" != "$CSET" ] ; then 3107 | ASK_TO_REBOOT=1 3108 | fi 3109 | fi 3110 | } 3111 | 3112 | get_vnc_resolution() { 3113 | if is_wayfire ; then 3114 | W=$(grep ^headless_width $WAYFIRE_FILE | grep -o "[0-9]*") 3115 | H=$(grep ^headless_height $WAYFIRE_FILE | grep -o "[0-9]*") 3116 | if [ -n "$W" ] && [ -n "$H" ] ; then 3117 | echo $W"x"$H 3118 | else 3119 | echo "1280x720" 3120 | fi 3121 | else 3122 | if [ -e /etc/xdg/autostart/vnc_xrandr.desktop ] ; then 3123 | grep fb /etc/xdg/autostart/vnc_xrandr.desktop | cut -f 15 -d ' ' 3124 | else 3125 | echo "" 3126 | fi 3127 | fi 3128 | } 3129 | 3130 | do_vnc_resolution() { 3131 | if [ "$INTERACTIVE" = True ]; then 3132 | CUR=$(get_vnc_resolution) 3133 | if [ "$CUR" = "" ] ; then 3134 | CUR=640x480 3135 | fi 3136 | FUN=$(whiptail --title "Raspberry Pi Software Configuration Tool (raspi-config)" --default-item $CUR --menu "Set VNC Resolution" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT --cancel-button Back --ok-button Select \ 3137 | "640x480" "" "720x480" "" "800x600" "" "1024x768" "" "1280x720" "" "1280x1024" "" "1600x1200" "" "1920x1080" "" 3>&1 1>&2 2>&3) 3138 | RET=$? 3139 | else 3140 | FUN=$1 3141 | RET=0 3142 | fi 3143 | if [ $RET -eq 1 ]; then 3144 | return 0 3145 | elif [ $RET -eq 0 ]; then 3146 | if is_wayfire ; then 3147 | W=$(echo "$FUN" | cut -d x -f 1) 3148 | H=$(echo "$FUN" | cut -d x -f 2) 3149 | if grep -q ^headless_width $WAYFIRE_FILE ; then 3150 | sed -i "s/headless_width.*/headless_width = $W/" $WAYFIRE_FILE 3151 | sed -i "s/headless_height.*/headless_height = $H/" $WAYFIRE_FILE 3152 | else 3153 | if grep -q "\[output\]" $WAYFIRE_FILE ; then 3154 | sed -i "s/\[output]/[output]\nheadless_width = $W\nheadless_height = $H/" $WAYFIRE_FILE 3155 | else 3156 | printf '\n[output]\nheadless_width = %d\nheadless_height = %d\n' "$W" "$H" >> $WAYFIRE_FILE 3157 | fi 3158 | fi 3159 | else 3160 | cat > /etc/xdg/autostart/vnc_xrandr.desktop << EOF 3161 | [Desktop Entry] 3162 | Type=Application 3163 | Name=vnc_xrandr 3164 | Comment=Set resolution for VNC 3165 | NoDisplay=true 3166 | Exec=sh -c "if ! (xrandr | grep -q -w connected) ; then /usr/bin/xrandr --fb $FUN ; fi" 3167 | EOF 3168 | fi 3169 | if [ "$INTERACTIVE" = True ]; then 3170 | whiptail --msgbox "The resolution is set to $FUN" 20 60 1 3171 | ASK_TO_REBOOT=1 3172 | fi 3173 | fi 3174 | } 3175 | 3176 | list_wlan_interfaces() { 3177 | for dir in /sys/class/net/*/wireless; do 3178 | if [ -d "$dir" ]; then 3179 | IFACE="$(basename "$(dirname "$dir")")" 3180 | if wpa_cli -i "$IFACE" status > /dev/null 2>&1; then 3181 | echo "$IFACE" 3182 | fi 3183 | fi 3184 | done 3185 | } 3186 | 3187 | do_wifi_ssid_passphrase() { 3188 | RET=0 3189 | if [ "$INTERACTIVE" = True ] && [ -z "$(get_wifi_country)" ]; then 3190 | do_wifi_country 3191 | fi 3192 | 3193 | if systemctl -q is-active dhcpcd; then 3194 | IFACE="$(list_wlan_interfaces | head -n 1)" 3195 | 3196 | if [ -z "$IFACE" ]; then 3197 | if [ "$INTERACTIVE" = True ]; then 3198 | whiptail --msgbox "No wireless interface found" 20 60 3199 | fi 3200 | return 1 3201 | fi 3202 | 3203 | if ! wpa_cli -i "$IFACE" status > /dev/null 2>&1; then 3204 | if [ "$INTERACTIVE" = True ]; then 3205 | whiptail --msgbox "Could not communicate with wpa_supplicant" 20 60 3206 | fi 3207 | return 1 3208 | fi 3209 | elif ! systemctl -q is-active NetworkManager; then 3210 | if [ "$INTERACTIVE" = True ]; then 3211 | whiptail --msgbox "No supported network connection manager found" 20 60 3212 | fi 3213 | return 1 3214 | fi 3215 | 3216 | SSID="$1" 3217 | while [ -z "$SSID" ] && [ "$INTERACTIVE" = True ]; do 3218 | if ! SSID=$(whiptail --inputbox "Please enter SSID" 20 60 3>&1 1>&2 2>&3); then 3219 | return 0 3220 | elif [ -z "$SSID" ]; then 3221 | whiptail --msgbox "SSID cannot be empty. Please try again." 20 60 3222 | fi 3223 | done 3224 | 3225 | PASSPHRASE="$2" 3226 | while [ "$INTERACTIVE" = True ]; do 3227 | if ! PASSPHRASE=$(whiptail --passwordbox "Please enter passphrase. Leave it empty if none." 20 60 3>&1 1>&2 2>&3); then 3228 | return 0 3229 | else 3230 | break 3231 | fi 3232 | done 3233 | 3234 | # Escape special characters for embedding in regex below 3235 | ssid="$(echo "$SSID" \ 3236 | | sed 's;\\;\\\\;g' \ 3237 | | sed -e 's;\.;\\\.;g' \ 3238 | -e 's;\*;\\\*;g' \ 3239 | -e 's;\+;\\\+;g' \ 3240 | -e 's;\?;\\\?;g' \ 3241 | -e 's;\^;\\\^;g' \ 3242 | -e 's;\$;\\\$;g' \ 3243 | -e 's;\/;\\\/;g' \ 3244 | -e 's;\[;\\\[;g' \ 3245 | -e 's;\];\\\];g' \ 3246 | -e 's;{;\\{;g' \ 3247 | -e 's;};\\};g' \ 3248 | -e 's;(;\\(;g' \ 3249 | -e 's;);\\);g' \ 3250 | -e 's;";\\\\\";g')" 3251 | 3252 | HIDDEN=${3:-0} 3253 | PLAIN=${4:-1} 3254 | 3255 | if systemctl -q is-active dhcpcd; then 3256 | wpa_cli -i "$IFACE" list_networks \ 3257 | | tail -n +2 | cut -f -2 | grep -P "\t$ssid$" | cut -f1 \ 3258 | | while read -r ID; do 3259 | wpa_cli -i "$IFACE" remove_network "$ID" > /dev/null 2>&1 3260 | done 3261 | 3262 | ID="$(wpa_cli -i "$IFACE" add_network)" 3263 | wpa_cli -i "$IFACE" set_network "$ID" ssid "\"$SSID\"" 2>&1 | grep -q "OK" 3264 | RET=$((RET + $?)) 3265 | 3266 | if [ -z "$PASSPHRASE" ]; then 3267 | wpa_cli -i "$IFACE" set_network "$ID" key_mgmt NONE 2>&1 | grep -q "OK" 3268 | RET=$((RET + $?)) 3269 | else 3270 | if [ "$PLAIN" = 1 ]; then 3271 | PASSPHRASE="\"$PASSPHRASE\"" 3272 | fi 3273 | wpa_cli -i "$IFACE" set_network "$ID" psk "$PASSPHRASE" 2>&1 | grep -q "OK" 3274 | RET=$((RET + $?)) 3275 | fi 3276 | if [ "$HIDDEN" -ne 0 ]; then 3277 | wpa_cli -i "$IFACE" set_network "$ID" scan_ssid 1 2>&1 | grep -q "OK" 3278 | RET=$((RET + $?)) 3279 | fi 3280 | if [ $RET -eq 0 ]; then 3281 | wpa_cli -i "$IFACE" enable_network "$ID" > /dev/null 2>&1 3282 | else 3283 | wpa_cli -i "$IFACE" remove_network "$ID" > /dev/null 2>&1 3284 | if [ "$INTERACTIVE" = True ]; then 3285 | whiptail --msgbox "Failed to set SSID or passphrase" 20 60 3286 | fi 3287 | fi 3288 | wpa_cli -i "$IFACE" save_config > /dev/null 2>&1 3289 | echo "$IFACE_LIST" | while read -r IFACE; do 3290 | wpa_cli -i "$IFACE" reconfigure > /dev/null 2>&1 3291 | done 3292 | else 3293 | IFACE="$(list_wlan_interfaces | head -n 1)" 3294 | if [ "$HIDDEN" -ne 0 ]; then 3295 | nmcli device wifi connect "$SSID" password "$PASSPHRASE" ifname "${IFACE}" hidden true | grep -q "activated" 3296 | else 3297 | nmcli device wifi connect "$SSID" password "$PASSPHRASE" ifname "${IFACE}" | grep -q "activated" 3298 | fi 3299 | RET=$((RET + $?)) 3300 | fi 3301 | 3302 | return "$RET" 3303 | } 3304 | 3305 | do_finish() { 3306 | disable_raspi_config_at_boot 3307 | if [ $ASK_TO_REBOOT -eq 1 ]; then 3308 | whiptail --yesno "Would you like to reboot now?" 20 60 2 3309 | if [ $? -eq 0 ]; then # yes 3310 | sync 3311 | reboot 3312 | fi 3313 | fi 3314 | exit 0 3315 | } 3316 | 3317 | # $1 = filename, $2 = key name 3318 | get_json_string_val() { 3319 | sed -n -e "s/^[[:space:]]*\"$2\"[[:space:]]*:[[:space:]]*\"\(.*\)\"[[:space:]]*,$/\1/p" $1 3320 | } 3321 | 3322 | # TODO: This is probably broken 3323 | do_apply_os_config() { 3324 | [ -e /boot/os_config.json ] || return 0 3325 | NOOBSFLAVOUR=$(get_json_string_val /boot/os_config.json flavour) 3326 | NOOBSLANGUAGE=$(get_json_string_val /boot/os_config.json language) 3327 | NOOBSKEYBOARD=$(get_json_string_val /boot/os_config.json keyboard) 3328 | 3329 | if [ -n "$NOOBSFLAVOUR" ]; then 3330 | printf "Setting flavour to %s based on os_config.json from NOOBS. May take a while\n" "$NOOBSFLAVOUR" 3331 | 3332 | printf "Unrecognised flavour. Ignoring\n" 3333 | fi 3334 | 3335 | # TODO: currently ignores en_gb settings as we assume we are running in a 3336 | # first boot context, where UK English settings are default 3337 | case "$NOOBSLANGUAGE" in 3338 | "en") 3339 | if [ "$NOOBSKEYBOARD" = "gb" ]; then 3340 | DEBLANGUAGE="" # UK english is the default, so ignore 3341 | else 3342 | DEBLANGUAGE="en_US.UTF-8" 3343 | fi 3344 | ;; 3345 | "de") 3346 | DEBLANGUAGE="de_DE.UTF-8" 3347 | ;; 3348 | "fi") 3349 | DEBLANGUAGE="fi_FI.UTF-8" 3350 | ;; 3351 | "fr") 3352 | DEBLANGUAGE="fr_FR.UTF-8" 3353 | ;; 3354 | "hu") 3355 | DEBLANGUAGE="hu_HU.UTF-8" 3356 | ;; 3357 | "ja") 3358 | DEBLANGUAGE="ja_JP.UTF-8" 3359 | ;; 3360 | "nl") 3361 | DEBLANGUAGE="nl_NL.UTF-8" 3362 | ;; 3363 | "pt") 3364 | DEBLANGUAGE="pt_PT.UTF-8" 3365 | ;; 3366 | "ru") 3367 | DEBLANGUAGE="ru_RU.UTF-8" 3368 | ;; 3369 | "zh_CN") 3370 | DEBLANGUAGE="zh_CN.UTF-8" 3371 | ;; 3372 | *) 3373 | printf "Language '%s' not handled currently. Run sudo raspi-config to set up" "$NOOBSLANGUAGE" 3374 | ;; 3375 | esac 3376 | 3377 | if [ -n "$DEBLANGUAGE" ]; then 3378 | printf "Setting language to %s based on os_config.json from NOOBS. May take a while\n" "$DEBLANGUAGE" 3379 | do_change_locale "$DEBLANGUAGE" 3380 | fi 3381 | 3382 | if [ -n "$NOOBSKEYBOARD" -a "$NOOBSKEYBOARD" != "gb" ]; then 3383 | printf "Setting keyboard layout to %s based on os_config.json from NOOBS. May take a while\n" "$NOOBSKEYBOARD" 3384 | do_configure_keyboard "$NOOBSKEYBOARD" 3385 | fi 3386 | return 0 3387 | } 3388 | 3389 | get_overlay_now() { 3390 | grep -q "overlayroot=tmpfs" /proc/cmdline 3391 | echo $? 3392 | } 3393 | 3394 | get_overlay_conf() { 3395 | grep -q "overlayroot=tmpfs" $CMDLINE 3396 | echo $? 3397 | } 3398 | 3399 | get_bootro_now() { 3400 | findmnt /boot${FIRMWARE} | grep -q " ro," 3401 | echo $? 3402 | } 3403 | 3404 | get_bootro_conf() { 3405 | grep /boot${FIRMWARE} /etc/fstab | grep -q "defaults.*,ro[ ,]" 3406 | echo $? 3407 | } 3408 | 3409 | is_uname_current() { 3410 | test -d "/lib/modules/$(uname -r)" 3411 | } 3412 | 3413 | enable_overlayfs() { 3414 | if [ "$(awk '/MemTotal/{print $2; exit}' /proc/meminfo)" -le 262144 ]; then 3415 | if [ "$INTERACTIVE" = True ]; then 3416 | whiptail --msgbox "At least 512MB of RAM is recommended for overlay filesystem" 20 60 1 3417 | else 3418 | echo "At least 512MB of RAM is recommended for overlay filesystem" 3419 | fi 3420 | return 1 3421 | fi 3422 | is_installed overlayroot || apt-get install -y overlayroot 3423 | # mount the boot partition as writable if it isn't already 3424 | if [ $(get_bootro_now) -eq 0 ] ; then 3425 | if ! mount -o remount,rw /boot${FIRMWARE} 2>/dev/null ; then 3426 | echo "Unable to mount boot partition as writable - cannot enable" 3427 | return 1 3428 | fi 3429 | BOOTRO=yes 3430 | else 3431 | BOOTRO=no 3432 | fi 3433 | 3434 | # modify command line 3435 | if ! grep -q "overlayroot=tmpfs" $CMDLINE ; then 3436 | sed -i $CMDLINE -e "s/^/overlayroot=tmpfs /" 3437 | fi 3438 | 3439 | if [ "$BOOTRO" = "yes" ] ; then 3440 | if ! mount -o remount,ro /boot${FIRMWARE} 2>/dev/null ; then 3441 | echo "Unable to remount boot partition as read-only" 3442 | fi 3443 | fi 3444 | } 3445 | 3446 | disable_overlayfs() { 3447 | # mount the boot partition as writable if it isn't already 3448 | if [ $(get_bootro_now) -eq 0 ] ; then 3449 | if ! mount -o remount,rw /boot${FIRMWARE} 2>/dev/null ; then 3450 | echo "Unable to mount boot partition as writable - cannot disable" 3451 | return 1 3452 | fi 3453 | BOOTRO=yes 3454 | else 3455 | BOOTRO=no 3456 | fi 3457 | 3458 | # modify command line 3459 | sed -i $CMDLINE -e "s/\(.*\)overlayroot=tmpfs \(.*\)/\1\2/" 3460 | 3461 | if [ "$BOOTRO" = "yes" ] ; then 3462 | if ! mount -o remount,ro /boot${FIRMWARE} 2>/dev/null ; then 3463 | echo "Unable to remount boot partition as read-only" 3464 | fi 3465 | fi 3466 | } 3467 | 3468 | enable_bootro() { 3469 | if [ $(get_overlay_now) -eq 0 ] ; then 3470 | echo "Overlay in use; cannot update fstab" 3471 | return 1 3472 | fi 3473 | sed -i /etc/fstab -e "s#\(.*/boot$FIRMWARE.*\)defaults\(.*\)#\1defaults,ro\2#" 3474 | } 3475 | 3476 | disable_bootro() { 3477 | if [ $(get_overlay_now) -eq 0 ] ; then 3478 | echo "Overlay in use; cannot update fstab" 3479 | return 1 3480 | fi 3481 | sed -i /etc/fstab -e "s#\(.*/boot$FIRMWARE.*\)defaults,ro\(.*\)#\1defaults\2#" 3482 | } 3483 | 3484 | do_overlayfs() { 3485 | DEFAULT=--defaultno 3486 | CURRENT=0 3487 | STATUS="disabled" 3488 | 3489 | if [ "$INTERACTIVE" = True ] && ! is_uname_current; then 3490 | whiptail --msgbox "Could not find modules for the running kernel ($(uname -r))." 20 60 1 3491 | return 1 3492 | fi 3493 | 3494 | if [ $(get_overlay_conf) -eq 0 ] ; then 3495 | DEFAULT= 3496 | CURRENT=1 3497 | STATUS="enabled" 3498 | fi 3499 | if [ "$INTERACTIVE" = True ]; then 3500 | whiptail --yesno "Would you like the overlay file system to be enabled?" $DEFAULT 20 60 2 3501 | RET=$? 3502 | else 3503 | RET=$1 3504 | fi 3505 | if [ $RET -eq $CURRENT ]; then 3506 | if [ $RET -eq 0 ]; then 3507 | if enable_overlayfs; then 3508 | STATUS="enabled" 3509 | ASK_TO_REBOOT=1 3510 | else 3511 | STATUS="unchanged" 3512 | fi 3513 | elif [ $RET -eq 1 ]; then 3514 | if disable_overlayfs; then 3515 | STATUS="disabled" 3516 | ASK_TO_REBOOT=1 3517 | else 3518 | STATUS="unchanged" 3519 | fi 3520 | else 3521 | return $RET 3522 | fi 3523 | fi 3524 | if [ "$INTERACTIVE" = True ]; then 3525 | whiptail --msgbox "The overlay file system is $STATUS." 20 60 1 3526 | fi 3527 | if [ $(get_overlay_now) -eq 0 ] ; then 3528 | if [ $(get_bootro_conf) -eq 0 ] ; then 3529 | BPRO="read-only" 3530 | else 3531 | BPRO="writable" 3532 | fi 3533 | if [ "$INTERACTIVE" = True ]; then 3534 | whiptail --msgbox "The boot partition is currently $BPRO. This cannot be changed while an overlay file system is enabled." 20 60 1 3535 | fi 3536 | else 3537 | DEFAULT=--defaultno 3538 | CURRENT=0 3539 | STATUS="writable" 3540 | if [ $(get_bootro_conf) -eq 0 ]; then 3541 | DEFAULT= 3542 | CURRENT=1 3543 | STATUS="read-only" 3544 | fi 3545 | if [ "$INTERACTIVE" = True ]; then 3546 | whiptail --yesno "Would you like the boot partition to be write-protected?" $DEFAULT 20 60 2 3547 | RET=$? 3548 | else 3549 | RET=$1 3550 | fi 3551 | if [ $RET -eq $CURRENT ]; then 3552 | if [ $RET -eq 0 ]; then 3553 | if enable_bootro; then 3554 | STATUS="read-only" 3555 | ASK_TO_REBOOT=1 3556 | else 3557 | STATUS="unchanged" 3558 | fi 3559 | elif [ $RET -eq 1 ]; then 3560 | if disable_bootro; then 3561 | STATUS="writable" 3562 | ASK_TO_REBOOT=1 3563 | else 3564 | STATUS="unchanged" 3565 | fi 3566 | else 3567 | return $RET 3568 | fi 3569 | fi 3570 | if [ "$INTERACTIVE" = True ]; then 3571 | whiptail --msgbox "The boot partition is $STATUS." 20 60 1 3572 | fi 3573 | fi 3574 | } 3575 | 3576 | get_proxy() { 3577 | SCHEME="$1" 3578 | VAR_NAME="${SCHEME}_proxy" 3579 | if [ -f /etc/profile.d/proxy.sh ]; then 3580 | # shellcheck disable=SC1091 3581 | . /etc/profile.d/proxy.sh 3582 | fi 3583 | eval "echo \$$VAR_NAME" 3584 | } 3585 | 3586 | do_proxy() { 3587 | SCHEMES="$1" 3588 | ADDRESS="$2" 3589 | if [ "$SCHEMES" = "all" ]; then 3590 | CURRENT="$(get_proxy http)" 3591 | SCHEMES="http https ftp rsync" 3592 | else 3593 | CURRENT="$(get_proxy "$SCHEMES")" 3594 | fi 3595 | if [ "$INTERACTIVE" = True ]; then 3596 | if [ "$SCHEMES" = "no" ]; then 3597 | STRING="Please enter a comma separated list of addresses that should be excluded from using proxy servers.\\nEg: localhost,127.0.0.1,localaddress,.localdomain.com" 3598 | else 3599 | STRING="Please enter proxy address.\\nEg: http://user:pass@proxy:8080" 3600 | fi 3601 | if ! ADDRESS="$(whiptail --inputbox "$STRING" 20 60 "$CURRENT" 3>&1 1>&2 2>&3)"; then 3602 | return 0 3603 | fi 3604 | fi 3605 | for SCHEME in $SCHEMES; do 3606 | unset "${SCHEME}_proxy" 3607 | CURRENT="$(get_proxy "$SCHEME")" 3608 | if [ "$CURRENT" != "$ADDRESS" ]; then 3609 | ASK_TO_REBOOT=1 3610 | fi 3611 | if [ -f /etc/profile.d/proxy.sh ]; then 3612 | sed -i "/^export ${SCHEME}_/Id" /etc/profile.d/proxy.sh 3613 | fi 3614 | if [ "${SCHEME#*http}" != "$SCHEME" ]; then 3615 | if [ -f /etc/apt/apt.conf.d/01proxy ]; then 3616 | sed -i "/::${SCHEME}::Proxy/d" /etc/apt/apt.conf.d/01proxy 3617 | fi 3618 | fi 3619 | if [ -z "$ADDRESS" ]; then 3620 | STATUS=cleared 3621 | continue 3622 | fi 3623 | STATUS=updated 3624 | SCHEME_UPPER="$(echo "$SCHEME" | tr '[:lower:]' '[:upper:]')" 3625 | echo "export ${SCHEME_UPPER}_PROXY=\"$ADDRESS\"" >> /etc/profile.d/proxy.sh 3626 | if [ "$SCHEME" != "rsync" ]; then 3627 | echo "export ${SCHEME}_proxy=\"$ADDRESS\"" >> /etc/profile.d/proxy.sh 3628 | fi 3629 | if [ "${SCHEME#*http}" != "$SCHEME" ]; then 3630 | echo "Acquire::$SCHEME::Proxy \"$ADDRESS\";" >> /etc/apt/apt.conf.d/01proxy 3631 | fi 3632 | done 3633 | if [ "$INTERACTIVE" = True ]; then 3634 | whiptail --msgbox "Proxy settings $STATUS" 20 60 1 3635 | fi 3636 | } 3637 | 3638 | get_usb_current() { 3639 | USB=$(get_config_var usb_max_current_enable $CONFIG) 3640 | if [ $USB -eq 1 ]; then 3641 | echo 0 3642 | else 3643 | echo 1 3644 | fi 3645 | } 3646 | 3647 | do_usb_current() { 3648 | DEFAULT=--defaultno 3649 | if [ $(get_usb_current) -eq 0 ]; then 3650 | DEFAULT= 3651 | fi 3652 | if [ "$INTERACTIVE" = True ]; then 3653 | whiptail --yesno "Would you like the USB current limit to be disabled?" $DEFAULT 20 60 2 3654 | RET=$? 3655 | else 3656 | RET=$1 3657 | fi 3658 | if [ $RET -eq 0 ]; then 3659 | set_config_var usb_max_current_enable 1 $CONFIG && 3660 | STATUS=disabled 3661 | elif [ $RET -eq 1 ]; then 3662 | sed $CONFIG -i -e "/usb_max_current_enable.*/d" 3663 | STATUS=enabled 3664 | else 3665 | return $RET 3666 | fi 3667 | 3668 | 3669 | if [ "$INTERACTIVE" = True ]; then 3670 | whiptail --msgbox "The USB current limit is $STATUS" 20 60 1 3671 | fi 3672 | } 3673 | 3674 | get_squeekboard() { 3675 | if ! is_installed squeekboard ; then 3676 | echo 2 3677 | elif [ -e /etc/xdg/autostart/squeekboard.desktop ] ; then 3678 | if grep -q sbtest /etc/xdg/autostart/squeekboard.desktop ; then 3679 | echo 1 3680 | else 3681 | echo 0 3682 | fi 3683 | else 3684 | echo 2 3685 | fi 3686 | } 3687 | 3688 | do_squeekboard() { 3689 | if [ "$INTERACTIVE" = True ]; then 3690 | OPT=$(whiptail --title "Raspberry Pi Software Configuration Tool (raspi-config)" --menu "On-screen Keyboard" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT \ 3691 | "S1 Always On" "On-screen keyboard always enabled" \ 3692 | "S2 Autodetect" "On-screen keyboard enabled if touch device found" \ 3693 | "S3 Always Off" "On-screen keyboard disabled" \ 3694 | 3>&1 1>&2 2>&3) 3695 | else 3696 | OPT=$1 3697 | true 3698 | fi 3699 | GFILE="/etc/xdg/labwc-greeter/autostart" 3700 | if [ ! -e $GFILE ] ; then 3701 | GFILE="/usr/share/labwc/autostart" 3702 | fi 3703 | case "$OPT" in 3704 | S1*) 3705 | is_installed squeekboard || apt-get install -y squeekboard 3706 | cat > /etc/xdg/autostart/squeekboard.desktop << EOF 3707 | [Desktop Entry] 3708 | Name=Squeekboard 3709 | Comment=Launch the on-screen keyboard 3710 | Exec=/usr/bin/sbout 3711 | Terminal=false 3712 | Type=Application 3713 | NoDisplay=true 3714 | EOF 3715 | sed -i '/sbtest/d' $GFILE 3716 | if ! grep -q sbout $GFILE ; then 3717 | echo "/usr/bin/sbout &" >> $GFILE 3718 | fi 3719 | PREFIX="" 3720 | if [ -n "$SUDO_USER" ] ; then 3721 | PREFIX="sudo -u $USER XDG_RUNTIME_DIR=/run/user/$SUDO_UID DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$SUDO_UID/bus " 3722 | fi 3723 | $PREFIX sbout > /dev/null 2> /dev/null & 3724 | STATUS="enabled" 3725 | ;; 3726 | S2*) 3727 | is_installed squeekboard || apt-get install -y squeekboard 3728 | cat > /etc/xdg/autostart/squeekboard.desktop << EOF 3729 | [Desktop Entry] 3730 | Name=Squeekboard 3731 | Comment=Launch the on-screen keyboard 3732 | Exec=/usr/bin/sbtest 3733 | Terminal=false 3734 | Type=Application 3735 | NoDisplay=true 3736 | EOF 3737 | sed -i '/sbout/d' $GFILE 3738 | if ! grep -q sbtest $GFILE ; then 3739 | echo "/usr/bin/sbtest &" >> $GFILE 3740 | fi 3741 | PREFIX="" 3742 | if [ -n "$SUDO_USER" ] ; then 3743 | PREFIX="sudo -u $USER XDG_RUNTIME_DIR=/run/user/$SUDO_UID DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$SUDO_UID/bus " 3744 | fi 3745 | pkill squeekboard 3746 | $PREFIX sbtest > /dev/null 2> /dev/null & 3747 | STATUS="using autodetect" 3748 | ;; 3749 | S3*) 3750 | pkill squeekboard 3751 | rm -f /etc/xdg/autostart/squeekboard.desktop 3752 | sed -i '/sbout/d' $GFILE 3753 | sed -i '/sbtest/d' $GFILE 3754 | STATUS="disabled" 3755 | ;; 3756 | *) 3757 | return $OPT 3758 | ;; 3759 | esac 3760 | if [ "$INTERACTIVE" = True ]; then 3761 | whiptail --msgbox "The onscreen keyboard is $STATUS" 20 60 1 3762 | fi 3763 | } 3764 | 3765 | get_squeek_output (){ 3766 | if [ -e /usr/share/squeekboard/output ] ; then 3767 | echo `grep SQUEEKBOARD_PREFERRED_OUTPUT /usr/share/squeekboard/output | cut -d = -f 2` 3768 | else 3769 | echo "" 3770 | fi 3771 | } 3772 | 3773 | do_squeek_output() { 3774 | PREFIX="" 3775 | if [ -n "$SUDO_USER" ] ; then 3776 | PREFIX="sudo -u $USER XDG_RUNTIME_DIR=/run/user/$SUDO_UID DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$SUDO_UID/bus " 3777 | fi 3778 | if [ "$INTERACTIVE" = True ]; then 3779 | menu=$($PREFIX wlr-randr | grep -v ^' ' | cut -d ' ' -f 1 | tr '\n' '/' | sed 's#/#//#g') 3780 | oIFS="$IFS" 3781 | IFS="/" 3782 | OPT=$(whiptail --title "Raspberry Pi Software Configuration Tool (raspi-config)" --menu "Select where the on-screen keyboard is to be shown" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT \ 3783 | ${menu} \ 3784 | 3>&1 1>&2 2>&3) 3785 | IFS="$oIFS" 3786 | else 3787 | OPT=$1 3788 | true 3789 | fi 3790 | mkdir -p /usr/share/squeekboard/ 3791 | echo "#!/bin/sh\nexport SQUEEKBOARD_PREFERRED_OUTPUT=$OPT" > /usr/share/squeekboard/output 3792 | chmod a+x /usr/share/squeekboard/output 3793 | if pgrep sbtest > /dev/null ; then 3794 | pkill squeekboard 3795 | $PREFIX sbtest > /dev/null 2> /dev/null & 3796 | elif pgrep squeekboard > /dev/null ; then 3797 | pkill squeekboard 3798 | $PREFIX sbout > /dev/null 2> /dev/null & 3799 | fi 3800 | if [ "$INTERACTIVE" = True ]; then 3801 | whiptail --msgbox "The onscreen keyboard is on $OPT" 20 60 1 3802 | fi 3803 | } 3804 | 3805 | nonint() { 3806 | "$@" 3807 | } 3808 | 3809 | # 3810 | # Command line options for non-interactive use 3811 | # 3812 | for i in $* 3813 | do 3814 | case $i in 3815 | --memory-split) 3816 | OPT_MEMORY_SPLIT=GET 3817 | printf "Not currently supported\n" 3818 | exit 1 3819 | ;; 3820 | --memory-split=*) 3821 | OPT_MEMORY_SPLIT=$(echo $i | sed 's/[-a-zA-Z0-9]*=//') 3822 | printf "Not currently supported\n" 3823 | exit 1 3824 | ;; 3825 | --expand-rootfs) 3826 | INTERACTIVE=False 3827 | do_expand_rootfs 3828 | printf "Please reboot\n" 3829 | exit 0 3830 | ;; 3831 | --apply-os-config) 3832 | INTERACTIVE=False 3833 | do_apply_os_config 3834 | exit $? 3835 | ;; 3836 | nonint) 3837 | INTERACTIVE=False 3838 | #echo "$@" 3839 | "$@" 3840 | exit $? 3841 | ;; 3842 | *) 3843 | # unknown option 3844 | ;; 3845 | esac 3846 | done 3847 | 3848 | #if [ "GET" = "${OPT_MEMORY_SPLIT:-}" ]; then 3849 | # set -u # Fail on unset variables 3850 | # get_current_memory_split 3851 | # echo $CURRENT_MEMSPLIT 3852 | # exit 0 3853 | #fi 3854 | 3855 | # Everything else needs to be run as root 3856 | if [ $(id -u) -ne 0 ]; then 3857 | printf "Script must be run as root. Try 'sudo raspi-config'\n" 3858 | exit 1 3859 | fi 3860 | 3861 | if [ -n "${OPT_MEMORY_SPLIT:-}" ]; then 3862 | set -e # Fail when a command errors 3863 | set_memory_split "${OPT_MEMORY_SPLIT}" 3864 | exit 0 3865 | fi 3866 | 3867 | do_system_menu() { 3868 | if is_pi ; then 3869 | FUN=$(whiptail --title "Raspberry Pi Software Configuration Tool (raspi-config)" --menu "System Options" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT --cancel-button Back --ok-button Select \ 3870 | "S1 Wireless LAN" "Enter SSID and passphrase" \ 3871 | "S2 Audio" "Select audio out through HDMI or 3.5mm jack" \ 3872 | "S3 Password" "Change password for the '$USER' user" \ 3873 | "S4 Hostname" "Set name for this computer on a network" \ 3874 | "S5 Boot" "Select boot into desktop or to command line" \ 3875 | "S6 Auto Login" "Enable auto login to desktop or to command line" \ 3876 | "S7 Splash Screen" "Choose graphical splash screen or text boot" \ 3877 | "S8 Power LED" "Set behaviour of power LED" \ 3878 | "S9 Browser" "Choose default web browser" \ 3879 | "S10 Logging" "Set storage location for logs" \ 3880 | 3>&1 1>&2 2>&3) 3881 | elif is_live ; then 3882 | FUN=$(whiptail --title "Raspberry Pi Software Configuration Tool (raspi-config)" --menu "System Options" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT --cancel-button Back --ok-button Select \ 3883 | "S1 Wireless LAN" "Enter SSID and passphrase" \ 3884 | "S3 Password" "Change password for the '$USER' user" \ 3885 | "S4 Hostname" "Set name for this computer on a network" \ 3886 | "S5 Boot" "Select boot into desktop or to command line" \ 3887 | "S6 Auto Login" "Enable auto login to desktop or to command line" \ 3888 | 3>&1 1>&2 2>&3) 3889 | else 3890 | FUN=$(whiptail --title "Raspberry Pi Software Configuration Tool (raspi-config)" --menu "System Options" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT --cancel-button Back --ok-button Select \ 3891 | "S1 Wireless LAN" "Enter SSID and passphrase" \ 3892 | "S3 Password" "Change password for the '$USER' user" \ 3893 | "S4 Hostname" "Set name for this computer on a network" \ 3894 | "S5 Boot" "Select boot into desktop or to command line" \ 3895 | "S6 Auto Login" "Enable auto login to desktop or to command line" \ 3896 | "S7 Splash Screen" "Choose graphical splash screen or text boot" \ 3897 | 3>&1 1>&2 2>&3) 3898 | fi 3899 | RET=$? 3900 | if [ $RET -eq 1 ]; then 3901 | return 0 3902 | elif [ $RET -eq 0 ]; then 3903 | case "$FUN" in 3904 | S1\ *) do_wifi_ssid_passphrase ;; 3905 | S2\ *) do_audio ;; 3906 | S3\ *) do_change_pass ;; 3907 | S4\ *) do_hostname ;; 3908 | S5\ *) do_boot_target ;; 3909 | S6\ *) do_autologin ;; 3910 | S7\ *) do_boot_splash ;; 3911 | S8\ *) do_leds ;; 3912 | S9\ *) do_browser ;; 3913 | S10\ *) do_journald_storage ;; 3914 | *) whiptail --msgbox "Programmer error: unrecognized option" 20 60 1 ;; 3915 | esac || whiptail --msgbox "There was an error running option $FUN" 20 60 1 3916 | fi 3917 | } 3918 | 3919 | do_display_menu() { 3920 | if is_pi ; then 3921 | if is_wayland; then 3922 | if is_pifour; then 3923 | FUN=$(whiptail --title "Raspberry Pi Software Configuration Tool (raspi-config)" --menu "Display Options" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT --cancel-button Back --ok-button Select \ 3924 | "D2 Screen Blanking" "Enable/disable screen blanking" \ 3925 | "D4 Composite" "Enable/disable composite output" \ 3926 | "D5 4Kp60 HDMI" "Enable 4Kp60 resolution on HDMI0" \ 3927 | "D6 Onscreen Keyboard" "Enable on-screen keyboard" \ 3928 | "D7 Keyboard Output" "Select monitor used for on-screen keyboard" \ 3929 | 3>&1 1>&2 2>&3) 3930 | else 3931 | FUN=$(whiptail --title "Raspberry Pi Software Configuration Tool (raspi-config)" --menu "Display Options" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT --cancel-button Back --ok-button Select \ 3932 | "D2 Screen Blanking" "Enable/disable screen blanking" \ 3933 | "D4 Composite" "Enable/disable composite output" \ 3934 | "D6 Onscreen Keyboard" "Enable on-screen keyboard" \ 3935 | "D7 Keyboard Output" "Select monitor used for on-screen keyboard" \ 3936 | 3>&1 1>&2 2>&3) 3937 | fi 3938 | else 3939 | if is_pifour; then 3940 | FUN=$(whiptail --title "Raspberry Pi Software Configuration Tool (raspi-config)" --menu "Display Options" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT --cancel-button Back --ok-button Select \ 3941 | "D1 Underscan" "Remove black border around screen" \ 3942 | "D2 Screen Blanking" "Enable/disable screen blanking" \ 3943 | "D3 VNC Resolution" "Set resolution for headless use" \ 3944 | "D4 Composite" "Enable/disable composite output" \ 3945 | "D5 4Kp60 HDMI" "Enable 4Kp60 resolution on HDMI0" \ 3946 | 3>&1 1>&2 2>&3) 3947 | else 3948 | FUN=$(whiptail --title "Raspberry Pi Software Configuration Tool (raspi-config)" --menu "Display Options" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT --cancel-button Back --ok-button Select \ 3949 | "D1 Underscan" "Remove black border around screen" \ 3950 | "D2 Screen Blanking" "Enable/disable screen blanking" \ 3951 | "D3 VNC Resolution" "Set resolution for headless use" \ 3952 | "D4 Composite" "Enable/disable composite output" \ 3953 | 3>&1 1>&2 2>&3) 3954 | fi 3955 | fi 3956 | else 3957 | FUN=$(whiptail --title "Raspberry Pi Software Configuration Tool (raspi-config)" --menu "Display Options" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT --cancel-button Back --ok-button Select \ 3958 | "D1 Underscan" "Remove black border around screen" \ 3959 | "D2 Screen Blanking" "Enable/disable screen blanking" \ 3960 | 3>&1 1>&2 2>&3) 3961 | fi 3962 | RET=$? 3963 | if [ $RET -eq 1 ]; then 3964 | return 0 3965 | elif [ $RET -eq 0 ]; then 3966 | case "$FUN" in 3967 | D1\ *) do_overscan_kms ;; 3968 | D2\ *) do_blanking ;; 3969 | D3\ *) do_vnc_resolution ;; 3970 | D4\ *) do_composite ;; 3971 | D5\ *) do_pi4video ;; 3972 | D6\ *) do_squeekboard ;; 3973 | D7\ *) do_squeek_output ;; 3974 | *) whiptail --msgbox "Programmer error: unrecognized option" 20 60 1 ;; 3975 | esac || whiptail --msgbox "There was an error running option $FUN" 20 60 1 3976 | fi 3977 | } 3978 | 3979 | do_interface_menu() { 3980 | if is_pi ; then 3981 | FUN=$(whiptail --title "Raspberry Pi Software Configuration Tool (raspi-config)" --menu "Interfacing Options" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT --cancel-button Back --ok-button Select \ 3982 | "I1 SSH" "Enable/disable remote command line access using SSH" \ 3983 | "I2 RPi Connect" "Enable/disable Raspberry Pi Connect" \ 3984 | "I3 VNC" "Enable/disable graphical remote desktop access" \ 3985 | "I4 SPI" "Enable/disable automatic loading of SPI kernel module" \ 3986 | "I5 I2C" "Enable/disable automatic loading of I2C kernel module" \ 3987 | "I6 Serial Port" "Enable/disable shell messages on the serial connection" \ 3988 | "I7 1-Wire" "Enable/disable one-wire interface" \ 3989 | "I8 Remote GPIO" "Enable/disable remote access to GPIO pins" \ 3990 | 3>&1 1>&2 2>&3) 3991 | else 3992 | FUN=$(whiptail --title "Raspberry Pi Software Configuration Tool (raspi-config)" --menu "Interfacing Options" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT --cancel-button Back --ok-button Select \ 3993 | "I2 SSH" "Enable/disable remote command line access using SSH" \ 3994 | 3>&1 1>&2 2>&3) 3995 | fi 3996 | RET=$? 3997 | if [ $RET -eq 1 ]; then 3998 | return 0 3999 | elif [ $RET -eq 0 ]; then 4000 | case "$FUN" in 4001 | I1\ *) do_ssh ;; 4002 | I2\ *) do_rpi_connect ;; 4003 | I3\ *) do_vnc ;; 4004 | I4\ *) do_spi ;; 4005 | I5\ *) do_i2c ;; 4006 | I6\ *) if is_pifive ; then do_serial_pi5 ; else do_serial ; fi ;; 4007 | I7\ *) do_onewire ;; 4008 | I8\ *) do_rgpio ;; 4009 | *) whiptail --msgbox "Programmer error: unrecognized option" 20 60 1 ;; 4010 | esac || whiptail --msgbox "There was an error running option $FUN" 20 60 1 4011 | fi 4012 | } 4013 | 4014 | do_performance_menu() { 4015 | case "$(get_pi_type)" in 4016 | [03]) FUN=$(whiptail --title "Raspberry Pi Software Configuration Tool (raspi-config)" --menu "Performance Options" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT --cancel-button Back --ok-button Select \ 4017 | "P2 Overlay File System" "Enable/disable read-only file system" \ 4018 | 3>&1 1>&2 2>&3) ;; 4019 | [12]) FUN=$(whiptail --title "Raspberry Pi Software Configuration Tool (raspi-config)" --menu "Performance Options" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT --cancel-button Back --ok-button Select \ 4020 | "P1 Overclock" "Configure CPU overclocking" \ 4021 | "P2 Overlay File System" "Enable/disable read-only file system" \ 4022 | 3>&1 1>&2 2>&3) ;; 4023 | 4) FUN=$(whiptail --title "Raspberry Pi Software Configuration Tool (raspi-config)" --menu "Performance Options" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT --cancel-button Back --ok-button Select \ 4024 | "P2 Overlay File System" "Enable/disable read-only file system" \ 4025 | "P3 Fan" "Set behaviour of GPIO case fan" \ 4026 | 3>&1 1>&2 2>&3) ;; 4027 | *) FUN=$(whiptail --title "Raspberry Pi Software Configuration Tool (raspi-config)" --menu "Performance Options" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT --cancel-button Back --ok-button Select \ 4028 | "P2 Overlay File System" "Enable/disable read-only file system" \ 4029 | "P4 USB Current" "Set USB current limit" \ 4030 | 3>&1 1>&2 2>&3) ;; 4031 | esac 4032 | RET=$? 4033 | if [ $RET -eq 1 ]; then 4034 | return 0 4035 | elif [ $RET -eq 0 ]; then 4036 | case "$FUN" in 4037 | P1\ *) do_overclock ;; 4038 | P2\ *) do_overlayfs ;; 4039 | P3\ *) do_fan ;; 4040 | P4\ *) do_usb_current ;; 4041 | *) whiptail --msgbox "Programmer error: unrecognized option" 20 60 1 ;; 4042 | esac || whiptail --msgbox "There was an error running option $FUN" 20 60 1 4043 | fi 4044 | } 4045 | 4046 | do_internationalisation_menu() { 4047 | FUN=$(whiptail --title "Raspberry Pi Software Configuration Tool (raspi-config)" --menu "Localisation Options" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT --cancel-button Back --ok-button Select \ 4048 | "L1 Locale" "Configure language and regional settings" \ 4049 | "L2 Timezone" "Configure time zone" \ 4050 | "L3 Keyboard" "Set keyboard layout to match your keyboard" \ 4051 | "L4 WLAN Country" "Set legal wireless channels for your country" \ 4052 | 3>&1 1>&2 2>&3) 4053 | RET=$? 4054 | if [ $RET -eq 1 ]; then 4055 | return 0 4056 | elif [ $RET -eq 0 ]; then 4057 | case "$FUN" in 4058 | L1\ *) do_change_locale ;; 4059 | L2\ *) do_change_timezone ;; 4060 | L3\ *) do_configure_keyboard ;; 4061 | L4\ *) do_wifi_country ;; 4062 | *) whiptail --msgbox "Programmer error: unrecognized option" 20 60 1 ;; 4063 | esac || whiptail --msgbox "There was an error running option $FUN" 20 60 1 4064 | fi 4065 | } 4066 | 4067 | do_advanced_menu() { 4068 | if gpu_has_mmu ; then 4069 | FUN=$(whiptail --title "Raspberry Pi Software Configuration Tool (raspi-config)" --menu "Advanced Options" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT --cancel-button Back --ok-button Select \ 4070 | "A1 Expand Filesystem" "Ensures that all of the SD card is available" \ 4071 | "A2 Network Interface Names" "Enable/disable predictable network i/f names" \ 4072 | "A3 Network Proxy Settings" "Configure network proxy settings" \ 4073 | "A4 Boot Order" "Choose boot device priority (SD/net/USB/NVMe)" \ 4074 | "A5 Bootloader Version" "Select bootloader (latest/factory default)" \ 4075 | "A6 Wayland" "Switch between X and Wayland backends" \ 4076 | "A7 Audio Config" "Set audio control system" \ 4077 | "A8 PCIe Speed" "Set PCIe x1 port speed" \ 4078 | "A9 Network Install UI" "Select display of bootloader network install UI" \ 4079 | "A10 Libliftoff" "Enable/disable libliftoff hardware overlays" \ 4080 | "A11 Shutdown Behaviour" "Configure shutdown behavior" \ 4081 | 3>&1 1>&2 2>&3) 4082 | elif is_pi ; then 4083 | FUN=$(whiptail --title "Raspberry Pi Software Configuration Tool (raspi-config)" --menu "Advanced Options" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT --cancel-button Back --ok-button Select \ 4084 | "A1 Expand Filesystem" "Ensures that all of the SD card is available" \ 4085 | "A2 Network Interface Names" "Enable/disable predictable network i/f names" \ 4086 | "A3 Network Proxy Settings" "Configure network proxy settings" \ 4087 | "A6 Wayland" "Switch between X and Wayland backends" \ 4088 | "A7 Audio Config" "Set audio control system" \ 4089 | "A10 Libliftoff" "Enable/disable libliftoff hardware overlays" \ 4090 | 3>&1 1>&2 2>&3) 4091 | else 4092 | FUN=$(whiptail --title "Raspberry Pi Software Configuration Tool (raspi-config)" --menu "Advanced Options" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT --cancel-button Back --ok-button Select \ 4093 | "A2 Network Interface Names" "Enable/disable predictable network i/f names" \ 4094 | "A3 Network Proxy Settings" "Configure network proxy settings" \ 4095 | "A6 Wayland" "Switch between X and Wayland backends" \ 4096 | "A7 Audio Config" "Set audio control system" \ 4097 | "A10 Libliftoff" "Enable/disable libliftoff hardware overlays" \ 4098 | 3>&1 1>&2 2>&3) 4099 | fi 4100 | RET=$? 4101 | if [ $RET -eq 1 ]; then 4102 | return 0 4103 | elif [ $RET -eq 0 ]; then 4104 | case "$FUN" in 4105 | A1\ *) do_expand_rootfs ;; 4106 | A2\ *) do_net_names ;; 4107 | A3\ *) do_proxy_menu ;; 4108 | A4\ *) do_boot_order ;; 4109 | A5\ *) do_boot_rom ;; 4110 | A6\ *) do_wayland ;; 4111 | A7\ *) do_audioconf ;; 4112 | A8\ *) do_pci ;; 4113 | A9\ *) do_network_install_ui ;; 4114 | A10\ *) do_libliftoff ;; 4115 | A11\ *) do_power_off_on_halt ;; 4116 | *) whiptail --msgbox "Programmer error: unrecognized option" 20 60 1 ;; 4117 | esac || whiptail --msgbox "There was an error running option $FUN" 20 60 1 4118 | fi 4119 | } 4120 | 4121 | do_proxy_menu() { 4122 | FUN=$(whiptail --title "Raspberry Pi Software Configuration Tool (raspi-config)" --menu "Network Proxy Settings" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT --cancel-button Back --ok-button Select \ 4123 | "P1 All" "Set the same proxy for all schemes" \ 4124 | "P2 HTTP" "Set the HTTP proxy" \ 4125 | "P3 HTTPS" "Set the HTTPS/SSL proxy" \ 4126 | "P4 FTP" "Set the FTP proxy" \ 4127 | "P5 RSYNC" "Set the RSYNC proxy" \ 4128 | "P6 Exceptions" "Set addresses for which a proxy server should not be used" \ 4129 | 3>&1 1>&2 2>&3) 4130 | RET=$? 4131 | if [ $RET -eq 1 ]; then 4132 | return 0 4133 | elif [ $RET -eq 0 ]; then 4134 | case "$FUN" in 4135 | P1\ *) do_proxy all ;; 4136 | P2\ *) do_proxy http ;; 4137 | P3\ *) do_proxy https ;; 4138 | P4\ *) do_proxy ftp ;; 4139 | P5\ *) do_proxy rsync ;; 4140 | P6\ *) do_proxy no;; 4141 | *) whiptail --msgbox "Programmer error: unrecognized option" 20 60 1 ;; 4142 | esac || whiptail --msgbox "There was an error running option $FUN" 20 60 1 4143 | fi 4144 | } 4145 | 4146 | # 4147 | # Interactive use loop 4148 | # 4149 | if [ "$INTERACTIVE" = True ]; then 4150 | [ -e $CONFIG ] || touch $CONFIG 4151 | calc_wt_size 4152 | while [ "$USER" = "root" ] || [ -z "$USER" ]; do 4153 | if ! USER=$(whiptail --inputbox "raspi-config could not determine the default user.\\n\\nWhat user should these settings apply to?" 20 60 pi 3>&1 1>&2 2>&3); then 4154 | return 0 4155 | fi 4156 | done 4157 | while true; do 4158 | if is_pi ; then 4159 | MEMSIZE=$(vcgencmd get_config total_mem|cut -d= -f2) 4160 | if [ $MEMSIZE -lt 1024 ]; then 4161 | FMEMSIZE="${MEMSIZE}MB" 4162 | else 4163 | FMEMSIZE="$(expr $MEMSIZE / 1024)GB" 4164 | fi 4165 | FUN=$(whiptail --title "Raspberry Pi Software Configuration Tool (raspi-config)" --backtitle "$(cat /proc/device-tree/model), ${FMEMSIZE}" --menu "Setup Options" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT --cancel-button Finish --ok-button Select \ 4166 | "1 System Options" "Configure system settings" \ 4167 | "2 Display Options" "Configure display settings" \ 4168 | "3 Interface Options" "Configure connections to peripherals" \ 4169 | "4 Performance Options" "Configure performance settings" \ 4170 | "5 Localisation Options" "Configure language and regional settings" \ 4171 | "6 Advanced Options" "Configure advanced settings" \ 4172 | "8 Update" "Update this tool to the latest version" \ 4173 | "9 About raspi-config" "Information about this configuration tool" \ 4174 | 3>&1 1>&2 2>&3) 4175 | else 4176 | FUN=$(whiptail --title "Raspberry Pi Software Configuration Tool (raspi-config)" --menu "Setup Options" $WT_HEIGHT $WT_WIDTH $WT_MENU_HEIGHT --cancel-button Finish --ok-button Select \ 4177 | "1 System Options" "Configure system settings" \ 4178 | "2 Display Options" "Configure display settings" \ 4179 | "3 Interface Options" "Configure connections to peripherals" \ 4180 | "5 Localisation Options" "Configure language and regional settings" \ 4181 | "6 Advanced Options" "Configure advanced settings" \ 4182 | "8 Update" "Update this tool to the latest version" \ 4183 | "9 About raspi-config" "Information about this configuration tool" \ 4184 | 3>&1 1>&2 2>&3) 4185 | fi 4186 | RET=$? 4187 | if [ $RET -eq 1 ]; then 4188 | do_finish 4189 | elif [ $RET -eq 0 ]; then 4190 | case "$FUN" in 4191 | 1\ *) do_system_menu ;; 4192 | 2\ *) do_display_menu ;; 4193 | 3\ *) do_interface_menu ;; 4194 | 4\ *) do_performance_menu ;; 4195 | 5\ *) do_internationalisation_menu ;; 4196 | 6\ *) do_advanced_menu ;; 4197 | 8\ *) do_update ;; 4198 | 9\ *) do_about ;; 4199 | *) whiptail --msgbox "Programmer error: unrecognized option" 20 60 1 ;; 4200 | esac || whiptail --msgbox "There was an error running option $FUN" 20 60 1 4201 | else 4202 | exit 1 4203 | fi 4204 | done 4205 | fi 4206 | -------------------------------------------------------------------------------- /usr/lib/raspi-config/cmstart.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | if ps ax | grep -v grep | grep -q openbox ; then 3 | exec xcompmgr -aR 4 | fi 5 | -------------------------------------------------------------------------------- /usr/lib/raspi-config/init_resize.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | reboot_pi () { 4 | umount /boot 5 | mount / -o remount,ro 6 | sync 7 | if [ "$NOOBS" = "1" ]; then 8 | if [ "$NEW_KERNEL" = "1" ]; then 9 | reboot -f "$BOOT_PART_NUM" 10 | sleep 5 11 | else 12 | echo "$BOOT_PART_NUM" > "/sys/module/${BCM_MODULE}/parameters/reboot_part" 13 | fi 14 | fi 15 | reboot -f 16 | sleep 5 17 | exit 0 18 | } 19 | 20 | check_commands () { 21 | if ! command -v whiptail > /dev/null; then 22 | echo "whiptail not found" 23 | sleep 5 24 | return 1 25 | fi 26 | for COMMAND in grep cut sed parted fdisk findmnt; do 27 | if ! command -v $COMMAND > /dev/null; then 28 | FAIL_REASON="$COMMAND not found" 29 | return 1 30 | fi 31 | done 32 | return 0 33 | } 34 | 35 | check_noobs () { 36 | if [ "$BOOT_PART_NUM" = "1" ]; then 37 | NOOBS=0 38 | else 39 | NOOBS=1 40 | fi 41 | } 42 | 43 | get_variables () { 44 | ROOT_PART_DEV=$(findmnt / -o source -n) 45 | ROOT_PART_NAME=$(echo "$ROOT_PART_DEV" | cut -d "/" -f 3) 46 | ROOT_DEV_NAME=$(echo /sys/block/*/"${ROOT_PART_NAME}" | cut -d "/" -f 4) 47 | ROOT_DEV="/dev/${ROOT_DEV_NAME}" 48 | ROOT_PART_NUM=$(cat "/sys/block/${ROOT_DEV_NAME}/${ROOT_PART_NAME}/partition") 49 | 50 | BOOT_PART_DEV=$(findmnt /boot -o source -n) 51 | BOOT_PART_NAME=$(echo "$BOOT_PART_DEV" | cut -d "/" -f 3) 52 | BOOT_DEV_NAME=$(echo /sys/block/*/"${BOOT_PART_NAME}" | cut -d "/" -f 4) 53 | BOOT_PART_NUM=$(cat "/sys/block/${BOOT_DEV_NAME}/${BOOT_PART_NAME}/partition") 54 | 55 | OLD_DISKID=$(fdisk -l "$ROOT_DEV" | sed -n 's/Disk identifier: 0x\([^ ]*\)/\1/p') 56 | 57 | check_noobs 58 | 59 | ROOT_DEV_SIZE=$(cat "/sys/block/${ROOT_DEV_NAME}/size") 60 | TARGET_END=$((ROOT_DEV_SIZE - 1)) 61 | 62 | PARTITION_TABLE=$(parted -m "$ROOT_DEV" unit s print | tr -d 's') 63 | 64 | LAST_PART_NUM=$(echo "$PARTITION_TABLE" | tail -n 1 | cut -d ":" -f 1) 65 | 66 | ROOT_PART_LINE=$(echo "$PARTITION_TABLE" | grep -e "^${ROOT_PART_NUM}:") 67 | ROOT_PART_START=$(echo "$ROOT_PART_LINE" | cut -d ":" -f 2) 68 | ROOT_PART_END=$(echo "$ROOT_PART_LINE" | cut -d ":" -f 3) 69 | 70 | if [ "$NOOBS" = "1" ]; then 71 | EXT_PART_LINE=$(echo "$PARTITION_TABLE" | grep ":::;" | head -n 1) 72 | EXT_PART_NUM=$(echo "$EXT_PART_LINE" | cut -d ":" -f 1) 73 | EXT_PART_START=$(echo "$EXT_PART_LINE" | cut -d ":" -f 2) 74 | EXT_PART_END=$(echo "$EXT_PART_LINE" | cut -d ":" -f 3) 75 | fi 76 | } 77 | 78 | fix_partuuid() { 79 | mount -o remount,rw "$ROOT_PART_DEV" 80 | mount -o remount,rw "$BOOT_PART_DEV" 81 | DISKID="$(tr -dc 'a-f0-9' < /dev/hwrng | dd bs=1 count=8 2>/dev/null)" 82 | fdisk "$ROOT_DEV" > /dev/null < /dev/null 2>&1 166 | 167 | check_kernel 168 | 169 | if [ "$NOOBS" = "1" ] && [ "$NEW_KERNEL" != "1" ]; then 170 | BCM_MODULE=$(grep -e "^Hardware" /proc/cpuinfo | cut -d ":" -f 2 | tr -d " " | tr '[:upper:]' '[:lower:]') 171 | if ! modprobe "$BCM_MODULE"; then 172 | FAIL_REASON="Couldn't load BCM module $BCM_MODULE" 173 | return 1 174 | fi 175 | fi 176 | 177 | if [ "$ROOT_PART_END" -eq "$TARGET_END" ]; then 178 | reboot_pi 179 | fi 180 | 181 | if [ "$NOOBS" = "1" ]; then 182 | if ! printf "resizepart %s\nyes\n%ss\n" "$EXT_PART_NUM" "$TARGET_END" | parted "$ROOT_DEV" ---pretend-input-tty; then 183 | FAIL_REASON="Extended partition resize failed" 184 | return 1 185 | fi 186 | fi 187 | 188 | if ! parted -m "$ROOT_DEV" u s resizepart "$ROOT_PART_NUM" "$TARGET_END"; then 189 | FAIL_REASON="Root partition resize failed" 190 | return 1 191 | fi 192 | 193 | fix_partuuid 194 | 195 | return 0 196 | } 197 | 198 | mount -t proc proc /proc 199 | mount -t sysfs sys /sys 200 | mount -t tmpfs tmp /run 201 | mkdir -p /run/systemd 202 | 203 | mount /boot 204 | mount / -o remount,ro 205 | 206 | sed -i 's| init=/usr/lib/raspi-config/init_resize\.sh||' /boot/cmdline.txt 207 | sed -i 's| sdhci\.debug_quirks2=4||' /boot/cmdline.txt 208 | 209 | if ! grep -q splash /boot/cmdline.txt; then 210 | sed -i "s/ quiet//g" /boot/cmdline.txt 211 | fi 212 | mount /boot -o remount,ro 213 | sync 214 | 215 | if ! check_commands; then 216 | reboot_pi 217 | fi 218 | 219 | if main; then 220 | whiptail --infobox "Resized root filesystem. Rebooting in 5 seconds..." 20 60 221 | sleep 5 222 | else 223 | whiptail --msgbox "Could not expand filesystem, please try raspi-config or rc_gui.\n${FAIL_REASON}" 20 60 224 | sleep 5 225 | fi 226 | 227 | reboot_pi 228 | -------------------------------------------------------------------------------- /usr/share/raspi-config/10-blanking.conf: -------------------------------------------------------------------------------- 1 | Section "Extensions" 2 | Option "DPMS" "Disable" 3 | EndSection 4 | 5 | Section "ServerLayout" 6 | Identifier "ServerLayout0" 7 | Option "StandbyTime" "0" 8 | Option "SuspendTime" "0" 9 | Option "OffTime" "0" 10 | Option "BlankTime" "0" 11 | EndSection 12 | --------------------------------------------------------------------------------