From 4a740ca7ad822dd6be9a58a354571019424be440 Mon Sep 17 00:00:00 2001 From: P. J. McDermott Date: Thu, 08 Aug 2013 08:50:40 -0400 Subject: build: Rewrite. --- diff --git a/build b/build index fa48d2f..4f77a6f 100755 --- a/build +++ b/build @@ -1,55 +1,32 @@ #!/usr/bin/make -f +include ../macros.$(OPK_HOST_ARCH_KERNEL).mk + +version = $$(printf '%s\n' '$(OPK_SOURCE_VERSION)' | \ + sed 's|\(^[0-9][0-9]*\.[0-9][0-9]*\).*$$|\1|') + +script = \ + s|@DISTRIBUTION@|ProteanOS|; \ + s|@OS@|$(os)|; \ + s|@VERSION@|$(version)|; + build: install: build - printf 'base-files: Installing base files...\n' - mv src dest - printf 'base-files: Making filesystem hierarchy...\n' - cd dest && \ - mkdir -p bin boot dev/pts etc/opt home lib media mnt opt proc && \ - install -d -m 0750 root && \ - mkdir -p sbin srv sys && \ - install -d -m 1777 tmp var/tmp && \ - mkdir -p usr/bin usr/include usr/lib usr/sbin \ - usr/share/man usr/share/misc usr/src && \ - mkdir -p usr/local/bin usr/local/include usr/local/lib usr/local/sbin \ - usr/local/share/man usr/local/share/misc usr/local/src && \ - mkdir -p usr/local/etc usr/local/games && \ - mkdir -p usr/share/doc usr/share/info usr/share/locale \ - usr/share/terminfo usr/share/zoneinfo && \ - mkdir -p usr/local/share/doc usr/local/share/info \ - usr/local/share/locale usr/local/share/terminfo \ - usr/local/share/zoneinfo && \ - mkdir -p usr/share/man/man1 usr/share/man/man2 \ - usr/share/man/man3 usr/share/man/man4 \ - usr/share/man/man5 usr/share/man/man6 \ - usr/share/man/man7 usr/share/man/man8 && \ - mkdir -p usr/local/share/man/man1 usr/local/share/man/man2 \ - usr/local/share/man/man3 usr/local/share/man/man4 \ - usr/local/share/man/man5 usr/local/share/man/man6 \ - usr/local/share/man/man7 usr/local/share/man/man8 && \ - ln -s share/man usr/local/man && \ - mkdir -p var/cache var/lib/misc var/local var/lock var/log var/mail \ - var/opt var/run var/spool - printf 'base-files: Making service run control links...\n' - cd dest && \ - mkdir etc/rc.d && \ - ln -s rc etc/init.d/rcS && \ - ln -s rc etc/init.d/rcK && \ - ln -s ../init.d/sysfs etc/rc.d/S01sysfs && \ - ln -s ../init.d/mdev etc/rc.d/S02mdev && \ - ln -s ../init.d/mountall etc/rc.d/S03mountall && \ - ln -s ../init.d/hostname etc/rc.d/S04hostname && \ - ln -s ../init.d/networking etc/rc.d/S05networking && \ - ln -s ../init.d/syslog etc/rc.d/S06syslog && \ - ln -s ../init.d/telnetd etc/rc.d/S07telnetd && \ - ln -s ../init.d/httpd etc/rc.d/S08httpd - cd dest && \ - ln -s ../init.d/httpd etc/rc.d/K01httpd && \ - ln -s ../init.d/telnetd etc/rc.d/K02telnetd && \ - ln -s ../init.d/syslog etc/rc.d/K03syslog && \ - ln -s ../init.d/networking etc/rc.d/K04networking - cd dest/etc/network && \ - mkdir if-down.d if-post-down.d if-pre-up.d if-up.d - oh-installfiles + # Make file system hierarchy. + while read -r mode dir; do \ + install -d -m "$${mode}" "base-files.data/$${dir}"; \ + done <'../dirs' + while read -r mode dir; do \ + install -d -m "$${mode}" "base-files.data/$${dir}"; \ + done <'../dirs.$(OPK_HOST_ARCH_KERNEL)' + ln -s share/man base-files.data/usr/local/man + # Install base files. + for file in /etc/issue /etc/motd; do \ + sed "$(script)" "src/$${file}" >"base-files.data/$${file}"; \ + done + printf '%s\n' '$(OPK_HOST_ARCH)' >'base-files.data/etc/proteanos_arch' + printf '%s\n' '$(OPK_HOST_PLAT)' >'base-files.data/etc/proteanos_plat' + # Install common licenses. + install -p -m 644 src/usr/share/common-licenses/* \ + base-files.data/usr/share/common-licenses diff --git a/dirs b/dirs new file mode 100644 index 0000000..e833ce4 --- /dev/null +++ b/dirs @@ -0,0 +1,71 @@ +0755 /bin +0755 /boot +0755 /dev +0755 /etc +0755 /etc/opt +0755 /home +0755 /lib +0755 /media +0755 /mnt +0755 /opt +0750 /root +0755 /sbin +0755 /srv +1755 /tmp +0755 /usr/bin +0755 /usr/include +0755 /usr/lib +0755 /usr/local +0755 /usr/local/bin +0755 /usr/local/etc +0755 /usr/local/games +0755 /usr/local/include +0755 /usr/local/lib +0755 /usr/local/sbin +0755 /usr/local/share +0755 /usr/local/share/doc +0755 /usr/local/share/info +0755 /usr/local/share/locale +0755 /usr/local/share/man +0755 /usr/local/share/man/man1 +0755 /usr/local/share/man/man2 +0755 /usr/local/share/man/man3 +0755 /usr/local/share/man/man4 +0755 /usr/local/share/man/man5 +0755 /usr/local/share/man/man6 +0755 /usr/local/share/man/man7 +0755 /usr/local/share/man/man8 +0755 /usr/local/share/misc +0755 /usr/local/share/terminfo +0755 /usr/local/share/zoneinfo +0755 /usr/local/src +0755 /usr/sbin +0755 /usr/share +0755 /usr/share/common-licenses +0755 /usr/share/doc +0755 /usr/share/info +0755 /usr/share/locale +0755 /usr/share/man +0755 /usr/share/man/man1 +0755 /usr/share/man/man2 +0755 /usr/share/man/man3 +0755 /usr/share/man/man4 +0755 /usr/share/man/man5 +0755 /usr/share/man/man6 +0755 /usr/share/man/man7 +0755 /usr/share/man/man8 +0755 /usr/share/misc +0755 /usr/share/terminfo +0755 /usr/share/zoneinfo +0755 /usr/src +0755 /var/cache +0755 /var/lib +0755 /var/lib/misc +0755 /var/local +0755 /var/lock +0755 /var/log +0755 /var/mail +0755 /var/opt +0755 /var/run +0755 /var/spool +1755 /var/tmp diff --git a/dirs.linux b/dirs.linux new file mode 100644 index 0000000..170f079 --- /dev/null +++ b/dirs.linux @@ -0,0 +1,3 @@ +0755 /dev/pts +0755 /proc +0755 /sys diff --git a/macros.linux.mk b/macros.linux.mk new file mode 100644 index 0000000..a2f99c0 --- /dev/null +++ b/macros.linux.mk @@ -0,0 +1 @@ +os = BusyBox/Linux-libre -- cgit v0.9.1