Skip to content

Commit

Permalink
'modprobe loop' (for loopback mounts) automatically. multiple files i…
Browse files Browse the repository at this point in the history
…n config search path, 'findiso' style installs. Added ZorinOS, Manjaro, Deepin, Slackware
  • Loading branch information
ColumPaget committed Nov 22, 2020
1 parent bc66c41 commit f778674
Show file tree
Hide file tree
Showing 3 changed files with 84 additions and 30 deletions.
20 changes: 12 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,27 +77,31 @@ distroflash.lua has been seen to work with the following distributions. If anyon
## Perfect, runs live and installs from live environment

* AntiX Linux 19
* MX Linux 19.1
* ArchLinux 2020.03.01
* Bodhi Linux 5.0.0
* Trisquel-mini 8.0
* Deepin Community Desktop 1002
* MX Linux 19.1
* Linux Mint 19.3
* Ubuntu Desktop 18.04.4
* LUbuntu Desktop 19.10
* Manjaro 20.1.2
* KUbuntu Desktop 19.10
* KNOPPIX 8.6.1
* Peppermint 10
* Porteus 3.2.2
* ArchLinux 2020.03.01
* PCLinuxOS 2020.02
* PCLinuxOS 2020.02
* Slackware 14.2
* Trisquel-mini 8.0
* ZorinOS 15.3

## Finiky, can be made to install

* TinyCorePlus - has to be told path to core.gz to install (see 'Finiky installs' below)
* TinyCorePlus - has to be told path to core.gz to install (see 'Finiky installs' below)
* Puppy Linux slacko 6.3.2 - complex install process (see 'Finiky installs' below)
* Puppy Linux tahr 6.0.5 - complex install process (see 'Finiky installs' below)
* Salix 14.2 - has to be told to install from harddrive, and given both the device name and path to files on disk
* Calculate Linux - has been seen to install to a vm. Installer has issues with some graphics cards.
* CentOS Linux 8.1 - has been seen to install to a vm. Installer crashes on some hardware.
* Calculate Linux - has been seen to install to a vm. Installer has issues with some graphics cards.
* CentOS Linux 8.1 - has been seen to install to a vm. Installer crashes on some hardware.

## Runs live. Might also install from usb to hard-drive if you really know how and the wind is in the right direction

Expand All @@ -111,7 +115,7 @@ distroflash.lua has been seen to work with the following distributions. If anyon
* Clonezilla
* SystemRescueCD
* Fatdog Linux 721
* Nst Linux 30-11210 - runs live, but installer refuses to install from mounted usb key
* Nst Linux 30-11210 - runs live, but installer refuses to install from mounted usb key
* Puppy Linux xenialpup 7.5 - installs, but installed system doesn't seem to boot
* Slitaz-rolling - installer can't find installation files

