unMENU plug-in: Go Script Manager


Recommended Posts

Introducing v0.6... Jan 16,2009

 

 

I still need people to test this on their systems and report back to me. I have done all the testing that I can do on my system.  I can confirm operation for unRAID v4.3.3 using unmenu v1.1 with the /boot/packages/go (stock unraid). I don't anticipate any major bugs. Mostly feature requests and feature modification requests.

 

 

Details:

 

The idea behind the plug-in was to provide a way to manage appended lines in the go script.  This allows packages to be enabled and disabled for boot easily without the need to hardcode them into your go script. For instance, in my go script, I had added lines to start the unmenu interface.  This plug-in (based heavily on the package manager) will allow you to select which scripts will be invoked on start-up and disable old/obsolete scripts.  It works on both go script and /boot/custom/etc/rc.d/S10-install_custom_packages structures (in theory, I tested go file append but i do not have a rc.d/S10-install_custom_packages file structure to test, however it uses the almost identical code to the package manager to accomplish the same goals)

 

 

.CONF Files

 

This plugin uses .conf files the same way the program manager uses them, although they have been significantly simplified.  Only three lines are required.  Here is a sample "package" (note this package comes with this .conf file, just ensure that the PACKAGE_INSTALLATION lines are correct for your set-up)

PACKAGE_NAME Start unMENU
PACKAGE_DESCR Script to start unmenu at boot up.
PACKAGE_INSTALLATION nohup sh -c "while true; do awk  -W re-interval -f /boot/unmenu/unmenu.awk; done" >/dev/null 2>&1 &

where

PACKAGE_NAME <- A name that associates the script with the reason for invoking it
PACKAGE_DESCR <- describe the script in more detail (can have many lines)
PACKAGE_INSTALLATION <- lines to be executed (may have many lines).

 

The filename convention for .conf files is: *ANYNAME*-unmenu-goscript.conf (items in red are necessary).  *ANYNAME* - can be anything, try to keep it short.  You will not need to remember it. You can delete the package later from the Manager without the need to know the file name. 

 

The last line in a .conf file should be an empty line and not a PACKAGE_INSTALLATION line.

for instance this is right: (> signifies lines the cursor can be placed on)

>PACKAGE_NAME ...
>PACKAGE_DESCR ...
>PACKAGE_INSTALLATION ...
>

 

this is WRONG:

>PACKAGE_NAME ...
>PACKAGE_DESCR ...
>PACKAGE_INSTALLATION ...

 

NOTE: If you are unsure of what do to and need .conf files made for you, please post a message in this topic and I will try and create it for you ASAP.  Also, if you know of user modification that utilize the go file, then by all means post a link to the appropriate thread or post a message describing the script entries and a description of why it is invoked and I will try to make standard packages.

 

 

To use/install/upgrade:

 

INSTALL - further detail in the "installation.txt" file located in the .zip file

1. stop unmenu (In telnet/putty/console: killall -g awk)

2. place 800-unmenu-goscript*.awk in your unmenu folder on your flash drive

3. place .conf files in your package directory or directly in your unmenu folder (they will be moved to /boot/packages/ for you)

4. place .sh files in /boot/custom/bin

5. re-start unmenu

 

UPGRADE - further detail in the "installation.txt" file located in the .zip file

1. stop unmenu (In telnet/putty/console: killall -g awk)

2. delete the old version of 800-unmenu-goscript*.awk from your unMENU folder

3. place 800-unmenu-goscript*.awk in your unMENU folder on your flash drive

