mirror of
https://github.com/A2osX/A2osX.git
synced 2024-06-03 05:29:38 +00:00
Doc and some make script updates.
This commit is contained in:
parent
c9110f3298
commit
e20b870ff4
|
@ -82,6 +82,8 @@ In KCONFIG you can set:
|
||||||
|
|
||||||
LOGIN is a system process for A2osX that authenticates users against the A2osX User Database stored in ./ETC/PASSWD. Once a user is authenticated, LOGIN then loads the SH (./BIN/SH) process passing it the PROFILE script found in the users Home directory.
|
LOGIN is a system process for A2osX that authenticates users against the A2osX User Database stored in ./ETC/PASSWD. Once a user is authenticated, LOGIN then loads the SH (./BIN/SH) process passing it the PROFILE script found in the users Home directory.
|
||||||
|
|
||||||
|
>Note, at the shell prompt you can execute the **LOGIN** command which will then ask you for a name/password and create a new user "session" for you as if you are that user. You will have a new shell environment and be placed in that user's home directory. When you type **EXIT** or press Control-D at the shell prompt, that session will be terminated and you will returned to your original session in tact.
|
||||||
|
|
||||||
### NETWORKD
|
### NETWORKD
|
||||||
|
|
||||||
| Command |
|
| Command |
|
||||||
|
|
|
@ -767,6 +767,35 @@ loading functions this way
|
||||||
|
|
||||||
>A note on memory. All scripts get loaded into and run from Main Memory.
|
>A note on memory. All scripts get loaded into and run from Main Memory.
|
||||||
|
|
||||||
|
### Getting and Validating Input
|
||||||
|
|
||||||
|
One of the challenges when writing scripts is gathering input from the user and validating that input before performing a series of operations that would be affected by missing or invalid data. For example, suppose you wrote a script that prompted a user to enter in an IP address which will be passed to the ping command. You might want to gather the input as the 4 separate octets that make up an IP address and make sure each is a valid integer in the range of 1 to 255. The A2osX shell provides a robust set of commands you can use to craft such a script with extensive error checking. For instance the **READ** command (see above) has options to limit input to just 3 characters (the max an IP octet can be), in this case **READ -N 3 IP1** would accomplish this. Next you might want to validate that the user did not press return without typing anything (a null) by using either the **IF [ -Z var ]** (is null) or **IF [ -N var ]** (not null) checks. Then using the **IF [ -I var ]** check you could make sure the user entered an integer. Once you know you have **an** integer, you can check to see if it is in an acceptable range by using the compound **IF [ $IP1 -gt 0 ] AND [ $IP1 -LT 256 ]**.
|
||||||
|
|
||||||
|
>Note, it may seem expedient to just do that last compound **IF** to check the range of the input. If you do that, should the user enter nothing (just press return) or enter a string (i.e. ABC) then when the script executes this **IF** command the shell will throw and error and stop execution of your script. This is because **IF** checks like **-gt** can only handle integers and the integer check **-I** cannot handle nulls.
|
||||||
|
|
||||||
|
The following example demonstrates the complete validation concept outlined above. You could enhance this example further by putting the input and error checking in a **WHILE** loop to continue prompting the user for a valid octet until one was entered in the proper range. In addition, you could put such a routine in a function so that you could have the same set of code executed for all 4 octets.
|
||||||
|
|
||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# Demo of Getting and Validating Input
|
||||||
|
#
|
||||||
|
ECHO \f ; # Clear screen
|
||||||
|
ECHO "\n\n Enter Octet: "
|
||||||
|
READ -N 3 IP1
|
||||||
|
IF [ -Z $IP1 ]
|
||||||
|
ECHO "\n\nNothing entered"
|
||||||
|
ELSE
|
||||||
|
IF ![ -I $IP1 ] ; # Note the use of ! to negate IF
|
||||||
|
ECHO "\n\nNon-numeric characters entered"
|
||||||
|
ELSE
|
||||||
|
IF [ $IP1 -gt 0 ] AND [ $IP1 -lt 256 ]
|
||||||
|
ECHO "\n\nValid Octet Entered"
|
||||||
|
ELSE
|
||||||
|
ECHO "\n\nNumber out of range"
|
||||||
|
FI
|
||||||
|
FI
|
||||||
|
FI
|
||||||
|
|
||||||
### Shell Environment
|
### Shell Environment
|
||||||
|
|
||||||
Copy Vars????, Different Context, own vars get lost, own funcs, when called with dot, is using the same env.
|
Copy Vars????, Different Context, own vars get lost, own funcs, when called with dot, is using the same env.
|
||||||
|
|
Binary file not shown.
|
@ -7,7 +7,7 @@ AUTO 4,1
|
||||||
# and then verifies/corrects that files are in the right locations to
|
# and then verifies/corrects that files are in the right locations to
|
||||||
# be used by other MAKE processes such as those for making disk images
|
# be used by other MAKE processes such as those for making disk images
|
||||||
#
|
#
|
||||||
. MAKEFUNCS
|
. makefuncs
|
||||||
CALL CS
|
CALL CS
|
||||||
CALL TBOX " New BUILD File Copier"
|
CALL TBOX " New BUILD File Copier"
|
||||||
# Check for BUILD and MAKE online
|
# Check for BUILD and MAKE online
|
||||||
|
@ -53,4 +53,4 @@ ECHO "PREFIX BUILDS/BUILD${B}" > /MAKE/BLEED
|
||||||
ECHO "-A2OSX.SYSTEM" >> /MAKE/BLEED
|
ECHO "-A2OSX.SYSTEM" >> /MAKE/BLEED
|
||||||
ECHO "BLEED file updated! Process Complete. Exiting.\n"
|
ECHO "BLEED file updated! Process Complete. Exiting.\n"
|
||||||
MAN
|
MAN
|
||||||
TEXT /MAKE/USR/SHARE/MAKE/COPYBUILD
|
TEXT /MAKE/USR/SHARE/MAKE/copybuild
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
NEW
|
NEW
|
||||||
PREFIX
|
PREFIX
|
||||||
AUTO 4,1
|
AUTO 4,1
|
||||||
a2osx.logo
|
A2osX.logo
|
||||||
a2osx.system
|
A2OSX.SYSTEM
|
||||||
bin/arp
|
bin/arp
|
||||||
bin/cat
|
bin/cat
|
||||||
bin/chmod
|
bin/chmod
|
||||||
|
|
|
@ -6,7 +6,7 @@ AUTO 4,1
|
||||||
# This script makes a proper fullboot disk using the files
|
# This script makes a proper fullboot disk using the files
|
||||||
# found in a particular build stored in /make/builds
|
# found in a particular build stored in /make/builds
|
||||||
#
|
#
|
||||||
. MAKEFUNCS
|
. makefuncs
|
||||||
CALL CS
|
CALL CS
|
||||||
CALL TBOX " fullboot 800 Media Creator"
|
CALL TBOX " fullboot 800 Media Creator"
|
||||||
CALL PRINTXY 8 0 "You must have the correct image mounted on /dev/s7d2"
|
CALL PRINTXY 8 0 "You must have the correct image mounted on /dev/s7d2"
|
||||||
|
@ -28,7 +28,7 @@ IF [ -Z $B ]
|
||||||
ECHO "Exiting"
|
ECHO "Exiting"
|
||||||
EXIT
|
EXIT
|
||||||
FI
|
FI
|
||||||
SET SRC = "/make/builds/build${B}"
|
SET SRC = "/MAKE/BUILDS/BUILD${B}"
|
||||||
IF [ -D ${SRC} ]
|
IF [ -D ${SRC} ]
|
||||||
ECHO "\n\nFound Valid BUILD\n"
|
ECHO "\n\nFound Valid BUILD\n"
|
||||||
ELSE
|
ELSE
|
||||||
|
@ -66,13 +66,10 @@ SWITCH $RCS
|
||||||
EXIT
|
EXIT
|
||||||
END
|
END
|
||||||
ECHO "Which Prodos:"
|
ECHO "Which Prodos:"
|
||||||
ECHO " 1) Asset ProDOS 2.03tc"
|
ECHO " 1) ProDOS 2.03tc"
|
||||||
ECHO " 2) Asset ProDOS FX"
|
ECHO " 2) ProDOS FX"
|
||||||
ECHO " 3) Asset ProDOS FX Paked"
|
ECHO " 3) ProDOS FX Paked"
|
||||||
ECHO " 4) Build ProDOS 2.03tc"
|
READ -P "Enter 1-3: " PDOS
|
||||||
ECHO " 5) Build ProDOS FX"
|
|
||||||
ECHO " 6) Build ProDOS FX Paked"
|
|
||||||
READ -P "Enter 1-6: " PDOS
|
|
||||||
IF [ -Z $PDOS ]
|
IF [ -Z $PDOS ]
|
||||||
ECHO "You did not enter any response."
|
ECHO "You did not enter any response."
|
||||||
ECHO
|
ECHO
|
||||||
|
@ -81,22 +78,13 @@ IF [ -Z $PDOS ]
|
||||||
FI
|
FI
|
||||||
SWITCH $PDOS
|
SWITCH $PDOS
|
||||||
CASE 1
|
CASE 1
|
||||||
SET PDOSFILE = "/make/assets/pdos203tc/prodos"
|
SET PDOSFILE = "${SRC}/PRODOS"
|
||||||
BREAK
|
BREAK
|
||||||
CASE 2
|
CASE 2
|
||||||
SET PDOSFILE = "/make/assets/pdos203fx/prodos.fx"
|
SET PDOSFILE = "${SRC}/PRODOS.FX"
|
||||||
BREAK
|
BREAK
|
||||||
CASE 3
|
CASE 3
|
||||||
SET PDOSFILE = "/make/assets/pdos203fx/prodos.fx.paked"
|
SET PDOSFILE = "${SRC}/PRODOS.FX.PAKED"
|
||||||
BREAK
|
|
||||||
CASE 4
|
|
||||||
SET PDOSFILE = "${SRC}/prodos"
|
|
||||||
BREAK
|
|
||||||
CASE 5
|
|
||||||
SET PDOSFILE = "${SRC}/prodos.fx"
|
|
||||||
BREAK
|
|
||||||
CASE 6
|
|
||||||
SET PDOSFILE = "${SRC}/prodos.fx.paked"
|
|
||||||
BREAK
|
BREAK
|
||||||
DEFAULT
|
DEFAULT
|
||||||
ECHO "You did not enter a valid response."
|
ECHO "You did not enter a valid response."
|
||||||
|
@ -106,7 +94,7 @@ SWITCH $PDOS
|
||||||
EXIT
|
EXIT
|
||||||
END
|
END
|
||||||
ECHO "Formatting Destination..."
|
ECHO "Formatting Destination..."
|
||||||
FORMAT -B 1600 s7d2 fullboot
|
format -B 1600 s7d2 fullboot
|
||||||
ECHO "Making Directory Structure..."
|
ECHO "Making Directory Structure..."
|
||||||
md /fullboot/bin
|
md /fullboot/bin
|
||||||
md /fullboot/drv
|
md /fullboot/drv
|
||||||
|
@ -121,15 +109,19 @@ md /fullboot/var
|
||||||
md /fullboot/var/log
|
md /fullboot/var/log
|
||||||
ECHO "Copying Files..."
|
ECHO "Copying Files..."
|
||||||
FOR FILE IN (fullfiles)
|
FOR FILE IN (fullfiles)
|
||||||
CP -Q ${SRC}/${FILE} /fullboot/${FILE}
|
cp -Q ${SRC}/${FILE} /fullboot/${FILE}
|
||||||
NEXT
|
NEXT
|
||||||
CP -Q -Y $PDOSFILE /fullboot/ProDOS
|
cp -Q -Y $PDOSFILE /fullboot/ProDOS
|
||||||
CP -Q -Y initboot /fullboot/etc/init
|
cp -Q -Y initboot /fullboot/etc/init
|
||||||
ECHO "Welcome to A2osX!" > /fullboot/etc/issue
|
ECHO "Welcome to A2osX!" > /fullboot/etc/issue
|
||||||
ECHO >> /fullboot/etc/issue
|
ECHO >> /fullboot/etc/issue
|
||||||
ECHO $IM >> /fullboot/etc/issue
|
ECHO $IM >> /fullboot/etc/issue
|
||||||
CP -Q tcpip.conf /fullboot/etc/tcpip.conf
|
cp -Q tcpip.conf /fullboot/etc/tcpip.conf
|
||||||
CP -Q profile /fullboot/root/profile
|
cp -Q profile /fullboot/root/profile
|
||||||
|
IF [ $PDOS -eq 1 ]
|
||||||
|
ECHO Renaming VOL
|
||||||
|
REN /fullboot FULLBOOT
|
||||||
|
FI
|
||||||
ECHO "fullboot Disk Created!"
|
ECHO "fullboot Disk Created!"
|
||||||
MAN
|
MAN
|
||||||
TEXT /MAKE/USR/SHARE/MAKE/MAKEFULL
|
TEXT /MAKE/USR/SHARE/MAKE/MAKEFULL
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
|
||||||
NEW
|
NEW
|
||||||
PREFIX
|
PREFIX
|
||||||
AUTO 4,1
|
AUTO 4,1
|
||||||
|
@ -67,7 +68,5 @@ WHILE [ $OL -ne 0 ]
|
||||||
NEXT
|
NEXT
|
||||||
SET OL = $OL - 1
|
SET OL = $OL - 1
|
||||||
LOOP
|
LOOP
|
||||||
|
|
||||||
|
|
||||||
MAN
|
MAN
|
||||||
TEXT /MAKE/USR/SHARE/TESTS/FORTEST
|
TEXT /MAKE/USR/SHARE/TESTS/FORTEST
|
||||||
|
|
Loading…
Reference in New Issue
Block a user