From 3f321b1f261671fad9f2db2556af4a5b5d8437d6 Mon Sep 17 00:00:00 2001 From: Mikael Magnusson Date: Thu, 28 Jun 2018 20:09:51 +0000 Subject: Add support for 18.06.0-rc1 --- build.sh | 43 ++++++++++---- patches/procd-lede-17.01/001_lxd_no_mounts.patch | 69 ++++++++++++++++++++++ .../procd-openwrt-18.06/001_lxd_no_mounts.patch | 69 ++++++++++++++++++++++ patches/procd/001_lxd_no_mounts.patch | 69 ---------------------- 4 files changed, 168 insertions(+), 82 deletions(-) create mode 100644 patches/procd-lede-17.01/001_lxd_no_mounts.patch create mode 100644 patches/procd-openwrt-18.06/001_lxd_no_mounts.patch delete mode 100644 patches/procd/001_lxd_no_mounts.patch diff --git a/build.sh b/build.sh index 6d2dcc4..7b7ee33 100755 --- a/build.sh +++ b/build.sh @@ -53,7 +53,15 @@ case "$arch_lxd" in ;; esac -procd_url=https://github.com/openwrt/openwrt/branches/lede-17.01/package/system/procd +branch_ver=$(echo "${ver}"|cut -d- -f1|cut -d. -f1,2) + +if test $ver = snapshot; then + openwrt_branch=openwrt-18.06 +else + openwrt_branch=${dist}-${branch_ver} +fi + +procd_url=https://github.com/openwrt/openwrt/branches/${openwrt_branch}/package/system/procd procd_extra_ver=lxd-3 lxc_tar=bin/${dist}-${ver}-${arch}-${subarch}-lxd.tar.gz @@ -76,8 +84,10 @@ download_rootfs() { download_sdk() { if test $ver = snapshot; then local sdk_url=https://downloads.openwrt.org/snapshots/targets/${arch}/${subarch}/${dist}-sdk-${arch}-${subarch}_gcc-7.3.0_musl.Linux-x86_64.tar.xz - else + elif test $ver \< 18; then local sdk_url=https://downloads.openwrt.org/releases/${ver}/targets/${arch}/${subarch}/${dist}-sdk-${ver}-${arch}-${subarch}_gcc-5.4.0_musl-1.1.16.Linux-x86_64.tar.xz + else + local sdk_url=https://downloads.openwrt.org/releases/${ver}/targets/${arch}/${subarch}/${dist}-sdk-${ver}-${arch}-${subarch}_gcc-7.3.0_musl.Linux-x86_64.tar.xz fi local sdk_tar=dl/$(basename $sdk_url) @@ -136,23 +146,30 @@ check() { } download_procd() { - if ! test -e dl/procd; then - svn co $procd_url dl/procd - sed -i -e "s/PKG_RELEASE:=\(\S\+\)/PKG_RELEASE:=\1-${procd_extra_ver}/" dl/procd/Makefile + if ! test -e dl/procd-${openwrt_branch}; then + svn co $procd_url dl/procd-${openwrt_branch} + sed -i -e "s/PKG_RELEASE:=\(\S\+\)/PKG_RELEASE:=\1-${procd_extra_ver}/" dl/procd-${openwrt_branch}/Makefile fi - test -e dl/procd/patches || mkdir dl/procd/patches - cp -a patches/procd/* dl/procd/patches + test -e dl/procd-${openwrt_branch}/patches || mkdir dl/procd-${openwrt_branch}/patches + cp -a patches/procd-${openwrt_branch}/* dl/procd-${openwrt_branch}/patches } build_procd() { - if ! test -e $sdk/package/lxd-procd; then - ln -sfT $(pwd)/dl/procd $sdk/package/lxd-procd + rm $sdk/package/lxd-procd||true + ln -sfT $(pwd)/dl/procd-${openwrt_branch} $sdk/package/lxd-procd + + local date=$(grep PKG_SOURCE_DATE:= dl/procd-${openwrt_branch}/Makefile | cut -d '=' -f 2) + local version=$(grep PKG_SOURCE_VERSION:= dl/procd-${openwrt_branch}/Makefile | cut -d '=' -f 2 | cut -b '1-8') + local release=$(grep PKG_RELEASE:= dl/procd-${openwrt_branch}/Makefile | cut -d '=' -f 2) + local ipk_old=$sdk/bin/targets/${arch}/${subarch}/packages/procd_${date}-${version}-${release}_*.ipk + local ipk_new=$sdk/bin/packages/${arch_lxd}/base/procd_${date}-${version}-${release}_*.ipk + + if test $ver \< 18; then + local ipk=$ipk_old + else + local ipk=$ipk_new fi - local date=$(grep PKG_SOURCE_DATE:= dl/procd/Makefile | cut -d '=' -f 2) - local version=$(grep PKG_SOURCE_VERSION:= dl/procd/Makefile | cut -d '=' -f 2 | cut -b '1-8') - local release=$(grep PKG_RELEASE:= dl/procd/Makefile | cut -d '=' -f 2) - local ipk=$sdk/bin/targets/${arch}/${subarch}/packages/procd_${date}-${version}-${release}_*.ipk if ! test -s $ipk; then (cd $sdk diff --git a/patches/procd-lede-17.01/001_lxd_no_mounts.patch b/patches/procd-lede-17.01/001_lxd_no_mounts.patch new file mode 100644 index 0000000..f3b2c4f --- /dev/null +++ b/patches/procd-lede-17.01/001_lxd_no_mounts.patch @@ -0,0 +1,69 @@ +diff --git a/initd/early.c b/initd/early.c +index 7028ff8..115d8f8 100644 +--- a/initd/early.c ++++ b/initd/early.c +@@ -27,13 +27,6 @@ + #include "../libc-compat.h" + + static void +-early_dev(void) +-{ +- mkdev("*", 0600); +- mknod("/dev/null", 0666, makedev(1, 3)); +-} +- +-static void + early_console(const char *dev) + { + struct stat s; +@@ -56,15 +49,6 @@ early_mounts(void) + { + unsigned int oldumask = umask(0); + +- mount("proc", "/proc", "proc", MS_NOATIME | MS_NODEV | MS_NOEXEC | MS_NOSUID, 0); +- mount("sysfs", "/sys", "sysfs", MS_NOATIME | MS_NODEV | MS_NOEXEC | MS_NOSUID, 0); +- mount("cgroup", "/sys/fs/cgroup", "cgroup", MS_NODEV | MS_NOEXEC | MS_NOSUID, 0); +- mount("tmpfs", "/dev", "tmpfs", MS_NOATIME | MS_NOSUID, "mode=0755,size=512K"); +- ignore(symlink("/tmp/shm", "/dev/shm")); +- mkdir("/dev/pts", 0755); +- mount("devpts", "/dev/pts", "devpts", MS_NOATIME | MS_NOEXEC | MS_NOSUID, "mode=600"); +- early_dev(); +- + early_console("/dev/console"); + if (mount_zram_on_tmp()) { + mount("tmpfs", "/tmp", "tmpfs", MS_NOSUID | MS_NODEV | MS_NOATIME, 0); +diff --git a/initd/zram.c b/initd/zram.c +index c730942..8eb38a6 100644 +--- a/initd/zram.c ++++ b/initd/zram.c +@@ -116,12 +116,6 @@ mount_zram_on_tmp(void) + waitpid(pid, NULL, 0); + } + +- ret = mount("/dev/zram0", "/tmp", "ext4", MS_NOSUID | MS_NODEV | MS_NOATIME, "errors=continue,noquota"); +- if (ret < 0) { +- ERROR("Can't mount /dev/zram0 on /tmp: %s\n", strerror(errno)); +- return errno; +- } +- + LOG("Using up to %ld kB of RAM as ZRAM storage on /mnt\n", zramsize); + + ret = chmod("/tmp", 01777); +diff --git a/plug/coldplug.c b/plug/coldplug.c +index 5fcb9a3..b846d7f 100644 +--- a/plug/coldplug.c ++++ b/plug/coldplug.c +@@ -43,13 +43,8 @@ void procd_coldplug(void) + char *argv[] = { "udevtrigger", NULL }; + unsigned int oldumask = umask(0); + +- umount2("/dev/pts", MNT_DETACH); +- umount2("/dev/", MNT_DETACH); +- mount("tmpfs", "/dev", "tmpfs", MS_NOSUID, "mode=0755,size=512K"); + ignore(symlink("/tmp/shm", "/dev/shm")); +- mkdir("/dev/pts", 0755); + umask(oldumask); +- mount("devpts", "/dev/pts", "devpts", MS_NOEXEC | MS_NOSUID, 0); + udevtrigger.cb = udevtrigger_complete; + udevtrigger.pid = fork(); + if (!udevtrigger.pid) { diff --git a/patches/procd-openwrt-18.06/001_lxd_no_mounts.patch b/patches/procd-openwrt-18.06/001_lxd_no_mounts.patch new file mode 100644 index 0000000..e9e5368 --- /dev/null +++ b/patches/procd-openwrt-18.06/001_lxd_no_mounts.patch @@ -0,0 +1,69 @@ +diff --git a/initd/early.c b/initd/early.c +index 7028ff8..115d8f8 100644 +--- a/initd/early.c ++++ b/initd/early.c +@@ -27,13 +27,6 @@ + #include "../libc-compat.h" + + static void +-early_dev(void) +-{ +- mkdev("*", 0600); +- mknod("/dev/null", 0666, makedev(1, 3)); +-} +- +-static void + early_console(const char *dev) + { + struct stat s; +@@ -56,15 +49,6 @@ early_mounts(void) + { + unsigned int oldumask = umask(0); + +- mount("proc", "/proc", "proc", MS_NOATIME | MS_NODEV | MS_NOEXEC | MS_NOSUID, 0); +- mount("sysfs", "/sys", "sysfs", MS_NOATIME | MS_NODEV | MS_NOEXEC | MS_NOSUID, 0); +- mount("cgroup", "/sys/fs/cgroup", "cgroup", MS_NODEV | MS_NOEXEC | MS_NOSUID, 0); +- mount("tmpfs", "/dev", "tmpfs", MS_NOATIME | MS_NOSUID, "mode=0755,size=512K"); +- ignore(symlink("/tmp/shm", "/dev/shm")); +- mkdir("/dev/pts", 0755); +- mount("devpts", "/dev/pts", "devpts", MS_NOATIME | MS_NOEXEC | MS_NOSUID, "mode=600"); +- early_dev(); +- + early_console("/dev/console"); + if (mount_zram_on_tmp()) { + mount("tmpfs", "/tmp", "tmpfs", MS_NOSUID | MS_NODEV | MS_NOATIME, 0); +diff --git a/initd/zram.c b/initd/zram.c +index c730942..8eb38a6 100644 +--- a/initd/zram.c ++++ b/initd/zram.c +@@ -116,12 +116,6 @@ mount_zram_on_tmp(void) + waitpid(pid, NULL, 0); + } + +- ret = mount("/dev/zram0", "/tmp", "ext4", MS_NOSUID | MS_NODEV | MS_NOATIME, "errors=continue,noquota"); +- if (ret < 0) { +- ERROR("Can't mount /dev/zram0 on /tmp: %m\n"); +- return errno; +- } +- + LOG("Using up to %ld kB of RAM as ZRAM storage on /mnt\n", zramsize); + + ret = chmod("/tmp", 01777); +diff --git a/plug/coldplug.c b/plug/coldplug.c +index 5fcb9a3..b846d7f 100644 +--- a/plug/coldplug.c ++++ b/plug/coldplug.c +@@ -43,13 +43,8 @@ void procd_coldplug(void) + char *argv[] = { "udevtrigger", NULL }; + unsigned int oldumask = umask(0); + +- umount2("/dev/pts", MNT_DETACH); +- umount2("/dev/", MNT_DETACH); +- mount("tmpfs", "/dev", "tmpfs", MS_NOSUID, "mode=0755,size=512K"); + ignore(symlink("/tmp/shm", "/dev/shm")); +- mkdir("/dev/pts", 0755); + umask(oldumask); +- mount("devpts", "/dev/pts", "devpts", MS_NOEXEC | MS_NOSUID, 0); + udevtrigger.cb = udevtrigger_complete; + udevtrigger.pid = fork(); + if (!udevtrigger.pid) { diff --git a/patches/procd/001_lxd_no_mounts.patch b/patches/procd/001_lxd_no_mounts.patch deleted file mode 100644 index f3b2c4f..0000000 --- a/patches/procd/001_lxd_no_mounts.patch +++ /dev/null @@ -1,69 +0,0 @@ -diff --git a/initd/early.c b/initd/early.c -index 7028ff8..115d8f8 100644 ---- a/initd/early.c -+++ b/initd/early.c -@@ -27,13 +27,6 @@ - #include "../libc-compat.h" - - static void --early_dev(void) --{ -- mkdev("*", 0600); -- mknod("/dev/null", 0666, makedev(1, 3)); --} -- --static void - early_console(const char *dev) - { - struct stat s; -@@ -56,15 +49,6 @@ early_mounts(void) - { - unsigned int oldumask = umask(0); - -- mount("proc", "/proc", "proc", MS_NOATIME | MS_NODEV | MS_NOEXEC | MS_NOSUID, 0); -- mount("sysfs", "/sys", "sysfs", MS_NOATIME | MS_NODEV | MS_NOEXEC | MS_NOSUID, 0); -- mount("cgroup", "/sys/fs/cgroup", "cgroup", MS_NODEV | MS_NOEXEC | MS_NOSUID, 0); -- mount("tmpfs", "/dev", "tmpfs", MS_NOATIME | MS_NOSUID, "mode=0755,size=512K"); -- ignore(symlink("/tmp/shm", "/dev/shm")); -- mkdir("/dev/pts", 0755); -- mount("devpts", "/dev/pts", "devpts", MS_NOATIME | MS_NOEXEC | MS_NOSUID, "mode=600"); -- early_dev(); -- - early_console("/dev/console"); - if (mount_zram_on_tmp()) { - mount("tmpfs", "/tmp", "tmpfs", MS_NOSUID | MS_NODEV | MS_NOATIME, 0); -diff --git a/initd/zram.c b/initd/zram.c -index c730942..8eb38a6 100644 ---- a/initd/zram.c -+++ b/initd/zram.c -@@ -116,12 +116,6 @@ mount_zram_on_tmp(void) - waitpid(pid, NULL, 0); - } - -- ret = mount("/dev/zram0", "/tmp", "ext4", MS_NOSUID | MS_NODEV | MS_NOATIME, "errors=continue,noquota"); -- if (ret < 0) { -- ERROR("Can't mount /dev/zram0 on /tmp: %s\n", strerror(errno)); -- return errno; -- } -- - LOG("Using up to %ld kB of RAM as ZRAM storage on /mnt\n", zramsize); - - ret = chmod("/tmp", 01777); -diff --git a/plug/coldplug.c b/plug/coldplug.c -index 5fcb9a3..b846d7f 100644 ---- a/plug/coldplug.c -+++ b/plug/coldplug.c -@@ -43,13 +43,8 @@ void procd_coldplug(void) - char *argv[] = { "udevtrigger", NULL }; - unsigned int oldumask = umask(0); - -- umount2("/dev/pts", MNT_DETACH); -- umount2("/dev/", MNT_DETACH); -- mount("tmpfs", "/dev", "tmpfs", MS_NOSUID, "mode=0755,size=512K"); - ignore(symlink("/tmp/shm", "/dev/shm")); -- mkdir("/dev/pts", 0755); - umask(oldumask); -- mount("devpts", "/dev/pts", "devpts", MS_NOEXEC | MS_NOSUID, 0); - udevtrigger.cb = udevtrigger_complete; - udevtrigger.pid = fork(); - if (!udevtrigger.pid) { -- cgit v1.2.3