4. place all .confs in your package directory (it is a good idea to replace all the old stock .conf files with the new ones(included in each version release)

5. place .sh files in /boot/custom/bin

6. re-start unmenu

 

It is further advisable that you disable all packages prior to upgrading, then after the replacing old .confs with the new versions(included with every release).  After you restart unmenu, load the Go Script Manager and re-enable your previous packages.  This will ensure that you have the most up to date version of the packages.

-OR-

You can replace all the .confs and disable and re-enable all the previously selected .confs.  This will update the .auto_goscript file with the appropriate changes (if any).

 

I plan on making upgrading much easier in the future, but for now I'm focusing on planned features and any bugs that get reported.

 

USE

With unMENU started and open in a web browser, click on "Go Script Manager" plugin link in the top left corner of the unmenu interface.

 

 

Features

 

.confs

- Enable/Disable scripts defined in .conf files

- View contents of .conf files

- View active script associated with enabled .conf file

- Delete old/unused scripts (with confirmation screen for added safety)

 

go file

- View current go or S10-install_custom_packages file (system dependent)

- Back-up current go/S10-install_custom_packages file

- View backups (keeps last 10, define GO_BACKUP_DIRECTORY in unmenu_local.conf.. defaults to /boot/packages/BackupGo)

- Restore backups (with confirmation, current file gets moved to go1.bak in the backup folder)

- Delete go file backups

 

Screenshots NOTE: screenshots are from version 0.4,  There has been some change to the appearance in some of the screenshots below, but overall the look and "feel" is more or less unchanged.

 

Initial Screen

uminit.jpg

Package Enabled

unenab.jpg

Package Disabled

undisab.jpg

View .conf

umvp.jpg

View Script

umvs.jpg

Package Delete

umpdel.jpg

Package Delete Confirm

umpdelcon.jpg

View Go Script

umvgo.jpg

Go Script Backed-up

umgob.jpg

Go Script Backed-up - go same as last backup

umgob.jpg

View Go Script Backup files

umvgob.jpg

Go Script Backup Restore

umgobr.jpg

Go Script Backup Restore Confirm

umgobr2.jpg

 

 

Future Work:

 

- Fixing reported bugs

- .conf file generation in plug-in for use (adding packages by filling in fields and generating .conf files for immediate use)

- Modify .conf files to update them (changing values in scripts).

- Improve upgrading procedures for ease of use

 

 

Configurable Global Variables in unmenu_local.conf

 

- AUTO_GOSCRIPT_COMMAND <- Command to be appended to go file or S10-custom_install_package to invoke .auto_goscript files

(Defaults to AUTO_GOSCRIPT_COMMAND = cd %PACKAGE_DIRECTORY% && find . -name '*.auto_goscript' -type f -print | sort | xargs -n1 sh -c)

where %PACKAGE_DIRECTORY% is your PACKAGE_DIRECTORY as defined in your unmenu_local.conf (defaults to /boot/packages if not present in unmenu_local.conf)

 

- AUTO_GOSCRIPT_TEST <- Command to test to ensure the AUTO_GOSCRIPT_COMMAND has been appended to either the go file or S10-install_custom_packages

(Defaults to AUTO_GOSCRIPT_TEST = grep '^[^#]*\.auto_goscript')

 

- GO_BACKUP_DIRECTORY is no longer used by the Go Script Editor, it has been replaced by FILE_BACKUP_DIRECTORY used by the file editor to unionize the location of all back-ups.

 

- FILE_BACKUP_DIRECTORY <- location for storing backups creating in unmenu.

(Defaults to FILE_BACKUP_DIRECTORY = /boot/backup_files)

 

In particular, the FILE_BACKUP_DIRECTORY is probably of most interest to the average user.  This is the place where unMENU will store all the program generated file backups.  If you wish to change it, simply add the line:

FILE_BACKUP_DIRECTORY = /boot/backup_files

in your unmenu_local.conf and replace "/boot/backup_files" to whatever you would like.

NOTE THIS UNMENU_LOCAL.CONF VARIABLE IS USED BY THE unMENU FILE EDITOR AS WELL.

 

 

DISCLAIMER

 

It has been tested on my system (4.3.3) in unmenu (1.1.0) with the included .conf file (starting unmenu).  It is very unlikely that this program will do anything to harm your data on the server, but as with all user customization programs shared on this forum, USE AT YOUR OWN RISK.  You can always stop the array and spin down the drives as an extra percaution.  I have not experienced any server related problems in the many cycles of testing. (although i did crash unmenu a few times. ;) Restarting unmenu solved this problem.)

 

Cheers,

 

Matt

 

Edit - updated for new version

Link to comment
  • Replies 98
  • Created
  • Last Reply

Top Posters In This Topic

Nice first "awk" program...

 

I do have one issue with you re-defining AUTO_INSTALL_TEST in that if it is changed in the unmenu.conf file, as you have done, it will break the package manager.

 

Please define your own variable for the test, as you started to do, but commented out.  It can be added to the unmenu_local.conf.

  # AUTO_GOSCRIPT_TEST      = CONFIG["AUTO_GOSCRIPT_TEST"] ? CONFIG["AUTO_GOSCRIPT_TEST"] : "grep '^[^#]*\.auto_goscript'"
  AUTO_INSTALL_TEST     = "grep '^[^#]*\.auto_goscript'"

Besides un-commenting the one AUTO_GOSCRIPT_TEST line, I think you would only need to change your plug-in in one other place, where AUTO_INSTALL_TEST is used.

 

Other than that, glad to have you on-board.

 

I'm certain people will have ideas for improvements, but that's what is so great about rapid development tools... you get to incorporate the best of all the ideas offered.  Clearly, you have some programming background...

 

Joe L.

Link to comment

And the UnMENU momentum continues to build!

 

Nice work.  I had some thoughts awhile ago, but never found the time, to create an UnMENU plugin to edit the go file, in order to help new users add some of the performance tips, and special tools such as the powerdown script, and individual spin down controls (no longer needed).  I wasn't sure how to do it, but thought there should be a way to break the go file into its component parts, and then allow a user to specify and select which standard additions they would like to add, modify, or remove, similar to the 2 package managers.  I haven't examined your code yet.  I thought if that worked, then I could do the same for the syslinux.cfg and possibly others, let users easily manage boot options and add Joe's mods for previous versions in the boot menu.

 

