Skip to content

Commit

Permalink
Add build scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
chaitanyarahalkar committed Jul 23, 2019
1 parent 2ba8c1b commit 1caae2e
Show file tree
Hide file tree
Showing 32 changed files with 1,386 additions and 0 deletions.
Empty file added airootfs/etc/fstab
Empty file.
1 change: 1 addition & 0 deletions airootfs/etc/hostname
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
frost
1 change: 1 addition & 0 deletions airootfs/etc/locale.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
LANG=en_US.UTF-8
Empty file added airootfs/etc/machine-id
Empty file.
7 changes: 7 additions & 0 deletions airootfs/etc/modprobe.d/broadcom-wl.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# The broadcom-wl package requires some modules to be disabled in order to use
# wl. Since the ISO image needs to cover many hardware cases, this file
# overrides the default blacklist in /usr/lib/modprobe.d/
#
# If you need to use wl, you may need to delete this file, then `rmmod` any
# already-loaded modules that are now blacklisted before proceeding to modprobe
# wl itself.
26 changes: 26 additions & 0 deletions airootfs/etc/systemd/scripts/choose-mirror
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash

get_cmdline() {
local param
for param in $(< /proc/cmdline); do
case "${param}" in
$1=*) echo "${param##*=}";
return 0
;;
esac
done
}

mirror=$(get_cmdline mirror)
[[ $mirror = auto ]] && mirror=$(get_cmdline archiso_http_srv)
[[ $mirror ]] || exit 0

mv /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.orig
cat >/etc/pacman.d/mirrorlist << EOF
#
# Arch Linux repository mirrorlist
# Generated by archiso
#
Server = ${mirror%%/}/\$repo/os/\$arch
EOF
10 changes: 10 additions & 0 deletions airootfs/etc/systemd/system/choose-mirror.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[Unit]
Description=Choose mirror from the kernel command line
ConditionKernelCommandLine=mirror

[Service]
Type=oneshot
ExecStart=/etc/systemd/scripts/choose-mirror

[Install]
WantedBy=multi-user.target
8 changes: 8 additions & 0 deletions airootfs/etc/systemd/system/etc-pacman.d-gnupg.mount
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[Unit]
Description=Temporary /etc/pacman.d/gnupg directory

[Mount]
What=tmpfs
Where=/etc/pacman.d/gnupg
Type=tmpfs
Options=mode=0755
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[Service]
ExecStart=
ExecStart=-/sbin/agetty --autologin root --noclear %I 38400 linux
15 changes: 15 additions & 0 deletions airootfs/etc/systemd/system/pacman-init.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[Unit]
Description=Initializes Pacman keyring
Wants=haveged.service
After=haveged.service
Requires=etc-pacman.d-gnupg.mount
After=etc-pacman.d-gnupg.mount

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/bin/pacman-key --init
ExecStart=/usr/bin/pacman-key --populate archlinux

[Install]
WantedBy=multi-user.target
1 change: 1 addition & 0 deletions airootfs/etc/udev/rules.d/81-dhcpcd.rules
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ACTION=="add", SUBSYSTEM=="net", ENV{INTERFACE}=="en*|eth*", ENV{SYSTEMD_WANTS}="dhcpcd@$name.service"
34 changes: 34 additions & 0 deletions airootfs/root/.automated_script.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/bash

script_cmdline ()
{
local param
for param in $(< /proc/cmdline); do
case "${param}" in
script=*) echo "${param#*=}" ; return 0 ;;
esac
done
}

automated_script ()
{
local script rt
script="$(script_cmdline)"
if [[ -n "${script}" && ! -x /tmp/startup_script ]]; then
if [[ "${script}" =~ ^http:// || "${script}" =~ ^ftp:// ]]; then
wget "${script}" --retry-connrefused -q -O /tmp/startup_script >/dev/null
rt=$?
else
cp "${script}" /tmp/startup_script
rt=$?
fi
if [[ ${rt} -eq 0 ]]; then
chmod +x /tmp/startup_script
/tmp/startup_script
fi
fi
}

if [[ $(tty) == "/dev/tty1" ]]; then
automated_script
fi
1 change: 1 addition & 0 deletions airootfs/root/.zlogin
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
~/.automated_script.sh
23 changes: 23 additions & 0 deletions airootfs/root/customize_airootfs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash

set -e -u

sed -i 's/#\(en_US\.UTF-8\)/\1/' /etc/locale.gen
locale-gen

ln -sf /usr/share/zoneinfo/UTC /etc/localtime

usermod -s /usr/bin/zsh root
cp -aT /etc/skel/ /root/
chmod 700 /root

sed -i 's/#\(PermitRootLogin \).\+/\1yes/' /etc/ssh/sshd_config
sed -i "s/#Server/Server/g" /etc/pacman.d/mirrorlist
sed -i 's/#\(Storage=\)auto/\1volatile/' /etc/systemd/journald.conf

sed -i 's/#\(HandleSuspendKey=\)suspend/\1ignore/' /etc/systemd/logind.conf
sed -i 's/#\(HandleHibernateKey=\)hibernate/\1ignore/' /etc/systemd/logind.conf
sed -i 's/#\(HandleLidSwitch=\)suspend/\1ignore/' /etc/systemd/logind.conf

systemctl enable pacman-init.service choose-mirror.service
systemctl set-default multi-user.target
Loading

0 comments on commit 1caae2e

Please sign in to comment.