# vim: set ft=bash:

wait	10
command	Del("/Misc/Bible.TXT.Z");

# The idea is to get a package manager running as early as possible,
# and used for the rest of the content

# Inject SnailNet subset needed to run Pkg
# !!! We mustn't inject tunelled SnailLib as it would re-include /Doc/Comm,
#     resetting all RX fifos to NULL and breaking the MFA connection
command	DirMk("/Adam/Net");
put	/Adam/Net/Http.HC.Z	SnailNet/Http.HC
put	/Adam/Net/Socket.HC.Z	SnailNet/SocketDummy.HC
put	/Adam/Net/Url.HC.Z	SnailNet/Url.HC
put	/Adam/Net/UrlParse.HC.Z	SnailNet/UrlParse.HC

# Inject Pkg
put	/Apps/Pkg.HC.Z	Pkg/Pkg.HC
command	#include "/Apps/Pkg"

# From this point on, we have a package manager -- and we're not scared to use it

# HwSupp
command	DirMk("/Tmp/HwSupp");
put	/Tmp/HwSupp/Pci.HC.Z	HwSupp/Pci.HC
put	/Tmp/HwSupp/PCNet.HC.Z	HwSupp/PCNet.HC
put	/Tmp/HwSupp.MF	HwSupp/manifest
command	PkgMakeFromDir("/Tmp/HwSupp.MF", "/Tmp/HwSupp");
#list	/Tmp/HwSupp.ISO.C	PkgBin/HwSupp.ISO.C
#list	/Tmp/HwSupp.MF	PkgBin/HwSupp.MF

# Lsh
put	/Tmp/Lsh.HC.Z	Lsh/Lsh.HC
put	/Tmp/Lsh.MF	Lsh/Lsh.MF
command	PkgMakeFromFile("/Tmp/Lsh.MF", "/Tmp/Lsh.HC.Z");
#list	/Tmp/Lsh.ISO.C	PkgBin/Lsh.ISO.C
#list	/Tmp/Lsh.MF	PkgBin/Lsh.MF

# Mfa
put	/Tmp/Mfa.HC.Z	Mfa/Mfa.HC
put	/Tmp/Mfa.MF	Mfa/manifest
command	PkgMakeFromFile("/Tmp/Mfa.MF", "/Tmp/Mfa.HC.Z");
#list	/Tmp/Mfa.ISO.C	PkgBin/Mfa.ISO.C
#list	/Tmp/Mfa.MF	PkgBin/Mfa.MF

# Pkg
put	/Tmp/Pkg.HC.Z	Pkg/Pkg.HC
put	/Tmp/Pkg.MF	Pkg/manifest
command	PkgMakeFromFile("/Tmp/Pkg.MF", "/Tmp/Pkg.HC.Z");
#list	/Tmp/Pkg.ISO.C	PkgBin/Pkg.ISO.C
#list	/Tmp/Pkg.MF	PkgBin/Pkg.MF

# Shrine
command	DirMk("/Tmp/Shrine");
command	DirMk("/Tmp/Shrine/Adam");
command	DirMk("/Tmp/Shrine/Demo/Network");
command	DirMk("/Tmp/Shrine/Doc");
command	DirMk("/Tmp/Shrine/Misc");
put	/Tmp/Shrine/Once.HC.Z	Shrine/Patched/Once.HC
put	/Tmp/Shrine/Adam/ADefine.HC.Z	Shrine/Patched/Adam/ADefine.HC
put	/Tmp/Shrine/Adam/MakeAdam.HC.Z	Shrine/Patched/Adam/MakeAdam.HC
put	/Tmp/Shrine/Demo/Network/TcpEchoClient.HC.Z	Demo/Network/TcpEchoClient.HC
put	/Tmp/Shrine/Demo/Network/UdpListen.HC.Z	Demo/Network/UdpListen.HC
put	/Tmp/Shrine/Demo/Network/UdpSend.HC.Z	Demo/Network/UdpSend.HC
put	/Tmp/Shrine/Doc/Start.DD.Z	Shrine/Patched/Doc/Start.DD
put	/Tmp/Shrine/Kernel/KGlbls.HC.Z	Shrine/Patched/Kernel/KGlbls.HC
put	/Tmp/Shrine/Misc/DoDistro.HC.Z	Shrine/Patched/Misc/DoDistro.HC
put	/Tmp/Shrine/Misc/PalConEmu.HC.Z	Shrine/Branding/PalConEmu.HC
put	/Tmp/Shrine/Misc/PalMonokai.HC.Z	Shrine/Branding/PalMonokai.HC
put	/Tmp/Shrine/Misc/PalUbuntu.HC.Z	Shrine/Branding/PalUbuntu.HC
put	/Tmp/Shrine.MF	Shrine/manifest
command	PkgMakeFromDir("/Tmp/Shrine.MF", "/Tmp/Shrine");
#list	/Tmp/Shrine.ISO.C	PkgBin/Shrine.ISO.C
#list	/Tmp/Shrine.MF	PkgBin/Shrine.MF