I'm not completely clear on the difference between these go scripts and the other package .conf files, or what you mean with the rc.d structures.  Perhaps some further examples and samples would be helpful.

 

A minor nit, I noticed you put your UnMENU files in the root of the flash.  Many of us use a different folder, just for UnMENU files.  I don't know if it matters, but you may want to clarify step 2 of the instructions, to indicate that it goes in the user's UnMENU folder.

Link to comment

I do have one issue with you re-defining AUTO_INSTALL_TEST in that if it is changed in the unmenu.conf file, as you have done, it will break the package manager.

 

Please define your own variable for the test, as you started to do, but commented out.   It can be added to the unmenu_local.conf.

  # AUTO_GOSCRIPT_TEST      = CONFIG["AUTO_GOSCRIPT_TEST"] ? CONFIG["AUTO_GOSCRIPT_TEST"] : "grep '^[^#]*\.auto_goscript'"
  AUTO_INSTALL_TEST     = "grep '^[^#]*\.auto_goscript'"

Besides un-commenting the one AUTO_GOSCRIPT_TEST line, I think you would only need to change your plug-in in one other place, where AUTO_INSTALL_TEST is used.

 

oops, i meant to fix that before publishing the file.  Now that I know the program works, I will be working on cleaning things up.  I have the AUTO_INSTALL issue first on my to do list.  I was just so proud of my achievement, I wanted to share.... ;D

 

I'm not completely clear on the difference between these go scripts and the other package .conf files, or what you mean with the rc.d structures.  Perhaps some further examples and samples would be helpful.

 

These .conf differ only in the quantity of information needed.  I have reduced the number of required fields down to 5(name, decription, package file, installed file, installation code)... I have a plan to reduce that to 3 in a future version.  My eventual goal is for the end user to not handle the .confs at all but instead have them created/managed/deleted by the plug-in itself.

 

In terms of the go file versus rc.d structure... As far as I understand it, the norm is to have a go file appended while in the rc.d sturcture the file s10-install_custom_package needs to be append in order for the modifications to work.  This program should be able to handle both situations (although I have only tested and used the go file approach).  Truth be told, i'm not an experienced linux person and don't fully understand the difference.  The code that is used to distinguish between the two was taken directly from the package manager plug-in.

Link to comment

I'm having trouble with awk and i'm hoping someone could help....

 

i'm trying to run through the list of *-unmenu-goscript.conf files in /boot/packages/ and storing the value for FILENAME using the getline function into an array.

 

I have tried various ways of trying to get it to work.. but to no avail... in particluar I would like these two values set..

 

NOTE: You are supposed to be able to use getline without redirection to fill the variable FILENAME... But I can't figure out how to....

package_file[i] = FILENAME
package_installed[i] = PACKAGE_DIRECTORY "/" FILENAME ".auto_goscript"

and have them correspond to the other arrays containing the internal .conf file information

 

In the original code, it would go somewhere between lines 68-126 (you can see that right now it takes the information for these variables from inside the file, but i want to change those variables to be dependent on the .conf file name.)

 

thanks,

Matt

Link to comment

New version v0.4... Full of features and ready to go.  Not just a simple first awk program anymore (800+ lines of code)!

 

I will hopefully be working on some more advanced features and all reported bugs/feature requests in the next little while.

 

Please see OP for details and to download.

 

Hopefully, this catches on and becomes part of the regular unmenu release. *fingers crossed*

 

Cheers,

 

Matt

Link to comment

New version v0.4... Full of features and ready to go.  Not just a simple first awk program anymore (800+ lines of code)!

 

I will hopefully be working on some more advanced features and all reported bugs/feature requests in the next little while.

 

Please see OP for details and to download.

 

Hopefully, this catches on and becomes part of the regular unmenu release. *fingers crossed*

 

Cheers,

 

Matt

Matt,

 

You have come a long way with "awk". 

 

I just took a quick look, and I think I need to borrow a few of your ideas to add to a file-editor I've nearly got complete.  I think the two plug-ins might compliment each other.  You have a way to "view" .conf files.  I have a way to edit them from the browser...

 

I have dinner guests arriving in a few hours, so can't spend time now to go into detail, but nice work. 

 

I'm sure there will be suggestions... (but again, that is the really great thing about rapid development tools like this)    Eventually, I can see several of these plug-ins being combined, but first, let's get them working individually.  It is FAR easier to debug that way.

 

Please note, the newest version of unMENU uses a different method to start than the older "nohup while true ... loop."  Check it out.  It will warrant a different "package"

 

Joe L.

 

Joe L.

