archboot/usr/lib/initcpio/install/arch_base

232 lines
10 KiB
Text
Raw Normal View History

#!/usr/bin/env bash
2007-02-22 23:46:50 +01:00
# Created by Tobias Powalowski <tpowa@archlinux.org>
build ()
2007-02-22 23:46:50 +01:00
{
### setting up base structure
add_dir "/mnt"
add_dir "/media"
add_dir "/install"
2007-02-22 23:46:50 +01:00
add_dir "/var/log"
add_dir "/home"
2012-06-24 10:04:54 +02:00
add_symlink /var/run ../run
2012-06-24 10:18:32 +02:00
add_symlink /var/lock ../run/lock
2012-06-18 14:36:34 +02:00
2013-05-22 09:36:34 +02:00
apps="getent agetty mount umount basename du clear env head id md5sum nano printf tail \
tee test tr tty uptime w who wc which whoami xargs yes \
2013-05-22 09:36:34 +02:00
bash swapon uniq cut seq snarf find sort fdisk sfdisk cfdisk parted partprobe \
gawk cp mv free ls rm sed less chgrp chmod chown date df dialog dmesg egrep fgrep grep \
kill killall more ps pwd rmdir stty sync tar bsdtar bsdcpio touch uname hdparm \
true mktemp chroot dirname expr bzip2 hwclock su cat cpio dd gzip wget top sdparm tput \
ifconfig ln losetup mkdir mkfifo mknod readlink echo dir lzmadec xz last wall mesg utmpdump \
xzdec switch_root false pivot_root sleep chcpu ctrlaltdel raw gdisk sgdisk cgdisk fixparts findmnt \
2014-08-01 12:40:20 +02:00
lsblk swaplabel cal chrt col colcrt colrm column fallocate flock getopt hexdump \
2013-05-22 09:36:34 +02:00
ionice ipcmk ipcrm ipcs isosize swapoff logger look lscpu mcookie namei pg \
prlimit rename renice rev script scriptreplay setarch setsid setterm tailf taskset ul unshare \
uuidgen whereis write addpart delpart fdformat \
ldattach partx readprofile rtcwake uuidd sysctl pgrep pkill pmap pwdx slabtop tload \
vmstat watch file eject keyctl request-key kmod zsh hostname tac sulogin \
2015-09-04 20:09:05 +02:00
resizepart lslocks wdctl zless zgrep fold od ldd pidof shred blockdev blkdiscard newgrp nsenter runuser vipw ldconfig diff"
2012-05-27 22:28:05 +02:00
for i in $apps; do
add_binary "$i"
done
2012-08-24 16:27:39 +02:00
appfiles="/usr/lib/libkmod.so /usr/bin/gunzip /usr/bin/zcat"
2012-05-27 22:28:05 +02:00
for i in $appfiles; do
add_file "$i"
done
symlinks="/usr/bin/depmod /usr/bin/awk /usr/bin/halt /usr/bin/telinit /usr/bin/shutdown /usr/bin/runlevel /usr/bin/reboot \
2013-05-31 15:49:14 +02:00
/usr/bin/poweroff /usr/bin/insmod /usr/bin/i386 /usr/bin/linux32 /usr/bin/linux64 \
2012-08-24 16:27:39 +02:00
/usr/bin/lsmod /usr/bin/lzcat /usr/bin/lzcmp /usr/bin/lzdiff /usr/bin/lzegrep /usr/bin/lzfgrep \
/usr/bin/lzgrep /usr/bin/lzegrep /usr/bin/lzfgrep /usr/bin/lzgrep /usr/bin/lzless /usr/bin/lzmore \
2013-05-31 15:49:14 +02:00
/usr/bin/lzma /usr/bin/modinfo /usr/bin/modprobe /usr/bin/nc /usr/bin/reset /usr/bin/rmmod \
/usr/bin/unlzma /usr/bin/unxz /usr/bin/xzcat /usr/bin/lastb /usr/bin/sh"
2012-08-24 16:27:39 +02:00
for i in $symlinks; do
2013-10-07 14:48:08 +02:00
# echo "Checking $i"
# if [ -e $i ]; then
add_binary "$(which "$(basename "$(readlink "$i")")")"
add_symlink "$i" "$(which "$(basename "$(readlink "$i")")")"
# fi
2012-08-24 16:27:39 +02:00
done
2013-05-31 15:49:14 +02:00
add_symlink "/usr/bin/init" "/usr/lib/systemd/systemd"
add_symlink "/init" "/usr/lib/systemd/systemd"
### add zsh
add_full_dir "/etc/zsh"
add_full_dir "/usr/share/zsh"
add_full_dir "/usr/lib/zsh"
2012-10-08 10:38:58 +02:00
### add en_US.utf8 locale
add_file "/usr/lib/locale/locale-archive"
### adding needed files from running system
2011-11-24 09:14:23 +01:00
add_symlink "/etc/mtab" "/proc/self/mounts"
2007-02-22 23:46:50 +01:00
add_file "/usr/share/terminfo/l/linux"
add_full_dir "/etc/profile.d"
systemfiles="bash.bashrc bash.bash_logout crypttab fstab host.conf hosts inputrc mke2fs.conf \
nanorc nsswitch.conf protocols request-key.conf resolv.conf securetty \
2013-09-14 10:00:57 +02:00
services"
for i in $systemfiles; do
add_file "/etc/$i"
done
2009-05-24 15:47:17 +02:00
2007-02-22 23:46:50 +01:00
### adding config files of installation system
2011-02-04 21:04:11 +01:00
for i in $(find /usr/share/archboot/base/etc/* ! -type d); do
2011-02-16 14:37:20 +01:00
add_file "$i" "$(echo $i | sed -e 's#/usr/share/archboot/base##g')"
2007-02-22 23:46:50 +01:00
done
2009-05-24 15:47:17 +02:00
2012-01-09 13:54:09 +01:00
### add kmod related config file(s)
2012-04-04 11:30:21 +02:00
add_file "/usr/lib/depmod.d/search.conf"
2012-01-09 13:54:09 +01:00
2007-02-22 23:46:50 +01:00
### fixing network support
add_file "/lib/libnss_files.so.2"
add_file "/lib/libnss_dns.so.2"
2009-05-24 15:47:17 +02:00
### add copy-mountpoint.sh
add_file "/usr/bin/copy-mountpoint.sh"
2009-05-24 15:47:17 +02:00
2012-09-10 19:01:45 +02:00
### add pam
2013-05-22 09:36:34 +02:00
apps="mkhomedir_helper pam_tally pam_tally2 pam_timestamp_check unix_chkpwd unix_update"
for i in $apps; do
add_binary "$i"
done
2012-09-10 19:01:45 +02:00
add_full_dir "/etc/security"
add_full_dir "/etc/default"
add_full_dir "/etc/pam.d"
add_file "/etc/environment"
add_full_dir "/usr/lib/security"
#fix cracklib support!
add_file /usr/lib/libcrack.so.2
### add shadow
2013-05-22 09:36:34 +02:00
apps="groups login nologin chage chfn chsh expiry faillog gpasswd lastlog passwd \
chgpasswd chpasswd groupadd groupdel groupmems groupmod grpck grpconv grpunconv \
newusers pwck pwconv pwunconv useradd userdel usermod sg"
2012-09-10 19:01:45 +02:00
for i in $apps; do
add_binary "$i"
done
2013-05-31 15:49:14 +02:00
symlinks="/usr/bin/vigr"
2012-09-10 19:01:45 +02:00
for i in $symlinks; do
2013-10-07 14:48:08 +02:00
# echo "Checking $i"
# if [ -e $i ]; then
add_binary "$(which "$(basename "$(readlink "$i")")")"
add_symlink "$i" "$(which "$(basename "$(readlink "$i")")")"
# fi
2012-09-10 19:01:45 +02:00
done
add_file "/etc/login.defs"
### add systemd
2012-09-11 12:57:34 +02:00
# add systemd kernel modules
add_checked_modules 'nfs|autofs4|loop'
2013-05-22 09:36:34 +02:00
apps="mount.nfs setfont loadkeys"
2012-09-11 12:57:34 +02:00
for i in $apps; do
add_binary "$i"
done
2013-01-21 16:17:52 +01:00
#dbus files
2013-05-22 09:36:34 +02:00
apps="dbus-cleanup-sockets dbus-daemon dbus-monitor dbus-send dbus-uuidgen"
2012-09-10 19:01:45 +02:00
for i in $apps; do
add_binary "$i"
done
add_binary "/usr/lib/dbus-1.0/dbus-daemon-launch-helper"
add_dir "/var/lib/dbus"
add_full_dir "/etc/dbus-1"
add_full_dir "/usr/share/dbus-1"
#systemd files
2014-09-10 09:55:55 +02:00
apps="busctl bootctl coredumpctl hostnamectl journalctl kernel-install localectl \
loginctl machinectl networkctl systemctl systemd-analyze systemd-ask-password \
systemd-cat systemd-cgls systemd-cgtop \
2015-03-08 11:32:54 +01:00
systemd-delta systemd-detect-virt systemd-escape systemd-firstboot systemd-hwdb systemd-inhibit systemd-machine-id-setup \
2014-09-10 09:55:55 +02:00
systemd-notify systemd-nspawn systemd-path systemd-run systemd-stdio-bridge systemd-sysusers systemd-tmpfiles \
2013-05-22 09:36:34 +02:00
systemd-tty-ask-password-agent timedatectl"
2012-09-10 19:01:45 +02:00
for i in $apps; do
add_binary "$i"
done
add_dir "/etc/tmpfiles.d"
add_dir "/etc/modules-load.d"
add_dir "/etc/binfmt.d/"
2013-09-14 10:00:57 +02:00
add_full_dir "/etc/sysctl.d/"
2014-07-05 22:18:06 +02:00
add_file "/usr/lib/os-release"
2012-09-10 19:01:45 +02:00
add_full_dir "/etc/systemd"
add_full_dir "/etc/xdg"
add_full_dir "/usr/lib/systemd"
add_full_dir "/usr/share/systemd"
2015-03-08 18:58:29 +01:00
add_full_dir "/usr/share/factory"
2012-09-10 19:01:45 +02:00
add_full_dir "/usr/share/polkit-1"
add_full_dir "/usr/lib/tmpfiles.d"
add_full_dir "/usr/lib/modules-load.d"
add_dir "/var/lib/systemd"
add_file "/usr/share/archboot/base/etc/locale.conf" "/etc/locale.conf"
add_file "/usr/share/archboot/base/etc/vconsole.conf" "/etc/vconsole.conf"
add_file "/usr/share/archboot/base/etc/systemd/system/getty@.service" "/etc/systemd/system/getty@.service"
2013-05-23 12:33:24 +02:00
add_file "/usr/share/archboot/base/etc/systemd/system/local-fs.target.wants/var-tmp.mount" "/etc/systemd/system/local-fs.target.wants/var-tmp.mount"
2012-09-10 19:01:45 +02:00
add_file "/usr/share/archboot/base/etc/systemd/system/serial-getty@.service" "/etc/systemd/system/serial-getty@.service"
add_file "/usr/share/archboot/base/etc/systemd/system/autovt@.service" "/etc/systemd/system/autovt@.service"
add_file "/usr/share/archboot/base/etc/systemd/system/getty.target.wants/getty@tty1.service" \
"/etc/systemd/system/getty.target.wants/getty@tty1.service"
add_file "/usr/share/archboot/base/etc/machine-id" "/etc/machine-id"
2013-08-21 09:56:38 +02:00
### add udev, which is not covered by udev hook
2013-05-22 09:36:34 +02:00
add_binary "logger"
2012-09-10 21:59:22 +02:00
add_file "/usr/lib/modprobe.d/usb-load-ehci-first.conf"
# add rule files
2012-09-13 08:44:13 +02:00
add_full_dir "/usr/lib/udev"
2014-04-11 17:34:32 +02:00
# add schedule rules file
add_file "/usr/share/archboot/base/etc/udev/rules.d/60-schedulers.rules" "/etc/udev/rules.d/60-schedulers.rules"
2012-09-10 21:59:22 +02:00
# add swapiness sysctl config file
add_file "/usr/share/archboot/base/etc/sysctl.d/99-sysctl.conf" "/etc/sysctl.d/99-sysctl.conf"
### add pacman
2014-12-17 08:18:05 +01:00
apps="pacman pacman-key pacman-db-upgrade pacsort pactree cleanupdelta makepkg pacman-optimize pkgdelta \
2016-05-14 20:09:17 +02:00
rankmirrors repo-add repo-elephant testpkg vercmp curl gpg-agent haveged"
for i in $apps; do
add_binary "$i"
done
2013-04-05 17:11:19 +02:00
symlinks="/usr/bin/gpg /usr/bin/repo-remove"
for i in $symlinks; do
2013-10-07 14:48:08 +02:00
# echo "Checking $i"
# if [ -e $i ]; then
add_binary "$(which "$(basename "$(readlink "$i")")")"
add_symlink "$i" "$(which "$(basename "$(readlink "$i")")")"
# fi
done
2012-09-12 17:58:27 +02:00
add_dir "/var/cache/pacman/pkg"
add_dir "/var/lib/pacman"
add_file "/usr/share/archboot/pacman/etc/pacman.conf" "/etc/pacman.conf"
[ "$(uname -m)" = "x86_64" ] && add_file "/usr/share/archboot/pacman/etc/makepkg.conf.x86_64" "/etc/makepkg.conf"
[ "$(uname -m)" = "i686" ] && add_file "/usr/share/archboot/pacman/etc/makepkg.conf.i686" "/etc/makepkg.conf"
add_file "/usr/share/archboot/pacman/etc/pacman.d/mirrorlist" "/etc/pacman.d/mirrorlist"
2013-06-18 11:19:33 +02:00
# add pacman initialisation of gpg keys
2014-09-10 16:11:15 +02:00
add_file "/usr/share/archboot/pacman/etc/systemd/system/etc-pacman.d-gnupg.mount" "/etc/systemd/system/etc-pacman.d-gnupg.mount"
add_file "/usr/share/archboot/pacman/etc/systemd/system/pacman-init.service" "/etc/systemd/system/pacman-init.service"
add_symlink "/etc/systemd/system/multi-user.target.wants/pacman-init.service" "/etc/systemd/system/pacman-init.service"
add_symlink "/etc/systemd/system/multi-user.target.wants/etc-pacman.d-gnupg.mount" "/etc/systemd/system/etc-pacman.d-gnupg.mount"
add_full_dir "/usr/share/pacman/keyrings"
2012-04-20 16:20:18 +02:00
### fix file
2013-02-01 14:50:26 +01:00
add_file "/usr/share/file/misc/magic.mgc"
2012-04-20 16:20:18 +02:00
2009-05-24 15:47:17 +02:00
### fix licenses
2012-04-20 16:20:18 +02:00
add_file "/usr/share/licenses/file/COPYING"
2009-05-08 08:05:45 +02:00
add_file "/usr/share/licenses/bzip2/LICENSE"
add_file "/usr/share/licenses/hdparm/LICENSE.TXT"
2014-12-22 16:58:32 +01:00
add_file "/usr/share/licenses/ncurses/LICENSE"
2009-05-08 08:05:45 +02:00
add_file "/usr/share/licenses/pcre/LICENSE"
2011-07-25 22:17:37 +02:00
add_file "/usr/share/licenses/shadow/LICENSE"
2013-01-21 16:17:52 +01:00
add_file "/usr/share/licenses/sdparm/LICENSE"
2010-02-07 23:43:45 +01:00
add_file "/usr/share/licenses/zlib/LICENSE"
2010-07-25 21:53:03 +02:00
add_file "/usr/share/licenses/iana-etc/LICENSE"
2013-01-21 16:17:52 +01:00
add_file "/usr/share/licenses/dbus/COPYING"
2007-02-22 23:46:50 +01:00
}
help ()
{
cat <<HELPEOF
2012-01-09 13:54:09 +01:00
This hook sets up all initial directories and installs base, kmod,
pam, pacman, shadow, systemd, udev utilities and libraries
for a arch boot image.
2007-02-22 23:46:50 +01:00
DO NOT remove this one unless you know what you're doing.
HELPEOF
}