Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding Username and Password options to the build script #15

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
29 changes: 29 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Build and Install

on:
workflow_dispatch:

jobs:
build_universal-barebone:
runs-on: ubuntu-latest #${{ matrix.platform }#}
steps:
- name: Checkout repository
uses: actions/checkout@v3

#- name: Install tools
# if#: matrix.platform == #'self-hosted'
# run: |
# sudo pacman -Syu --noconfirm
# sudo pacman -S --noconfirm devtools \
# lsof \
# wget \
# fdisk \
# bsdtar
- name: Install tools
run: |
sudo apt-get update
sudo apt-get install -y lsof wget util-linux libarchive-tools e2fsprogs dosfstools arch-install-scripts fdisk qemu-user-static
- name: Run build script
run: |
chmod +x ./build.sh
sudo ./build.sh -u barebone -d pinetab2 -a aarch64 -n alarm -p 123456
16 changes: 9 additions & 7 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ date=$(date +%Y%m%d)

error() { echo -e "\e[41m\e[5mERROR:\e[49m\e[25m $1" && exit 1; }
check_dependency() { [ $(which $1) ] || error "$1 not found. Please make sure it is installed and on your PATH."; }
usage() { error "$0 [-a ARCHITECTURE] [-d device] [-u ui] [-h hostname] [--osk-sdl] [--noconfirm] [--cachedir directory] [--no-cachedir]"; }
usage() { error "$0 [-a ARCHITECTURE] [-d device] [-u ui] [-h hostname] [-n username] [-p password] [--osk-sdl] [--noconfirm] [--cachedir directory] [--no-cachedir]"; }
cleanup() {
trap '' EXIT
trap '' INT
Expand Down Expand Up @@ -51,6 +51,8 @@ parse_args() {
-d|--device) device=$2; shift ;;
-u|--ui) ui=$2; shift ;;
-h|--hostname) hostname=$2; shift ;;
-n| --username) username=$2; shift ;;
-p| --password) password=$2; shift ;;
--noconfirm) NOCONFIRM=1;;
--osk-sdl) OSK_SDL=1;;
--cachedir) cachedir=$2; shift ;;
Expand Down Expand Up @@ -209,20 +211,20 @@ systemctl disable systemd-resolved
systemctl enable zramswap
systemctl enable NetworkManager

usermod -a -G network,video,audio,rfkill,wheel alarm
usermod -a -G network,video,audio,rfkill,wheel $username

$(echo -e "${postinstall[@]}")

cp -rv /etc/skel/. /home/alarm
chown -R alarm:alarm /home/alarm
cp -rv /etc/skel/. /home/$username
chown -R $username:$username /home/$username

if [ -e /etc/sudoers ]; then
sed -i 's/# %wheel ALL=(ALL:ALL) ALL/%wheel ALL=(ALL:ALL) ALL/' /etc/sudoers
fi

cat << FOE | passwd alarm
123456
123456
cat << FOE | passwd $username
$password
$password

FOE

Expand Down