Coder Social home page Coder Social logo

snapp-x / snapp_installer Goto Github PK

View Code? Open in Web Editor NEW
36.0 2.0 2.0 988 KB

command-line tool that simplifies the installation and development of Flutter applications on your Raspberry Pi. This Bash script automates the process of setting up the Flutter environment, installs essential files and dependencies, and offers additional features like running your Flutter apps in kiosk mode.

License: MIT License

Shell 100.00%
command-line-tool flutter raspberry-pi

snapp_installer's Introduction

snapp_installer: Raspberry Pi Flutter Development Toolkit

snapp_installer

snapp_installer is a command-line tool that simplifies the installation and development of Flutter applications on your Raspberry Pi. This Bash script automates the process of setting up the Flutter environment, installs essential files and dependencies, and offers additional features like running your Flutter apps in kiosk mode.

With snapp_installer, you can effortlessly configure your Raspberry Pi for Flutter app development and create immersive user experiences by running your apps in kiosk mode.

Prerequisites

Before running the installer script, ensure you have the following prerequisites:

  • Raspberry Pi 4 with Raspberry pi OS 64-bit (Raspbian)
  • Bash shell (version 4.0 or higher) - by default is available
  • Curl - by default is available

Kiosk Mode Result

kiosk_result.mp4

Getting Started

To quickly install snapp_installer on your Raspberry Pi, open a terminal and simply run the following command:

