bootfiles for slax-debian
parent
e0d1896a61
commit
a3bd955648
|
|
@ -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
|
||||||
|
\linux\boot\syslinux.exe -maf -d /linux/boot/ %DISK%:
|
||||||
|
if %ERRORLEVEL% == 0 goto setupDone
|
||||||
|
goto errorFound
|
||||||
|
|
||||||
|
:setup95
|
||||||
|
\linux\boot\syslinux.com -maf -d /linux/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%:\linux\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
|
||||||
|
|
@ -0,0 +1,149 @@
|
||||||
|
#!/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 Linux by default."
|
||||||
|
echo "Press [Enter] to continue, or [Ctrl+C] to abort..."
|
||||||
|
read junk
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -x ./extlinux.exe ]; 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
|
||||||
|
chmod a+x ./extlinux.exe
|
||||||
|
mount -o remount,exec $DEV
|
||||||
|
fi
|
||||||
|
|
||||||
|
# install syslinux bootloader
|
||||||
|
echo "* attempting to install bootloader to $BOOT..."
|
||||||
|
|
||||||
|
# Try to use installed extlinux binary and fallback to extlinux.exe only
|
||||||
|
# if no installed extlinux is not found at all.
|
||||||
|
EXTLINUX="$(which extlinux 2>/dev/null)"
|
||||||
|
if [ "$EXTLINUX" = "" ]; then
|
||||||
|
EXTLINUX="./extlinux.exe"
|
||||||
|
fi
|
||||||
|
|
||||||
|
"$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"
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 22 KiB |
|
|
@ -0,0 +1,3 @@
|
||||||
|
Set UAC = CreateObject("Shell.Application")
|
||||||
|
Set args = WScript.Arguments
|
||||||
|
UAC.ShellExecute args.Item(0), "", "", "runas", 1
|
||||||
|
|
@ -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
|
||||||
Loading…
Reference in New Issue