Skip to content

Commit

Permalink
WIP update of Pi-DJ DietPi build script
Browse files Browse the repository at this point in the history
  • Loading branch information
bvobart committed Aug 18, 2023
1 parent 0e93666 commit 98722f9
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 19 deletions.
57 changes: 38 additions & 19 deletions dietpi/build.sh
Original file line number Diff line number Diff line change
@@ -1,29 +1,21 @@
#!/bin/bash -e
# This script is meant to be run inside a DietPi image.
# This script is meant to be run inside a DietPi image and expects to be within this Git repository (as it will look for certain files there)
# It installs the necessary packages and configs on top of DietPi to create the OS image for Pi-DJ.
# TODO: figure out how I can experiment with the resulting images without having to flash them onto an actual Pi.

## Install basic packages
# 5: Alsa
# 6: X.Org
# 7: FFmpeg
# 170: UnRAR
# 17: Git
# 188: Go
# 67: Firefox
dietpi-software install 5 6 7 170 17 188 67
HERE="$(dirname "$(realpath "$0")")"
REPO_DIR=$(realpath "$HERE/..")

source "$HERE/utils.sh"

## Create pi-dj user and delete default dietpi user
default_username=pi-dj
default_password=pidj
# TODO: create user pi-dj (or pidj) and remove the default dietpi user
useradd -m -G sudo -s "$(which zsh)" -p $default_password $default_username
# userdel -r dietpi # not sure if the dietpi user can be removed: https://github.com/MichaIng/DietPi/issues/2807#issuecomment-493044119

## Configure /boot/dietpi.txt
# TODO: instruct users about dietpi-wifi.txt to pre-enter WiFicredentials.
function set_dietpi_config() {
key=$1
value=$2
sed -i "s/^$key=.*/$key=$value/" /boot/dietpi.txt
}

set_dietpi_config AUTO_SETUP_LOCALE en_GB.UTF-8
set_dietpi_config AUTO_SETUP_KEYBOARD_LAYOUT gb
Expand All @@ -47,7 +39,6 @@ set_dietpi_config SOFTWARE_DISABLE_SSH_PASSWORD_LOGINS root # Disable SSH passwo
# 0=Allow password logins for all users, including root
# root=Disable password login for root user only
# 1=Disable password logins for all users, assure that you have a valid SSH key applied!

##### other DietPi.txt stuff to configure later
#
# Custom Script (pre-networking and pre-DietPi install)
Expand All @@ -65,7 +56,35 @@ set_dietpi_config SOFTWARE_DISABLE_SSH_PASSWORD_LOGINS root # Disable SSH passwo
#
#

## Install all packages needed for a usable desktop environment
# 5: Alsa
# 6: X.Org
# 7: FFmpeg
# 170: UnRAR
# 17: Git
# 188: Go
# 67: Firefox
dietpi-software install 5 6 7 170 17 188 67
# install i3 and dependencies
apt install -y i3 polybar onboard fonts-roboto fonts-font-awesome dunst rofi

# install some useful CLI tools for maintenance
apt install -y alacritty zsh
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
chsh -s "$(which zsh)"

## Configure desktop environment & applications

# copy_dotfiles i3
copy_dotfiles alacritty
copy_dotfiles rofi

# install icon pack
"$REPO_DIR/desktop/icons/install.sh"


# TODO: install i3
# TODO: install other packages required for desktop environment
# Goal for next time: get a bootable image with i3 working and pidj user
# Goal for next time: get a usable and pretty UI with i3, polybar, alacritty, rofi, onboard, dunst, nerd-fonts

# TODO: install Mixxx
# TODO: install mixxx-folders2crates
15 changes: 15 additions & 0 deletions dietpi/utils.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Set a config value in /boot/dietpi.txt
# Example: set_dietpi_config AUTO_SETUP_TIMEZONE Europe/Amsterdam
function set_dietpi_config() {
key=$1
value=$2
sed -i "s/^$key=.*/$key=$value/" /boot/dietpi.txt
}

# Copy config files from this repo's desktop folder into the Pi-DJ user's home directory
function copy_dotfiles() {
config_dir=$1
mkdir -p "/home/$default_username/.config/$config_dir"
chown -R $default_username:$default_username "/home/$default_username/.config/$config_dir"
cp -r "$REPO_DIR/desktop/$config_dir" /home/$default_username/.config/
}

0 comments on commit 98722f9

Please sign in to comment.