Add regular user spark and clone-sparkos.sh script, default to non-root login

Co-authored-by: johndoe6345789 <224850594+johndoe6345789@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2025-12-28 15:55:25 +00:00
parent 5f366534aa
commit e1acbfc231
10 changed files with 250 additions and 12 deletions

View File

@@ -18,7 +18,13 @@ Directory Structure:
/usr - User programs
/var - Variable data
/root - Root home directory
/home - User home directories
/home/spark - Default user home directory
Default User:
Username: spark (UID 1000)
Home: /home/spark
Sudo: Full access without password
Scripts: ~/clone-sparkos.sh for installing spark CLI
Network Configuration:
/etc/network/interfaces - Wired network (DHCP)
@@ -26,10 +32,11 @@ Network Configuration:
/sbin/init-network - Network initialization script
Bootstrap Process:
1. System boots with wired networking (DHCP)
2. Use git to clone spark CLI repository
1. System boots as 'spark' user with wired networking (DHCP)
2. Run ~/clone-sparkos.sh to install spark CLI
3. Use spark CLI to configure WiFi and system
4. Install additional packages via spark CLI
5. Use 'sudo' for any root-level operations
Note: This is a minimal system. You'll need to populate /bin and /usr/bin
with actual binaries (busybox, git, sudo) from a proper Linux system

View File

@@ -1 +1,3 @@
root:x:0:
spark:x:1000:
sudo:x:27:spark

View File

@@ -1 +1,2 @@
root:x:0:0:root:/root:/bin/sh
spark:x:1000:1000:SparkOS User:/home/spark:/bin/sh

View File

@@ -2,9 +2,15 @@
export PATH=/bin:/sbin:/usr/bin:/usr/sbin
export PS1='SparkOS:\w\$ '
export HOME=/root
export TERM=linux
# Set HOME based on user
if [ "$(id -u)" = "0" ]; then
export HOME=/root
else
export HOME=/home/$(whoami)
fi
# Welcome message
echo "Welcome to SparkOS!"
echo "Type 'help' for available commands"

15
rootfs/etc/sudoers Normal file
View File

@@ -0,0 +1,15 @@
# SparkOS Sudoers Configuration
# Allow spark user to run any command without password
# Default settings
Defaults env_reset
Defaults secure_path="/bin:/sbin:/usr/bin:/usr/sbin"
# Root can run anything
root ALL=(ALL:ALL) ALL
# Spark user can run anything without password
spark ALL=(ALL:ALL) NOPASSWD: ALL
# Include sudoers.d directory
@includedir /etc/sudoers.d

View File

@@ -0,0 +1,12 @@
# SparkOS User Shell Configuration
# Set prompt
PS1='SparkOS:\w\$ '
# Aliases
alias ll='ls -lah'
alias ..='cd ..'
# Environment
export EDITOR=vi
export PAGER=less

View File

@@ -0,0 +1,50 @@
#!/bin/sh
# SparkOS CLI Installation Script
# This script clones the SparkOS CLI repository
echo "SparkOS CLI Installation"
echo "========================"
echo ""
SPARK_REPO="https://github.com/johndoe6345789/spark-cli.git"
INSTALL_DIR="$HOME/spark-cli"
echo "This script will clone the SparkOS CLI to: $INSTALL_DIR"
echo ""
# Check if git is available
if ! command -v git >/dev/null 2>&1; then
echo "Error: git is not installed"
echo "Please install git to continue"
exit 1
fi
# Check if directory already exists
if [ -d "$INSTALL_DIR" ]; then
echo "Warning: $INSTALL_DIR already exists"
echo -n "Do you want to remove it and re-clone? (y/N): "
read answer
if [ "$answer" = "y" ] || [ "$answer" = "Y" ]; then
rm -rf "$INSTALL_DIR"
else
echo "Installation cancelled"
exit 0
fi
fi
# Clone the repository
echo "Cloning spark CLI repository..."
if git clone "$SPARK_REPO" "$INSTALL_DIR"; then
echo ""
echo "SparkOS CLI cloned successfully!"
echo ""
echo "Next steps:"
echo " 1. cd $INSTALL_DIR"
echo " 2. Follow the installation instructions in the repository"
echo ""
else
echo ""
echo "Error: Failed to clone repository"
echo "Please check your network connection and try again"
exit 1
fi