mirror of
https://github.com/MichielDerhaeg/build-linux.git
synced 2025-09-24 22:41:31 +02:00
some work
This commit is contained in:
92
filesystem/build.sh
Executable file
92
filesystem/build.sh
Executable file
@@ -0,0 +1,92 @@
|
||||
#!/bin/sh
|
||||
|
||||
mkdir root
|
||||
pkgdir=$PWD/root
|
||||
srcdir=$PWD
|
||||
# --- original
|
||||
|
||||
cd "$pkgdir"
|
||||
|
||||
#
|
||||
# setup root filesystem
|
||||
#
|
||||
for d in boot dev etc home mnt usr var opt srv/http run; do
|
||||
install -d -m755 $d
|
||||
done
|
||||
install -d -m555 proc
|
||||
install -d -m555 sys
|
||||
install -d -m0750 root
|
||||
install -d -m1777 tmp
|
||||
# vsftpd won't run with write perms on /srv/ftp
|
||||
install -d -m555 -g ftp srv/ftp
|
||||
|
||||
# setup /etc
|
||||
install -d etc/{ld.so.conf.d,skel,profile.d}
|
||||
for f in fstab group host.conf hosts issue ld.so.conf motd nsswitch.conf passwd resolv.conf securetty shells profile; do
|
||||
install -m644 "$srcdir"/$f etc/
|
||||
done
|
||||
ln -s /proc/self/mounts etc/mtab
|
||||
for f in gshadow shadow crypttab; do
|
||||
install -m600 "$srcdir"/$f etc/
|
||||
done
|
||||
touch etc/arch-release
|
||||
install -D -m644 "$srcdir"/modprobe.d.usb-load-ehci-first usr/lib/modprobe.d/usb-load-ehci-first.conf
|
||||
install -m755 "$srcdir"/locale.sh etc/profile.d/locale.sh
|
||||
install -Dm644 "$srcdir"/os-release "$pkgdir"/usr/lib/os-release
|
||||
|
||||
# setup /var
|
||||
for d in cache local opt log/old lib/misc empty; do
|
||||
install -d -m755 var/$d
|
||||
done
|
||||
install -d -m1777 var/{tmp,spool/mail}
|
||||
|
||||
# allow setgid games to write scores
|
||||
install -d -m775 -g games var/games
|
||||
ln -s spool/mail var/mail
|
||||
ln -s ../run var/run
|
||||
ln -s ../run/lock var/lock
|
||||
|
||||
#
|
||||
# setup /usr hierarchy
|
||||
#
|
||||
for d in bin include lib share/misc src; do
|
||||
install -d -m755 usr/$d
|
||||
done
|
||||
for d in $(seq 8); do
|
||||
install -d -m755 usr/share/man/man$d
|
||||
done
|
||||
|
||||
#
|
||||
# add lib symlinks
|
||||
#
|
||||
ln -s usr/lib "$pkgdir"/lib
|
||||
[[ $CARCH = 'x86_64' ]] && (
|
||||
ln -s usr/lib "$pkgdir"/lib64
|
||||
ln -s lib "$pkgdir"/usr/lib64
|
||||
)
|
||||
|
||||
#
|
||||
# add bin symlinks
|
||||
#
|
||||
ln -s usr/bin "$pkgdir"/bin
|
||||
ln -s usr/bin "$pkgdir"/sbin
|
||||
ln -s bin "$pkgdir"/usr/sbin
|
||||
|
||||
#
|
||||
# setup /usr/local hierarchy
|
||||
#
|
||||
for d in bin etc games include lib man sbin share src; do
|
||||
install -d -m755 usr/local/$d
|
||||
done
|
||||
ln -s ../man usr/local/share/man
|
||||
|
||||
### --- custom
|
||||
|
||||
install -m755 ../../busybox usr/bin/busybox
|
||||
busybox --install -s usr/bin
|
||||
|
||||
install -m644 "$srcdir/inittab" etc/inittab
|
||||
install -d -m755 etc/init.d
|
||||
install -m755 "$srcdir/rcS" etc/init.d/rcS
|
||||
|
||||
tar --xattrs -cpf ../fs.tar *
|
17
filesystem/crypttab
Normal file
17
filesystem/crypttab
Normal file
@@ -0,0 +1,17 @@
|
||||
# crypttab: mappings for encrypted partitions
|
||||
#
|
||||
# Each mapped device will be created in /dev/mapper, so your /etc/fstab
|
||||
# should use the /dev/mapper/<name> paths for encrypted devices.
|
||||
#
|
||||
# The Arch specific syntax has been deprecated, see crypttab(5) for the
|
||||
# new supported syntax.
|
||||
#
|
||||
# NOTE: Do not list your root (/) partition here, it must be set up
|
||||
# beforehand by the initramfs (/etc/mkinitcpio.conf).
|
||||
|
||||
# <name> <device> <password> <options>
|
||||
# home UUID=b8ad5c18-f445-495d-9095-c9ec4f9d2f37 /etc/mypassword1
|
||||
# data1 /dev/sda3 /etc/mypassword2
|
||||
# data2 /dev/sda5 /etc/cryptfs.key
|
||||
# swap /dev/sdx4 /dev/urandom swap,cipher=aes-cbc-essiv:sha256,size=256
|
||||
# vol /dev/sdb7 none
|
69
filesystem/filesystem.install
Normal file
69
filesystem/filesystem.install
Normal file
@@ -0,0 +1,69 @@
|
||||
# args: <group> [options]
|
||||
_addgroup() {
|
||||
if ! getent group "$1" >/dev/null && groupadd "$@" >/dev/null; then
|
||||
need_group_update=1
|
||||
fi
|
||||
}
|
||||
|
||||
# args: <group> [options]
|
||||
_adduser() {
|
||||
if ! getent passwd "$1" >/dev/null && useradd "$@" >/dev/null; then
|
||||
need_passwd_update=1
|
||||
fi
|
||||
}
|
||||
|
||||
post_upgrade() {
|
||||
_addgroup optical -g 93
|
||||
_addgroup audio -g 92
|
||||
_addgroup video -g 91
|
||||
_addgroup floppy -g 94
|
||||
_addgroup storage -g 95
|
||||
_addgroup log -g 19
|
||||
_addgroup utmp -g 20
|
||||
_addgroup power -g 98
|
||||
_addgroup network -g 90
|
||||
_addgroup games -g 50
|
||||
_addgroup uucp -g 14
|
||||
_addgroup proc -g 26
|
||||
_addgroup http -g 33
|
||||
_adduser http -u 33 -d /srv/http -g http -s /usr/bin/nologin
|
||||
_addgroup scanner -g 96
|
||||
_addgroup rfkill -g 24
|
||||
_addgroup lock -g 54
|
||||
_addgroup uuidd -g 68
|
||||
_adduser uuidd -u 68 -d / -g uuidd -s /usr/bin/nologin
|
||||
_addgroup dbus -g 81
|
||||
_adduser dbus -u 81 -d / -g dbus -s /usr/bin/nologin
|
||||
_addgroup input -g 97
|
||||
_addgroup systemd-journal -g 190
|
||||
_addgroup systemd-journal-gateway -g 191
|
||||
_adduser systemd-journal-gateway -u 191 -g 191 -d / -s /usr/bin/nologin
|
||||
_addgroup systemd-timesync -g 192
|
||||
_adduser systemd-timesync -u 192 -g 192 -d / -s /usr/bin/nologin
|
||||
_addgroup systemd-network -g 193
|
||||
_adduser systemd-network -u 193 -g 193 -d / -s /usr/bin/nologin
|
||||
_addgroup systemd-bus-proxy -g 194
|
||||
_adduser systemd-bus-proxy -u 194 -g 194 -d / -s /usr/bin/nologin
|
||||
_addgroup systemd-resolve -g 195
|
||||
_adduser systemd-resolve -u 195 -g 195 -d / -s /usr/bin/nologin
|
||||
|
||||
# update shadow files if needed
|
||||
if (( need_group_update )); then
|
||||
grpconv >/dev/null
|
||||
fi
|
||||
|
||||
if (( need_passwd_update )); then
|
||||
pwconv >/dev/null
|
||||
fi
|
||||
|
||||
if ! grep -q '^include /etc/ld.so.conf.d/\*.conf$' etc/ld.so.conf; then
|
||||
echo 'include /etc/ld.so.conf.d/*.conf' >> etc/ld.so.conf
|
||||
fi
|
||||
|
||||
# set "Last password change" > 0; otherwise su $user wont work
|
||||
for user in bin daemon mail ftp http nobody; do
|
||||
if LANG=C chage -l ${user} | grep -q 'password must be changed'; then
|
||||
chage -d 14871 ${user}
|
||||
fi
|
||||
done
|
||||
}
|
4
filesystem/fstab
Normal file
4
filesystem/fstab
Normal file
@@ -0,0 +1,4 @@
|
||||
#
|
||||
# /etc/fstab: static file system information
|
||||
#
|
||||
# <file system> <dir> <type> <options> <dump> <pass>
|
42
filesystem/group
Normal file
42
filesystem/group
Normal file
@@ -0,0 +1,42 @@
|
||||
root:x:0:root
|
||||
bin:x:1:root,bin,daemon
|
||||
daemon:x:2:root,bin,daemon
|
||||
sys:x:3:root,bin
|
||||
adm:x:4:root,daemon
|
||||
tty:x:5:
|
||||
disk:x:6:root
|
||||
lp:x:7:daemon
|
||||
mem:x:8:
|
||||
kmem:x:9:
|
||||
wheel:x:10:root
|
||||
ftp:x:11:
|
||||
mail:x:12:
|
||||
uucp:x:14:
|
||||
log:x:19:root
|
||||
utmp:x:20:
|
||||
locate:x:21:
|
||||
rfkill:x:24:
|
||||
smmsp:x:25:
|
||||
proc:x:26:
|
||||
http:x:33:
|
||||
games:x:50:
|
||||
lock:x:54:
|
||||
uuidd:x:68:
|
||||
dbus:x:81:
|
||||
network:x:90:
|
||||
video:x:91:
|
||||
audio:x:92:
|
||||
optical:x:93:
|
||||
floppy:x:94:
|
||||
storage:x:95:
|
||||
scanner:x:96:
|
||||
input:x:97:
|
||||
power:x:98:
|
||||
nobody:x:99:
|
||||
users:x:100:
|
||||
systemd-journal:x:190:
|
||||
systemd-journal-gateway:x:191:
|
||||
systemd-timesync:x:192:
|
||||
systemd-network:x:193:
|
||||
systemd-bus-proxy:x:194:
|
||||
systemd-resolve:x:195:
|
42
filesystem/gshadow
Normal file
42
filesystem/gshadow
Normal file
@@ -0,0 +1,42 @@
|
||||
root:::root
|
||||
bin:::root,bin,daemon
|
||||
daemon:::root,bin,daemon
|
||||
sys:::root,bin
|
||||
adm:::root,daemon
|
||||
tty:::
|
||||
disk:::root
|
||||
lp:::daemon
|
||||
mem:::
|
||||
kmem:::
|
||||
wheel:::root
|
||||
ftp:::
|
||||
mail:::
|
||||
uucp:::
|
||||
log:::root
|
||||
utmp:x::
|
||||
locate:::
|
||||
rfkill:x::
|
||||
smmsp:::
|
||||
proc:::
|
||||
http:::
|
||||
games:::
|
||||
lock:::
|
||||
uuidd:x::
|
||||
dbus:x::
|
||||
network:x::
|
||||
video:x::
|
||||
audio:::
|
||||
optical:::
|
||||
floppy:x::
|
||||
storage:x::
|
||||
scanner:x::
|
||||
input:x::
|
||||
power:x::
|
||||
nobody:::
|
||||
users:::
|
||||
systemd-journal:::
|
||||
systemd-journal-gateway:::
|
||||
systemd-timesync:::
|
||||
systemd-network:::
|
||||
systemd-bus-proxy:::
|
||||
systemd-resolve:::
|
8
filesystem/host.conf
Normal file
8
filesystem/host.conf
Normal file
@@ -0,0 +1,8 @@
|
||||
#
|
||||
# /etc/host.conf
|
||||
#
|
||||
|
||||
order hosts,bind
|
||||
multi on
|
||||
|
||||
# End of file
|
9
filesystem/hosts
Normal file
9
filesystem/hosts
Normal file
@@ -0,0 +1,9 @@
|
||||
#
|
||||
# /etc/hosts: static lookup table for host names
|
||||
#
|
||||
|
||||
#<ip-address> <hostname.domain.org> <hostname>
|
||||
127.0.0.1 localhost.localdomain localhost
|
||||
::1 localhost.localdomain localhost
|
||||
|
||||
# End of file
|
3
filesystem/inittab
Normal file
3
filesystem/inittab
Normal file
@@ -0,0 +1,3 @@
|
||||
::sysinit:/etc/init.d/rcS
|
||||
::respawn:-/bin/sh
|
||||
::ctrlaltdel:/bin/umount -a -r
|
2
filesystem/issue
Normal file
2
filesystem/issue
Normal file
@@ -0,0 +1,2 @@
|
||||
Arch Linux \r (\l)
|
||||
|
7
filesystem/ld.so.conf
Normal file
7
filesystem/ld.so.conf
Normal file
@@ -0,0 +1,7 @@
|
||||
#
|
||||
# /etc/ld.so.conf
|
||||
#
|
||||
|
||||
include /etc/ld.so.conf.d/*.conf
|
||||
|
||||
# End of file
|
26
filesystem/locale.sh
Normal file
26
filesystem/locale.sh
Normal file
@@ -0,0 +1,26 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ -z "$LANG" ]; then
|
||||
if [ -n "$XDG_CONFIG_HOME" ] && [ -r "$XDG_CONFIG_HOME/locale.conf" ]; then
|
||||
. "$XDG_CONFIG_HOME/locale.conf"
|
||||
elif [ -n "$HOME" ] && [ -r "$HOME/.config/locale.conf" ]; then
|
||||
. "$HOME/.config/locale.conf"
|
||||
elif [ -r /etc/locale.conf ]; then
|
||||
. /etc/locale.conf
|
||||
fi
|
||||
fi
|
||||
|
||||
LANG=${LANG:-C}
|
||||
export LANG
|
||||
[ -n "$LC_CTYPE" ] && export LC_CTYPE
|
||||
[ -n "$LC_NUMERIC" ] && export LC_NUMERIC
|
||||
[ -n "$LC_TIME" ] && export LC_TIME
|
||||
[ -n "$LC_COLLATE" ] && export LC_COLLATE
|
||||
[ -n "$LC_MONETARY" ] && export LC_MONETARY
|
||||
[ -n "$LC_MESSAGES" ] && export LC_MESSAGES
|
||||
[ -n "$LC_PAPER" ] && export LC_PAPER
|
||||
[ -n "$LC_NAME" ] && export LC_NAME
|
||||
[ -n "$LC_ADDRESS" ] && export LC_ADDRESS
|
||||
[ -n "$LC_TELEPHONE" ] && export LC_TELEPHONE
|
||||
[ -n "$LC_MEASUREMENT" ] && export LC_MEASUREMENT
|
||||
[ -n "$LC_IDENTIFICATION" ] && export LC_IDENTIFICATION
|
2
filesystem/modprobe.d.usb-load-ehci-first
Normal file
2
filesystem/modprobe.d.usb-load-ehci-first
Normal file
@@ -0,0 +1,2 @@
|
||||
softdep ohci_hcd pre: ehci_hcd
|
||||
softdep uhci_hcd pre: ehci_hcd
|
0
filesystem/motd
Normal file
0
filesystem/motd
Normal file
19
filesystem/nsswitch.conf
Normal file
19
filesystem/nsswitch.conf
Normal file
@@ -0,0 +1,19 @@
|
||||
# Begin /etc/nsswitch.conf
|
||||
|
||||
passwd: files
|
||||
group: files
|
||||
shadow: files
|
||||
|
||||
publickey: files
|
||||
|
||||
hosts: files dns myhostname
|
||||
networks: files
|
||||
|
||||
protocols: files
|
||||
services: files
|
||||
ethers: files
|
||||
rpc: files
|
||||
|
||||
netgroup: files
|
||||
|
||||
# End /etc/nsswitch.conf
|
8
filesystem/os-release
Normal file
8
filesystem/os-release
Normal file
@@ -0,0 +1,8 @@
|
||||
NAME="Arch Linux"
|
||||
ID=arch
|
||||
PRETTY_NAME="Arch Linux"
|
||||
ANSI_COLOR="0;36"
|
||||
HOME_URL="https://www.archlinux.org/"
|
||||
SUPPORT_URL="https://bbs.archlinux.org/"
|
||||
BUG_REPORT_URL="https://bugs.archlinux.org/"
|
||||
|
14
filesystem/passwd
Normal file
14
filesystem/passwd
Normal file
@@ -0,0 +1,14 @@
|
||||
root:x:0:0:root:/root:/bin/bash
|
||||
bin:x:1:1:bin:/bin:/usr/bin/nologin
|
||||
daemon:x:2:2:daemon:/:/usr/bin/nologin
|
||||
mail:x:8:12:mail:/var/spool/mail:/usr/bin/nologin
|
||||
ftp:x:14:11:ftp:/srv/ftp:/usr/bin/nologin
|
||||
http:x:33:33:http:/srv/http:/usr/bin/nologin
|
||||
uuidd:x:68:68:uuidd:/:/usr/bin/nologin
|
||||
dbus:x:81:81:dbus:/:/usr/bin/nologin
|
||||
nobody:x:99:99:nobody:/:/usr/bin/nologin
|
||||
systemd-journal-gateway:x:191:191:systemd-journal-gateway:/:/usr/bin/nologin
|
||||
systemd-timesync:x:192:192:systemd-timesync:/:/usr/bin/nologin
|
||||
systemd-network:x:193:193:systemd-network:/:/usr/bin/nologin
|
||||
systemd-bus-proxy:x:194:194:systemd-bus-proxy:/:/usr/bin/nologin
|
||||
systemd-resolve:x:195:195:systemd-resolve:/:/usr/bin/nologin
|
27
filesystem/profile
Normal file
27
filesystem/profile
Normal file
@@ -0,0 +1,27 @@
|
||||
# /etc/profile
|
||||
|
||||
#Set our umask
|
||||
umask 022
|
||||
|
||||
# Set our default path
|
||||
PATH="/usr/local/sbin:/usr/local/bin:/usr/bin"
|
||||
export PATH
|
||||
|
||||
# Load profiles from /etc/profile.d
|
||||
if test -d /etc/profile.d/; then
|
||||
for profile in /etc/profile.d/*.sh; do
|
||||
test -r "$profile" && . "$profile"
|
||||
done
|
||||
unset profile
|
||||
fi
|
||||
|
||||
# Source global bash config
|
||||
if test "$PS1" && test "$BASH" && test -z ${POSIXLY_CORRECT+x} && test -r /etc/bash.bashrc; then
|
||||
. /etc/bash.bashrc
|
||||
fi
|
||||
|
||||
# Termcap is outdated, old, and crusty, kill it.
|
||||
unset TERMCAP
|
||||
|
||||
# Man is much better than us at figuring this out
|
||||
unset MANPATH
|
2
filesystem/rcS
Normal file
2
filesystem/rcS
Normal file
@@ -0,0 +1,2 @@
|
||||
#!/bin/sh
|
||||
/usr/bin/mount -a
|
8
filesystem/resolv.conf
Normal file
8
filesystem/resolv.conf
Normal file
@@ -0,0 +1,8 @@
|
||||
#
|
||||
# /etc/resolv.conf
|
||||
#
|
||||
|
||||
#search <yourdomain.tld>
|
||||
#nameserver <ip>
|
||||
|
||||
# End of file
|
15
filesystem/securetty
Normal file
15
filesystem/securetty
Normal file
@@ -0,0 +1,15 @@
|
||||
#
|
||||
# /etc/securetty
|
||||
#
|
||||
|
||||
console
|
||||
tty1
|
||||
tty2
|
||||
tty3
|
||||
tty4
|
||||
tty5
|
||||
tty6
|
||||
ttyS0
|
||||
hvc0
|
||||
|
||||
# End of file
|
14
filesystem/shadow
Normal file
14
filesystem/shadow
Normal file
@@ -0,0 +1,14 @@
|
||||
root::14871::::::
|
||||
bin:x:14871::::::
|
||||
daemon:x:14871::::::
|
||||
mail:x:14871::::::
|
||||
ftp:x:14871::::::
|
||||
http:x:14871::::::
|
||||
uuidd:x:14871::::::
|
||||
dbus:x:14871::::::
|
||||
nobody:x:14871::::::
|
||||
systemd-journal-gateway:x:14871::::::
|
||||
systemd-timesync:x:14871::::::
|
||||
systemd-network:x:14871::::::
|
||||
systemd-bus-proxy:x:14871::::::
|
||||
systemd-resolve:x:14871::::::
|
8
filesystem/shells
Normal file
8
filesystem/shells
Normal file
@@ -0,0 +1,8 @@
|
||||
#
|
||||
# /etc/shells
|
||||
#
|
||||
|
||||
/bin/sh
|
||||
/bin/bash
|
||||
|
||||
# End of file
|
Reference in New Issue
Block a user