# SnailNet
command	DirMk("/Tmp/SnailNet");
put	/Tmp/SnailNet/Arp.HC.Z	SnailNet/Arp.HC
put	/Tmp/SnailNet/Dhcp.HC.Z	SnailNet/Dhcp.HC
put	/Tmp/SnailNet/Dns.HC.Z	SnailNet/Dns.HC
put	/Tmp/SnailNet/Ethernet.HC.Z	SnailNet/Ethernet.HC
put	/Tmp/SnailNet/Http.HC.Z	SnailNet/Http.HC
put	/Tmp/SnailNet/Icmp.HC.Z	SnailNet/Icmp.HC
put	/Tmp/SnailNet/IPv4.HC.Z	SnailNet/IPv4.HC
put	/Tmp/SnailNet/MakeSnailNet.HC.Z	SnailNet/MakeSnailNet.HC
put	/Tmp/SnailNet/NativeSocket.HC.Z	SnailNet/NativeSocket.HC
put	/Tmp/SnailNet/Netcfg.HC.Z	SnailNet/Netcfg.HC
put	/Tmp/SnailNet/NetFifo.HC.Z	SnailNet/NetFifo.HC
put	/Tmp/SnailNet/NetHandlerTask.HC.Z	SnailNet/NetHandlerTask.HC
put	/Tmp/SnailNet/SnailLib.HC.Z	SnailNet/SnailLib.HC
put	/Tmp/SnailNet/Socket.HC.Z	SnailNet/Socket.HC
put	/Tmp/SnailNet/Tcp.HC.Z	SnailNet/Tcp.HC
put	/Tmp/SnailNet/Udp.HC.Z	SnailNet/Udp.HC
put	/Tmp/SnailNet/Url.HC.Z	SnailNet/Url.HC
put	/Tmp/SnailNet/UrlParse.HC.Z	SnailNet/UrlParse.HC
put	/Tmp/SnailNet.MF	SnailNet/manifest
command	PkgMakeFromDir("/Tmp/SnailNet.MF", "/Tmp/SnailNet");
#list	/Tmp/SnailNet.ISO.C	PkgBin/SnailNet.ISO.C
#list	/Tmp/SnailNet.MF	PkgBin/SnailNet.MF

# Wget
put	/Tmp/Wget.HC.Z	Wget/Wget.HC
put	/Tmp/Wget.MF	Wget/manifest
command	PkgMakeFromFile("/Tmp/Wget.MF", "/Tmp/Wget.HC.Z");
#list	/Tmp/Wget.ISO.C	PkgBin/Wget.ISO.C
#list	/Tmp/Wget.MF	PkgBin/Wget.MF

# Install packages
command	PkgInstallFromFile("/Tmp/HwSupp.MF");
command	PkgInstallFromFile("/Tmp/Lsh.MF");
command	PkgInstallFromFile("/Tmp/Mfa.MF");
command	PkgInstallFromFile("/Tmp/Pkg.MF");
command	PkgInstallFromFile("/Tmp/Shrine.MF");
command	PkgInstallFromFile("/Tmp/SnailNet.MF");
command	PkgInstallFromFile("/Tmp/Wget.MF");

# Clean up & build a distro
command	DelTree("/Tmp");
command	DirMk("/Tmp");

command	#include "/Misc/DoDistro";
list	/Tmp/ShrineDist.ISO.C	Shrine-HEAD.iso

command	Reboot;
wait	1
