Skip to content

Commit f778674

Browse files
committed
'modprobe loop' (for loopback mounts) automatically. multiple files in config search path, 'findiso' style installs. Added ZorinOS, Manjaro, Deepin, Slackware
1 parent bc66c41 commit f778674

3 files changed

Lines changed: 84 additions & 30 deletions

File tree

README.md

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -77,27 +77,31 @@ distroflash.lua has been seen to work with the following distributions. If anyon
7777
## Perfect, runs live and installs from live environment
7878

7979
* AntiX Linux 19
80-
* MX Linux 19.1
80+
* ArchLinux 2020.03.01
8181
* Bodhi Linux 5.0.0
82-
* Trisquel-mini 8.0
82+
* Deepin Community Desktop 1002
83+
* MX Linux 19.1
8384
* Linux Mint 19.3
8485
* Ubuntu Desktop 18.04.4
8586
* LUbuntu Desktop 19.10
87+
* Manjaro 20.1.2
8688
* KUbuntu Desktop 19.10
8789
* KNOPPIX 8.6.1
8890
* Peppermint 10
8991
* Porteus 3.2.2
90-
* ArchLinux 2020.03.01
91-
* PCLinuxOS 2020.02
92+
* PCLinuxOS 2020.02
93+
* Slackware 14.2
94+
* Trisquel-mini 8.0
95+
* ZorinOS 15.3
9296

9397
## Finiky, can be made to install
9498

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

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

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

distroflash.conf

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,20 @@
66
# Distros that work as installers (this is the main focus of distroflash.lua)
77
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"
88
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)"
9+
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"
910
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"
1011
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"
12+
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"
1113
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"
1214
name="PCLinuxOS" id="EFI/BOOT/themes/pclinuxos" kernel="isolinux/vmlinuz" initrd="isolinux/initrd.gz" append="livecd=$(distdir)/livecd nomodeset xdriver=vesa"
1315
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 --"
1416
name="Porteus" id="porteus" kernel="boot/syslinux/vmlinuz" initrd="boot/syslinux/initrd*" append="from=$(distdir)"
17+
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)"
1518
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 --"
1619
name="Knoppix" id="KNOPPIX,boot/isolinux/minirt.gz" kernel="boot/isolinux/linux" initrd="boot/isolinux/minirt.gz" append="knoppix_dir=$(distdir)/KNOPPIX"
1720
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"
21+
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"
22+
1823

1924
# Distros that have been seen to install, but have issues on some hardware or are difficult to install
2025
name="Salix" id="salix" kernel="/kernels/huge.s/bzImage" initrd="/isolinux/initrd.img" append=""
@@ -34,12 +39,17 @@ name="SystemRescueCD" id="sysresccd" kernel="sysresccd/boot/i686/vmlinuz" initrd
3439
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"
3540

3641

42+
#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,
43+
#read the FAQ etc
44+
#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"
45+
3746
#NOT WORKING - These distros do not yet work at all
38-
#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"
47+
#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"
48+
#name="Debian9" install_type=iso id="doc/debian-manifesto" append="findiso=$(distdir)/$(isoname) components quiet splash"
3949
#name="Debian", id="d-i" kernel="d-i/gtk/vmlinuz" initrd="d-i/gtk/initrd.gz" append="video=vesa:ywrap,mtrr vga=788"
4050
#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"
4151
#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"
4252
#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"
4353
#name="4mLinux" id="" kernel="boot/bzImage" initrd="boot/initrd.gz" append="root=/dev/ram0 vga=normal"
44-
54+
#name="Void" install_type=iso id="boot/grub/grub_void.cfg" kernel=boot/vmlinuz initrd=boot/initrd append="iso-scan/filename=$(distdir)/$(isoname)"
4555

distroflash.lua

Lines changed: 60 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -70,16 +70,22 @@ function LoadDistroParseLine(line)
7070
local toks, str
7171
local iso_details={}
7272

73+
iso_details.install_type=""
7374
toks=strutil.TOKENIZER(line, "\\S", "Q")
7475
str=toks:next()
7576
while str ~= nil
7677
do
7778
if string.sub(str, 1, 5)=="name=" then iso_details.name=strutil.stripQuotes(string.sub(str, 6)) end
79+
if string.sub(str, 1, 13)=="install_type=" then iso_details.install_type=strutil.stripQuotes(string.sub(str, 14)) end
7880
if string.sub(str, 1, 3)=="id=" then iso_details.pattern=strutil.stripQuotes(string.sub(str, 4)) end
7981
if string.sub(str, 1, 7)=="kernel=" then iso_details.kernel=strutil.stripQuotes(string.sub(str, 8)) end
8082
if string.sub(str, 1, 7)=="initrd=" then iso_details.initrd=strutil.stripQuotes(string.sub(str, 8)) end
8183
if string.sub(str, 1, 7)=="append=" then iso_details.append=strutil.stripQuotes(string.sub(str, 8)) end
82-
if string.sub(str, 1, 12)=="append-live=" then iso_details.append_live=strutil.stripQuotes(string.sub(str, 13)) end
84+
if string.sub(str, 1, 12)=="append-live="
85+
then
86+
iso_details.install_type="live"
87+
iso_details.append_live=strutil.stripQuotes(string.sub(str, 13))
88+
end
8389
str=toks:next()
8490
end
8591

@@ -89,23 +95,34 @@ end
8995

9096
function LoadDistroList()
9197
local S, str, iso_details
98+
local toks
9299