Expand Down
14 changes: 12 additions & 2 deletions distroflash.conf
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,20 @@
# Distros that work as installers (this is the main focus of distroflash.lua)
name="AntiX" id="antiX/vmlinuz" kernel="antiX/vmlinuz" initrd="antiX/initrd.gz" append="bdir=$(distdir)/antiX rootdelay=5 from=usb,cd,hd splasht disable=lxF xorg=safe"
name="Arch" id="arch" kernel="arch/boot/x86_64/vmlinuz" initrd="arch/boot/x86_64/archiso.img" append="archisobasedir=/$(distdir)/arch archisodevice=/dev/disk/by-uuid/$(uuid)"
name="Deepin" install_type=iso id="deepin-boot-maker.exe" kernel="/live/vmlinuz" initrd="/live/initrd.lz" append="root=UUID=$(uuid) fromiso=$(distdir)/$(isoname) boot=live components quiet splash union=overlay livecd-installer"
name="Gentoo" id="isolinux/gentoo" kernel="isolinux/gentoo" initrd="isolinux/gentoo.xz" append="init=/linuxrc looptype=squashfs loop=/$(distdir)/image.squashfs cdroot subdir=$(distdir) console=tty1"
name="lUbuntu" id="preseed/lubuntu.seed" kernel="casper/vmlinuz" initrd="" append="file=$(distdir)/preseed/lubuntu.seed boot=casper ignore_uuid only-ubiquity initrd=$(distdir)/casper/initrd live-media-path=$(distdir)/casper"
name="Manjaro" install_type=iso id="manjaro" kernel="boot/vmlinuz-x86_64" initrd="boot/initramfs-x86_64.img" append="img_dev=UUID:$(uuid) img_loop=$(distdir)/$(isoname) earlymodules=loop misobasedir=manjaro"
name="Mint" id="preseed/linuxmint.seed" kernel="casper/vmlinuz" initrd="casper.initrd.lz" append="file=$(distdir)/preseed/linuxmint.seed boot=casper xforcevesa ignore_uuid live-media-path=$(distdir)/casper"
name="PCLinuxOS" id="EFI/BOOT/themes/pclinuxos" kernel="isolinux/vmlinuz" initrd="isolinux/initrd.gz" append="livecd=$(distdir)/livecd nomodeset xdriver=vesa"
name="Peppermint" id="preseed/peppermint.seed" kernel="casper/vmlinuz" initrd="casper/initrd*" append="noprompt cdrom-detect/try-usb=true file=/$(distdir)/preseed/peppermint.seed boot=casper ignore_uuid live-media-path=$(distdir)/casper quiet splash --"
name="Porteus" id="porteus" kernel="boot/syslinux/vmlinuz" initrd="boot/syslinux/initrd*" append="from=$(distdir)"
name="Slackware" install_type=iso id="slackware" kernel="kernels/huge.s/bzImage" initrd="isolinux/initrd.img" append="livemedia=/dev/disk/by-uuid/UUID:$(uuid):/$(distdir)/$(isoname)"
name="Trisquel" id="preseed/trisquel.seed" kernel="casper/vmlinuz" initrd="casper/initrd" append="file=$(distdir)/preseed/linuxmint.seed ignore_uuid boot=casper live-media-path=$(distdir)/casper --"
name="Knoppix" id="KNOPPIX,boot/isolinux/minirt.gz" kernel="boot/isolinux/linux" initrd="boot/isolinux/minirt.gz" append="knoppix_dir=$(distdir)/KNOPPIX"
name="Ubuntu" id="casper/vmlinuz" kernel="casper/vmlinuz" initrd="casper/initrd" append="file=$(distdir)/preseed/custom.seed boot=casper ignore_uuid live-media-path=$(distdir)/casper"
name="openSUSE" install_type=iso id="SUSEgo.png" kernel="boot/i386/loader/linux" initrd="boot/i386/loader/initrd" append="isofrom_device=UUID:$(uuid) isofrom_system=(distdir)/$(isoname) ramdisk_size=512000 ramdisk_blocksize=4096 splash=silent quiet showopts"


# Distros that have been seen to install, but have issues on some hardware or are difficult to install
name="Salix" id="salix" kernel="/kernels/huge.s/bzImage" initrd="/isolinux/initrd.img" append=""
Expand All @@ -34,12 +39,17 @@ name="SystemRescueCD" id="sysresccd" kernel="sysresccd/boot/i686/vmlinuz" initrd
name="NST" id="README.nst" kernel="isolinux/vmlinuz0" initrd="isolinux/initrd0.img" append="append root=live:UUID=$(uuid) rootfstype=auto ro liveimg quiet rhgb rd.luks=0 rd.md=0 rd.dm=0 xdriver=vesa nomodeset live_dir=$(distdir)/LiveOS rd.live.image"


#Pentoo runs, but asks for a password to login. I've been unable to figure out what username/password to use, and yes I've googled,
#read the FAQ etc
#name="Pentoo" id="boot/pentoo" kernel="boot/pentoo" initrd="/boot/pentoo.igz" append="init=/linuxrc looptype=squashfs loop=/$(distdir)/image.squashfs cdroot subdir=$(distdir) console=tty1"

#NOT WORKING - These distros do not yet work at all
#name="BunsenLabsHelium" id="bunsen_version" kernel="/live/vmlinuz" initrd="/live/initrd.gz" append="boot=live components memtest noapic noapm nodma nomce nolapic nomodeset nosmp nosplash vga=normal"
#name="BunsenLabsHelium" install_type=iso id="bunsen_version" kernel="/live/vmlinuz" initrd="/live/initrd.gz" append="findiso=$(distdir)/$(isoname) components memtest noapic noapm nodma nomce nolapic nomodeset nosmp nosplash vga=normal"
#name="Debian9" install_type=iso id="doc/debian-manifesto" append="findiso=$(distdir)/$(isoname) components quiet splash"
#name="Debian", id="d-i" kernel="d-i/gtk/vmlinuz" initrd="d-i/gtk/initrd.gz" append="video=vesa:ywrap,mtrr vga=788"
#name="Qubes" id="isolinux/xen.gz" kernel=isolinux/mboot.c32 initrd="" append="xen.gz --- vmlinuz inst.stage2=hd:UUID=$(uuid):/$(distdir) xdriver=vesa nomodeset --- initrd.img"
#name="RedhatFedora" id="EFI/fedora" kernel="images/vmlinuz" initrd="images/initramfs.img" append="inst.stage2=hd:UUID=$(uuid):$(distdir) root=UUID=$(uuid) rootfstype=vfat rd.live.dir=$(distdir) rd.live.image xdriver=vesa nomodeset"
#name=OpenMandriva id="boot/liveinitrd.img" kernel="boot/vmlinuz0" initrd="boot/liveinitrd.img" append="root=live:UUID=$(uuid) rootfstype=auto ro liveimg rhgb xdriver=vesa nobodeset rd.live.dir=$(distdir)/LiveOS rd.live.image"
#name="4mLinux" id="" kernel="boot/bzImage" initrd="boot/initrd.gz" append="root=/dev/ram0 vga=normal"

