#!/bin/csh # Use the C shell to run this script. # This is a port build script it executes make, make install, rehash, # and make clean. You must be in the directory of the port you want # to build in. # Identify the user as root. if ( "$user" == "root" ) then # If the user is root output to screen echo "You are authorized to install ports. Please Stand By." # If the user is not root, do something else. else # Output to screen for non root users echo "You are not authorized to install ports. Please leave me alone." # End this section and go to the next section. endif # Check the current working directory to see if you are in /usr/ports/. The ports all have pkg-descr. This command looks for that. if ( -f $cwd/pkg-descr ) then # If you are in /usr/ports in a proper directory with a pkg-descr, this will output to the screen. echo "Okay smart boy you seem to be in the right place." # If you are not in a proper /usr/ports directory with no pkg-descr do this. else # If you are not in a /usr/ports directory, output this to the screen. echo "Hey dummy! How about making sure you are in the ports directory and quit wasting my time." # If not in /usr/ports exit out of the script. exit # End this section and go to the next. endif # Let's find out what you want to do with the port. This outputs to screen. echo "Would you like the port installed[YES/NO]?" # Begin the YES,NO,or other variables that the user can answer. This sets up the authentication. set valid = false # This begins the loop for the authentication. while ( $valid == false ) # I have no idea what this line does. switch ( $< ) # If the response is YES do the following: case YES: # Output this to the screen. echo "Here we go!" # This confirms a match for YES. set valid = true # This makes sure you are in the proper directory. cd $cwd # These are the commands that build the port. make && make install && rehash && make clean # This breaks the switch but doesn't kill it. breaksw # If the response is NO do the following: case NO: # output this to the screen echo "Why did you bother me then? Go away!" # This confirms a match for NO set valid = true # This breaks the switch but doesn't kill it. breaksw # If anything other than YES or NO is typed do the following: default: # Output this to the screen echo "How about learning to type YES or NO dummy!" # This breaks the switch but doesn't kill it. breaksw # the loop stays open until YES or NO is typed anything else keeps the loop going. # This is the end command for the switches. endsw # This is the end command for the loop. end