93-
S=stream.STREAM(Settings.distro_file, "r")
100+
toks=strutil.TOKENIZER(Settings.distro_file, ":")
101+
path=toks:next()
102+
103+
while path ~= nil
104+
do
105+
106+
S=stream.STREAM(path, "r")
94107
if S ~= nil
95108
then
96109
str=S:readln()
97110
while str~= nil
98111
do
99-
str=strutil.trim(str)
100-
if strutil.strlen(str) > 0 and string.sub(str, 1, 1) ~= '#'
101-
then
102-
iso_details=LoadDistroParseLine(str)
103-
table.insert(Settings.iso_list, iso_details)
104-
end
105-
str=S:readln()
112+
str=strutil.trim(str)
113+
if strutil.strlen(str) > 0 and string.sub(str, 1, 1) ~= '#'
114+
then
115+
iso_details=LoadDistroParseLine(str)
116+
table.insert(Settings.iso_list, iso_details)
117+
end
118+
str=S:readln()
106119
end
107120

108121
S:close()
122+
break
123+
end
124+
125+
path=toks:next()
109126
end
110127

111128
end
@@ -136,6 +153,7 @@ do
136153
if ISOFindIDFiles(distro, details.pattern) == true
137154
then
138155
distro.name=details.name
156+
distro.install_type=details.install_type
139157
if strutil.strlen(details.kernel) > 0 then distro.kernel=ISOFindItem(details.kernel, distro.mnt) end
140158
if strutil.strlen(details.initrd) > 0 then distro.initrd=ISOFindItem(details.initrd, distro.mnt) end
141159
distro.append=details.append
@@ -368,23 +386,25 @@ local from, to
368386
end
369387

370388

371-
function InstallAddSyslinuxEntry(S, name, distro, install_type)
389+
function InstallAddSyslinuxEntry(S, name, distro)
372390

373-
if install_type=="live" then name=name.."-LIVE" end
391+
if distro.install_type=="live" then name=name.."-LIVE" end
374392

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

380-
if install_type=="live"
398+
if distro.install_type=="live"
381399
then
382400
str=string.gsub(distro.append_live, "%$%(distdir%)", name)
383401
str=string.gsub(str, "%$%(uuid%)", Settings.DestUUID)
384402
S:writeln("APPEND "..str.."\n")
385403
elseif strutil.strlen(distro.append) > 0
386404
then
387405
str=string.gsub(distro.append, "%$%(distdir%)", name)
406+
407+
if distro.install_type=="iso" then str=string.gsub(str, "%$%(isoname%)", name..".iso") end
388408
str=string.gsub(str, "%$%(uuid%)", Settings.DestUUID)
389409
S:writeln("APPEND "..str.."\n")
390410
end
@@ -394,14 +414,25 @@ end
394414

395415

396416
function InstallISO(S, iso_path, distro)
397-
local name, bootdir
417+
local name, dest
398418

399419
name=string.gsub(filesys.basename(iso_path), ".iso$", "")
400-
bootdir=Settings.MountPoint.."/"..name.."/"
401-
filesys.mkdir(bootdir)
402420

403-
-- print("COPYDIR: "..distro.mnt, bootdir)
404-
filesys.copydir(distro.mnt, bootdir)
421+
dest=Settings.MountPoint.."/"..name.."/"
422+
filesys.mkdir(dest)
423+
424+
if distro.install_type=="iso"
425+
then
426+
filesys.mkdirPath(dest..distro.kernel)
427+
filesys.copy(distro.mnt..distro.kernel, dest..distro.kernel)
428+
429+
filesys.mkdirPath(dest..distro.initrd)
430+
filesys.copy(distro.mnt..distro.initrd, dest..distro.initrd)
431+
432+
filesys.copy(iso_path, dest..name..".iso")
433+
else
434+
filesys.copydir(distro.mnt, dest)
435+
end
405436

406437
InstallAddSyslinuxEntry(S, name, distro, "")
407438
if strutil.strlen(distro.append_live) > 0 then InstallAddSyslinuxEntry(S, name, distro, "live") end
@@ -492,15 +523,17 @@ end
492523
function InitConfig()
493524
local str
494525

495-
Settings.Version="2.0"
526+
Settings.Version="3.0"
496527
Settings.MountPoint="/mnt"
497528
str=string.gsub(process.getenv("PATH"), "/bin", "/share")
498529
Settings.SyslinuxDir=filesys.find("syslinux", str)
499530
Settings.SyslinuxMBR="mbr.bin"
500531
Settings.SyslinuxModules="ldlinux.c32,memdisk,libutil.c32,menu.c32"
501532
Settings.InstallItems=""
502533
Settings.Force=false
503-
Settings.distro_file="/etc/distroflash.conf"
534+
Settings.distro_file=process.getenv("HOME").."/.config/distroflash.conf"
535+
Settings.distro_file=Settings.distro_file .. ":"..process.getenv("HOME").."/.distroflash.conf"
536+
Settings.distro_file=Settings.distro_file .. ":" .. "/etc/distroflash.conf"
504537
end
505538

506539

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

706+
if FindRequiredPrograms("modprobe") == true
707+
then
708+
os.execute(Settings.programs["modprobe"] .. " loop")
709+
else
710+
Out:puts("~yWARNING:~0 Can't find the 'modprobe' program. Make sure the module for loopback filesystems ('modprobe loop') is loaded.\n")
711+
end
712+
673713
if FindRequiredPrograms("blkid") ~= true
674714
then
675715
Out:puts("~yWARNING:~0 Can't find the 'blkid' program. Some distros (TinyCore,Arch,Calculate,CentOS,NST,SystemRescueCD) may not work.\n")

0 commit comments

Comments
 (0)