#name="Void" install_type=iso id="boot/grub/grub_void.cfg" kernel=boot/vmlinuz initrd=boot/initrd append="iso-scan/filename=$(distdir)/$(isoname)"

80 changes: 60 additions & 20 deletions distroflash.lua
Original file line number Diff line number Diff line change
Expand Up @@ -70,16 +70,22 @@ function LoadDistroParseLine(line)
local toks, str
local iso_details={}

iso_details.install_type=""
toks=strutil.TOKENIZER(line, "\\S", "Q")
str=toks:next()
while str ~= nil
do
if string.sub(str, 1, 5)=="name=" then iso_details.name=strutil.stripQuotes(string.sub(str, 6)) end
if string.sub(str, 1, 13)=="install_type=" then iso_details.install_type=strutil.stripQuotes(string.sub(str, 14)) end
if string.sub(str, 1, 3)=="id=" then iso_details.pattern=strutil.stripQuotes(string.sub(str, 4)) end
if string.sub(str, 1, 7)=="kernel=" then iso_details.kernel=strutil.stripQuotes(string.sub(str, 8)) end
if string.sub(str, 1, 7)=="initrd=" then iso_details.initrd=strutil.stripQuotes(string.sub(str, 8)) end
if string.sub(str, 1, 7)=="append=" then iso_details.append=strutil.stripQuotes(string.sub(str, 8)) end
if string.sub(str, 1, 12)=="append-live=" then iso_details.append_live=strutil.stripQuotes(string.sub(str, 13)) end
if string.sub(str, 1, 12)=="append-live="
then
iso_details.install_type="live"
iso_details.append_live=strutil.stripQuotes(string.sub(str, 13))
end
str=toks:next()
end

Expand All @@ -89,23 +95,34 @@ end

function LoadDistroList()
local S, str, iso_details
local toks

S=stream.STREAM(Settings.distro_file, "r")
toks=strutil.TOKENIZER(Settings.distro_file, ":")
path=toks:next()

while path ~= nil
do

S=stream.STREAM(path, "r")
if S ~= nil
then
str=S:readln()
while str~= nil
do
str=strutil.trim(str)
if strutil.strlen(str) > 0 and string.sub(str, 1, 1) ~= '#'
then
iso_details=LoadDistroParseLine(str)
table.insert(Settings.iso_list, iso_details)
end
str=S:readln()
str=strutil.trim(str)
if strutil.strlen(str) > 0 and string.sub(str, 1, 1) ~= '#'
then
iso_details=LoadDistroParseLine(str)
table.insert(Settings.iso_list, iso_details)
end
str=S:readln()
end

S:close()
break
end

path=toks:next()
end

end
Expand Down Expand Up @@ -136,6 +153,7 @@ do
if ISOFindIDFiles(distro, details.pattern) == true
then
distro.name=details.name
distro.install_type=details.install_type
if strutil.strlen(details.kernel) > 0 then distro.kernel=ISOFindItem(details.kernel, distro.mnt) end
if strutil.strlen(details.initrd) > 0 then distro.initrd=ISOFindItem(details.initrd, distro.mnt) end
distro.append=details.append
Expand Down Expand Up @@ -368,23 +386,25 @@ local from, to
end


function InstallAddSyslinuxEntry(S, name, distro, install_type)
function InstallAddSyslinuxEntry(S, name, distro)

if install_type=="live" then name=name.."-LIVE" end
if distro.install_type=="live" then name=name.."-LIVE" end

S:writeln("LABEL "..name.."\n")
S:writeln("MENU LABEL "..name.."\n")
if strutil.strlen(distro.kernel) > 0 then S:writeln("KERNEL ".."/"..name..distro.kernel.."\n") end
if strutil.strlen(distro.initrd) > 0 then S:writeln("INITRD ".."/"..name..distro.initrd.."\n") end