Link to comment

Please note, the newest version of unMENU uses a different method to start than the older "nohup while true ... loop."  Check it out.  It will warrant a different "package"

 

I will look into that ASAP.  I haven't had any time to update unmenu and figure out the differences (all my energies/free time have been programming this plugin.)

 

Thanks for the heads up.

 

Cheers,

 

Matt

Link to comment

Official .conf file message.  These have been tested and confirmed working as of Jan 16, 2008.  There were some issues with the first .confs released, it is best to replace them with the new ones, if you are having difficulties.

 

Start unMENU - start_unmenu.zip

 

unMENUstart-unmenu-goscript.conf - new .conf for starting unMENU v1.1 on boot

-where /boot/unmenu is the location of your unmenu folder

PACKAGE_NAME Start unMENU
PACKAGE_DESCR Script to start unmenu at boot up.
PACKAGE_INSTALLATION /boot/unmenu/uu

 

umstart-unmenu-goscript.conf - old .conf for starting unMENU V1.0.0 on boot (also for those who do not have the uu script)

-where /boot/unmenu is the location of your unmenu folder

PACKAGE_NAME Start unMENU
PACKAGE_DESCR Script to start unmenu at boot up.
PACKAGE_INSTALLATION nohup sh -c "while true; do awk  -W re-interval -f /boot/unmenu/unmenu.awk; done" >/dev/null 2>&1 &

 

 

Network Performance Tweak - net_tweak.zip

 

net_tweak_adv-unmenu-goscript.conf - uses weebotech's update_hosts script to improve samba performance.

PACKAGE_NAME Network Tweak 
PACKAGE_DESCR This tweak, discovered by RobJ, may help to increase network performance.
PACKAGE_DESCR It is designed to speed up samba requests.  
PACKAGE_DESCR <b>This version do NOT require customization to work properly.</b>
PACKAGE_DESCR This version uses a script by Weebotech to determine the hostname and IP Address and updates /etc/hosts.
PACKAGE_DESCR Find out more here: http://lime-technology.com/forum/index.php?topic=2035.msg14798#msg14798
PACKAGE_INSTALLATION /boot/custom/bin/update_hosts.sh

 

update_hosts.sh - Script by weebotech, place in /boot/custom/bin, if it does not already exists, create it. (\\flash\custom\bin\ from your network)

#!/bin/bash 
# Fixes /etc/hosts with proper hostname information
HOSTNAME=`hostname`

if grep $HOSTNAME /etc/hosts >/dev/null
   then echo "hostname: '$HOSTNAME' already in hosts. skipping"
        exit
fi

# Remove this crappy entry.
grep -v 'darkstar.example.net' < /etc/hosts > /tmp/hosts

# Get current ifconfig information and use it to get address
ifconfig | awk -vhostname="$HOSTNAME" ' { 
    # inet addr:192.168.1.178  Bcast:192.168.1.255  Mask:255.255.255.0
    # $1   $2                  $3                   $4
    if ( /inet addr:/ && /Bcast:/ && /Mask:/ ) {
        addr=$2
        gsub("addr:","",addr);
        printf("%s\t%s\n",addr,hostname);
    } 
} '  >> /tmp/hosts

if ! grep $HOSTNAME /tmp/hosts > /dev/null
   then printf "127.0.0.1\t%s\n" $HOSTNAME >> /tmp/hosts
fi

cat /tmp/hosts > /etc/hosts
rm -f /tmp/hosts

 

 

Monthly Parity Check - monthly_parity.zip

 

MonthlyParityChk-unmenu-goscript.conf - Uses Joe L's monthly_paritycheck.sh script to add entry to crontab to do a monthly parity check the first day of every month at midnight.

 

PACKAGE_NAME Monthly Parity Check
PACKAGE_DESCR Script to run a monthly parity check.
PACKAGE_INSTALLATION /boot/custom/bin/monthly_paritycheck.sh

 

monthly_paritychek.sh - Script by Joe L, place in /boot/custom/bin, if it does not already exists, create it. (\\flash\custom\bin\ from your network)

 

#!/bin/sh
crontab -l >/tmp/crontab
grep -q "/root/mdcmd check" /tmp/crontab 1>/dev/null 2>&1
if [ "$?" = "1" ]
then
    echo "# check parity on the first of every month at midnight:" >>/tmp/crontab
    echo "0 0 1 * * /root/mdcmd check 1>/dev/null 2>&1" >>/tmp/crontab
    crontab /tmp/crontab
fi

 

 

Set Read-Aheads - Set_Read-Ahead.zip

 

setra****-unmenu-goscript.conf

- There are 4 files in this package the only differenceis the value of ****.  They are 256, 512, 1024 and 2048.

