아치 리눅스 ISO를 사용하고 완전히 자동화 된 설치를 수행하는 수정 된 루트 이미지로 새로운 ISO를 생성하는 작은 bash 스크립트를 한 번 작성했습니다. 여기에는 Xorg, FVWM 및 Chromium을 사용한 시스템 설정 및 구성뿐만 아니라 파티셔닝이 포함됩니다. 설치된 시스템이 자동으로 로그인하고 Chromium을 시작합니다. 새로운 ISO를 USB 플래시 드라이브에 넣고 뒤로 기대기만하면됩니다. ;-)
면책 조항 : 스크립트는있는 그대로 제공되며 보증은 제공되지 않습니다. 한동안 사용하지 않았으므로 여기 또는 거기에서 조정이 필요할 수 있습니다. 필요에 따라 수정하십시오.
#!/bin/bash
# Helpful pages:
#
# * [ArchWiki topic][1] that explains the options of an AIF configuration
# file.
#
# * [Status of automated installation][2], a topic in the Arch Linux Forums
# that contains the original basic install script by *mhertz*.
#
# [1]: https://wiki.archlinux.org/index.php/AIF_Configuration_File
# [2]: https://bbs.archlinux.org/viewtopic.php?id=111925
TMP_DIR=/tmp/arch-install
# Read command line parameters for input and output ISO files.
if [ -z "$1" ]; then
echo 'No input file specified, aborting.'
exit 1
elif [ ! -f "$1" ]; then
echo 'Input file "'$INPUT_ISO'" not found, aborting.'
exit 1
elif [ -z "$2" ]; then
echo 'No output file specified, aborting.'
exit 1
elif [ -f "$2" ]; then
echo 'Output file "'$OUTPUT_ISO'" already exists, aborting.'
exit 1
fi
# Determine full paths to input and output ISO files.
INPUT_ISO=$(readlink -f "$1")
OUTPUT_ISO=$(readlink -f "$2")
# Set some variables for convenience.
SOURCE_DIR=$TMP_DIR/source
DEST_DIR=$TMP_DIR/dest
ROOT_DIR=$TMP_DIR/squashfs-root
BOOT_CFG=$DEST_DIR/boot/isolinux/isolinux.cfg
# Extract ISO image and root image.
mkdir -p $SOURCE_DIR
mount -o loop "$INPUT_ISO" $SOURCE_DIR
cp -a $SOURCE_DIR $DEST_DIR
umount $SOURCE_DIR
rmdir $SOURCE_DIR
unsquashfs -d $ROOT_DIR $DEST_DIR/root-image.sqfs
rm $DEST_DIR/root-image.sqfs
# Modify the root image as needed.
cat >> $ROOT_DIR/etc/aif.conf <<EOF
SOURCE=cd
FILE_URL=file:///src/core/pkg
SYNC_URL=http://ftp.tu-chemnitz.de/pub/linux/archlinux/\$repo/os/\$arch
HARDWARECLOCK=UpTC
TIMEZONE=Europe/Vienna
RUNTIME_REPOSITORIES=
RUNTIME_PACKAGES=
TARGET_GROUPS=base
TARGET_PACKAGES_EXCLUDE=
TARGET_PACKAGES='openssh xorg xcursor-vanilla-dmz-aa'
worker_runtime_network () {
dhcpcd eth0
}
worker_configure_system () {
prefill_configs
sed -i '/^HOSTNAME/ s/"myhost"/"arch"/' \$var_TARGET_DIR/etc/rc.conf
sed -i '/^password/ s/pam_permit\.so/pam_unix.so md5 shadow/' \$var_TARGET_DIR/etc/pam.d/chpasswd
sed -i '\|Server = http://ftp\.tu-chemnitz\.de/| s/^#//' \$var_TARGET_DIR/etc/pacman.d/mirrorlist
sed -i '/id:3:initdefault:/ s/^/#/' \$var_TARGET_DIR/etc/inittab
sed -i '/id:5:initdefault:/ s/^#//' \$var_TARGET_DIR/etc/inittab
sed -i '\|x:5:respawn:/usr/bin/xdm| s/^/#/' \$var_TARGET_DIR/etc/inittab
echo "x:5:respawn:/bin/su -l -c '/usr/bin/startx </dev/null >/dev/null 2>&1' myuser" >> \$var_TARGET_DIR/etc/inittab
sed -i 's/^timeout .*$/timeout 0/' \$var_TARGET_DIR/boot/grub/menu.lst
cp /etc/rc.local.firstboot \$var_TARGET_DIR/etc/rc.local
}
# Mandatory variables.
GRUB_DEVICE=/dev/sda
PARTITIONS='/dev/sda 20:ext2:+ 512:swap 2500:xfs *:xfs'
BLOCKDATA='/dev/sda1 raw no_label ext2;yes;/boot;target;no_opts;no_label;no_params
/dev/sda2 raw no_label swap;yes;no_mountpoint;target;no_opts;no_label;no_params
/dev/sda3 raw no_label xfs;yes;/;target;no_opts;no_label;no_params
/dev/sda4 raw no_label xfs;yes;/home;target;no_opts;no_label;no_params'
EOF
cat >> $ROOT_DIR/etc/rc.local <<EOF
aif -p automatic -c /etc/aif.conf
reboot
EOF
cat >> $ROOT_DIR/etc/rc.local.firstboot <<EOF
echo root:rootpassword | chpasswd
useradd -m myuser
echo myuser:myuser | chpasswd
cat >> /home/myuser/.xinitrc <<EOT
#!/bin/sh
exec fvwm2
EOT
cat >> /home/myuser/.Xdefaults <<EOT
Xcursor.theme: Vanilla-DMZ-AA
EOT
mkdir -p /home/myuser/.fvwm
cat >> /home/myuser/.fvwm/config <<EOT
DeskTopSize 1x1
DesktopName 0 Main
DestroyFunc StartFunction
AddToFunc StartFunction
+ I Test (Init) Exec exec xsetroot -solid '#303030'
+ I Test (Init) Exec exec chromium 'http://www.stackoverflow.com'
DestroyMenu RootMenu
AddToMenu RootMenu "Menu" Title
+ "Terminal" Exec exec xterm
+ "Browser" Exec exec chromium 'https://www.stackoverflow.com'
+ "" Nop
+ "Log off" Quit
+ "Reboot" Exec exec sudo /sbin/reboot
+ "Shutdown" Exec exec sudo /sbin/halt
OpaqueMoveSize unlimited
Style * ClickToFocus, ResizeOpaque
Style chromium !Title, !Border, !Handles
CursorStyle root top_left_arrow
CursorStyle stroke hand2
IgnoreModifiers L25
Key Help R A -
Key F1 R A -
Key Tab A M -
Key Escape A MC -
Mouse 1 R A -
Mouse 1 T A Move
Mouse 1 FS A Resize
Mouse 1 I A Iconify Off
Mouse 2 FST A -
Mouse 3 R A Menu RootMenu Nop
EOT
mkdir -p /home/myuser/.config/chromium/Default
touch /home/myuser/.config/chromium/First\ Run
cat >> /home/myuser/.config/chromium/Default/Preferences <<EOT
{
"alternate_error_pages": {
"enabled": false
},
"autofill": {
"enabled": false
},
"browser": {
"custom_chrome_frame": true,
"enable_spellchecking": false
},
"default_search_provider": {
"enabled": true,
"encodings": "UTF-8",
"icon_url": "about:blank",
"id": "2",
"instant_url": "",
"keyword": "google.com",
"name": "Google",
"prepopulate_id": "1",
"search_url": "{google:baseURL}search?ie={inputEncoding}&q={searchTerms}",
"suggest_url": ""
},
"devtools": {
"disabled": true
},
"dns_prefetching": {
"enabled": false
},
"download": {
"directory_upgrade": true
},
"extensions": {
"chrome_url_overrides": {
"bookmarks": [ "chrome-extension://eemcgdkfndhakfknompkggombfjjjeno/main.html" ]
}
},
"geolocation": {
"default_content_setting": 2
},
"google": {
"services": {
"username": ""
}
},
"homepage": "https://www.stackoverflow.com",
"homepage_is_newtabpage": false,
"intl": {
"accept_languages": "en",
"charset_default": "ISO-8859-1"
},
"ntp": {
"pref_version": 3
},
"profile": {
"clear_site_data_on_exit": true,
"content_settings": {
"pref_version": 1
},
"default_content_settings": {
"plugins": 1
},
"exited_cleanly": true,
"notifications_default_content_setting": 2,
"password_manager_enabled": false
},
"safebrowsing": {
"enabled": false
},
"search": {
"suggest_enabled": false
},
"tabs": {
"use_vertical_tabs": false
},
"translate": {
"enabled": false
}
}
EOT
chown -R myuser:myuser /home/myuser
pacman -Sy
pacman -S --noconfirm pacman
pacman -S --noconfirm fvwm-devel chromium sudo
echo 'myuser arch=NOPASSWD: /sbin/halt,/sbin/reboot' > /etc/sudoers.d/start_stop
chmod 0440 /etc/sudoers.d/start_stop
rm /etc/rc.local
EOF
# Create the new root image.
mksquashfs $TMP_DIR/squashfs-root $TMP_DIR/dest/root-image.sqfs
rm -rf $TMP_DIR/squashfs-root
# Configure the boot loader.
sed -i 's/TIMEOUT 3000/TIMEOUT 100/' $BOOT_CFG
sed -i '/APPEND hd0 0/d' $BOOT_CFG
sed -i 's/archisolabel=[^ ]*/archisolabel=ARCH/' $BOOT_CFG
# Create the new ISO image.
genisoimage -l -R -b boot/isolinux/isolinux.bin -c boot/isolinux/boot.cat \
-no-emul-boot -boot-load-size 4 -boot-info-table -V ARCH \
-o "$OUTPUT_ISO" $DEST_DIR
rm -rf $TMP_DIR
isohybrid "$OUTPUT_ISO"