Initial commit
This commit is contained in:
101
slax/boot/bootinst.bat
Normal file
101
slax/boot/bootinst.bat
Normal file
@@ -0,0 +1,101 @@
|
||||
#!/bin/sh
|
||||
exec /bin/bash "$(dirname "$0")"/bootinst.sh
|
||||
exec /bin/sh "$(dirname "$0")"/bootinst.sh
|
||||
|
||||
@echo off
|
||||
COLOR 2F
|
||||
cls
|
||||
echo ===============================================================================
|
||||
echo.
|
||||
echo ________.__
|
||||
echo / ____/^| ^| _____ ___ ___
|
||||
echo \____ \ ^| ^| \__ \ \ \/ /
|
||||
echo / \^| ^|__/ __ \_^> ^<
|
||||
echo /______ /^|____(____ /__/\_ \
|
||||
echo \/ \/ \/
|
||||
echo.
|
||||
echo ===============================================================================
|
||||
echo.
|
||||
|
||||
set DISK=none
|
||||
set BOOTFLAG=boot666s.tmp
|
||||
|
||||
:checkPrivileges
|
||||
mkdir "%windir%\AdminCheck" 2>nul
|
||||
if '%errorlevel%' == '0' rmdir "%windir%\AdminCheck" & goto gotPrivileges else goto getPrivileges
|
||||
|
||||
:getPrivileges
|
||||
ECHO.
|
||||
ECHO Administrator Rights are required
|
||||
ECHO Invoking UAC for Privilege Escalation
|
||||
ECHO.
|
||||
runadmin.vbs %0
|
||||
goto end
|
||||
|
||||
:gotPrivileges
|
||||
CD /D "%~dp0"
|
||||
|
||||
echo This file is used to determine current drive letter. It should be deleted. >\%BOOTFLAG%
|
||||
if not exist \%BOOTFLAG% goto readOnly
|
||||
|
||||
echo.|set /p=wait please
|
||||
for %%d in ( C D E F G H I J K L M N O P Q R S T U V W X Y Z ) do echo.|set /p=. & if exist %%d:\%BOOTFLAG% set DISK=%%d
|
||||
echo . . . . . . . . . .
|
||||
del \%BOOTFLAG%
|
||||
if %DISK% == none goto DiskNotFound
|
||||
|
||||
wscript.exe samedisk.vbs %windir% %DISK%
|
||||
if %ERRORLEVEL% == 99 goto refuseDisk
|
||||
|
||||
echo Setting up boot record for %DISK%: ...
|
||||
|
||||
if %OS% == Windows_NT goto setupNT
|
||||
goto setup95
|
||||
|
||||
:setupNT
|
||||
\slax\boot\syslinux.exe -maf -d /slax/boot/ %DISK%:
|
||||
if %ERRORLEVEL% == 0 goto setupDone
|
||||
goto errorFound
|
||||
|
||||
:setup95
|
||||
\slax\boot\syslinux.com -maf -d /slax/boot/ %DISK%:
|
||||
if %ERRORLEVEL% == 0 goto setupDone
|
||||
goto errorFound
|
||||
|
||||
:setupDone
|
||||
echo Installation finished.
|
||||
goto pauseit
|
||||
|
||||
:errorFound
|
||||
color 4F
|
||||
echo.
|
||||
echo Error installing boot loader
|
||||
goto pauseit
|
||||
|
||||
:refuseDisk
|
||||
color 4F
|
||||
echo.
|
||||
echo Directory %DISK%:\slax\boot\ seems to be on the same physical disk as your Windows.
|
||||
echo Installing bootloader would harm your Windows and thus is disabled.
|
||||
echo Please use different drive and try again.
|
||||
goto pauseit
|
||||
|
||||
:readOnly
|
||||
color 4F
|
||||
echo.
|
||||
echo You're starting this installer from a read-only media, this will not work.
|
||||
goto pauseit
|
||||
|
||||
:DiskNotFound
|
||||
color 4F
|
||||
echo.
|
||||
echo Error: can't discover current drive letter
|
||||
|
||||
:pauseit
|
||||
if "%1" == "auto" goto end
|
||||
|
||||
echo.
|
||||
echo Press any key...
|
||||
pause > nul
|
||||
|
||||
:end
|
||||
154
slax/boot/bootinst.sh
Normal file
154
slax/boot/bootinst.sh
Normal file
@@ -0,0 +1,154 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# This script will setup booting from disk (USB or harddrive)
|
||||
#
|
||||
# If you see this file in a text editor instead of getting it executed,
|
||||
# then it is missing executable permissions (chmod). You can try to set
|
||||
# exec permissions for this file by using: chmod a+x bootinst.sh
|
||||
# Alternatively, you may try to run bootinst.bat file instead
|
||||
#
|
||||
# Scrolling down will reveal the actual code of this script.
|
||||
#
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# if we're running this from X, re-run the script in konsole or xterm
|
||||
if [ "$DISPLAY" != "" ]; then
|
||||
if [ "$1" != "--rex" -a "$2" != "--rex" ]; then
|
||||
konsole --nofork -e /bin/sh $0 --rex 2>/dev/null || xterm -e /bin/sh $0 --rex 2>/dev/null || /bin/sh $0 --rex 2>/dev/null
|
||||
exit
|
||||
fi
|
||||
fi
|
||||
|
||||
# make sure I am root
|
||||
if [ "$UID" != "0" -a "$UID" != "" ]; then
|
||||
echo ""
|
||||
echo "You are not root. You must run bootinst script as root."
|
||||
echo "The bootinst script needs direct access to your boot device."
|
||||
echo "Use sudo or kdesudo or similar wrapper to execute this."
|
||||
read junk
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# change working directory to dir from which we are started
|
||||
CWD="$(pwd)"
|
||||
BOOT="$(dirname "$0")"
|
||||
BOOT="$(realpath "$BOOT" 2>/dev/null || echo $BOOT)"
|
||||
cd "$BOOT"
|
||||
|
||||
# find out device and mountpoint
|
||||
PART="$(df . | tail -n 1 | tr -s " " | cut -d " " -f 1)"
|
||||
DEV="$(echo "$PART" | sed -r "s:[0-9]+\$::" | sed -r "s:([0-9])[a-z]+\$:\\1:i")" #"
|
||||
|
||||
# check if disk is already bootable. Mostly for Windows discovery
|
||||
if [ "$(fdisk -l "$DEV" | fgrep "$DEV" | fgrep "*")" != "" ]; then
|
||||
echo ""
|
||||
echo "Partition $PART seems to be located on a physical disk,"
|
||||
echo "which is already bootable. If you continue, your drive $DEV"
|
||||
echo "will boot only Slax by default."
|
||||
echo "Press [Enter] to continue, or [Ctrl+C] to abort..."
|
||||
read junk
|
||||
fi
|
||||
|
||||
ARCH=$(uname -m)
|
||||
if [ "$ARCH" = "x86_64" ]; then ARCH=64; else ARCH=32; fi
|
||||
EXTLINUX=extlinux.x$ARCH
|
||||
|
||||
if [ ! -x ./$EXTLINUX ]; then
|
||||
# extlinux is not executable. There are two possible reasons:
|
||||
# either the fs is mounted with noexec, or file perms are wrong.
|
||||
# Try to fix both, no fail on error yet
|
||||
mount -o remount,exec $DEV
|
||||
chmod a+x ./$EXTLINUX
|
||||
fi
|
||||
|
||||
if [ ! -x ./$EXTLINUX ]; then
|
||||
# extlinux is still not executable. As a last try, copy it to .exe
|
||||
# because the partition may be mounted with showexec option, from which
|
||||
# we probably can't escape by remount
|
||||
cp -f ./$EXTLINUX ./extlinux.exe
|
||||
EXTLINUX=extlinux.exe
|
||||
fi
|
||||
|
||||
# install syslinux bootloader
|
||||
echo "* attempting to install bootloader to $BOOT..."
|
||||
|
||||
./"$EXTLINUX" --install "$BOOT"
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Error installing boot loader."
|
||||
echo "Read the errors above and press enter to exit..."
|
||||
read junk
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$DEV" != "$PART" ]; then
|
||||
# Setup MBR on the first block
|
||||
echo "* setup MBR on $DEV"
|
||||
dd bs=440 count=1 conv=notrunc if="$BOOT/mbr.bin" of="$DEV" 2>/dev/null
|
||||
|
||||
# Toggle bootable flags
|
||||
echo "* set bootable flag for $PART"
|
||||
PART="$(echo "$PART" | sed -r "s:.*[^0-9]::")"
|
||||
(
|
||||
fdisk -l "$DEV" | fgrep "*" | fgrep "$DEV" | cut -d " " -f 1 \
|
||||
| sed -r "s:.*[^0-9]::" | xargs -I '{}' echo -ne "a\n{}\n"
|
||||
echo a
|
||||
echo $PART
|
||||
echo w
|
||||
) | fdisk $DEV >/dev/null 2>&1
|
||||
fi
|
||||
|
||||
echo "Boot installation finished."
|
||||
echo "Press Enter..."
|
||||
read junk
|
||||
cd "$CWD"
|
||||
BIN
slax/boot/bootlogo.png
Normal file
BIN
slax/boot/bootlogo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 22 KiB |
BIN
slax/boot/extlinux.x32
Normal file
BIN
slax/boot/extlinux.x32
Normal file
Binary file not shown.
BIN
slax/boot/extlinux.x64
Normal file
BIN
slax/boot/extlinux.x64
Normal file
Binary file not shown.
19
slax/boot/help.txt
Normal file
19
slax/boot/help.txt
Normal file
@@ -0,0 +1,19 @@
|
||||
|
||||
Welcome
|
||||
|
||||
If you need to edit boot command line (for advanced users), hit [Tab].
|
||||
When finished, press [Enter].
|
||||
|
||||
|
||||
Keep changes persistent
|
||||
|
||||
Save all filesystem modifications to 'changes' directory and restore
|
||||
those changes next time you boot. Only usable while running from a
|
||||
writable media such as USB device or hard disk.
|
||||
|
||||
|
||||
Copy to RAM
|
||||
|
||||
Copies all data to memory during startup so you can eject the boot device.
|
||||
Requires enough RAM to store all modules and to run the system.
|
||||
|
||||
BIN
slax/boot/initrfs.img
Normal file
BIN
slax/boot/initrfs.img
Normal file
Binary file not shown.
BIN
slax/boot/isolinux.bin
Normal file
BIN
slax/boot/isolinux.bin
Normal file
Binary file not shown.
BIN
slax/boot/isolinux.boot
Normal file
BIN
slax/boot/isolinux.boot
Normal file
Binary file not shown.
BIN
slax/boot/ldlinux.c32
Normal file
BIN
slax/boot/ldlinux.c32
Normal file
Binary file not shown.
BIN
slax/boot/ldlinux.sys
Normal file
BIN
slax/boot/ldlinux.sys
Normal file
Binary file not shown.
BIN
slax/boot/libcom32.c32
Normal file
BIN
slax/boot/libcom32.c32
Normal file
Binary file not shown.
BIN
slax/boot/libutil.c32
Normal file
BIN
slax/boot/libutil.c32
Normal file
Binary file not shown.
BIN
slax/boot/mbr.bin
Normal file
BIN
slax/boot/mbr.bin
Normal file
Binary file not shown.
BIN
slax/boot/pxelinux.0
Normal file
BIN
slax/boot/pxelinux.0
Normal file
Binary file not shown.
3
slax/boot/runadmin.vbs
Normal file
3
slax/boot/runadmin.vbs
Normal file
@@ -0,0 +1,3 @@
|
||||
Set UAC = CreateObject("Shell.Application")
|
||||
Set args = WScript.Arguments
|
||||
UAC.ShellExecute args.Item(0), "", "", "runas", 1
|
||||
68
slax/boot/samedisk.vbs
Normal file
68
slax/boot/samedisk.vbs
Normal file
@@ -0,0 +1,68 @@
|
||||
' This script compares two given parameters (just first letter, so you can pass in full paths as well)
|
||||
' and returns exit code 99 if both disk drives are on the same physical drive
|
||||
' Run it as: wscript.exe samedisk.vbs c:\ d:\
|
||||
' Author: Tomas M <http://www.linux-live.org/>
|
||||
' Inspired by: http://www.activexperts.com/activmonitor/windowsmanagement/adminscripts/disk/drives/
|
||||
' -------------------------------------------
|
||||
|
||||
drive1 = ""
|
||||
drive2 = ""
|
||||
phys1 = ""
|
||||
phys2 = ""
|
||||
|
||||
Set args = WScript.Arguments
|
||||
|
||||
if args.Length > 0 then
|
||||
drive1 = args.Item(0)
|
||||
end if
|
||||
if args.Length > 1 then
|
||||
drive2 = args.Item(1)
|
||||
end if
|
||||
|
||||
if drive1 = "" then
|
||||
WScript.Quit(1)
|
||||
end if
|
||||
|
||||
if drive2 = "" then
|
||||
WScript.Quit(2)
|
||||
end if
|
||||
|
||||
|
||||
ComputerName = "."
|
||||
Set wmiServices = GetObject _
|
||||
("winmgmts:{impersonationLevel=Impersonate}!//" & ComputerName)
|
||||
Set wmiDiskDrives = wmiServices.ExecQuery _
|
||||
("SELECT Caption, DeviceID FROM Win32_DiskDrive")
|
||||
|
||||
For Each wmiDiskDrive In wmiDiskDrives
|
||||
|
||||
strEscapedDeviceID = _
|
||||
Replace(wmiDiskDrive.DeviceID, "\", "\\", 1, -1, vbTextCompare)
|
||||
Set wmiDiskPartitions = wmiServices.ExecQuery _
|
||||
("ASSOCIATORS OF {Win32_DiskDrive.DeviceID=""" & _
|
||||
strEscapedDeviceID & """} WHERE " & _
|
||||
"AssocClass = Win32_DiskDriveToDiskPartition")
|
||||
|
||||
For Each wmiDiskPartition In wmiDiskPartitions
|
||||
Set wmiLogicalDisks = wmiServices.ExecQuery _
|
||||
("ASSOCIATORS OF {Win32_DiskPartition.DeviceID=""" & _
|
||||
wmiDiskPartition.DeviceID & """} WHERE " & _
|
||||
"AssocClass = Win32_LogicalDiskToPartition")
|
||||
|
||||
For Each wmiLogicalDisk In wmiLogicalDisks
|
||||
|
||||
if UCase(Left(drive1,1)) = UCase(Left(wmiLogicalDisk.DeviceID,1)) then
|
||||
phys1=wmiDiskDrive.DeviceID
|
||||
end if
|
||||
|
||||
if UCase(Left(drive2,1)) = UCase(Left(wmiLogicalDisk.DeviceID,1)) then
|
||||
phys2=wmiDiskDrive.DeviceID
|
||||
end if
|
||||
|
||||
Next
|
||||
Next
|
||||
Next
|
||||
|
||||
if phys1 = phys2 then
|
||||
WScript.Quit(99)
|
||||
end if
|
||||
42
slax/boot/syslinux.cfg
Normal file
42
slax/boot/syslinux.cfg
Normal file
@@ -0,0 +1,42 @@
|
||||
UI /slax/boot/vesamenu.c32
|
||||
|
||||
PROMPT 0
|
||||
TIMEOUT 40
|
||||
|
||||
MENU CLEAR
|
||||
MENU HIDDEN
|
||||
MENU HIDDENKEY Enter default
|
||||
MENU BACKGROUND /slax/boot/bootlogo.png
|
||||
|
||||
MENU WIDTH 80
|
||||
MENU MARGIN 20
|
||||
MENU ROWS 5
|
||||
MENU TABMSGROW 9
|
||||
MENU CMDLINEROW 9
|
||||
MENU HSHIFT 0
|
||||
MENU VSHIFT 19
|
||||
|
||||
MENU COLOR BORDER 30;40 #00000000 #00000000 none
|
||||
MENU COLOR SEL 47;30 #FF000000 #FFFFFFFF none
|
||||
MENU COLOR UNSEL 37;40 #FFFFFFFF #FF000000 none
|
||||
MENU COLOR TABMSG 32;40 #FF60CA00 #FF000000 none
|
||||
|
||||
F1 help.txt /slax/boot/zblack.png
|
||||
|
||||
MENU AUTOBOOT Press Esc for options, automatic boot in # second{,s} ...
|
||||
MENU TABMSG [F1] help [Tab] cmdline >
|
||||
|
||||
LABEL default
|
||||
MENU LABEL Run Slax (Persistent changes)
|
||||
KERNEL /slax/boot/vmlinuz
|
||||
APPEND vga=normal initrd=/slax/boot/initrfs.img load_ramdisk=1 prompt_ramdisk=0 rw printk.time=0 consoleblank=0 slax.flags=perch,automount
|
||||
|
||||
LABEL perch
|
||||
MENU LABEL Run Slax (Fresh start)
|
||||
KERNEL /slax/boot/vmlinuz
|
||||
APPEND vga=normal initrd=/slax/boot/initrfs.img load_ramdisk=1 prompt_ramdisk=0 rw printk.time=0 consoleblank=0 slax.flags=automount
|
||||
|
||||
LABEL toram
|
||||
MENU LABEL Run Slax (Copy to RAM)
|
||||
KERNEL /slax/boot/vmlinuz
|
||||
APPEND vga=normal initrd=/slax/boot/initrfs.img load_ramdisk=1 prompt_ramdisk=0 rw printk.time=0 consoleblank=0 slax.flags=toram
|
||||
BIN
slax/boot/syslinux.com
Normal file
BIN
slax/boot/syslinux.com
Normal file
Binary file not shown.
BIN
slax/boot/syslinux.exe
Normal file
BIN
slax/boot/syslinux.exe
Normal file
Binary file not shown.
BIN
slax/boot/vesamenu.c32
Normal file
BIN
slax/boot/vesamenu.c32
Normal file
Binary file not shown.
BIN
slax/boot/vmlinuz
Normal file
BIN
slax/boot/vmlinuz
Normal file
Binary file not shown.
BIN
slax/boot/zblack.png
Normal file
BIN
slax/boot/zblack.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 6.3 KiB |
Reference in New Issue
Block a user