PACKAGE_NAME Set Read-Ahead to ****
PACKAGE_DESCR Sets the drive Read-Ahead value to **** during boot.
PACKAGE_INSTALLATION for i in /dev/md*
PACKAGE_INSTALLATION do
PACKAGE_INSTALLATION blockdev --setra **** $i
PACKAGE_INSTALLATION done

 

Cheers,

 

Matt

Link to comment

Official .conf file message

 

unMENUstart-unmenu-goscript.conf - new .conf for starting unMENU v1.1 on boot

-where /boot/unmenu is the location of your unmenu folder

 

PACKAGE_NAME Start unMENU
PACKAGE_DESCR Script to start unmenu at boot up.
PACKAGE_INSTALLATION /boot/unmenu/uu

 

is this the change you were referring to Joe L.?

 

Matt

Yes, it is...

 

You might need two packages, one for those who do not have "uu" installed, and the other for those who do.

 

Joe L.

Link to comment

I want to check this out, but I'm not too sure how to install. 

 

These are the values of pre-existing variables in my unmenu_local.conf:

PACKAGE_DIRECTORY      = /boot/custom/packages

AUTO_INSTALL_DIRECTORY = /boot/custom/etc/rc.d

AUTO_INSTALL_FILE      = S10-install_custom_packages

 

These are the variables and values I think I need to add to my unmenu_local.conf:

#Go Script Manager Variables

AUTO_GOSCRIPT_COMMAND = "cd %PACKAGE_DIRECTORY% && find . -name '*.auto_goscript' -type f -print | sort | xargs -n1 sh -c"

AUTO_GOSCRIPT_TEST        = "grep '^[^#]*\.auto_goscript'"

GO_BACKUP_DIRECTORY      = "/boot/custom/packages/backupgo"

 

Then I beleive I only need to do the following to get things running:

 

1) copy 800-unmenu-goscriptv0.4 to my unmenu directory, which is currently /boot/unmenu

2) copy unMENUstart-unmenu-goscript.conf to /boot/custom/packages (I'll need to use the "uu" version)

3) create the directory: "/boot/custom/packages/backupgo"

4) remove the line in my current go script that starts "uu" as this package manager will install and manage this line of my go script.

 

Questions:

 

1) Did I think of everything?  Will this work, or is there something else I need to do.

2) Is there a way to use the PACKAGE_DIRECTORY variable to define the GO_BACKUP_DIRECTORY variable.  This would seem more elegant as one is a subdirectory of the other.

3) What is the "*.auto_goscript" file referenced in the AUTO_GOSCRIPT_COMMAND variable.  It looks like this file needs to be located in my PACKAGE_DIRECTORY but I don't know where it comes from.  Is it auto-generated?

4) Will the new conf variables be included in the conf files distributed with the next official release of unMenu?

 

 

Link to comment

I want to check this out, but I'm not too sure how to install. 

 

These are the values of pre-existing variables in my unmenu_local.conf:

PACKAGE_DIRECTORY      = /boot/custom/packages

AUTO_INSTALL_DIRECTORY = /boot/custom/etc/rc.d

AUTO_INSTALL_FILE      = S10-install_custom_packages

 

These are the variables and values I think I need to add to my unmenu_local.conf:

#Go Script Manager Variables

AUTO_GOSCRIPT_COMMAND = "cd %PACKAGE_DIRECTORY% && find . -name '*.auto_goscript' -type f -print | sort | xargs -n1 sh -c"

AUTO_GOSCRIPT_TEST        = "grep '^[^#]*\.auto_goscript'"

GO_BACKUP_DIRECTORY       = "/boot/custom/packages/backupgo"

Thank you for your interest.  I hope you like it.

 

First off,

You only NEED to add -> GO_BACKUP_DIRECTORY = "/boot/custom/packages/backupgo" to unmenu_local.conf.  The values you chose for the other variables are identical to the program defaults... if you want to change them from the defaults, then you would need to add the new value to the unmenu_local.conf (although it is not a bad practice to include them anyways).   

 

in terms of installation:

1) copy 800-unmenu-goscriptv0.4 to my unmenu directory, which is currently /boot/unmenu

Yes this is correct.

 

2) copy unMENUstart-unmenu-goscript.conf to /boot/custom/packages (I'll need to use the "uu" version)

yes this is correct, alternatively, you could add the .conf to /boot/unmenu and the program will move them to the PACKAGE_DIRECTORY the next time it is run.

 

3) create the directory: "/boot/custom/packages/backupgo"

NO, this is not needed, the program will create it if it does not already exist.

 

4) remove the line in my current go script that starts "uu" as this package manager will install and manage this line of my go script.

Yes, this is correct... just make sure you enable the package before the next time you reboot the server so that uu is actually invoked the next time you boot.

 

Questions:

 

1) Did I think of everything?  Will this work, or is there something else I need to do.