bash <(curl -fSL https://raw.githubusercontent.com/Snapp-X/snapp_installer/main/installer.sh) && source ~/.bashrc

Usage

Once snapp_installer is installed on your Raspberry Pi, you can use it by simply running the desired command in your terminal. Here are the available commands:

  • doctor: Check the installation status and dependencies.
  • install: Install Flutter and set up the environment.
  • uninstall: Uninstall Flutter (Note: Uninstallation is not implemented yet).
  • kiosk: Run a Flutter app bundle in kiosk mode.
  • disable_kiosk: Disable the kiosk mode.
  • autologin: Enable auto login on your device.
  • disable_autologin: Disable auto login on your device.
  • enable_fullscreen: Enable Full Screen in your Flutter project.

For example, to check the installation status, kiosk mode state, and dependencies, simply run:

snapp_installer doctor

Install Flutter Environment

The "install" command in snapp_installer automates the installation of Flutter on your Raspberry Pi and prepares the environment for Flutter app development. Here's what it does:

  • Installs Linux Dependencies: It ensures that essential Linux packages, such as curl, git, and more, are installed on your Raspberry Pi.

  • Clones Flutter from GitHub: fetches the Flutter repository from GitHub and places it in your specified directory.

  • Sets Up PATH: It configures your system's PATH environment variable to include the Flutter binary directory, making the flutter command globally executable.

  • Installs Development Dependencies: it installs necessary Linux development dependencies required for Flutter app development, including compilers and libraries.

  • Chooses Flutter Channel: You can specify your preferred Flutter channel (e.g., stable, beta) to ensure you're using the desired Flutter release.

  • Runs Flutter Doctor: This command checks your Flutter installation and displays any missing components or configuration issues.

  • Precaches Assets: It precaches Linux-specific assets, ensuring a smooth development experience.

To use the "install" command, simply follow the Getting Started section in this README and run:

snapp_installer install

Note: After running the "install" command, you need to restart your terminal or run source ~/.bashrc to apply the changes to your PATH environment variable.

Kiosk Mode

snapp_installer allows you to run your Flutter app in a kiosk mode on your Raspberry Pi, ensuring a seamless and focused user experience. To enable kiosk mode, follow these steps:

By Flutter Project

If you have a Flutter project on your machine, you can simply enable kiosk mode by running the following command in your project directory:

snapp_installer kiosk

It will take care of the rest and run your Flutter app in kiosk mode.

By Flutter App Bundle

  1. Build Your Flutter App: Ensure you have built your Flutter app for the Linux platform in release mode. You can use the following command to generate the app bundle:
 flutter build linux --release
  1. Enable Kiosk Mode:To run your Flutter app in kiosk mode, use the following command, replacing <file_path> with the path to the Flutter app bundle you built in step 1:
snapp_installer kiosk <file_path>

For example:

snapp_installer kiosk /home/pi/app/build/linux/arm64/release/bundle/app

Ensure that the specified file path exists, points to an executable file, and is the path to your Flutter app bundle.

Auto Login: Kiosk mode typically requires auto login on your Raspberry Pi. If auto login is not already enabled, snapp_installer will enable it for you.

You can also enable the auto login manually, by using the following command:

snapp_installer autologin

Disable Kiosk Mode (Optional):

To disable the kiosk mode and return your Raspberry Pi to a standard desktop environment, follow these steps:

  1. Exit Full-Screen Mode: If your Raspberry Pi is currently in full-screen kiosk mode, you need to exit this mode before disabling kiosk mode. You can typically exit full-screen mode by pressing Alt+F4(Close the app) or F11(Exit Fullscreen mode).

  2. Disable Kiosk Mode: Open a terminal on your Raspberry Pi and execute the following command to disable kiosk mode:

snapp_installer disable_kiosk

This command will remove the kiosk-related settings and restore your desktop environment.

Please note that enabling kiosk mode may affect the default behavior of your Raspberry Pi desktop environment. Ensure you have a backup or can access your Raspberry Pi via SSH in case you need to make any adjustments.

Contributing

If you encounter any issues with the installer script or have suggestions for improvements, please open an issue. You are welcome to contribute to the development of this project by forking the repository and submitting pull requests.

License

This project is licensed under the MIT License

snapp_installer's People

Contributors

payam-zahedi avatar m-theis avatar

Stargazers

Fernando Caletti avatar Jan Koudijs avatar Abdul Zalil avatar Batuhan avatar Zaki Mubarok avatar Simon Körner avatar Arthur Yang avatar  avatar Dominik Starke avatar Fran Čudina avatar Esen Sagynov avatar Sam avatar ЖЕЉКО ИЛИЈА ШОБОТ avatar Heri avatar NawafAlkhadidi avatar Antoine Lever avatar Lankey-K avatar ZaiGie avatar Matthias Koplin avatar  avatar Doug avatar Kingkor Roy Tirtho avatar Piotr Rogowski avatar Mondok Tamas avatar Georgi Dimitrov avatar Fabio avatar Muhammad Vaid avatar thefixer avatar Francesco Vezzani avatar Thomas avatar Mohammad Javad Bahiraei avatar Niklas avatar Ivan Louis avatar realSeyed avatar  avatar  avatar

Watchers

 avatar  avatar

snapp_installer's Issues

In debian bookwork kiosk autostart doesn't work

Love this project - great work thank you!

It looks like the way autostart works has changed in bookworm - See this thread: https://forums.raspberrypi.com/viewtopic.php?t=357858

$HOME/.config/lxsession/LXDE-pi/autostart now seems to be ignored.

It looks like it's now using ~/.config/wayfire.ini to look for autostart items adding:

[autostart]
kiosk=bash /home/douglash/kiosk/kiosk.sh && sleep 5 && xdotool key alt+F11

to the bottom of that file launches the app.

Feature request - SSH start flutter application & Vertical monitor

Hi @payam-zahedi at first compliments for the great tool, very useful!

I'm planning on using this tool in production for an embedded kiosk device, but i would need to do this two things:

  • launch the app using remote ssh (now it's returning error: (app:2438): Gtk-WARNING **: 10:24:49.602: cannot open display)
  • Launch app full screen in monitor at 90°

Thank you so much !

Cannot run the app to Pi 4B

I can list devices

snapp_cli devices list

✓  Searching for custom devices completed!

List of custom devices in "C:\Users\enzii\AppData\Roaming\.flutter_custom_devices.json":
  id: pi-5, label: Raspberry Pi 5, enabled: true
  id: pi-4b, label: Raspberry Pi 4 Model B, enabled: true

However, it cannot run an application to Pi 4 on debug mode

 flutter run -d pi-4b
Launching lib\main.dart on Raspberry Pi 4 Model B in debug mode...
Error: No pubspec.yaml file found.
This command should be run from the root of your Flutter project.
cp: target '/tmp/flutter_application_1/build/flutter_assets' is not a directory
cp: target '/tmp/flutter_application_1/build/linux/arm64/debug/bundle/data/flutter_assets' is not a directory
cp: cannot create regular file '/tmp/flutter_application_1/build/linux/arm64/debug/bundle/data': No such file or directory
bash: line 1: /tmp/flutter_application_1/build/linux/arm64/debug/bundle/flutter_application_1: No such file or directory

Error: Unable to 'pub upgrade' flutter tool.

Hi, I'm trying to install flutter via snapp_installer install and get the following error


********* Check Flutter Channel *********


Checking Flutter channel

Downloading Linux arm64 Dart SDK from Flutter engine c4cd48e186460b32d44585ce3c103271ab676355...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 212M 100 212M 0 0 5483k 0 0:00:39 0:00:39 --:--:-- 6186k
Building flutter tool...
/home/aka/sdk/flutter/bin/internal/shared.sh: line 23: /home/aka/sdk/flutter/bin/cache/dart-sdk/bin/dart: cannot execute: required file not found
Error: Unable to 'pub upgrade' flutter tool. Retrying in five seconds... (9 tries left)
/home/aka/sdk/flutter/bin/internal/shared.sh: line 23: /home/aka/sdk/flutter/bin/cache/dart-sdk/bin/dart: cannot execute: required file not found
Error: Unable to 'pub upgrade' flutter tool. Retrying in five seconds... (8 tries left)
/home/aka/sdk/flutter/bin/internal/shared.sh: line 23: /home/aka/sdk/flutter/bin/cache/dart-sdk/bin/dart: cannot execute: required file not found
Error: Unable to 'pub upgrade' flutter tool. Retrying in five seconds... (7 tries left)
/home/aka/sdk/flutter/bin/internal/shared.sh: line 23: /home/aka/sdk/flutter/bin/cache/dart-sdk/bin/dart: cannot execute: required file not found

Flutter Doctor:


************ Doctor summary: ************


Installation:

✓ | Linux Dependency packages | curl git unzip ...
* ✓ curl is installed
* ✓ git is installed
* ✓ unzip is installed
* ✓ xz-utils is installed
* ✓ zip is installed
* ✓ libglu1-mesa is installed
✓ | Flutter folder is located in /home/aka/sdk/flutter.
Flutter command not found globally. Checking common directories...
Flutter installation found at: /home/aka/sdk/flutter/bin/flutter
✓ | Flutter command is available in the PATH.
✓ | Flutter command is defined in .bashrc file.
✓ | Linux development packages | clang cmake ninja-build ...
* ✓ clang is installed
* ✓ cmake is installed
* ✓ ninja-build is installed
* ✓ pkg-config is installed
* ✓ libgtk-3-dev is installed
* ✓ liblzma-dev is installed

Kiosk Mode: unknown

✘ | Auto login is enabled in your device
✘ | Kiosk mode is enabled
✘ | Kiosk mode packages | xset xdotool ...
* ✘ x11-xserver-utils is missing
* ✘ xdotool is missing

System info:

RPI:
Raspberry PI 4B 8GB
Raspian 32Bit Headless

Host:
Windows 11
Flutter Version: 3.19.6

Let me know if you need more informations.

kind regards

Can't install, stuck on "Got dependencies."

I've tried everything already, everytime getting stuck on it and then process get's killed or system frezees.

*****************************************
********* Check Flutter Channel *********
*****************************************
Checking Flutter channel

Downloading Linux arm64 Dart SDK from Flutter engine e76c956498841e1ab458577d3892003e553e4f3c...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  212M  100  212M    0     0  7609k      0  0:00:28  0:00:28 --:--:-- 8615k
Building flutter tool...
Resolving dependencies... (10.6s)
Got dependencies.
/home/rostopira/sdk/flutter/bin/internal/shared.sh: line 183:  3421 Killed                  "$DART" --verbosity=error --disable-dart-dev $FLUTTER_TOOL_ARGS --snapshot="$SNAPSHOT_PATH" --snapshot-kind="app-jit" --packages="$FLUTTER_TOOLS_DIR/.dart_tool/package_config.json" --no-enable-mirrors "$SCRIPT_PATH" > /dev/null

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.