Skip to content

Commit

Permalink
Restructure kayak file layout. The number of kayak files has been gro…
Browse files Browse the repository at this point in the history
…wing

and the directory is now pretty cluttered. Move everything to appropriate
sub-directories and clean up the Makefile.
  • Loading branch information
citrus-it committed Mar 23, 2018
1 parent 0af61bd commit a59bd99
Show file tree
Hide file tree
Showing 32 changed files with 195 additions and 139 deletions.
9 changes: 2 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
kayak_root/
takeover-console
ipcalc
dialog
passutil
mount_media
zpool_patch
kbd.list
bin/*
etc/kbd.list
run
mkiso
pv-grub*
Expand Down
150 changes: 82 additions & 68 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,39 +31,31 @@ DESTDIR=$(BUILDSEND_MP)

all:

INSTALLS=anon.dtrace.conf anon.system build_miniroot.sh build_zfs_send.sh \
data/access.log data/boot data/etc data/filelist.ramdisk data/kernel \
data/known_extras data/mdb data/platform disk_help.sh install_help.sh \
install_image.sh src/takeover-console.c Makefile net_help.sh README.md \
build_iso.sh digest find-and-install.sh kayak-menu.sh config-menu.sh \
build_usb.sh ipcalc dialog src/passutil.c \
loader.conf.local rpool-install.sh \
sample/000000000000.sample sample/menu.lst.000000000000
PKGDIRS=build src/include src bin etc data lib installer sample
IMG_FILES=corner.png tail_bg_v1.png OmniOS_logo_medium.png tail_bg_v2.png
PKGFILES=Makefile README.md

TFTP_FILES=\
$(DESTDIR)/tftpboot/kayak/miniroot.gz \
$(DESTDIR)/tftpboot/kayak/miniroot.gz.hash \
$(DESTDIR)/tftpboot/boot/grub/menu.lst \
$(DESTDIR)/tftpboot/boot/loader.conf.local \
$(DESTDIR)/tftpboot/boot/loader.rc \
$(DESTDIR)/tftpboot/boot/forth $(DESTDIR)/tftpboot/boot/defaults \
$(DESTDIR)/tftpboot/boot/forth \
$(DESTDIR)/tftpboot/boot/defaults \
$(DESTDIR)/tftpboot/boot/platform/i86pc/kernel/amd64/unix \
$(DESTDIR)/tftpboot/pxeboot $(DESTDIR)/tftpboot/pxegrub
$(DESTDIR)/tftpboot/pxeboot \
$(DESTDIR)/tftpboot/pxegrub

WEB_FILES=$(DESTDIR)/var/kayak/kayak/$(VERSION).zfs.bz2
IMG_FILES=corner.png tail_bg_v1.png OmniOS_logo_medium.png tail_bg_v2.png

anon.dtrace.conf:
dtrace -A -q -n'int seen[string]; fsinfo:::/args[0]->fi_mount=="/" && seen[args[0]->fi_pathname]==0/{printf("%d %s\n",timestamp/1000000, args[0]->fi_pathname);seen[args[0]->fi_pathname]=1;}' -o $@.tmp
cat /kernel/drv/dtrace.conf $@.tmp > $@
rm $@.tmp
$(DESTDIR)/tftpboot/boot/loader.conf.local: etc/loader.conf.local
sed -e 's/@VERSION@/$(VERSION)/' $< > $@

MINIROOT_DEPS=build_miniroot.sh anon.dtrace.conf anon.system \
install_image.sh disk_help.sh install_help.sh net_help.sh
$(DESTDIR)/tftpboot/boot/grub/menu.lst: sample/menu.lst.000000000000
sed -e 's/@VERSION@/$(VERSION)/' $< > $@

$(BUILDSEND_MP)/kayak_$(VERSION).zfs.bz2: build_zfs_send.sh
@test -d "$(BUILDSEND_MP)" || (echo "$(BUILDSEND) missing" && false)
./build_zfs_send.sh -d $(BUILDSEND) $(VERSION)
# Files from proto

$(DESTDIR)/tftpboot/pxegrub: $(BUILDSEND_MP)/root/boot/grub/pxegrub
cp -p $< $@
Expand All @@ -74,40 +66,38 @@ $(DESTDIR)/tftpboot/pxeboot: $(BUILDSEND_MP)/root/boot/pxeboot
$(DESTDIR)/tftpboot/boot/loader.rc: $(BUILDSEND_MP)/root/boot/loader.rc
cp -p $< $@

$(DESTDIR)/tftpboot/boot/loader.conf.local: loader.conf.local
sed -e 's/@VERSION@/$(VERSION)/' $< > $@

$(DESTDIR)/tftpboot/boot/forth: $(BUILDSEND_MP)/root/boot/forth
cp -rp $< $@

$(DESTDIR)/tftpboot/boot/defaults: $(BUILDSEND_MP)/root/boot/defaults
cp -rp $< $@

$(DESTDIR)/tftpboot/boot/grub/menu.lst: sample/menu.lst.000000000000
sed -e 's/@VERSION@/$(VERSION)/' $< > $@

$(DESTDIR)/tftpboot/boot/platform/i86pc/kernel/amd64/unix: $(BUILDSEND_MP)/root/platform/i86pc/kernel/amd64/unix
cp -p $< $@

$(DESTDIR)/var/kayak/kayak/$(VERSION).zfs.bz2: $(BUILDSEND_MP)/kayak_$(VERSION).zfs.bz2
cp -p $< $@

$(DESTDIR)/tftpboot/kayak/miniroot.gz: $(BUILDSEND_MP)/miniroot.gz
cp -p $< $@

$(DESTDIR)/tftpboot/kayak/miniroot.gz.hash: $(BUILDSEND_MP)/miniroot.gz
digest -a sha1 $< > $@

build_miniroot.sh:
VERSION=$(VERSION) ./build_miniroot.sh
######################################################################
# More involved targets - creation of miniroot.gz & zfs image

$(BUILDSEND_MP)/miniroot.gz: $(MINIROOT_DEPS)
$(BUILDSEND_MP)/kayak_$(VERSION).zfs.bz2: build/build_zfs_send
@test -d "$(BUILDSEND_MP)" || (echo "$(BUILDSEND) missing" && false)
./$< -d $(BUILDSEND) $(VERSION)

$(BUILDSEND_MP)/miniroot.gz: build/build_miniroot
if test -n "`zfs list -H -t snapshot $(BUILDSEND)/root@fixup 2>/dev/null`"; then \
VERSION=$(VERSION) DEBUG=$(DEBUG) ./build_miniroot.sh $(BUILDSEND) fixup ; \
VERSION=$(VERSION) DEBUG=$(DEBUG) ./$< $(BUILDSEND) fixup ; \
else \
VERSION=$(VERSION) DEBUG=$(DEBUG) ./build_miniroot.sh $(BUILDSEND) begin ; \
VERSION=$(VERSION) DEBUG=$(DEBUG) ./$< $(BUILDSEND) begin ; \
fi

$(DESTDIR)/var/kayak/kayak/$(VERSION).zfs.bz2: $(BUILDSEND_MP)/kayak_$(VERSION).zfs.bz2
cp -p $< $@

tftp-dirs:
mkdir -p $(DESTDIR)/tftpboot/boot/grub
mkdir -p $(DESTDIR)/tftpboot/boot/platform/i86pc/kernel/amd64
Expand All @@ -117,61 +107,85 @@ server-dirs:
mkdir -p $(DESTDIR)/var/kayak/kayak
mkdir -p $(DESTDIR)/var/kayak/css
mkdir -p $(DESTDIR)/var/kayak/img
mkdir -p $(DESTDIR)/usr/share/kayak/data
mkdir -p $(DESTDIR)/usr/share/kayak/sample
mkdir -p $(DESTDIR)/usr/share/kayak/src
mkdir -p $(DESTDIR)/usr/share/kayak
mkdir -p $(DESTDIR)/var/kayak/log
mkdir -p $(DESTDIR)/var/svc/manifest/network
mkdir -p $(DESTDIR)/var/svc/method

install-package: tftp-dirs server-dirs
for file in $(INSTALLS) ; do \
cp $$file $(DESTDIR)/usr/share/kayak/$$file ; \
done
cp http/svc-kayak $(DESTDIR)/var/svc/method/svc-kayak
chmod a+x $(DESTDIR)/var/svc/method/svc-kayak
cp http/css/land.css $(DESTDIR)/var/kayak/css/land.css
for file in $(IMG_FILES) ; do \
cp http/img/$$file $(DESTDIR)/var/kayak/img/$$file ; \
done
cp http/kayak.xml $(DESTDIR)/var/svc/manifest/network/kayak.xml
# Rebuilding the anonymous dtrace configuration file requires root in a
# zone with dtrace permissions. Provide no dependencies and it won't be
# rebuilt automatically.
# This is only used in debug mode to build a list of all files
# accessed in order to build the miniroot exclusion list. These days we
# just tend to add files by hand as required.
etc/anon.dtrace.conf:
dtrace -A -q -s etc/anon.d -o $@.tmp
cat /kernel/drv/dtrace.conf $@.tmp > $@
rm $@.tmp

install-tftp: tftp-dirs $(TFTP_FILES)
######################################################################
# Binaries to build from source

install-web: server-dirs $(WEB_FILES)
BINS=bin/takeover-console bin/ipcalc bin/dialog bin/passutil bin/mount_media \
etc/kbd.list

takeover-console: src/takeover-console.c
bin/takeover-console: src/takeover-console.c
gcc -o $@ $<

passutil: src/passutil.c
bin/passutil: src/passutil.c
gcc -o $@ $<

mount_media: src/mount_media.c
bin/mount_media: src/mount_media.c
gcc -o $@ $< -ldevinfo

zpool_patch: src/zpool_patch.c
bin/zpool_patch: src/zpool_patch.c
gcc -Isrc/include -o $@ $< -lnvpair -lzfs

ipcalc: build_ipcalc
./build_ipcalc

dialog: build_dialog
./build_dialog
bin/ipcalc: build/build_ipcalc
./build/build_ipcalc

bins: takeover-console ipcalc dialog passutil mount_media kbd.list
bin/dialog: build/build_dialog
./build/build_dialog

kbd.list: /usr/share/lib/keytables/type_6/kbd_layouts
# Not a binary but a data file generated from key tables
etc/kbd.list: /usr/share/lib/keytables/type_6/kbd_layouts
grep = /usr/share/lib/keytables/type_6/kbd_layouts | cut -d= -f1 \
> kbd.list
> etc/kbd.list

bins: $(BINS)

clean:
rm -f $(BINS)

install-iso: bins kbd.list install-tftp install-web
BUILDSEND_MP=$(BUILDSEND_MP) VERSION=$(VERSION) ./build_iso.sh
######################################################################
# Install targets (see README.md)

install-tftp: tftp-dirs $(TFTP_FILES)

install-web: server-dirs $(WEB_FILES)

install-iso: bins install-tftp install-web
BUILDSEND_MP=$(BUILDSEND_MP) VERSION=$(VERSION) ./build/build_iso

install-usb: install-iso
./build_usb.sh $(BUILDSEND_MP)/$(VERSION).iso \
./build/build_usb $(BUILDSEND_MP)/$(VERSION).iso \
$(BUILDSEND_MP)/$(VERSION).usb-dd

clean:
rm -f takeover-console passutil mount_media ipcalc dialog zpool_patch \
kbd.list
install-package: bins tftp-dirs server-dirs
for dir in $(PKGDIRS); do \
mkdir -p $(DESTDIR)/usr/share/kayak/$$dir; \
cp $$dir/* $(DESTDIR)/usr/share/kayak/$$dir/; \
done
for file in $(PKGFILES); do \
cp $$file $(DESTDIR)/usr/share/kayak/$$file; \
done
for file in $(IMG_FILES); do \
cp http/img/$$file $(DESTDIR)/var/kayak/img/$$file; \
done
\
cp http/css/land.css $(DESTDIR)/var/kayak/css/land.css
\
cp smf/svc-kayak $(DESTDIR)/var/svc/method/svc-kayak
chmod a+x $(DESTDIR)/var/svc/method/svc-kayak
cp smf/kayak.xml $(DESTDIR)/var/svc/manifest/network/kayak.xml

7 changes: 4 additions & 3 deletions build_dialog → build/build_dialog
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,21 @@ SITE=https://mirrors.omniosce.org/dialog
VER=1.3-20170509
FILE=dialog-$VER.tgz
URL=$SITE/$FILE
PROG=dialog

dir=`/usr/gnu/bin/mktemp -d`

(
cd $dir
wget $URL
gtar -zxf $FILE
cd dialog-$VER
cd $PROG-$VER
./configure
gmake
)

cp $dir/dialog-$VER/dialog .
strip dialog
cp $dir/$PROG-$VER/$PROG ./bin/$PROG
strip bin/$PROG

rm -rf $dir

4 changes: 2 additions & 2 deletions build_ipcalc → build/build_ipcalc
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ dir=`/usr/gnu/bin/mktemp -d`
CFLAGS=-D_KERNEL
)

cp $dir/$PROG-$VER/$PROG .
strip $PROG
cp $dir/$PROG-$VER/$PROG ./bin/$PROG
strip ./bin/$PROG

rm -rf $dir

20 changes: 9 additions & 11 deletions build_iso.sh → build/build_iso
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/bash
#!/usr/bin/ksh

# {{{ CDDL HEADER
# This file and its contents are supplied under the terms of the
Expand All @@ -20,7 +20,7 @@
# Build an ISO installer using the Kayak tools.
#

if [ `id -u` != "0" ]; then
if [ "`id -u`" != "0" ]; then
echo "You must be root to run this script."
exit 1
fi
Expand Down Expand Up @@ -136,19 +136,17 @@ echo $VERSION > $ISO_ROOT/.volsetid
stage "Adding extra files to miniroot"

# Extra files
cp -p \
takeover-console \
ipcalc passutil mount_media nossh.xml \
dialog dialog.rc dialog.sh utils.sh dialog-tzselect \
kbd.list \
$BA_ROOT/kayak/.
for dir in bin; do
[ -d $BA_ROOT/kayak/$dir ] || mkdir -p $BA_ROOT/kayak/$dir
cp -p $dir/* $BA_ROOT/kayak/$dir/
done

if [ -n "$REFRESH_KAYAK" ]; then
# For testing, make sure files in miniroot are current
for f in $BA_ROOT/kayak/*; do
find $BA_ROOT/kayak -type f | while read f; do
[ -f "$f" ] || continue
echo "REFRESH $f"
cp `basename $f` $BA_ROOT/kayak
cp `echo $f | sed 's^.*/kayak/^^'` $f
done
fi

Expand All @@ -159,7 +157,7 @@ EOF

# Have initialboot invoke an interactive installer.
cat <<EOF > $BA_ROOT/.initialboot
/kayak/takeover-console /kayak/kayak-menu.sh
/kayak/bin/takeover-console /kayak/installer/kayak-menu
exit 0
EOF
# Increase the timeout
Expand Down
Loading

0 comments on commit a59bd99

Please sign in to comment.