Logo

Thin Clients : Windows 98 

The script

The Script to install Windows 98SE onto a thin client. This is built in to TinyCore98.iso. If you are rolling your own USB installation media you can download a copy

#!/bin/sh
#
# Script to setup ${TARGET}1 as a DOS bootable drive containing the necessary files
# to install Windows 98SE
#
#  Version 1.0  30-04-21
#  David Parkinson
#

TARGET="/dev/sda"	# destination drive
DRIVEC="/mnt/sda1"	# Mounted destination

# Determine our mount point. Depending on how the USB flash drive
# was formatted it will be /dev/sdb or /sdb1

SOURCE=$(df | grep /dev/sdb | sed 's/.* \//\//')
if [ -z "$SOURCE" ]; then
  echo "Boot drive is not /dev/sdb? as expected"
  exit
fi

# First step is to check we have the necessary components:
#  - sfdisk to format the drive
#  - ms-sys to create the boot sector
#  - directory dos_files for initial boot environment
#  - directory win98 for the Windows 98SE installation files

if ! [ `type -p ms-sys` ]; then
  echo "This script requires the program ms-sys"
  exit
fi

if ! [ `type -p sfdisk` ]; then
  echo "This script requires the program sfdisk"
  exit
fi

if ! [ `type -p mkfs.vfat` ]; then
  echo "This script requires dosfstools"
  exit
fi

if ! [ -d "${SOURCE}/boot_dos" ]; then
  echo "Can't see boot files at ${SOURCE}/boot_dos"
  exit
fi

if ! [ -d "${SOURCE}/win98" ]; then
  echo "Can't see Windows 98 files at ${SOURCE}/win98"
  exit
fi

# Warn before proceeding

echo "About to reformat $TARGET and copy over new files"

read -p "Are you sure? " -n 1 -r
echo
if [[ ! $REPLY =~ ^[Yy]$ ]]
then
  echo "Aborting"
  exit
fi

# Need to umount any sda partitions before proceeding
# (Shouldn't be mounted)

SDA=$(df | grep $TARGET | sed 's/ .*//')
if [ "$SDA" = "${TARGET}1" ]; then
  echo "Unmounting $SDA"
  sudo umount $SDA
fi

# Hose sda and re-read partition table
echo "Clearing old partition table"
sudo dd if=/dev/zero of=${TARGET} count=100
sudo partx -u $TARGET

echo "Partitioning $TARGET"
echo 'type=c' | sudo sfdisk $TARGET
if [ "$?" -ne 0 ] ; then
  echo "Failed to partition ${TARGET}"
  exit
fi
sudo partx -u $TARGET

# Mark partition as active
sudo sfdisk -A $TARGET 1

echo "Formatting ${TARGET}1"

mkfs.vfat -F 32 ${TARGET}1
if [ "$?" -ne 0 ] ; then
  echo "Format failed"
  exit
fi
echo "Writing boot sector to $TARGET and boot vector to ${TARGET}1"
ms-sys -w -9 $TARGET
# some form of error check

ms-sys -w -p -9 ${TARGET}1

echo "Mounting ${TARGET}1"
if ! [ -d $DRIVEC ] ; then
  mkdir $DRIVEC
fi
sudo mount ${TARGET}1 $DRIVEC
if [ "$?" -ne 0 ] ; then
  echo "Failed to mount ${TARGET}1 on $DRIVEC"
  exit
fi

# Now copy over all the files we need
# IO.SYS has to be the first entry (and contiguous)

echo "Copying over system files"
sudo cp $SOURCE/boot_dos/IO.SYS $DRIVEC
sudo cp $SOURCE/boot_dos/MSDOS.SYS $DRIVEC
sudo cp $SOURCE/boot_dos/CONFIG.SYS $DRIVEC
sudo cp $SOURCE/boot_dos/COMMAND.COM $DRIVEC
sudo cp $SOURCE/boot_dos/AUTOEXEC.BAT $DRIVEC

echo "Copying over DOS files"
sudo cp -R $SOURCE/boot_dos/DOS $DRIVEC
if [ "$?" -ne 0 ] ; then
  echo "An error occured"
fi
sync

echo "Copying over Windows 98SE files"
if ! [ -d $DRIVEC/win98 ] ; then
  sudo mkdir $DRIVEC/win98
fi
sudo cp -R $SOURCE/win98 $DRIVEC/
sync

echo "Copying over Extra files"
if ! [ -d $DRIVEC/extras ] ; then
  sudo mkdir $DRIVEC/extras
fi

sudo cp -R $SOURCE/extras $DRIVEC/
sync

echo "Job complete"

 


Any comments? email me. Added April 2021