2) Is there a way to use the PACKAGE_DIRECTORY variable to define the GO_BACKUP_DIRECTORY variable.  This would seem more elegant as one is a subdirectory of the other.

3) What is the "*.auto_goscript" file referenced in the AUTO_GOSCRIPT_COMMAND variable.  It looks like this file needs to be located in my PACKAGE_DIRECTORY but I don't know where it comes from.  Is it auto-generated?

4) Will the new conf variables be included in the conf files distributed with the next official release of unMenu?

 

1. I believe you have covered everything.  after the files have been transferred and unmenu retarted, you should see a link for "Go Script Manager" in the top left of the unmenu interface (just before package manager in the list), click on this to start it up.

 

2.  Yes, I should have done that.  like this -> GO_BACKUP_DIRECTORY = PACKAGE_DIRECTORY "/backupgo". (this will be used in all future versions of go script manager for defining the default setting, and you may want to add it to unmenu_local.conf instead).  **Make sure that you do not put that line BEFORE the definition of PACKAGE_DIRECTORY**. I completely overlooked defining it that way because it was one of the last features I worked on and wasn't sure if someone was going to suggests another place to put the backups more inline with a common linux convention.

 

3.  The .auto_goscript files are created when you enable a go script package.  it is very similar to the .auto_install files created by the package manager.  when the system boots up, it will look for all the .auto_goscript files and run the code located in them.  when you disable a go script package, the corresponding .auto_goscript is deleted.

 

4. Yes, you need to remove that line (uu) in the go file, or else when you install the package (Start unMENU) through the go script manager, unmenu will be started twice on boot. 

 

Hope that helps, any more questions feel free to ask.

 

Cheers,

Matt

Link to comment

So...

 

I added the following to my unmenu_local.conf:

 

AUTO_GOSCRIPT_COMMAND = "cd %PACKAGE_DIRECTORY% && find . -name '*.auto_goscript' -type f -print | sort | xargs -n1 sh -c"

 

And it did add a line to my S10-install_custom_packages file, but it added it with the quotes on either end.  Should I leave the quotes out of the entry in my unmenu_local.conf?

 

Also, I added the following to my unmenu_local.conf, but the backupgo directory was not automatically created:

 

GO_BACKUP_DIRECTORY = PACKAGE_DIRECTORY "/backupgo"

Link to comment

So...

 

I added the following to my unmenu_local.conf:

 

AUTO_GOSCRIPT_COMMAND = "cd %PACKAGE_DIRECTORY% && find . -name '*.auto_goscript' -type f -print | sort | xargs -n1 sh -c"

 

And it did add a line to my S10-install_custom_packages file, but it added it with the quotes on either end.  Should I leave the quotes out of the entry in my unmenu_local.conf?

 

Also, I added the following to my unmenu_local.conf, but the backupgo directory was not automatically created:

 

GO_BACKUP_DIRECTORY = PACKAGE_DIRECTORY "/backupgo"

 

i will have to get back to you... I'm not currently at home and don't have access to the code on my computer or my server to be able to do some testing and get back to you... in terms of what should be appearing in the go/s10 file, it is the same line that appears for the package manager except the '*.auto_install' is changed to '*.auto_goscript'.  check the AUTO_INSTALL_COMMAND line and see how it is defined(with or without the quotes).

 

I wish I could give you a better answer right now, but it will have to wait until I get home tomorrow.

 

Sorry,

Matt

Link to comment

So...

I added the following to my unmenu_local.conf:

AUTO_GOSCRIPT_COMMAND = "cd %PACKAGE_DIRECTORY% && find . -name '*.auto_goscript' -type f -print | sort | xargs -n1 sh -c"

And it did add a line to my S10-install_custom_packages file, but it added it with the quotes on either end.  Should I leave the quotes out of the entry in my unmenu_local.conf?

Also, I added the following to my unmenu_local.conf, but the backupgo directory was not automatically created:

GO_BACKUP_DIRECTORY = PACKAGE_DIRECTORY "/backupgo"

 

The way they  should appear in unmenu_local.conf is as follows:

 

AUTO_GOSCRIPT_COMMAND = cd %PACKAGE_DIRECTORY% && find . -name '*.auto_goscript' -type f -print | sort | xargs -n1 sh -c
AUTO_GOSCRIPT_TEST = grep '^[^#]*\.auto_goscript'
GO_BACKUP_DIRECTORY = /boot/packages/custom/backupgo

 

I made an error in logic when I said:

 

2.  Yes, I should have done that.  like this -> GO_BACKUP_DIRECTORY = PACKAGE_DIRECTORY "/backupgo". (this will be used in all future versions of go script manager for defining the default setting, and you may want to add it to unmenu_local.conf instead).  **Make sure that you do not put that line BEFORE the definition of PACKAGE_DIRECTORY**. I completely overlooked defining it that way because it was one of the last features I worked on and wasn't sure if someone was going to suggests another place to put the backups more inline with a common linux convention.

 

