-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·168 lines (136 loc) · 4.79 KB
/
Copy pathbuild.sh
File metadata and controls
executable file
·168 lines (136 loc) · 4.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
#!/bin/bash
# ShadowlyOS Build Script
# Builds a custom Arch Linux ISO with Hyprland and XFCE4 integration
set -e
# Configuration
WORK_DIR="/home/yoshi/shadowlyos-build"
ISO_NAME="shadowlyos"
ISO_LABEL="ShadowlyOS"
ISO_VERSION=$(date +%Y.%m.%d)
OUT_DIR="$(pwd)/out"
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
print_status() {
echo -e "${BLUE}[INFO]${NC} $1"
}
print_success() {
echo -e "${GREEN}[SUCCESS]${NC} $1"
}
print_warning() {
echo -e "${YELLOW}[WARNING]${NC} $1"
}
print_error() {
echo -e "${RED}[ERROR]${NC} $1"
exit 1
}
# Check if running as root
if [[ $EUID -ne 0 ]]; then
print_error "This script must be run as root"
fi
# Check dependencies
print_status "Checking build dependencies..."
for cmd in mkarchiso; do
if ! command -v $cmd &> /dev/null; then
print_error "$cmd is required but not installed. Please install archiso package."
fi
done
# Create work directory
print_status "Setting up build environment..."
rm -rf "$WORK_DIR"
mkdir -p "$WORK_DIR"
mkdir -p "$OUT_DIR"
# Copy archiso profile
cp -r /usr/share/archiso/configs/releng/* "$WORK_DIR/"
# Customize packages
print_status "Configuring package list..."
cat packages/packages.list >> "$WORK_DIR/packages.x86_64"
# Copy configurations
print_status "Installing configurations..."
mkdir -p "$WORK_DIR/airootfs/etc/skel/.config/hypr"
cp config/hyprland/hyprland.conf "$WORK_DIR/airootfs/etc/skel/.config/hypr/"
# Copy XFCE4 configurations
mkdir -p "$WORK_DIR/airootfs/etc/skel/.config/xfce4"
if [ -d "config/xfce4" ]; then
cp -r config/xfce4/* "$WORK_DIR/airootfs/etc/skel/.config/xfce4/"
fi
# Copy custom scripts
if [ -d "scripts" ] && [ "$(ls -A scripts/ 2>/dev/null)" ]; then
print_status "Installing custom scripts..."
mkdir -p "$WORK_DIR/airootfs/usr/local/bin"
cp scripts/*.sh "$WORK_DIR/airootfs/usr/local/bin/" 2>/dev/null || true
chmod +x "$WORK_DIR/airootfs/usr/local/bin/"*.sh 2>/dev/null || true
else
print_warning "No custom scripts found in scripts/ directory"
fi
# Copy wallpapers
if [ -d "wallpapers" ] && [ "$(ls -A wallpapers/ 2>/dev/null)" ]; then
print_status "Installing wallpapers..."
mkdir -p "$WORK_DIR/airootfs/usr/share/shadowlyos/wallpapers"
cp wallpapers/* "$WORK_DIR/airootfs/usr/share/shadowlyos/wallpapers/" 2>/dev/null || true
else
print_warning "No wallpapers found in wallpapers/ directory"
fi
# Copy themes
if [ -d "themes" ] && [ "$(ls -A themes/ 2>/dev/null)" ]; then
print_status "Installing themes..."
mkdir -p "$WORK_DIR/airootfs/usr/share/themes"
cp -r themes/* "$WORK_DIR/airootfs/usr/share/themes/" 2>/dev/null || true
else
print_warning "No themes found in themes/ directory"
fi
# Create custom installer script
print_status "Creating installer script..."
cat > "$WORK_DIR/airootfs/usr/local/bin/shadowlyos-install" << 'EOF'
#!/bin/bash
# ShadowlyOS Installation Script
echo "Welcome to ShadowlyOS Installer!"
echo "This will guide you through installing ShadowlyOS to your system."
echo ""
echo "Please run: archinstall"
echo "And select the ShadowlyOS profile when prompted."
# TODO: Implement custom installer
archinstall
EOF
chmod +x "$WORK_DIR/airootfs/usr/local/bin/shadowlyos-install"
# Customize ISO boot
print_status "Customizing boot configuration..."
sed -i "s/Arch Linux/ShadowlyOS/g" "$WORK_DIR/grub/grub.cfg"
sed -i "s/Arch Linux/ShadowlyOS/g" "$WORK_DIR/syslinux/archiso_sys-linux.cfg"
# Set ISO label
sed -i "s/ARCH_/SHADOWLY_/g" "$WORK_DIR/profiledef.sh"
sed -i "s/iso_label=.*/iso_label=\"$ISO_LABEL\"/" "$WORK_DIR/profiledef.sh"
sed -i "s/iso_name=.*/iso_name=\"$ISO_NAME\"/" "$WORK_DIR/profiledef.sh"
sed -i "s/iso_version=.*/iso_version=\"$ISO_VERSION\"/" "$WORK_DIR/profiledef.sh"
# Create systemd service to start Hyprland on boot for live session
print_status "Configuring live session..."
mkdir -p "$WORK_DIR/airootfs/etc/systemd/system"
cat > "$WORK_DIR/airootfs/etc/systemd/system/shadowlyos-session.service" << 'EOF'
[Unit]
Description=ShadowlyOS Live Session
After=graphical-session.target
[Service]
Type=simple
User=root
ExecStart=/usr/bin/Hyprland
Restart=always
[Install]
WantedBy=graphical.target
EOF
# Enable services
mkdir -p "$WORK_DIR/airootfs/etc/systemd/system/multi-user.target.wants"
ln -sf /usr/lib/systemd/system/NetworkManager.service "$WORK_DIR/airootfs/etc/systemd/system/multi-user.target.wants/"
# Build the ISO
print_status "Building ShadowlyOS ISO... This may take a while."
cd "$WORK_DIR"
mkarchiso -v -w work -o "$OUT_DIR" .
print_success "ShadowlyOS ISO built successfully!"
print_status "ISO location: $OUT_DIR/$ISO_NAME-$ISO_VERSION-x86_64.iso"
print_status "You can now flash this ISO to a USB drive or test it in a VM."
# Cleanup
print_status "Cleaning up build files..."
rm -rf "$WORK_DIR"
print_success "Build complete! 🎆"