if install_type=="live"
if distro.install_type=="live"
then
str=string.gsub(distro.append_live, "%$%(distdir%)", name)
str=string.gsub(str, "%$%(uuid%)", Settings.DestUUID)
S:writeln("APPEND "..str.."\n")
elseif strutil.strlen(distro.append) > 0
then
str=string.gsub(distro.append, "%$%(distdir%)", name)

if distro.install_type=="iso" then str=string.gsub(str, "%$%(isoname%)", name..".iso") end
str=string.gsub(str, "%$%(uuid%)", Settings.DestUUID)
S:writeln("APPEND "..str.."\n")
end
Expand All @@ -394,14 +414,25 @@ end


function InstallISO(S, iso_path, distro)
local name, bootdir
local name, dest

name=string.gsub(filesys.basename(iso_path), ".iso$", "")
bootdir=Settings.MountPoint.."/"..name.."/"
filesys.mkdir(bootdir)

-- print("COPYDIR: "..distro.mnt, bootdir)
filesys.copydir(distro.mnt, bootdir)
dest=Settings.MountPoint.."/"..name.."/"
filesys.mkdir(dest)

if distro.install_type=="iso"
then
filesys.mkdirPath(dest..distro.kernel)
filesys.copy(distro.mnt..distro.kernel, dest..distro.kernel)

filesys.mkdirPath(dest..distro.initrd)
filesys.copy(distro.mnt..distro.initrd, dest..distro.initrd)

filesys.copy(iso_path, dest..name..".iso")
else
filesys.copydir(distro.mnt, dest)
end

InstallAddSyslinuxEntry(S, name, distro, "")
if strutil.strlen(distro.append_live) > 0 then InstallAddSyslinuxEntry(S, name, distro, "live") end
Expand Down Expand Up @@ -492,15 +523,17 @@ end
function InitConfig()
local str

Settings.Version="2.0"
Settings.Version="3.0"
Settings.MountPoint="/mnt"
str=string.gsub(process.getenv("PATH"), "/bin", "/share")
Settings.SyslinuxDir=filesys.find("syslinux", str)
Settings.SyslinuxMBR="mbr.bin"
Settings.SyslinuxModules="ldlinux.c32,memdisk,libutil.c32,menu.c32"
Settings.InstallItems=""
Settings.Force=false
Settings.distro_file="/etc/distroflash.conf"
Settings.distro_file=process.getenv("HOME").."/.config/distroflash.conf"
Settings.distro_file=Settings.distro_file .. ":"..process.getenv("HOME").."/.distroflash.conf"
Settings.distro_file=Settings.distro_file .. ":" .. "/etc/distroflash.conf"
end


Expand Down Expand Up @@ -533,7 +566,7 @@ print("")
print("-d <device> destination device to install to. Can be either a partition (e.g. /dev/sda1), or a drive (e.g. /dev/sda)")
print("-dev <device> destination device to install to. Can be either a partition, or a drive")
print("-device <device> destination device to install to. Can be either a partition, or a drive")
print("-c <path> path to distroflash.conf config file, overriding default of /etc/distroflash.conf")
print("-c <path> path to distroflash.conf config file, overriding default search path. Multiple paths can be supplied, seperated by ':'. The default is '~/.config/distroflash.conf:~/.distroflash.conf:/etc/distroflash.conf'")
print("-force if distroflash objects that a device is not removable (not all devices set this flag) this option forces using the device")
print("-format by default distroflash.lua will not format a partition (it will if you give it a drive). This option forces format.")
print("-syslinuxdir path to syslinux dir containing mbr.bin, ldlinux.c32, etc. distroflash.lua should find this itself.")
Expand Down Expand Up @@ -670,6 +703,13 @@ then
Out:puts("~rERROR:~0 some required programs are missing. Please install them or add the directories they are installed in to your $PATH.\n")
else

if FindRequiredPrograms("modprobe") == true
then
os.execute(Settings.programs["modprobe"] .. " loop")
else
Out:puts("~yWARNING:~0 Can't find the 'modprobe' program. Make sure the module for loopback filesystems ('modprobe loop') is loaded.\n")
end

if FindRequiredPrograms("blkid") ~= true
then
Out:puts("~yWARNING:~0 Can't find the 'blkid' program. Some distros (TinyCore,Arch,Calculate,CentOS,NST,SystemRescueCD) may not work.\n")
Expand Down

0 comments on commit f778674

Please sign in to comment.