predefining package_directory and then refering to them in the same .conf file in terms of defining another variable won't work...  making the program automatically dependent on it will make it impossible if someone wants to keep their backups in /boot/config with the orignal or somewhere else.  the solution i refered to is for the awk program for setting the default only, my mistake sorry about that.

 

DO NOT use quotes in unmenu.conf/unmenu_local.conf variable definitions.  You need to in awk but not in the config files.  To fix it, remove the quotes in the unmenu_local.conf file and in your go file.

 

The folder will be created properly when you remove your current GO_BACKUP_DIRECTORY line with the one above.

 

I'm sorry if I caused any problems or confusion.  I was away for the weekend and was trying to provide prompt help at the expense of not being able to check my sources first.

 

Cheers,

Matt

 

Edit - OP has been modified to remove quotes in variable definition.

Link to comment
  • 3 weeks later...

Can't seem to get this to work...i think...

 

Installed all the goscript files and it Go Script Manager loads properly in unmenu. I also i installed the Start Unmenu script and it properly says its enabled. I made sure to delete the line I had appended to my go script "/boot/unmenu/uu" so i would not run two instances of it. In addition, I also added two scripts to the Go Script Manager, one for Monthly parity checks and one for increasing read performance. I think i followed directions correctly but for some reason, none of these load upon start up. My Go script is never appended with the additional commands to launch the scripts. Unmenu does not load and I have to start it manually. Also, upon startup, i get an error message that says my monthly parity check auto go script cannot be executed because it cannot execute binary file. Not sure what that means. I have attached my go script, a sample .conf file i created, and the associated script.

 

Any help would be much appreciated.

Link to comment

Hi,

 

First off, thank you for your interest in my project.  it looks as though the mistake was tiny...

 

-Your go script is fine, the line has been appended and everything is good that way.

 

-The reason the monthly parity check script fails is because of a small error in the .conf file.  You needed to press enter at the end of the last line so that the last line is an empty line and not the last PACKAGE_INSTALLATION line.  I figured that out in testing but forgot to mention it in the OP, I will update the post when I add a new version (working on it now, should be VERY soon).

 

-The reason unmenu wasn't started is because the "monthly check" file stars with an m, the unmenustart file begins with a u and the scripts are executed in alpha-order.  Becase the first one failed, the second one didn't run.

 

In the meantime try the attached .conf.  i will add it to the .conf collection along with the script ot the .confs post as well.

 

Cheers,

Matt

 

EDIT: can you confirm this solved the problem? if so, i will add the instructions and post the new .conf collection.

Link to comment

Hi,

 

First off, thank you for your interest in my project.  it looks as though the mistake was tiny...

 

-Your go script is fine, the line has been appended and everything is good that way.

 

-The reason the monthly parity check script fails is because of a small error in the .conf file.  You needed to press enter at the end of the last line so that the last line is an empty line and not the last PACKAGE_INSTALLATION line.  I figured that out in testing but forgot to mention it in the OP, I will update the post when I add a new version (working on it now, should be VERY soon).

 

-The reason unmenu wasn't started is because the "monthly check" file stars with an m, the unmenustart file begins with a u and the scripts are executed in alpha-order.  Becase the first one failed, the second one didn't run.

 

In the meantime try the attached .conf.  i will add it to the .conf collection along with the script ot the .confs post as well.

 

Cheers,

Matt

 

EDIT: can you confirm this solved the problem? if so, i will add the instructions and post the new .conf collection.

Another problem is the sub-folders created by your MAC OS.  They contain "binary" copies of the scripts named like the ones expected.  These will be "found" and as you have discovered, then are "binary" in nature (not plain text) and will also cause errors as the package manager attempts to execute them.

 

When I unzipped your files I found:

root@Tower:/boot/j# unzip go.zip

Archive:  go.zip

  inflating: go

root@Tower:/boot/j# unzip Monthly*.zip

Archive:  MonthlyParityChk-unmenu-goscript.conf.zip

  inflating: MonthlyParityChk-unmenu-goscript.conf

  creating: __MACOSX/

  inflating: __MACOSX/._MonthlyParityChk-unmenu-goscript.conf

root@Tower:/boot/j# unzip monthly*.zip

Archive:  monthly_paritycheck.sh.zip

  inflating: monthly_paritycheck.sh

  inflating: __MACOSX/._monthly_paritycheck.sh

 

Next, the MonthlyParityCheck-unmenu-goscript.conf file has extra CARRIAGE-RETURN characters at the ends of the first two lines.  It should have only LINEFEED characters.

 

In the "vi" editor, turning on the option to show a "$" at the ends of lines it looks like this:

PACKAGE_NAME Monthly Parity Check^M$

PACKAGE_DESCR Script to run a monthly parity check.^M$

