LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-25-2021, 01:35 PM   #1
andrewysk
Member
 
Registered: Mar 2020
Posts: 797

Rep: Reputation: Disabled
bootinst.bat file from slax.


This is a *.bat file that Readme.txt instructed to execute on usbstick.
It starts with hash-bang (shell script).


Q1.
This is shell script, should be for linux only, but why there is "windir" dir mentioned in the script ?

Code:
mkdir "%windir%\AdminCheck" 2>nul
if '%errorlevel%' == '0' rmdir "%windir%\AdminCheck" & goto gotPrivileges else goto getPrivileges
Q2.
I am just wonder what does this line means:
Code:
set BOOTFLAG=boot666s.tmp
I am a Christian, I am just sensitive of what putting into my computer.
Why it is "666" ? just a random name ? can i just change it to "boot123.tmp" instead ?


/slax/boot/bootinst.bat
Code:
#!/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

Readme.txt
Code:
Thank you for using slax!
If you are reading this from a CD, it is already bootable.
Steps to make it bootable from your USB device are following:

1) Copy the entire /slax/ directory to your USB drive.
   If you are using Windows, you will get for example E:\slax\
   You probably already did this - just make sure you are on your
   USB drive now and not on your local harddisk.

2) Now navigate to directory /slax/boot/ on your USB drive.
   In Windows, it will be E:\slax\boot\ for example.
   Use explorer or any other file manager for this task.

3) While you're in the boot directory, locate file bootinst.bat
   Run it by doubleclicking it. It will setup your USB to boot.

-- That's it. Your USB device is now ready to boot slax.
-- You can safely delete this file (readme.txt), it's not needed.
 
Old 12-25-2021, 02:28 PM   #2
shruggy
Senior Member
 
Registered: Mar 2020
Posts: 3,670

Rep: Reputation: Disabled
This script is supposed to run both on Linux and on Windows. The first three lines would generate error messages on Windows, but after complaining about them, Windows would happily run the rest of the script as a batch file. This is not very elegant. Answers to the SO question Single script to run in both Windows batch and Linux Bash? suggest more ingenious approaches.

Quote:
Originally Posted by andrewysk View Post
Why it is "666"? just a random name? can i just change it to "boot123.tmp" instead?
Yes, it's just a random name.

Last edited by shruggy; 12-26-2021 at 08:06 AM.
 
1 members found this post helpful.
Old 12-26-2021, 10:22 AM   #3
andrewysk
Member
 
Registered: Mar 2020
Posts: 797

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by shruggy View Post
This script is supposed to run both on Linux and on Windows.
I see, It is a script that runs on both windows and linux.

Code:
1.The instruction is to Copy the entire /slax/ directory to USB drive.
2.Then navigate to /slax/boot/ on the USB drive.
3.Then run  bootinst.bat
4.It will setup the USB to boot.
The USB device is now ready to boot slax.
Qa:
I Should run this script on a linux machine that is NOT intended for the installation right ? (because it seems to make install onto usbstick as bootable. It won't install anything to the host pc right ? )
I can't run this on my target laptop (EEE PC 900) , because the current operating system is emulated android (which i don't know how to run konsole).

Qb:
I had dd (previously) the slax iso image onto the usbstick (which i intended to boot up from) to install onto the EEEPC900 (which currently runs Emulated Android os). Is it (according to the instruction) totally wrong ? instead i shld copy the whole /slax folder into the usbstick after wipe the usb stick clean of the dd-ed image ?

Thx

Last edited by andrewysk; 12-26-2021 at 10:23 AM.
 
Old 12-26-2021, 10:51 AM   #4
shruggy
Senior Member
 
Registered: Mar 2020
Posts: 3,670

Rep: Reputation: Disabled
Quote:
Originally Posted by andrewysk View Post
I Should run this script on a linux machine that is NOT intended for the installation right?
How should I know? I don't use Slax. On Linux, the second line¹ would replace that script with another one, bootinst.sh, from the same directory.

According to Readme.txt, all the script does is make the USB drive bootable, yes. But the real commands to do this on Linux are in bootinst.sh whose contents you didn't provide.

--------
¹ Or the third line if /bin/bash cannot be found.

Last edited by shruggy; 12-26-2021 at 11:38 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] BAT script to copy files and run anther bat script? nibraz Programming 17 11-22-2016 03:56 AM
teamviewer 6/7 on slax, wine as root, on slax 64 build yanger Linux - Software 3 02-20-2014 01:35 PM
LXer: Slax 7.0 - Slax Is Back LXer Syndicated Linux News 0 01-29-2013 01:00 PM
Terminal command: cannot run bootinst.sh gordon__1 Linux - Newbie 4 01-28-2008 02:11 PM
grub commands for slax /slax frodo Paridoth Linux - General 2 07-15-2006 11:05 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:53 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration