#!/bin/sh # (c) Copyright Barry Kauler 2007 # Now LGPL 2007 # # run like this: # new2dir make install # # creates a directory one or two levels higher with the name of the package # but slightly modified. For example source package has dir 'abiword-0.5.6' # inside this you do the usual 'configure', 'make', then 'new2dir make install' # and 'abiword-0.5.6-i486' directory gets created, with all installed files # in it. # # 120220 jemimah: fix to work with cmake (uncertain if will break anything else). ref: # http://murga-linux.com/puppy/viewtopic.php?t=71767&start=420 # # 120602 updated installwatch to 0.7, got double hits from /tmp/pkginstall.list. # # 130121 grab a .pot if it exists. # # # # 2/24-2/26, 2/28/2015, 3/10/2015, 3/12/2015, 3/14/2015, 3/22/2015: # Modified quite a lot by Apollia. # # new2dir is a wonderfully useful script included with many (all?) Puppy # Linuxes, which makes it much easier to create PET and SFS files. # # Wikka page about the original new2dir: # # http://puppylinux.org/wikka/new2dir # # # Unfortunately, the original new2dir makes my hard disk alarmingly busy, # even if the software I'm building is all inside the RAM disk. So, I # decided to figure out how to stop that. # # Also, because I often find Bash very difficult to read and understand, # I ended up renaming a lot of variables, and adding some functions and a # lot of thorough comments. # # And, to make it a bit more convenient to build SFS files, I made it # possible for this script to optionally launch mksquashfs. # # # This script is based on the copy of new2dir found in Lighthouse 64 Puppy # Linux 6.02 Beta 2. # # # So far, my modified version seems to work well for me, but, I've only tested # it in Lighthouse 64 Puppy Linux 6.02 Beta 2 - a frugal installation running # in RAM with no Pupsave file. # # # Unfortunately, my modified version isn't perfect, and I don't have the time # to try to make it perfect. So, people who have a full installation of Puppy, # and possibly others who use this script, will still have their disk made # busier than it should be. # # (Perhaps that could be avoided if this script were modified to be capable # of creating a RAM disk.) # # Anyone whose /tmp/ folder isn't in a RAM disk will have their disk made # unnecessarily, excessively busy by things being done in /tmp/. # (And even if you opt not to do anything in /tmp/, some temporary files get # written, and that could probably be handled in a more efficient way somehow.) # # Though hopefully at least the disk should be less busy than the # original new2dir script would make it, because I took out the numerous # "sync" commands scattered throughout the script, which were sometimes # even inside loops. # # I actually don't know if "sync" is important to use or not - but, in my # experience, not using it seems to work fine. # # But, again, I have only tested this script in Lighthouse 64 Puppy Linux # 6.02 Beta 2 - a frugal installation running in RAM with no Pupsave file. # # # I assume (but am not sure) that anyone who runs Puppy the way I do - # with Puppy running entirely in RAM, and booted either from a live disc # or a frugal installation with no Pupsave file - will hopefully have no # problems with their disk(s) being made excessively busy. # # But, please be careful, in case I'm mistaken, or in case there are # other problems. # # # Feedback is welcome at: # # http://astroblahhh.com/puppy-linux/software/modified-new2dir/v1.0/discussion # # (That link should redirect to a discussion thread on the Puppy Linux # Discussion Forum at: http://murga-linux.com/puppy/ ) # # # Feedback also can be sent to me privately, or publicly at my own forum: # # http://astroblahhh.com/contact-apollia.shtml # # http://eryss.com/forum # # # Other known problems or possible problems: # # * I commented out the section dealing with .pot (not .pet - .pot) files # because somehow (maybe because of a change I made) it caused an error # mentioning a unary operator, and I didn't know how to fix that. # # # * I assume this script possibly might have trouble with paths containing # single or double quotes (' or "), since I didn't add in extra code to # escape paths, except for an unused function - # Escape_Single_Quotes_for_Bash_and_Enclose_in_Single_Quotes(). # # I didn't have the patience to add string-escaping anywhere it might be # needed, especially since I don't recall running into trouble related to # quotes in filenames with the original new2dir script. I just wanted to # avoid a lot of extra testing and fiddling. # # # * It appears that splitting packages up into separate packages for # development files, documentation files, and internationalization files # often doesn't work very well - for example, files that get added to the # development package sometimes also get erroneously added to the main # package. I'm not sure how to fix this, and sorry if this problem was # caused by something I did. # # Sorry if there are any other problems I'm not aware of! # # # This script can be downloaded from: # # http://astroblahhh.com/puppy-linux/software/modified-new2dir/v1.0/new2dir.txt Tmp_Build_Location="/tmp/New2Dir Stuff/Temporary Build Location" # Don't put a slash on the end. Also, the lines that remove the Tmp_Build_Location # don't contain this variable because I'm paranoid about the remove command, so, # those lines will have to be modified manually if you modify the above. mkdir -p "$Tmp_Build_Location" if [ ! $1 ]; # Apollia's note: If the script is launched without an argument, then, # the script is aborted immediately. # # Further explanation: # # Arguments for Bash scripts get stored in variables $1, $2, and so on. # # Arguments can be supplied to a script either via typing them manually # into a command line, or by dragging and dropping something onto the # script. # # The exclamation point, in this context, basically means "not". then echo "This script is used in the last step when installing a source" echo "or binary package. For example:" echo "# new2dir make install" echo "Exiting script." exit fi # @@@@ # Apollia: The @@@@ is my shorthand notation for a section where # variables get set, but where nothing particularly interesting # happens. # # A "#-------------" indicates things are about to get more interesting. fullpath_of_the_current_working_dir="`pwd`" Possible_Relative_Path_to_Package_Source="../`basename "$fullpath_of_the_current_working_dir"`" # Apollia's note: These next few lines just display the values of the above variables. echo echo echo "Full path of the current working directory: $fullpath_of_the_current_working_dir" #echo "Possible path to package source (should be relative): $Possible_Relative_Path_to_Package_Source" #-------------- if [ "`echo "$Possible_Relative_Path_to_Package_Source" | grep '[0-9]'`" = "" ]; # Apollia: OK, the above basically means, if the current Possible_Relative_Path_to_Package_Source # doesn't have any numbers in it, then, the stuff below (after the "then" # statement) has to happen. # # Further explanation: # # The variable Possible_Relative_Path_to_Package_Source is echoed simply to pass its # value on to the grep command, which searches the Possible_Relative_Path_to_Package_Source # string for any numbers from 0 to 9. # # The | (pipe) between the echo command and the grep command is what # pipes the first command's results over to the second command, so the # second command can work on what the first command produced. # # If grep finds no numbers in Possible_Relative_Path_to_Package_Source, there won't be any # output, because Linux commands are sometimes not very vocal about # exactly what's going on. # # So, instead of looking for a result like "grep found nothing!", the # above if statement looks for no result, or in other words: = "" # # # About "grep": # # http://linux.die.net/man/1/grep then # Apollia's note: # # With no version numbers found, we assume the path to the package source is # somewhere else. echo echo echo "No version numbers were detected in the name of the current possible path to package source!" echo echo "So, defaulting to the current working directory's parent directory." full_parentdirs_of_the_current_working_dir="`dirname "$fullpath_of_the_current_working_dir"`" Possible_Relative_Path_to_Package_Source="../../`basename "$full_parentdirs_of_the_current_working_dir"`" # Apollia's note: These next few lines just display the values of the above variables. echo #echo "Full parentdirs of the current working directory: $full_parentdirs_of_the_current_working_dir" #echo echo "Possible path to package source (should be relative): $Possible_Relative_Path_to_Package_Source" echo echo fi ########################################## # # # Start of function # # # Change_Text_Color_to_() # # Change_Text_Color_to_() { # Apollia's note: Argument 1 is the color to change the text color to. echo -en "\\$1" # Apollia's note: # # About "echo": # http://linux.die.net/man/1/echo # # The quoted bits below are from there. # # On echo's -n option: # "do not output the trailing newline" # # On echo's -e option: # "enable interpretation of backslash escapes" # # # About colorizing scripts: # # http://tldp.org/LDP/abs/html/colorizing.html } # # # End of function # # Change_Text_Color_to_() # ########################################################### ########################################## # # # Start of function # # # Print_Red_Error() # # Print_Red_Error() { Change_Text_Color_to_ $red_text_color echo -ne "Error:" Change_Text_Color_to_ $white_text_color } # # # End of function # # Print_Red_Error() # ########################################################### #@@@@ red_text_color="033[1;31m" green_text_color="033[32;40m" white_text_color="033[0;39m" #-------------- #if [ 1 = 0 ] # Apollia's note: The above is merely for conveniently getting # past this if statement without having to comment all of the # below out. # # 1 equals 0 is always false, so everything in the below # if block is skipped if the above line is used instead of the # real if query. if [ "`echo "$Possible_Relative_Path_to_Package_Source" | grep '[0-9]'`" = "" ]; # Apollia's note: The same check for numbers in the $Possible_Relative_Path_to_Package_Source # string is done again above. # # If the new directory still has no numbers in it, the script is aborted here # after printing some info for the user. then echo echo Print_Red_Error echo " $Possible_Relative_Path_to_Package_Source does not seem to be a package directory with" echo "a version number." echo echo "Unfortunately, some source package tarballs expand to a" echo "directory that does not have version number in its name. SeaMonkey" echo "is an example of this - it expands to a directory named just 'mozilla'." echo echo "This script will create a package with the same name as the directory," echo "and it absolutely must have the version number in it, which must commence" echo "with a numeric digit." echo echo "So, you must now close this terminal window, then rename the directory." echo "For example, for SeaMonkey version 1.0.7, rename the directory from" echo "'mozilla' to 'SeaMonkey-1.0.7'" echo echo "A dash '-' must be used to separate the package name from version." echo echo "A directory name like 'seamonkey-alpha1' is NOT allowed, as the version" echo "number must start with a numeric digit. Example: 'SeaMonkey-1.0.7alpha1'." echo echo "Exiting script." echo exit fi ########################################## # # # Start of function # # # Escape_Single_Quotes_for_Bash_and_Enclose_in_Single_Quotes() # # # Apollia's note: This function actually isn't used, because I didn't have the time/energy # to figure out what things needed to be escaped and to make sure the command lines those # strings are involved in will still be executed without me having to do additional fiddling. Escape_Single_Quotes_for_Bash_and_Enclose_in_Single_Quotes() { local quotes_escaped quotes_escaped=$(echo "$1" | sed -e "s/'/'\"'\"'/g") echo "'$quotes_escaped'" } # # # End of function # # Escape_Single_Quotes_for_Bash_and_Enclose_in_Single_Quotes() # # ########################################################### ###################################################################### # # Apollia's note: Stage 1 # # Ask User Whether the Package Source Directory is Correct # # After some info is printed, the user is given a chance to correct # an incorrect package directory, or accept the current one by # pressing ENTER. echo Change_Text_Color_to_ $green_text_color echo -en "Stage 1 - Is Package Source Directory Correct?" Change_Text_Color_to_ $white_text_color echo -n " Here's the directory:" echo echo " $Possible_Relative_Path_to_Package_Source" echo echo "If this is correct, just press the ENTER key." echo echo "Otherwise, type the correct directory with a relative address." echo echo " NOTE: This script will create a package with the same name as the directory." echo " The directory absolutely must have the version number in it, which" echo " must commence with a numeric digit, and name and version number must" echo " be separated by a dash '-'." echo echo " For example: 'SeaMonkey-1.0.7' (without the quotes)" echo echo " A directory name like 'SeamMonkey-alpha1' is NOT allowed, as the version" echo " number must start with a numeric digit. Example: 'SeaMonkey-1.0.7alpha1'." echo echo "If $Possible_Relative_Path_to_Package_Source is incorrect, you must now exit with CTRL-C, close this" echo "terminal window, then rename the directory." echo echo "Also, if you're not running Puppy in a RAM disk, running new2dir is not" echo "recommended, because this version of the new2dir script has not been" echo "perfected to minimize disk writes on systems which aren't running in a" echo "RAM disk." # Apollia's note: # # Pressing CTRL-C will abort any running Bash script immediately. # (That's a built-in feature of Bash which doesn't have to be coded # into each script.) echo echo -n " Type response now: " # Apollia's note: # # This is where the user's reply is collected. read User_Reply # Apollia's note: # # Documentation for the read command is here: # # http://ss64.com/bash/read.html [ ! "$User_Reply" = "" ] && Possible_Relative_Path_to_Package_Source="$User_Reply" # Apollia's note: # # I think the above line means, if the user's reply # isn't a blank string, then, Possible_Relative_Path_to_Package_Source is set to the # user's reply text. # # But, if the user's reply is blank, then, Possible_Relative_Path_to_Package_Source # is left alone. # Apollia's note: # # Now the Package_Folder_Name variable is created. # @@@@ #escaped_Possible_Relative_Path_to_Package_Source=$(Escape_Single_Quotes_for_Bash_and_Enclose_in_Single_Quotes "$Possible_Relative_Path_to_Package_Source") #command_line="basename $escaped_Possible_Relative_Path_to_Package_Source" command_line="basename $Possible_Relative_Path_to_Package_Source" #echo "command_line $command_line" Package_Folder_Name=`eval "$command_line"` #echo "Package_Folder_Name $Package_Folder_Name " #-------------- #if [ 1 = 0 ] if [ ! -d "$Possible_Relative_Path_to_Package_Source" ]; # Apollia's note: # # ! means "not", # # and # # -d tests whether the thing following it is a directory or not. # More info: http://tldp.org/LDP/abs/html/fto.html # # # So, putting it all together, the if query above means: # # "If Possible_Relative_Path_to_Package_Source is not a directory"... then echo echo Print_Red_Error echo -n " The path $Possible_Relative_Path_to_Package_Source does not exist! Exiting script." echo echo exit fi echo echo echo "Okay, using this path as the package source directory:" echo echo " $Possible_Relative_Path_to_Package_Source" ###################################################################### # # Apollia's note: Stage 2 # # Ask the User about CPU Type # # After some info is printed, the user is asked to specify a CPU type, # or accept the default (i486) by pressing ENTER. echo echo Change_Text_Color_to_ $green_text_color echo -e "Stage 2 - Specify CPU Type" Change_Text_Color_to_ $white_text_color echo echo "Puppy is designed to run on an i486 CPU upwards. Normally this means" echo "that you have to specify 'build=i486-t2-linux-gnu' (sometimes host=)" echo echo "Some packages do not have that configure option and compile for a" echo "specific CPU regardless what is in your PC." echo echo "If you have compiled for a i686, just press ENTER key." echo echo "Otherwise, enter the CPU type." echo echo "Examples: i386 i486 i686" echo "(The i is required)." echo echo -n "Type response now: " # Apollia's note: # # This is where the user's reply is collected. read User_Reply # Apollia's note: # # About "read": # # http://ss64.com/bash/read.html [ "$User_Reply" = "" ] && User_Reply="i686" # Apollia's note: # # Only if User_Reply is blank, then, CPU_TYPE gets set to the default: i686 CPU_TYPE="$User_Reply" if [ "`echo -n "$CPU_TYPE" | grep '^[a-zA-Z]'`" = "" ]; # Apollia's note: # # If the CPU_TYPE doesn't contain any letters, it's considered invalid. then echo echo Print_Red_Error echo -en " $CPU_TYPE without any letters is not valid. Exiting script." echo echo exit fi echo echo "Okay, using this for CPU type: $CPU_TYPE" ###################################################################### # # Apollia's note: Stage 3 # # Ask User About Splitting the Package Into # Multiple Packages # # Here, the user is asked if they want to split # the package into separate packages for executables (exe), # documentation (doc), development (dev), and international (nls) # components. # # Unfortunately, this doesn't appear to work very well - files that # are supposed to be in one of the separate files often get added # to the main package as well. I don't know how to fix that, and # sorry if I caused that somehow. echo echo Change_Text_Color_to_ $green_text_color echo -en "Stage 3 - Split up the package?" Change_Text_Color_to_ $white_text_color echo " If you wish, you can split the final package up" echo "into separate packages for the 'executables', 'documentation', 'development' and" echo "'international' components." echo echo "If the package has shared libraries, it is recommended to at least" echo "create a separate 'development' package." echo echo "The idea here is to 'trim the fat' as much as possible so that you only" echo "have what is absolutely needed in the 'executables' PET package, but" echo "the extra components can be installed if needed." echo echo " NOTE: The automatic splitting performed by this script may not be perfect" echo " and you may have to modify the contents of the created separate directories" echo " before the final step of converting them to PET packages." echo echo "Just press ENTER key only to create one package only." echo echo "Or, type a number to choose which separate packages to create:" echo " 1 Just one package (directory) only" echo " 2 Create a separate 'development' package" echo " 3 Create separate 'development', 'documentation', 'international' pkgs" echo echo "Or, type a comma-separated list of the separate pkgs that you want to" echo "create, using keywords 'exe', 'dev', 'doc', 'nls'." echo echo "Example: exe,dev,doc (in this example, nls component is left in the" echo "main package, that is, the exe component)." echo echo "Unfortunately, this feature doesn't work as well as it should, since" echo "often files that are supposed to go in a separate package also get added" echo "to the main package too. So, it is probably best to just make one package." echo echo -n "Type response (just press ENTER if in doubt): " # Apollia's note: # # This is where the user's reply is collected. read HOW_TO_SPLIT_PACKAGES [ "$HOW_TO_SPLIT_PACKAGES" = "" ] && HOW_TO_SPLIT_PACKAGES="exe" # Apollia's note: # Only if HOW_TO_SPLIT_PACKAGES is blank, HOW_TO_SPLIT_PACKAGES is set to "exe". [ "$HOW_TO_SPLIT_PACKAGES" = "1" ] && HOW_TO_SPLIT_PACKAGES="exe" # Apollia's note: # Only if HOW_TO_SPLIT_PACKAGES is 1, HOW_TO_SPLIT_PACKAGES is set to "exe". [ "$HOW_TO_SPLIT_PACKAGES" = "2" ] && HOW_TO_SPLIT_PACKAGES="exe,dev" # Apollia's note: # Only if HOW_TO_SPLIT_PACKAGES is 2, HOW_TO_SPLIT_PACKAGES is set to "exe, dev". [ "$HOW_TO_SPLIT_PACKAGES" = "3" ] && HOW_TO_SPLIT_PACKAGES="exe,dev,doc,nls" # Apollia's note: # Only if HOW_TO_SPLIT_PACKAGES is 3, HOW_TO_SPLIT_PACKAGES is set to "exe,dev,doc,nls". should_make_main_package=""; should_make_doc_package=""; should_make_dev_package=""; should_make_nls_package="" [ ! "`echo "$HOW_TO_SPLIT_PACKAGES" | grep 'exe'`" = "" ] && should_make_main_package="yes" # Apollia's note: # Wow, oddly phrased. I'd like to reword these lines of code to make them more readable, # but I'm afraid I might break something and I don't want to have to fiddle with them. # # Here's a more readable plain English version of the above: # # Only if $HOW_TO_SPLIT_PACKAGES is found to contain "exe", the variable should_make_main_package # is set to yes. [ ! "`echo "$HOW_TO_SPLIT_PACKAGES" | grep 'doc'`" = "" ] && should_make_doc_package="yes" [ ! "`echo "$HOW_TO_SPLIT_PACKAGES" | grep 'dev'`" = "" ] && should_make_dev_package="yes" [ ! "`echo "$HOW_TO_SPLIT_PACKAGES" | grep 'nls'`" = "" ] && should_make_nls_package="yes" #echo "HOW_TO_SPLIT_PACKAGES: $HOW_TO_SPLIT_PACKAGES" plural_or_not="" them_or_it="it" their_or_its="its" is_or_are="is" an_or_some="an" a_or_some="a" if [ "$should_make_doc_package" = "yes" ] || [ "$should_make_dev_package" = "yes" ] || [ "$should_make_nls_package" = "yes" ] then plural_or_not="s" them_or_it="them" their_or_its="their" is_or_are="are" an_or_some="an" a_or_some="some" fi echo echo #[ ! "`echo "$HOW_TO_SPLIT_PACKAGES" | grep 'exe'`" = "" ] && mkdir "$Final_Dest_Relpath_for_Main_Package" # Apollia's note: # # Don't know why these 3 lines were commented out, I don't think I did that. #[ ! "`echo "$HOW_TO_SPLIT_PACKAGES" | grep 'doc'`" = "" ] && mkdir "$Final_Dest_Relpath_for_Document_Stuff" #[ ! "`echo "$HOW_TO_SPLIT_PACKAGES" | grep 'dev'`" = "" ] && mkdir "$Final_Dest_Relpath_for_Development_Stuff" #[ ! "`echo "$HOW_TO_SPLIT_PACKAGES" | grep 'nls'`" = "" ] && mkdir "$Final_Dest_Relpath_for_Internationalization_NLS_Stuff" ###################################################################### # # Apollia's note: Stage 3.5 # # Prepare Destination (Dest) Variables # # # A comment by someone other than Apollia: # # would like to create different targets for exe, doc, dev, nls components... # @@@@ Final_Dest_Relpath_for_Main_Package="${Possible_Relative_Path_to_Package_Source}-${CPU_TYPE}" Dest_Foldername_for_Main_Package="`basename $Final_Dest_Relpath_for_Main_Package`" Tmp_Path_for_Main_Package="$Tmp_Build_Location/$Dest_Foldername_for_Main_Package" Relpath_Dots_Only_for_Packages="`dirname $Final_Dest_Relpath_for_Main_Package`" dot_files_string=".files" dot_moved_string=".moved" dot_dirs_string=".dirs" dot_tempdup_string=".tempdup" dot_sfs_string=".sfs" Final_Dest_Relpath_for_Filelist_for_Main_Package="$Final_Dest_Relpath_for_Main_Package$dot_files_string" Tmp_Path_for_Filelist_for_Main_Package="$Tmp_Build_Location/$Dest_Foldername_for_Main_Package" Tmp_Path_for_Filelist_for_Main_Package="$Tmp_Path_for_Filelist_for_Main_Package$dot_files_string" # Apollia's note: # # "relpath" is an abbreviation for "relative path". # # # "dots" refers to the periods ("/../" and "/./") that appear in relative paths. # # Quoted from http://en.wikipedia.org/wiki/Path_%28computing%29#Unix_style - # # "Two dots ("..") point upwards in the hierarchy, to indicate the parent directory; # one dot (".") represents the current directory itself." # # # "only" refers to the fact that nothing else appears in that variable except the relpath dots. # Apollia's note: These next few lines just display the values of the above variables. #echo " Final_Dest_Relpath_for_Main_Package $Final_Dest_Relpath_for_Main_Package" #echo " Dest_Foldername_for_Main_Package $Dest_Foldername_for_Main_Package" #echo " Relpath_Dots_Only_for_Packages $Relpath_Dots_Only_for_Packages " #-------------- # Comments by someone other than Apollia: # # difficult task, separate package name from version part... # not perfect, some start with non-numeric version info... Versionless_Package_Folder_Name="`echo -n "$Package_Folder_Name" | sed -e 's/\-[0-9].*$//g'`" # Apollia's note: # # Looks like the sed part uses a regular expression (regex) to strip $Package_Folder_Name # of its version numbers and last dash. # # # About "sed": # http://linux.die.net/man/1/sed # # The quoted bit below is from there. # # # On sed's -e option: # # "-e script, --expression=script # add the script to the commands to be executed" # # # About regexes (regular expressions): # http://www.regular-expressions.info/ # Apollia's note: These next couple lines just display the values of the above variables. #echo "Package_Folder_Name $Package_Folder_Name" #echo " Versionless_Package_Folder_Name $Versionless_Package_Folder_Name " # Comment by someone other than Apollia: # # ...if that fails, do it the old way... # # # Apollia's note: I think that comment means, if sed doesn't work, use # something other than sed to do the same thing. [ "$Versionless_Package_Folder_Name" = "$Package_Folder_Name" ] && Versionless_Package_Folder_Name="`echo "$Package_Folder_Name" | cut -f 1 -d "-"`" # Apollia's note: # # Only if Versionless_Package_Folder_Name and Package_Folder_Name are the same, # then, Versionless_Package_Folder_Name will be made by using the "cut" command # on Package_Folder_Name. # # # About "cut": # http://linux.die.net/man/1/cut # # The quoted bits below are from there. # # # On cut's -f option: # # "-f, --fields=LIST # select only these fields; also print any line that contains no delimiter character, # unless the -s option is specified" # # On cut's -d option: # "-d, --delimiter=DELIM # use DELIM instead of TAB for field delimiter" # Apollia's note: # # Below, a bunch more variables are defined. # @@@@ Dots_and_Versionless_Name_Only="${Relpath_Dots_Only_for_Packages}/${Versionless_Package_Folder_Name}" Regex_to_Remove_Versionless_Name="s/${Versionless_Package_Folder_Name}\\-//g" Version_Only="`echo -n "$Package_Folder_Name" | sed -e "$Regex_to_Remove_Versionless_Name"`" Final_Dest_Relpath_for_Document_Stuff="${Dots_and_Versionless_Name_Only}_DOC-${Version_Only}-${CPU_TYPE}" Dest_Foldername_for_Document_Stuff="`basename $Final_Dest_Relpath_for_Document_Stuff`" Tmp_Path_for_Document_Stuff="$Tmp_Build_Location/$Dest_Foldername_for_Document_Stuff" # Apollia's note: Realized too late that these are never used: #Tmp_Path_for_Filelist_for_Document_Stuff="$Tmp_Build_Location/$Dest_Foldername_for_Document_Stuff" #Tmp_Path_for_Filelist_for_Document_Stuff="$Tmp_Path_for_Filelist_for_Document_Stuff$dot_files_string" Final_Dest_Relpath_for_Development_Stuff="${Dots_and_Versionless_Name_Only}_DEV-${Version_Only}-${CPU_TYPE}" Dest_Foldername_for_Development_Stuff="`basename $Final_Dest_Relpath_for_Development_Stuff`" Tmp_Path_for_Development_Stuff="$Tmp_Build_Location/$Dest_Foldername_for_Development_Stuff" # Apollia's note: Realized too late that these are never used: #Tmp_Path_for_Filelist_for_Development_Stuff="$Tmp_Build_Location/$Dest_Foldername_for_Development_Stuff" #Tmp_Path_for_Filelist_for_Development_Stuff="$Tmp_Path_for_Filelist_for_Development_Stuff$dot_files_string" Final_Dest_Relpath_for_Internationalization_NLS_Stuff="${Dots_and_Versionless_Name_Only}_NLS-${Version_Only}-${CPU_TYPE}" Dest_Foldername_for_Internationalization_NLS_Stuff="`basename $Final_Dest_Relpath_for_Internationalization_NLS_Stuff`" Tmp_Path_for_Internationalization_NLS_Stuff="$Tmp_Build_Location/$Dest_Foldername_for_Internationalization_NLS_Stuff" # Apollia's note: Realized too late that these are never used: #Tmp_Path_for_Filelist_for_Internationalization_NLS_Stuff="$Tmp_Build_Location/$Dest_Foldername_for_Internationalization_NLS_Stuff" #Tmp_Path_for_Filelist_for_Internationalization_NLS_Stuff="$Tmp_Path_for_Filelist_for_Internationalization_NLS_Stuff$dot_files_string" # Apollia's note: These next several lines just display the values of the above variables. #echo "Tmp_Path_for_Document_Stuff $Tmp_Path_for_Document_Stuff" #echo "Tmp_Path_for_Development_Stuff $Tmp_Path_for_Development_Stuff" #echo "Tmp_Path_for_Internationalization_NLS_Stuff $Tmp_Path_for_Internationalization_NLS_Stuff" #echo "Dots_and_Versionless_Name_Only $Dots_and_Versionless_Name_Only" #echo "Version_Only $Version_Only" #echo "apattern $apattern" #echo "Final_Dest_Relpath_for_Document_Stuff $Final_Dest_Relpath_for_Document_Stuff" #echo "Dest_Foldername_for_Document_Stuff $Dest_Foldername_for_Document_Stuff" #echo "Final_Dest_Relpath_for_Development_Stuff $Final_Dest_Relpath_for_Development_Stuff" #echo "Dest_Foldername_for_Development_Stuff $Dest_Foldername_for_Development_Stuff" #echo "Final_Dest_Relpath_for_Internationalization_NLS_Stuff $Final_Dest_Relpath_for_Internationalization_NLS_Stuff" #echo "Dest_Foldername_for_Internationalization_NLS_Stuff $Dest_Foldername_for_Internationalization_NLS_Stuff" #echo "Final_Dest_Relpath_for_Main_Package $Final_Dest_Relpath_for_Main_Package" #echo #echo "Dest foldername variables:" #echo #echo "Dest_Foldername_for_Main_Package $Dest_Foldername_for_Main_Package" #echo "Dest_Foldername_for_Document_Stuff $Dest_Foldername_for_Document_Stuff" #echo "Dest_Foldername_for_Development_Stuff $Dest_Foldername_for_Development_Stuff" #echo "Dest_Foldername_for_Internationalization_NLS_Stuff $Dest_Foldername_for_Internationalization_NLS_Stuff" #echo # Apollia's note: # # Deleting stuff makes me nervous, especially when dealing with confusing relative directory paths. # So, I commented out these lines and even replaced the remove command with "blah" (which should # do nothing). ###blah -rf "$Final_Dest_Relpath_for_Main_Package" 2>/dev/null ###blah -rf "$Final_Dest_Relpath_for_Document_Stuff" 2>/dev/null ###blah -rf "$Final_Dest_Relpath_for_Development_Stuff" 2>/dev/null ###blah -rf "$Final_Dest_Relpath_for_Internationalization_NLS_Stuff" 2>/dev/null #-------------- # Apollia's note: # # Even deleting things in /tmp/ makes me nervous. So, I took some precautions to # avoid doing the remove command if the variables below contain a slash (/), or # are equal to "." or "..". if [[ $Dest_Foldername_for_Main_Package == *"/"* ]] || [[ $Dest_Foldername_for_Main_Package == ".." ]] || [[ $Dest_Foldername_for_Main_Package == "." ]] then echo "Can't remove old temporary build location - the variable Dest_Foldername_for_Main_Package contains - $Dest_Foldername_for_Main_Package - which should never happen!" else #echo "Remove command reached for Dest_Foldername_for_Main_Package $Dest_Foldername_for_Main_Package" rm -r "/tmp/New2Dir Stuff/Temporary Build Location/$Dest_Foldername_for_Main_Package" fi if [ "$should_make_doc_package" = "yes" ]; then if [[ $Dest_Foldername_for_Document_Stuff == *"/"* ]] || [[ $Dest_Foldername_for_Document_Stuff == ".." ]] || [[ $Dest_Foldername_for_Document_Stuff == "." ]] then echo "Can't remove old temporary build location - the variable Dest_Foldername_for_Document_Stuff contains - $Dest_Foldername_for_Document_Stuff - which should never happen!" else #echo "Remove command reached for Dest_Foldername_for_Document_Stuff $Dest_Foldername_for_Document_Stuff" rm -r "/tmp/New2Dir Stuff/Temporary Build Location/$Dest_Foldername_for_Document_Stuff" fi fi if [ "$should_make_dev_package" = "yes" ]; then if [[ $Dest_Foldername_for_Development_Stuff == *"/"* ]] || [[ $Dest_Foldername_for_Development_Stuff == ".." ]] || [[ $Dest_Foldername_for_Development_Stuff == "." ]] then echo "Can't remove old temporary build location - the variable Dest_Foldername_for_Development_Stuff contains - $Dest_Foldername_for_Development_Stuff - which should never happen!" else #echo "Remove command reached for Dest_Foldername_for_Development_Stuff $Dest_Foldername_for_Development_Stuff" rm -r "/tmp/New2Dir Stuff/Temporary Build Location/$Dest_Foldername_for_Development_Stuff" fi fi if [ "$should_make_nls_package" = "yes" ]; then if [[ $Dest_Foldername_for_Internationalization_NLS_Stuff == *"/"* ]] || [[ $Dest_Foldername_for_Internationalization_NLS_Stuff == ".." ]] || [[ $Dest_Foldername_for_Internationalization_NLS_Stuff == "." ]] then echo "Can't remove old temporary build location - the variable Dest_Foldername_for_Internationalization_NLS_Stuff contains - $Dest_Foldername_for_Internationalization_NLS_Stuff - which should never happen!" else #echo "Remove command reached for Dest_Foldername_for_Internationalization_NLS_Stuff $Dest_Foldername_for_Internationalization_NLS_Stuff" rm -r "/tmp/New2Dir Stuff/Temporary Build Location/$Dest_Foldername_for_Internationalization_NLS_Stuff" fi fi ###################################################################### # # Apollia's note: Stage 4 # # Ask User Whether to Build Packages at Their Final Locations or # inside /tmp/ # # should_skip_building_packages_at_tmp="no" echo echo Change_Text_Color_to_ $green_text_color echo -n "Stage 4 - Build package$plural_or_not inside /tmp/ or at final destination?" Change_Text_Color_to_ $white_text_color echo echo echo "By default, this script will build your package$plural_or_not inside the /tmp/ folder." echo echo "An advantage of that is: if your /tmp/ folder is inside a RAM disk, building" echo "things there avoids making your physical disk do a lot of unnecessary work." echo echo "However, if you have a full installation of Puppy, then, things written to /tmp/" echo "will probably be written to your physical disk. So, in that case," echo "you might as well just build the package$plural_or_not at $their_or_its final destination to" echo "begin with, since it will be less work for your physical disk than unnecessarily" echo "copying stuff from one part of your physical disk to another part." echo echo "If you're running Puppy via a live disc or a frugal installation with no" echo "Pupsave file, most likely /tmp/ is in a RAM disk." echo echo "But, if you don't have enough RAM, you might want to build things on your" echo "physical disk anyway, even if your /tmp/ is in a RAM disk." echo echo "To have your package$plural_or_not built in /tmp/, just press ENTER." echo echo "Or, to have your package$plural_or_not built at $their_or_its final destination, press any" echo "character on the keyboard, then ENTER." echo echo "(The build won't happen immediately after you answer this - you'll be asked" echo "for confirmation later, after a few more questions.)" echo echo -n "Type response here: " read User_Reply [ ! "$User_Reply" = "" ] && should_skip_building_packages_at_tmp="yes" # @@@@ Construction_Path_for_Main_Package="$Tmp_Path_for_Main_Package" Construction_Path_for_Document_Stuff="$Tmp_Path_for_Document_Stuff" Construction_Path_for_Development_Stuff="$Tmp_Path_for_Development_Stuff" Construction_Path_for_Internationalization_NLS_Stuff="$Tmp_Path_for_Internationalization_NLS_Stuff" Construction_Path_for_Filelist_for_Main_Package="$Tmp_Path_for_Filelist_for_Main_Package" #echo "Construction_Path_for_Main_Package $Construction_Path_for_Main_Package" #echo "Construction_Path_for_Document_Stuff $Construction_Path_for_Document_Stuff" #echo "Construction_Path_for_Development_Stuff $Construction_Path_for_Development_Stuff" #echo "Construction_Path_for_Internationalization_NLS_Stuff $Construction_Path_for_Internationalization_NLS_Stuff" #echo "Final_Dest_Relpath_for_Document_Stuff $Final_Dest_Relpath_for_Document_Stuff" #echo "Dest_Foldername_for_Document_Stuff $Dest_Foldername_for_Document_Stuff" #echo "Final_Dest_Relpath_for_Development_Stuff $Final_Dest_Relpath_for_Development_Stuff" #echo "Dest_Foldername_for_Development_Stuff $Dest_Foldername_for_Development_Stuff" #echo "Final_Dest_Relpath_for_Internationalization_NLS_Stuff $Final_Dest_Relpath_for_Internationalization_NLS_Stuff" if [ "$should_skip_building_packages_at_tmp" = "yes" ]; then # echo "SHOULD SKIP BUILDING PACKAGES AT TMP!" Construction_Path_for_Main_Package="$Final_Dest_Relpath_for_Main_Package" Construction_Path_for_Document_Stuff="$Final_Dest_Relpath_for_Document_Stuff" Construction_Path_for_Development_Stuff="$Final_Dest_Relpath_for_Development_Stuff" Construction_Path_for_Internationalization_NLS_Stuff="$Final_Dest_Relpath_for_Internationalization_NLS_Stuff" #Construction_Path_for_Filelist_for_Main_Package="$Final_Dest_Relpath_for_Filelist_for_Main_Package" Construction_Path_for_Filelist_for_Main_Package="$Tmp_Path_for_Filelist_for_Main_Package" #echo "Construction_Path_for_Main_Package $Construction_Path_for_Main_Package" # echo "Construction_Path_for_Document_Stuff $Construction_Path_for_Document_Stuff" #echo "Construction_Path_for_Development_Stuff $Construction_Path_for_Development_Stuff" #echo "Construction_Path_for_Internationalization_NLS_Stuff $Construction_Path_for_Internationalization_NLS_Stuff" #echo "Construction_Path_for_Filelist_for_Main_Package $Construction_Path_for_Filelist_for_Main_Package" # Apollia's note: Realized too late that these are never used: #Construction_Path_for_Filelist_for_Document_Stuff="$Final_Dest_Relpath_for_Filelist_for_Document_Stuff" #Construction_Path_for_Filelist_for_Development_Stuff="$Final_Dest_Relpath_for_Filelist_for_Development_Stuff" #Construction_Path_for_Filelist_for_Internationalization_NLS_Stuff="$Final_Dest_Relpath_for_Filelist_for_Internationalization_NLS_Stuff" fi #else # Construction_Path_for_Main_Package="$Tmp_Path_for_Main_Package" # Construction_Path_for_Document_Stuff="$Tmp_Path_for_Document_Stuff" # Construction_Path_for_Development_Stuff="$Tmp_Path_for_Development_Stuff" # Construction_Path_for_Internationalization_NLS_Stuff="$Tmp_Path_for_Internationalization_NLS_Stuff" # Construction_Path_for_Filelist_for_Main_Package="$Tmp_Path_for_Filelist_for_Main_Package" # Apollia's note: Realized too late that these are never used: #Construction_Path_for_Filelist_for_Document_Stuff="$Tmp_Path_for_Filelist_for_Document_Stuff" #Construction_Path_for_Filelist_for_Development_Stuff="$Tmp_Path_for_Filelist_for_Development_Stuff" #Construction_Path_for_Filelist_for_Internationalization_NLS_Stuff="$Tmp_Path_for_Filelist_for_Internationalization_NLS_Stuff" #fi #-------------- ###################################################################### # # Apollia's note: Stage 4.5 # # Ask User Whether Completed Packages Should Be Left in /tmp/ # or Copied to Non-/tmp/ Location # # # This only gets asked if the user didn't decide to skip building # packages in /tmp/. should_leave_built_packages_at_tmp="yes" if [ ! "$should_skip_building_packages_at_tmp" = "yes" ]; then echo echo Change_Text_Color_to_ $green_text_color echo "Stage 4.5 - Copy completed package$plural_or_not to non-/tmp/ final destination" echo "or leave $them_or_it in /tmp/?" Change_Text_Color_to_ $white_text_color echo echo "Once your package$plural_or_not $is_or_are finished building, you can either have $them_or_it" echo "copied automatically from /tmp/ to $their_or_its final destination, or, you" echo "you can just leave $them_or_it in /tmp/." echo echo "To leave your completed package$plural_or_not in /tmp/, just press ENTER." echo echo "Or, if you'd rather have your package$plural_or_not automatically copied to $their_or_its" echo "final destination after building is complete, press any character on" echo "the keyboard, then ENTER." echo echo "(The build won't happen immediately after you answer this - you'll be asked" echo "for confirmation after a few more questions.)" echo echo -n "Type response here: " read User_Reply [ ! "$User_Reply" = "" ] && should_leave_built_packages_at_tmp="no" fi ###################################################################### # # Apollia's note: Stage 5 # # Ask User Whether to Make .pet File Automatically After Build # # should_skip_making_pet_files_after_build="yes" echo echo Change_Text_Color_to_ $green_text_color echo "Stage 5 - Make .pet file$plural_or_not after building package$plural_or_not?" Change_Text_Color_to_ $white_text_color echo echo "Once the package$plural_or_not $is_or_are built, do you want to automatically start dir2pet" echo "to make $a_or_some .pet$plural_or_not file$plural_or_not?" echo echo "Some reasons not to run dir2pet automatically are because you might want to" echo "remove files you don't need, add files you do need, add a" echo "pinstall.sh script which runs when the .pet is installed, or a" echo "puninstalls.h script which runs when the .pet is uninstalled." echo echo "You can always run dir2pet manually. Just go to the directory containing" echo "your package, and do this:" echo #echo "# cd ${Relpath_Dots_Only_for_Packages}" echo " dir2pet $Dest_Foldername_for_Main_Package" echo echo "If you want to automatically create $a_or_some .pet file$plural_or_not after the package$plural_or_not $is_or_are built," echo "press any character on the keyboard, then ENTER." echo echo "Or, to skip making any .pet file$plural_or_not, just press ENTER only." echo echo -n "Type response here: " read User_Reply [ ! "$User_Reply" = "" ] && should_skip_making_pet_files_after_build="no" ###################################################################### # # Apollia's note: Stage 6 # # Ask User Whether to Make .sfs File Automatically After Build # # should_skip_making_sfs_files_after_build="yes" echo echo Change_Text_Color_to_ $green_text_color echo "Stage 6 - Make .sfs file$plural_or_not after building package$plural_or_not?" Change_Text_Color_to_ $white_text_color echo echo "After the package$plural_or_not $is_or_are built, do you want to automatically" echo "make $them_or_it into $an_or_some .sfs file$plural_or_not?" echo echo "Some reasons not to do that automatically are because you might want to" echo "remove files you don't need, or add files you do need." echo echo "You can always run mksquashfs manually. Just go to the directory containing" echo "your package, and do this:" echo #echo "# cd ${Relpath_Dots_Only_for_Packages}" echo "# mksquashfs $Dest_Foldername_for_Main_Package $Dest_Foldername_for_Main_Package.sfs -noappend" echo echo "If you want to automatically create $an_or_some .sfs file$plural_or_not after the package$plural_or_not $is_or_are built," echo "press any character on the keyboard, then ENTER." echo echo "Or, to skip making any .sfs file$plural_or_not, just press ENTER only." echo echo -n "Type response here: " read User_Reply [ ! "$User_Reply" = "" ] && should_skip_making_sfs_files_after_build="no" ###################################################################### # # Apollia's note: Stage 7 # # Before Proceeding, Ask User to Confirm # # Here, the user has one last chance to quit before new2dir starts # to build the software and packages. echo echo Change_Text_Color_to_ $green_text_color echo -en "Stage 7 - Proceed with building the package$plural_or_not?" Change_Text_Color_to_ $white_text_color echo echo echo "The following command line is about to be executed:" echo echo "# installwatch -o /tmp/pkginstall.list ${@}" echo echo "That logs all file activity to:" echo " /tmp/pkginstall.list" echo echo "This script will then determine all newly created directories" echo "and files and create the following package folder$plural_or_not, which" echo "will contain all the new files:" echo echo " $Construction_Path_for_Main_Package" if [ "$should_make_doc_package" = "yes" ]; then echo " $Construction_Path_for_Document_Stuff" fi if [ "$should_make_dev_package" = "yes" ]; then echo " $Construction_Path_for_Development_Stuff" fi if [ "$should_make_nls_package" = "yes" ]; then echo " $Construction_Path_for_Internationalization_NLS_Stuff" fi if [ "$should_skip_building_packages_at_tmp" = "yes" ]; then echo echo "The package folder$plural_or_not $is_or_are not going to be built in /tmp/." else if [ "$should_leave_built_packages_at_tmp" = "yes" ]; then echo echo "After being built, the package folder$plural_or_not will be left in /tmp/ rather than" echo "moved to $their_or_its final destination$plural_or_not." else echo echo "After being built, the package folder$plural_or_not will be moved to $their_or_its final" echo "destination$plural_or_not at:" echo " $Final_Dest_Relpath_for_Main_Package" if [ "$should_make_doc_package" = "yes" ]; then echo " $Final_Dest_Relpath_for_Document_Stuff" fi if [ "$should_make_dev_package" = "yes" ]; then echo " $Final_Dest_Relpath_for_Development_Stuff" fi if [ "$should_make_nls_package" = "yes" ]; then echo " $Final_Dest_Relpath_for_Internationalization_NLS_Stuff" fi fi fi echo if [ "$should_skip_making_pet_files_after_build" = "yes" ]; then echo "No .pet file$plural_or_not will be created." else echo ".pet file$plural_or_not will be created automatically after build." fi echo if [ "$should_skip_making_sfs_files_after_build" = "yes" ]; then echo "No .sfs file$plural_or_not will be created." else echo ".sfs file$plural_or_not will be created automatically after build." fi echo echo "When building is complete, you'll be able to find a list of the" echo "installed files in the ${Dest_Foldername_for_Main_Package}.files file, just outside" echo "the completed package's folder." echo echo "To continue, press ENTER key." echo echo "Or, to quit: either press Ctrl-C, or press any character on the keyboard" echo -n "then ENTER. Type response here: " read User_Reply [ ! "$User_Reply" = "" ] && exit # Apollia's note: # # If the user's reply is anything other than a blank string, the script exits. if [ "$should_skip_building_packages_at_tmp" = "yes" ]; then mkdir -p "$Final_Dest_Relpath_for_Main_Package" if [ "$should_make_doc_package" = "yes" ]; then mkdir -p "$Final_Dest_Relpath_for_Document_Stuff" fi if [ "$should_make_dev_package" = "yes" ]; then mkdir -p "$Final_Dest_Relpath_for_Development_Stuff" fi if [ "$should_make_nls_package" = "yes" ]; then mkdir -p "$Final_Dest_Relpath_for_Internationalization_NLS_Stuff" fi fi installwatch -o /tmp/pkginstall.list ${@} #sync # Apollia's note: I think sync is partly the cause of my disk being # made excessively busy. # # # About "sync": # # http://linux.die.net/man/1/sync # # Quoted from there: # # "sync - flush file system buffers" # # [...] # # "Force changed blocks to disk, update the super block." # # # Apollia's note: sync is used many times, including during a loop. # # So, I commented out all of the places it's used. # Comments not by Apollia: # # create list of installed files... # v2.17 bug, if sometimes logs files in the pkg installing from, have added # filter out $full_parentdirs_of_the_current_working_dir... # BUGPATTERN='&'"$full_parentdirs_of_the_current_working_dir" # no, just filter out /mnt and /initrd... # Not commented out by Apollia: #cat /tmp/pkginstall.list | grep '#success$' | tr -s '\t' | tr '&' ' ' | tr '\t' '&' | grep '^[345]&open&' | grep --extended-regexp -v '&/dev/tty&|&/dev/null&|&/root/\.packages/|&/tmp/|&/root/\.icewm/|&/proc/|&/sys/|DotPupTmpDir|/\.myownmenuerc' | grep -E -v '&/initrd|&/mnt/' | cut -f 3 -d '&' > ${Relpath_Dots_Only_for_Packages}/${Dest_Foldername_for_Main_Package}.files cat /tmp/pkginstall.list | grep '#success$' | tr -s '\t' | tr '&' ' ' | tr '\t' '&' | egrep '^[345]&open&|^0&chmod&' | grep --extended-regexp -v '&/dev/tty&|&/dev/null&|&/root/\.packages/|&/tmp/|&/root/\.icewm/|&/proc/|&/sys/|DotPupTmpDir|/\.myownmenuerc' | grep -E -v '&/initrd|&/mnt/|&/media/|&/apmnt/|&/root/00-ApWorkspace' | cut -f 3 -d '&' | sort -u > "$Construction_Path_for_Filelist_for_Main_Package" # Note by Apollia: # # OK, I'll try to interpret what this complicated command line seems to doing. # Apologies if I got anything wrong. # # Looks like the overall point of the above is to build a list of files the rest of this script # will read from. # # # It looks like it first tries to read in the contents of /tmp/pkingstall.list. # (/tmp/pkginstall.list is a file generated by the above-used "installwatch" command.) # # Then, it uses grep to filter out all lines except those ending in the string '#success' (without quotes). # # Then, it uses tr with the -s option (short for --squeeze-repeats) to squash down repeated tab characters into just 1 tab. # # Then, it uses tr to find ampersands (&) and replace them with spaces. # # Then, it uses tr to replace all remaining tabs with ampersands (&). # # Then, it runs grep to look for lines which start with the numbers 3, 4, or 5, and then are followed by # the word "open" sandwiched between two ampersands (which were the replacement for tabs in the original list). # # # Then grep with the extended regex (regular expression) option is run, along with the -v option # (short for --invert-match) which makes it so grep will reverse what it otherwise would have done, # and find things that _don't_ match what the regex is looking for. # # I think the purpose of the above is to filter out the items grep is looking for. # # So, the regex appears to be looking for any among a lot of path names, sometimes with ampersands around # or preceding them: # # &/dev/tty& # &/dev/null& # &/root/.packages/ # &/tmp/ # &/root/.icewm # &/proc/ # &/sys # # And these two paths not enclosed in ampersands nor even slashes (/): # # DotPupTmpDir # .myownmenuerc # # With the grep -v option (short for --invert-match) in use, that means lines containing those # paths get weeded out. # # # The grep after that, also with extended regex capabilities and also using -v (short for --invert-match), # looks for just these 5 things: # # &/initrd # &/mnt/ # # &/media/ \___ I, Apollia, added these 3. /media/ is the default mountpoint parentdir in LH64_602_B2, # &/apmnt/ / /apmnt/ is where I like to mount my TrueCrypt volumes, and /root/00-ApWorkspace/ is where # &/root/00-ApWorkspace / I like to build software packages in my RAM disk, and I don't want clutter from any of # them ending up in my .pet or .sfs files. I'm not sure clutter would result from those, # but here they are filtered out just in case. # # # After the greps, a cut is done. -f is short for --fields, so 3 means only the third field # is selected. -d is short for --delimiter, so & is used instead of the default (a tab) as # the delimiter for fields. # # Then, a sort -u (short for --unique) is done, which I assume gets rid of any duplicate lines. # # # At the end of it all, the final result of all that stuff is written to a file. # # That file is either at the final destination for the package, or somewhere in /tmp/, # depending on what the user chose. # Comments not by Apollia: 120220 120602 #...list will only have created files, not created directories, so an empty # directory won't get recorded. # End of comments not by Apollia. # Apollia's note: # # About "cat": # # http://linux.die.net/man/1/cat # # # About "grep": # # http://linux.die.net/man/1/grep # # # About "tr": # # http://linux.die.net/man/1/tr # # # According to http://linux.die.net/man/1/egrep - # # "egrep is the same as grep -E." # # And grep -E is: # # "-E, --extended-regexp # Interpret PATTERN as an extended regular expression (ERE, see below). # (-E is specified by POSIX .)" # # About "cut": # # http://linux.die.net/man/1/cut # # # About "sort": # # http://linux.die.net/man/1/sort # Apollia's note, 20:33:58 02/24/2015. # # /tmp/pkginstall.list is a file generated by the above-used "installwatch" command. # # I don't know why sometimes you can't open that file in a text editor like Geany (though # fortunately, often you can). # # When you can't, even doing "cat /tmp/pkginstall.list > /root/test.txt" somehow # doesn't result in a readable text file, even though you can read pkginstall.list's # contents in a terminal window using the cat command without the > to redirect output # to a file. # # Doing the command "file pkginstall.list" results in this not so informative # output: # # pkginstall.list: data # # About "file": # # http://linux.die.net/man/1/file # # # Fortunately, you can generate a readable text file if you do this: # # cat /tmp/pkginstall.list | grep '#success$' > /root/test.txt # # # # ************** DON'T DO THIS: ************** # # cat /tmp/pkginstall.list | grep * > /root/test.txt # # In LH64_602_B2, that consumed all of my RAM in seconds, though fortunately it didn't crash my # entire system, and I was able to get the RAM back just by deleting the # output file that command line created: /root/test.txt # # # ---------------------------------------------------------------------------- # Apollia's note: # # It looks like the next few lines starting with cat are very similar to the # line I just analyzed above, except they deal with directories being made, # symlinks, and renames/moves. # Comment not by Apollia: # bad if we miss out installing an empty directory... cat /tmp/pkginstall.list | grep '#success$' | tr -s '\t' | tr '&' ' ' | tr '\t' '&' | grep '^0&mkdir&' | grep --extended-regexp -v '&/dev/tty&|&/dev/null&|&/root/\.packages/|&/tmp/|&/root/\.icewm/|&/proc/|&/sys/|DotPupTmpDir|/\.myownmenuerc' | grep -E -v '&/initrd|&/mnt/|&/media/|&/apmnt/' | cut -f 3 -d '&' | sed -e 's/^\/\//\//g' > "$Construction_Path_for_Filelist_for_Main_Package$dot_dirs_string" # Apollia's note: # # Looks like the sed regex maybe replaces // at the beginning of a string with a single / ? # # And, this line creates this file: # $Construction_Path_for_Filelist_for_Main_Package$dot_dirs_string #sync # Sync commented out by Apollia # Comment not by Apollia: #pick up created symlinks... cat /tmp/pkginstall.list | grep '#success$' | tr -s '\t' | tr '&' ' ' | tr '\t' '&' | grep '^0&symlink&' | grep --extended-regexp -v '&/dev/tty&|&/dev/null&|&/root/\.packages/|&/tmp/|&/root/\.icewm/|&/proc/|&/sys/|DotPupTmpDir|/\.myownmenuerc' | grep -E -v '&/initrd|&/mnt/|&/media/|&/apmnt/' | cut -f 4 -d '&' >> "$Construction_Path_for_Filelist_for_Main_Package" # >> ${Relpath_Dots_Only_for_Packages}/${Dest_Foldername_for_Main_Package}.files #Apollia's note: # # This line appends data to this file: # $Construction_Path_for_Filelist_for_Main_Package #sync # Sync commented out by Apollia # Comment not by Apollia: # problem if there is a post-install script that moves or renames a file... cat /tmp/pkginstall.list | grep '#success$' | tr -s '\t' | tr '&' ' ' | tr '\t' '&' | grep '^0&rename&' | grep --extended-regexp -v '&/dev/tty&|&/dev/null&|&/root/\.packages/|&/tmp/|&/root/\.icewm/|&/proc/|&/sys/|DotPupTmpDir|/\.myownmenuerc' | grep -E -v '&/initrd|&/mnt/|&/media/|&/apmnt/' | cut -f 3,4 -d '&' | tr '\n' ' ' > "$Construction_Path_for_Filelist_for_Main_Package$dot_moved_string" # Apollia's note: # # Tis line creates this file: # $Construction_Path_for_Filelist_for_Main_Package$dot_moved_string #echo "Cat moved files?" #cat "$Construction_Path_for_Filelist_for_Main_Package$dot_moved_string" iteration=1 #dot_copy_string=".copy" #cp -f "$Construction_Path_for_Filelist_for_Main_Package" "$Construction_Path_for_Filelist_for_Main_Package$dot_copy_string" #find out if any installed file got moved/renamed... if [ -s "$Construction_Path_for_Filelist_for_Main_Package$dot_moved_string" ]; # Apollia's note: # # -s means "file is not zero size", according to: # # http://tldp.org/LDP/abs/html/fto.html then for Line_About_A_Moved_File in `cat "$Construction_Path_for_Filelist_for_Main_Package$dot_moved_string"` # Apollia's note: # # OK, I guess this just goes through the file (...)".files.moved" file line by line, and # puts each line into the variable Line_About_A_Moved_File. do #echo "Current line: Line_About_A_Moved_File $Line_About_A_Moved_File " #echo "Current iteration: $iteration" Orig_Location_of_Moved_File="`echo -n "$Line_About_A_Moved_File" | cut -f 1 -d '&'`" New_Location_of_Moved_File="`echo -n "$Line_About_A_Moved_File" | cut -f 2 -d '&'`" echo "Orig_Location_of_Moved_File $Orig_Location_of_Moved_File" echo "New_Location_of_Moved_File $New_Location_of_Moved_File " #grep -v "$Orig_Location_of_Moved_File" ${Relpath_Dots_Only_for_Packages}/${Dest_Foldername_for_Main_Package}.files > /tmp/${Dest_Foldername_for_Main_Package}.files grep -v --fixed-strings "$Orig_Location_of_Moved_File" "$Construction_Path_for_Filelist_for_Main_Package" > "$Construction_Path_for_Filelist_for_Main_Package$dot_tempdup_string" # Apollia's note: Searches for the original location of the moved file in the file list, # then outputs the results - with the orig location filtered out - to the tempdup (temporary # duplicate - slightly misnamed since it's not quite identical) file list. #cp -f "$Construction_Path_for_Filelist_for_Main_Package$dot_tempdup_string" "$Construction_Path_for_Filelist_for_Main_Package$iteration" # Apollia's note: moves the tempdup file list to overwrite the original file list. #echo "Echoing out to file: $New_Location_of_Moved_File" echo "$New_Location_of_Moved_File" >> "$Construction_Path_for_Filelist_for_Main_Package" # Apollia's note: Adds the new location of the moved file to the file list. #sync # Sync commented out by Apollia #mv -f /tmp/${Dest_Foldername_for_Main_Package}.files ${Relpath_Dots_Only_for_Packages}/${Dest_Foldername_for_Main_Package}.files # Apollia's note: # # Commented out that mv line too. # # I don't think there's any need to move the file from /tmp/ to the physical disk # on every loop iteration. That probably contributed to my disk being made # excessively busy. let "iteration = $iteration + 1" done fi ########################################## # # # Start of function # # # Remove_from_File_List_() # # Remove_from_File_List_() { # Apollia's note: It seems argument $1 is a string containing a file path # to be deleted from the file list located in this text file: # # $Construction_Path_for_Filelist_for_Main_Package # # # Here's the original comment, not by Apollia: # # $1 is file to remove, as doesn't exist. grep -v "$1" "$Construction_Path_for_Filelist_for_Main_Package" > "$Construction_Path_for_Filelist_for_Main_Package$dot_tempdup_string" # Apollia's note: # # From grep's documentation at: # http://linux.die.net/man/1/grep # # "-v, --invert-match # Invert the sense of matching, to select non-matching lines. (-v is specified by POSIX .)" # # # So, it looks like the above grep line matches everything that _isn't_ argument $1, # and overwrites the file list in /tmp/ with the new list free of argument $1. mv -f "$Construction_Path_for_Filelist_for_Main_Package$dot_tempdup_string" "$Construction_Path_for_Filelist_for_Main_Package" # Apollia's note: # # About "mv": # # http://linux.die.net/man/1/mv # # "-f, --force # do not prompt before overwriting" # # # Basically just a name change from (Dest_Foldername_for_Main_Package).files.tmp # to (Dest_Foldername_for_Main_Package).files. # # I guess the move has to be done because you shouldn't overwrite a file while # you're reading from it at the same time. echo " ...${1} has been deleted from the files list." } # # # End of function # # Remove_from_File_List_() # ########################################################### #sync # Sync commented out by Apollia # Comment not by Apollia: # Remove_from_File_List_() uses this... #cp -af ${Relpath_Dots_Only_for_Packages}/${Dest_Foldername_for_Main_Package}.files /tmp/${Dest_Foldername_for_Main_Package}.files # Apollia's note: I prefer to leave the file list in /tmp/ for as long as possible, so, I commented out # the above since it's too early to copy it to the physical disk. # # # Apollia's note: # # About cp: # # http://linux.die.net/man/1/cp # 06:13:19 03/16/2015. Comment not by Apollia: #fix for empty directories... cat "$Construction_Path_for_Filelist_for_Main_Package$dot_dirs_string" | while read A_NEW_DIR do [ "`ls -1 $A_NEW_DIR`" = "" ] && mkdir -p "${Construction_Path_for_Main_Package}${A_NEW_DIR}" done # Comment not by Apollia: #...a post-install script could delete files, which Remove_from_File_List_ fixes. #cat ${Relpath_Dots_Only_for_Packages}/${Dest_Foldername_for_Main_Package}.files | echo echo echo cat "$Construction_Path_for_Filelist_for_Main_Package" | # Apollia's note: # The above reads in the list of files. Since there's a pipe at the end of the line, I guess # that makes it so the result of the cat command (the file list that was read in) is passed # on to the while loop that follows. while read Line_About_a_File do Current_Filename="`basename "$Line_About_a_File"`" Parentdirs_of_Current_File="`dirname "$Line_About_a_File"`" #echo "Current_Filename $Current_Filename" #echo "Parentdirs_of_Current_File $Parentdirs_of_Current_File" echo "Processing ${Line_About_a_File}" # Comment not by Apollia: # strip the file... if [ ! -h "$Line_About_a_File" ]; then #make sure it isn't a symlink # Comment not by Apollia # Apollia's note: # # According to http://tldp.org/LDP/abs/html/fto.html - # # -h tests whether something is a symlink. [ ! "`file "$Line_About_a_File" | grep 'ELF' | grep 'shared object'`" = "" ] && strip --strip-debug "$Line_About_a_File" # Apollia's note: # # About "file": # # http://linux.die.net/man/1/file # # The file command gives output like this: # # # file "new2dir" # new2dir: POSIX shell script, ASCII text executable, with very long lines # # # About "strip": # http://linux.die.net/man/1/strip # # A more basic intro: # http://www.thegeekstuff.com/2012/09/strip-command-examples/ # # Here's a sort of related amusing page: http://www.muppetlabs.com/~breadbox/software/tiny/teensy.html # # # So, it looks like the above command line tries to get info about the file whose location is contained in # Line_About_a_File, by using the "file" command. Then the output of the "file" command is searched for # "ELF". # # About ELF: # http://en.wikipedia.org/wiki/Executable_and_Linkable_Format # # Then, the output of the ELF search is searched, to filter out any lines containing "shared object". # # Hmm, then there's than exclamation point at the beginning which means "not"... so, anyway, not # sure exactly what's going on. # # But anyway, if some condition stated by that stuff in brackets in met, then, only in that # case, does the "strip" command get run. # # I guess maybe it means - 'if it's not the case that the result of doing the 'file' command and those # greps equals "" (a blank string), then, proceed with the strip command'? # # So, in other words, if grep finds some lines containing "shared object", it proceeds with the strip # command? [ ! "`file "$Line_About_a_File" | grep 'ELF' | grep 'executable'`" = "" ] && strip --strip-unneeded "$Line_About_a_File" # Apollia's note: # # Similar to the line just before it which I analyzed above. fi # sync # Sync commented out by Apollia if [ "$should_make_nls_package" = "yes" ]; then # Comment not by Apollia: # find out if this is an international language file... if [ ! "`echo -n "$Line_About_a_File" | grep --extended-regexp '/locale/|/nls/|/i18n/'`" = "" ]; # Apollia's note: # # OK, another one of these kinds of lines. Seems overly convoluted, but maybe it has to be done that way # for some reason? # # I guess this just amounts to: if grep finds that Line_About_a_File contains either /locale/ or /nls/ # or /il8n/, the below if block should be executed. then mkdir -p "${Construction_Path_for_Internationalization_NLS_Stuff}/${Parentdirs_of_Current_File}" # Apollia's note: # # About "mkdir": # # http://linux.die.net/man/1/mkdir # # On the -p option: # # "make parent directories as needed" cp -af "$Line_About_a_File" "${Construction_Path_for_Internationalization_NLS_Stuff}/${Parentdirs_of_Current_File}/" 2>/dev/null # Apollia's note: # # About "2>/dev/null": # http://askubuntu.com/questions/350208/what-does-2-dev-null-mean # # Quoted from there: # # "The > operator redirects the output usually to a file but it can be to a device. # You can also use >> to append. # # If you don't specify a number then the standard output stream is assumed but you # can also redirect errors # # > file redirects stdout to file # 1> file redirects stdout to file # 2> file redirects stderr to file # &> file redirects stdout and stderr to file # # /dev/null is the null device it takes any input you want and throws it away. # It can be used to suppress any output." # Apollia's note: # # About "cp": # # http://linux.die.net/man/1/cp # # The quoted bits below are from there. # # # On the -f option (short for "--force"): # # "if an existing destination file cannot be opened, remove it and try again # (redundant if the -n option is used)" # # # On the -a option (short for "--archive"): # # "same as -dR --preserve=all" # # # On the -d option: # # "same as --no-dereference --preserve=links" # # (I think "links" above means symlinks.) # # # On the -R option (short for --recursive): # # "copy directories recursively" # # # On the --preserve=all option: # # "--preserve[=ATTR_LIST] # preserve the specified attributes (default: mode,ownership,timestamps), # if possible additional attributes: context, links, xattr, all" [ $? -ne 0 ] && Remove_from_File_List_ "$Line_About_a_File" # Apollia's note: # # About "$?": # # http://stackoverflow.com/questions/5163144/what-are-the-special-dollar-sign-shell-variables # https://www.gnu.org/software/bash/manual/html_node/Special-Parameters.html # # Quote: "($?) Expands to the exit status of the most recently executed foreground pipeline." # # I still am not quite sure what $? is (or is doing) exactly, here. continue # Apollia's note: rather than going through the rest of the code below in this loop, continue # starts the while loop over again with a new item. fi fi if [ "$should_make_doc_package" = "yes" ]; then # Comment not by Apollia: # find out if this is a documentation file... if [ ! "`echo -n "$Line_About_a_File" | grep --extended-regexp '/man/|/doc/|/docs/|/info/|/gtk-doc/|/faq/|/manual/|/examples/|/help/|/htdocs/'`" = "" ]; # Apollia's note: # # Looks like this means: if grep finds that Line_About_a_File contains either /man/ or /doc/ # or /docs/ or /info/ or /gtk-doc/ or /faq/ or /manual/ or /examples/ or /help/ or /htdocs/ , # the below if block should be executed. # # Below is pretty much the same stuff as before. then mkdir -p "${Construction_Path_for_Document_Stuff}/${Parentdirs_of_Current_File}" cp -af "$Line_About_a_File" "${Construction_Path_for_Document_Stuff}/${Parentdirs_of_Current_File}/" 2>/dev/null [ $? -ne 0 ] && Remove_from_File_List_ "$Line_About_a_File" continue fi fi if [ "$should_make_dev_package" = "yes" ]; then # Comment not by Apollia: # find out if this is development file... if [ ! "`echo -n "$Line_About_a_File" | grep --extended-regexp '/include/|/pkgconfig/|/aclocal|/cvs/|/svn/'`" = "" ]; # Apollia's note: # # I added .git and .hg (Mercurial) folders to the above. # # Looks like this means: if grep finds that Line_About_a_File contains either /include/ or /pkgconfig/ # or /aclocal or /cvs/ or /svn/ or /.hg/ or /.git/ , the below if block should be executed. then mkdir -p "${Construction_Path_for_Development_Stuff}/${Parentdirs_of_Current_File}" cp -af "$Line_About_a_File" "${Construction_Path_for_Development_Stuff}/${Parentdirs_of_Current_File}/" 2>/dev/null [ $? -ne 0 ] && Remove_from_File_List_ "$Line_About_a_File" continue fi # Comment not by Apollia: # find *.so symlink files... if [ -h "$Line_About_a_File" ]; then #-h tests for symlink if [ ! "`echo -n "$Line_About_a_File" | grep '\.so$'`" = "" ]; # Apollia's note: looks like this looks for files ending in .so then mkdir -p "${Construction_Path_for_Development_Stuff}/${Parentdirs_of_Current_File}" cp -af "$Line_About_a_File" "${Construction_Path_for_Development_Stuff}/${Parentdirs_of_Current_File}/" 2>/dev/null [ $? -ne 0 ] && Remove_from_File_List_ "$Line_About_a_File" continue fi fi # Comment not by Apollia: #find various config files... if [ ! "`echo -n "$Current_Filename" | grep --extended-regexp '\-config$|config.sh$|Conf.sh$'`" = "" ]; # Apollia's note: # # Looks like this means: if grep finds that Line_About_a_File contains a directory ending in # "-config", a file whose name ends in "config.sh", or a file whose name ends in "Conf.sh", # the below if block should be executed. then mkdir -p "${Construction_Path_for_Development_Stuff}/${Parentdirs_of_Current_File}" cp -af "$Line_About_a_File" "${Construction_Path_for_Development_Stuff}/${Parentdirs_of_Current_File}/" 2>/dev/null [ $? -ne 0 ] && Remove_from_File_List_ "$Line_About_a_File" continue fi # Comment not by Apollia: #all .a and .la files... and any stray .m4 files... if [ ! "`echo -n "$Current_Filename" | grep --extended-regexp '\.a$|\.la$|\.m4$'`" = "" ]; then mkdir -p "${Construction_Path_for_Development_Stuff}/${Parentdirs_of_Current_File}" cp -af "$Line_About_a_File" "${Construction_Path_for_Development_Stuff}/${Parentdirs_of_Current_File}/" 2>/dev/null [ $? -ne 0 ] && Remove_from_File_List_ "$Line_About_a_File" continue fi fi # Apollia's note: # Finally, the development stuff section ends. # Comment not by Apollia: # anything left over goes into the main 'executable' package... if [ "$should_make_main_package" = "yes" ]; then mkdir -p "${Construction_Path_for_Main_Package}/${Parentdirs_of_Current_File}" cp -af "$Line_About_a_File" "${Construction_Path_for_Main_Package}/${Parentdirs_of_Current_File}/" 2>/dev/null [ $? -ne 0 ] && Remove_from_File_List_ "$Line_About_a_File" fi done # Apollia's note: # # Finally, the end of the original while loop. # Comment not by Apollia: #130121 grab a .pot if it exists... #sync # Sync commented out by Apollia # 17:19:06 02/28/2015. Apollia's note: # # Commenting this stuff out, because it makes some kind of error about a unary operator come up # which I don't know how to fix. #search_pattern_to_find_pot_file="/${Versionless_Package_Folder_Name}.pot" # #if [ `grep "$search_pattern_to_find_pot_file" "$Construction_Path_for_Filelist_for_Main_Package"` = "" ]; #then # found_pot_file="$(find ${fullpath_of_the_current_working_dir}/ -type f -name "${Versionless_Package_Folder_Name}.pot" | head -n 1)" # if [ "$found_pot_file" ]; # then # mkdir -p ${Construction_Path_for_Main_Package}/usr/share/doc/nls/${Versionless_Package_Folder_Name} # cp -f "$found_pot_file" ${Construction_Path_for_Main_Package}/usr/share/doc/nls/${Versionless_Package_Folder_Name}/ # echo "/usr/share/doc/nls/${Versionless_Package_Folder_Name}/" >> /tmp/${Dest_Foldername_for_Main_Package}.files # echo "/usr/share/doc/nls/${Versionless_Package_Folder_Name}/${Versionless_Package_Folder_Name}.pot" >> /tmp/${Dest_Foldername_for_Main_Package}.files # fi #fi #sync # Sync commented out by Apollia echo echo echo "The package$plural_or_not $is_or_are finished building!" # Apollia's note: # # OK, now we're at the point where, if things are supposed to be copied to their non-tmp # final destination, we do so. # # But, if the user didn't say they wanted things copied over, we leave everything in /tmp/ . if [ "$should_skip_building_packages_at_tmp" = "no" ] then if [ "$should_leave_built_packages_at_tmp" = "no" ] then cp -ai "$Tmp_Path_for_Filelist_for_Main_Package" "$Final_Dest_Relpath_for_Filelist_for_Main_Package" cp -ai "$Tmp_Path_for_Main_Package" "$Final_Dest_Relpath_for_Main_Package" if [ "$should_make_doc_package" = "yes" ]; then cp -ai "$Tmp_Path_for_Document_Stuff" "$Final_Dest_Relpath_for_Document_Stuff" fi if [ "$should_make_dev_package" = "yes" ]; then cp -ai "$Tmp_Path_for_Development_Stuff" "$Final_Dest_Relpath_for_Development_Stuff" fi if [ "$should_make_nls_package" = "yes" ]; then cp -ai "$Tmp_Path_for_Internationalization_NLS_Stuff" "$Final_Dest_Relpath_for_Internationalization_NLS_Stuff" fi fi else # Apollia's note: Skipped building packages at tmp, so they should already be at the final destination. echo echo "Skipped building things in /tmp/, so, the package$plural_or_not should already be at $their_or_its" echo "final destination!" fi if [ "$should_skip_building_packages_at_tmp" = "no" ] then if [ "$should_leave_built_packages_at_tmp" = "no" ] then Path_to_Change_Directory_to="$Relpath_Dots_Only_for_Packages" else # Apollia's note: Else, yes, should leave built packages in /tmp/, # and that means we should build the pets and SFS files in /tmp/ too. Path_to_Change_Directory_to="$Tmp_Build_Location" fi else # Apollia's note: Should skip building packages in /tmp/. Path_to_Change_Directory_to="$Relpath_Dots_Only_for_Packages" fi cd "$Path_to_Change_Directory_to" echo "Path_to_Change_Directory_to: $Path_to_Change_Directory_to" ########################################## # # # Start of function # # # Build_Pet_Files() # # Build_Pet_Files() { echo "Time to build $a_or_some .pet file$plural_or_not!" echo "Now making .pet file from:" echo " $Dest_Foldername_for_Main_Package" dir2pet "$Dest_Foldername_for_Main_Package" # Apollia's note: # # This script waits for dir2pet to complete before proceeding with the below. echo -n "$Dest_Foldername_for_Main_Package.pet created. Press ENTER to continue: " read User_Reply if [ "$should_make_doc_package" = "yes" ]; then echo echo "Now making .pet file from:" echo " $Dest_Foldername_for_Document_Stuff" dir2pet "$Dest_Foldername_for_Document_Stuff" echo echo echo -n "$Dest_Foldername_for_Document_Stuff.pet created. Press ENTER to continue: " read User_Reply fi if [ "$should_make_dev_package" = "yes" ]; then echo echo "Now making .pet file from:" echo " $Dest_Foldername_for_Development_Stuff" dir2pet "$Dest_Foldername_for_Development_Stuff" echo echo echo -n "$Dest_Foldername_for_Development_Stuff.pet created. Press ENTER to continue: " read User_Reply fi if [ "$should_make_nls_package" = "yes" ]; then echo echo "Now making .pet file from:" echo " $Dest_Foldername_for_Internationalization_NLS_Stuff" dir2pet "$Dest_Foldername_for_Internationalization_NLS_Stuff" echo echo echo -n "$Dest_Foldername_for_Internationalization_NLS_Stuff.pet created. Press ENTER to continue: " read User_Reply fi } # # # End of function # # Build_Pet_Files() # # ########################################################### ########################################## # # # Start of function # # # Build_Sfs_Files() # # Build_Sfs_Files() { echo "Time to build $a_or_some .sfs file$plural_or_not!" mksquashfs "$Dest_Foldername_for_Main_Package" "$Dest_Foldername_for_Main_Package$dot_sfs_string" -noappend echo -n "$Dest_Foldername_for_Main_Package$dot_sfs_string created. Press ENTER to continue: " echo echo "Now making .sfs file from:" echo " $Dest_Foldername_for_Main_Package" read User_Reply if [ "$should_make_doc_package" = "yes" ]; then echo echo "Now making .sfs file from:" echo " $Dest_Foldername_for_Document_Stuff" mksquashfs "$Dest_Foldername_for_Document_Stuff" "$Dest_Foldername_for_Document_Stuff$dot_sfs_string" -noappend echo echo echo -n "$Dest_Foldername_for_Document_Stuff$dot_sfs_string created. Press ENTER to continue: " read User_Reply fi if [ "$should_make_dev_package" = "yes" ]; then echo echo "Now making .sfs file from:" echo " $Dest_Foldername_for_Development_Stuff" mksquashfs "$Dest_Foldername_for_Development_Stuff" "$Dest_Foldername_for_Development_Stuff$dot_sfs_string" -noappend echo echo echo -n "$Dest_Foldername_for_Development_Stuff$dot_sfs_string created. Press ENTER to continue: " read User_Reply fi if [ "$should_make_nls_package" = "yes" ]; then echo echo "Now making .sfs file from:" echo " $Dest_Foldername_for_Internationalization_NLS_Stuff" mksquashfs "$Dest_Foldername_for_Internationalization_NLS_Stuff" "$Dest_Foldername_for_Internationalization_NLS_Stuff$dot_sfs_string" -noappend echo echo echo -n "$Dest_Foldername_for_Internationalization_NLS_Stuff$dot_sfs_string created. Press ENTER to continue: " read User_Reply fi } # # # End of function # # Build_Sfs_Files() # # ########################################################### if [ "$should_skip_making_sfs_files_after_build" = "no" ] then Build_Sfs_Files fi if [ "$should_skip_making_pet_files_after_build" = "no" ] then Build_Pet_Files fi # Apollia's note: Now, after building, if the user opted to skip # building a pet or sfs file automatically, we pause and ask the user # again if they'd like to build an .sfs or .pet file. ###################################################################### # # Apollia's note: Stage 8 # # Ask User Whether to Make .sfs File Now # # should_skip_making_sfs_files_now="yes" if [ "$should_skip_making_sfs_files_after_build" = yes ] then echo echo Change_Text_Color_to_ $green_text_color echo "Stage 8 - Make .sfs file$plural_or_not now?" Change_Text_Color_to_ $white_text_color echo echo "Now that the package$plural_or_not $is_or_are built, do you want" echo "to make $a_or_some .sfs$plural_or_not file$plural_or_not?" echo echo "Some reasons not to yet are because you might want to" echo "remove files you don't need, or add files you do need." echo echo "You can always run mksquashfs manually. Just go to the directory containing" echo "your package, and do this:" echo #echo "# cd ${Relpath_Dots_Only_for_Packages}" echo "# mksquashfs $Dest_Foldername_for_Main_Package $Dest_Foldername_for_Main_Package.sfs -noappend" echo echo "If you want to automatically create $an_or_some .sfs file$plural_or_not now," echo "press any character on the keyboard, then ENTER." echo echo "Or, to skip making any .sfs file$plural_or_not, just press ENTER only." echo echo -n "Type response here: " read User_Reply [ ! "$User_Reply" = "" ] && should_skip_making_sfs_files_now="no" fi if [ "$should_skip_making_sfs_files_now" = "no" ] then Build_Sfs_Files fi ###################################################################### # # Apollia's note: Stage 9 # # Ask User Whether to Make .pet File Now # # should_skip_making_pet_files_now="yes" if [ "$should_skip_making_pet_files_after_build" = yes ] then echo echo Change_Text_Color_to_ $green_text_color echo "Stage 9 - Make .pet file$plural_or_not now?" Change_Text_Color_to_ $white_text_color echo echo "Now that the package$plural_or_not $is_or_are built, do you want to start dir2pet" echo "to make $a_or_some .pet$plural_or_not file$plural_or_not?" echo echo "Some reasons not to run dir2pet yet are because you might want to" echo "remove files you don't need, add files you do need, add a" echo "pinstall.sh script which runs when the .pet is installed, or a" echo "puninstalls.h script which runs when the .pet is uninstalled." echo echo "You can always run dir2pet manually. Just go to the directory containing" echo "your package, and do this:" echo #echo "# cd ${Relpath_Dots_Only_for_Packages}" echo " dir2pet $Dest_Foldername_for_Main_Package" echo echo "If you want to create $a_or_some .pet file$plural_or_not now," echo "press any character on the keyboard, then ENTER." echo echo "Or, to skip making any .pet file$plural_or_not, just press ENTER only." echo echo -n "Type response here: " read User_Reply [ ! "$User_Reply" = "" ] && should_skip_making_pet_files_now="no" fi if [ "$should_skip_making_pet_files_now" = "no" ] then Build_Pet_Files fi echo "All done! Now opening directory containing package$plural_or_not..." rox "$Path_to_Change_Directory_to" #rox "$fullpath_of_the_current_working_dir" ###END###