PACKAGE_INSTALLATION /boot/packages/monthly_paritycheck.sh$

The "^M" (control-M) characters should not be there.

 

Joe L.

Link to comment

Next, the MonthlyParityCheck-unmenu-goscript.conf file has extra CARRIAGE-RETURN characters at the ends of the first two lines.  It should have only LINEFEED characters.

 

In the "vi" editor, turning on the option to show a "$" at the ends of lines it looks like this:

PACKAGE_NAME Monthly Parity Check^M$

PACKAGE_DESCR Script to run a monthly parity check.^M$

PACKAGE_INSTALLATION /boot/packages/monthly_paritycheck.sh$

The "^M" (control-M) characters should not be there.

 

Joe L.

 

to avoid confusion...

 

The file I uploaded, does not contain the ^M.  I just double checked it in vi.

If you want to do it in the future the commands are:

vi /path/to/file

 

then type the command:

:set list to see the special characters

 

then to exit vi type the command:

:q

 

Cheers,

Matt

 

EDIT: make sure you delete the MAC files described by Joe L(starting with "._").  As Joe L mentioned, they can cause problems in the go script manager.

Link to comment

There is a nice little (free) Windows-based text editor called Notepad2 that handles Unix style line ends very well.

 

You can find a link on the "Best of the Forums" page (HERE).

 

vi can be pretty daunting to a non-believer.   :o

 

I personally love Crimson Editor myself, it's free, and has the options to set the file type (unix, dos, mac) and when I'm programming, I can set the language I'm using and have it colour the code(tags) and indent automatically for "if" and "for" statements etc.  It supports multiple tabs for switching between files easily without closing them or having multiple windows.  It even has FTP for uploading your files.  It's a very powerful text editor for windows, and extremely helpful for those that want one text editor for a variety of purposes.

 

It is feature rich so it is not for someone wanting a very simple editor, but if you use a variety of editors for different purposes, you might want to try it.

 

The download is only 1.2MB.  you can find it here: http://www.crimsoneditor.com/.  This version(3.70) is from 2004.  it is the one I use.  A more recent version of the program  and can be found here: http://www.emeraldeditor.com/ and looks to have been updated in Dec 2008 (version 3.72 beta 241).

 

Cheers,

Matt

Link to comment

I love the "vim" editor under windows.  It is a superset of "vi" and also color-codes the syntax.  It is free, and available at vim.org

 

Other ways to verify the file has no carriage returns is to use

od -c  MonthlyParityChk-unmenu-goscript.conf

0000000  P  A  C  K  A  G  E  _  N  A  M  E      M  o  n

0000020  t  h  l  y      P  a  r  i  t  y      C  h  e  c

0000040  k  \r  \n   P  A  C  K  A  G  E  _  D  E  S  C  R

0000060      S  c  r  i  p  t      t  o      r  u  n      a

0000100      m  o  n  t  h  l  y      p  a  r  i  t  y

0000120  c  h  e  c  k  .  \r  \n   P  A  C  K  A  G  E  _

0000140  I  N  S  T  A  L  L  A  T  I  O  N      /  b  o

0000160  o  t  /  p  a  c  k  a  g  e  s  /  m  o  n  t

0000200  h  l  y  _  p  a  r  i  t  y  c  h  e  c  k  .

0000220  s  h

0000222

Notice, the "\r \n" pairs of characters... it should only have "\n"  Also, the last character in the file is the "h" it should be a"\n"

 

Another way to check for carriage returns:

cat -v MonthlyParityChk-unmenu-goscript.conf

PACKAGE_NAME Monthly Parity Check^M

PACKAGE_DESCR Script to run a monthly parity check.^M

PACKAGE_INSTALLATION /boot/packages/monthly_paritycheck.shroot@Tower:/boot/j#

 

The "-v" option shows the non-printable characters.  Notice my shell prompt is on the same line as the last line in the .conf file.  This indicates there is no newline character there. (as already described, it is missing)

 

Joe L.

 

Link to comment

Guys,

 

Thats an amazingly quick response. Ive been following how good this forum is but its nice when you have a question and people show you the same courtesy.

 

I can't test until i get home but will let you know.

 

So instead of using my mac, i switched to my VM, turned on hidden files, and now see all the ._ files listed. Is this purely something the mac does? Is it safe to delete them all (there are quite a few; ie in the unmenu folder there is ._mymain_local.conf, ._unMENUstart-unmenu-goscript.conf, etc. In my packages folder there are ._rc.local-unmenu-package.conf, ._monthly_paritycheck.sh, etc).

 

Also, when using notepad2, is there some setting i have to enable to see the extra carriage returns? Frankly, I was aware of this problem and was using Textmate on my mac which i thought prevented these from occurring.

 

Lastly, any way for me to keep editing on my mac without those ._ files being created?

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.