Need some info on pinstall.sh and PETS

Using applications, configuring, problems
Post Reply
Message
Author
User avatar
rockedge
Posts: 1864
Joined: Wed 11 Apr 2012, 13:32
Location: Connecticut, United States
Contact:

Need some info on pinstall.sh and PETS

#1 Post by rockedge »

Hello !! I am have created a PET package. It works very well so far....but there is a script that needs to run to install mysql databases and set users. I have it a pinstall.sh that is in the PET's root, but does not seem to start after the PET is installed. The script pinstall.sh runs fine when manually started and successfully does all the necessary final setup steps. So far I have not seen it run though when the PET installs.

What needs to happen for the pinstall.sh to run when the PET is installed?

Thanks for any insight!

User avatar
bigpup
Posts: 13886
Joined: Sun 11 Oct 2009, 18:15
Location: S.C. USA

#2 Post by bigpup »

What is the program?

That looks like something that should run the first time you start the program.

Does the pet make a menu entry for the program?

Can the program code be edited?

Maybe have a simple script file that has the needed commands to start the pinstall.sh first and start the program after setup.
Use that script as the menu entry to start the program.
The things they do not tell you, are usually the clue to solving the problem.
When I was a kid I wanted to be older.... This is not what I expected :shock:
YaPI(any iso installer)

User avatar
rockedge
Posts: 1864
Joined: Wed 11 Apr 2012, 13:32
Location: Connecticut, United States
Contact:

#3 Post by rockedge »

Thanks for the insight! The project is a completely functioning Hiawatha v10.5, MySQL, PHP5 web server with ZoneMinder CCTV that will install totally automatically, one-click on the PET and the entire system with the needed Devx is installed and starts.

the script only needs to run once at inital install and never again. the code is is like this :

Code: Select all

#!/bin/sh
chown -R webuser /var/run/mysqld
chown -R webuser /var/cache/zoneminder
DATABASE_PASS="admin"
/usr/bin/mysql_install_db
mysqld &
sleep 2
mysqladmin -u root password "$DATABASE_PASS"
mysql -u root -p"$DATABASE_PASS" -e "UPDATE mysql.user SET Password=PASSWORD('$DATABASE_PASS') WHERE User='root'"
mysql -u root -p"$DATABASE_PASS" -e "DELETE FROM mysql.user WHERE User='root' AND Host NOT IN ('localhost', '127.0.0.1', '::1')"
mysql -u root -p"$DATABASE_PASS" -e "DELETE FROM mysql.user WHERE User=''"
mysql -u root -p"$DATABASE_PASS" -e "DELETE FROM mysql.db WHERE Db='test' OR Db='test\_%'"
mysql -u root -p"$DATABASE_PASS" -e "FLUSH PRIVILEGES"

mysql -u root -p"$DATABASE_PASS" -e "CREATE USER 'pma'@'localhost' IDENTIFIED BY 'admin';"
mysql -u root -p"$DATABASE_PASS" -e "GRANT ALL PRIVILEGES ON * . * TO 'pma'@'localhost'"

mysql -u root -p"$DATABASE_PASS" -e "CREATE USER 'zmuser'@'localhost' IDENTIFIED BY 'zmpass';"
mysql -u root -p"$DATABASE_PASS" -e "GRANT ALL PRIVILEGES ON * . * TO 'zmuser'@'localhost'"

mysql -u root -p"$DATABASE_PASS" < /usr/share/phpmyadmin/sql/create_tables.sql
mysql -u root -p"$DATABASE_PASS" < /usr/share/zoneminder/db/zm_create.sql
ln -s /etc/init.d/zoneminder /root/my-applications/bin
hiawatha
zoneminder start
So far the PET installs cleanly and when I run the script manually the setup is successful and the whole thing works. the PET is around 148 M.
I would like this script to run upon completion of the install automatically somehow....but I could do the menu entry way............

I will upload this zoneminder PET and make it available for all Puppy People through the forum.

mostly_lurking
Posts: 328
Joined: Wed 25 Jun 2014, 20:31

#4 Post by mostly_lurking »

The pinstall.sh script should run automatically upon installing. Are you sure it doesn't? Maybe it fails due to an error. Try installing the package from a terminal:

Code: Select all

petget your-package.pet
Does it show any error messages? (For example, do those directories like /var/run/mysqld not exist by the time the script is invoked?)

If you get no such errors and you still aren't sure if the script is actually executed, you could test it by putting something like this at the beginning of the script:

Code: Select all

mkdir /root/testfolder
If that "testfolder" directory is created upon installing the package, you know that the script runs.

User avatar
rockedge
Posts: 1864
Joined: Wed 11 Apr 2012, 13:32
Location: Connecticut, United States
Contact:

#5 Post by rockedge »

Very good idea....I will put a line in that creates a test directory.
I am pretty sure it is not running...when I run the script manually in a terminal or click on it....it works and the system is set and starts to run.
So it is maybe a timing issue as you suggest....some stuff to check...this project is finally very close to completion which was to get a zoneminder fully functional and very easy to install....one download...one click, started 4 years ago to become possible.

is this correct in placement?

inside the pet:
root# ls -l
total 36
drwxr-xr-x 2 root root 4096 Feb 1 07:43 bin
drwxr-xr-x 29 root root 4096 Feb 15 16:13 etc
drwxr-xr-x 4 root root 4096 Feb 15 16:13 lib
-rw-r--r-- 1 root root 171 Apr 30 22:20 pet.specs
-rwxr-xr-x 1 root root 1260 Apr 30 21:36 pinstall.sh
drwxr-xr-x 3 root root 4096 Feb 15 16:06 root
drwxr-xr-x 2 root root 4096 Feb 6 13:50 sbin
drwxr-xr-x 10 root root 4096 May 13 2013 usr
drwxr-xr-x 7 root root 4096 Feb 1 07:54 var

mostly_lurking
Posts: 328
Joined: Wed 25 Jun 2014, 20:31

#6 Post by mostly_lurking »

As far as I can tell, the script is in the correct place, and it is executable. I suppose this directory listing is the folder from which you created the package (with dir2pet?); you can look inside the actual package by changing its file extension from .pet to .tar.gz (or maybe .tar.xz with some newer Puppies, I'm not sure about those), since it's basically just a tar archive, so you can open it with an archive program and check if it was packed up correctly.

Have you tried running the package manager from the terminal as I suggested in my previous post? Did it tell you if anything was wrong?

User avatar
rockedge
Posts: 1864
Joined: Wed 11 Apr 2012, 13:32
Location: Connecticut, United States
Contact:

#7 Post by rockedge »

I did not use dir2pet but right-clicked the directory in ROX and selected Create a PET. Just in case I am trying dir2pet now. I looked inside and it is packaged correctly and the pinstall.sh is present.

In the test with petget in the terminal ran and it showed no errors but still did not complete the script.

User avatar
rcrsn51
Posts: 13096
Joined: Tue 05 Sep 2006, 13:50
Location: Stratford, Ontario

#8 Post by rcrsn51 »

Do any parts of the script execute, like the initial "chown" commands?

User avatar
Mike Walsh
Posts: 6351
Joined: Sat 28 Jun 2014, 12:42
Location: King's Lynn, UK.

#9 Post by Mike Walsh »

Hi, rockedge.

For the actual .pet manufacture, you may find trio's Pet-Maker to come in useful. It employs 'dir2pet' and 'mksquashfs' under the hood (it'll also manufacture SFS packages), but wrapped up in a very easy-to-use GUI.

I find it easiest, having created the initial directory, to move stuff around manually with ROX, then finish off by letting PetMaker do the construction for me (there's a nice GUI for creating the package manager entries, too.....which is super easy to use.)

You can find it here:-

http://www.murga-linux.com/puppy/viewtopic.php?t=40457

I've been using it for well over a year now, ever since I first started building packages.....although I prefer building SFSs directly in the terminal with 'mksquashfs'.


Mike. :wink:

User avatar
rockedge
Posts: 1864
Joined: Wed 11 Apr 2012, 13:32
Location: Connecticut, United States
Contact:

#10 Post by rockedge »

just finished a successful test. I started a fresh Tahr 6.0.6 started in RAM mode installed the PET, opened palemoon did http://localhost and the web console and zoneminder are working.
I added some sleep statements to the script. I am uploading to a Google Drive a copy, if someone with a webcam or any network camera from anywhere could take a chance and test it for me!.

zmbuildserver4.pet 262 M

download and install
open a browser http://localhost/zm

http://localhost/phpmyadmin
user-> root
password -> admin
Last edited by rockedge on Tue 02 May 2017, 11:18, edited 3 times in total.

User avatar
rockedge
Posts: 1864
Joined: Wed 11 Apr 2012, 13:32
Location: Connecticut, United States
Contact:

#11 Post by rockedge »

@Mike Walsh hello! yes I will try this program you suggest and give it a whirl with this package. SFS and remasters I do all manually with good results!

User avatar
rockedge
Posts: 1864
Joined: Wed 11 Apr 2012, 13:32
Location: Connecticut, United States
Contact:

#12 Post by rockedge »

I increased the sleep time between 3 operations by a few ticks and I have successfully installed the zoneminder PET in tahr 6.0.5 and 6.0.6. There is a small issue with missing symlink or lib for the onvif camera discovery....to fix it use the PPM to install libsoap-wsdl-perl_2.00.10-2 (easy to find in the PPM search with "soap"
Last edited by rockedge on Tue 02 May 2017, 04:05, edited 1 time in total.

User avatar
bigpup
Posts: 13886
Joined: Sun 11 Oct 2009, 18:15
Location: S.C. USA

#13 Post by bigpup »

What is Tahrpup installed on.
The save works a little different depending on the device Puppy boots from.

Save is active on a hard drive.
Internal SSD.
Installs go directly to save as it installs.

Save is not active on a USB flash until you click on save icon,
the save timer activates, or at shutdown.
Installs are in memory until a save is made.
The things they do not tell you, are usually the clue to solving the problem.
When I was a kid I wanted to be older.... This is not what I expected :shock:
YaPI(any iso installer)

slavvo67
Posts: 1610
Joined: Sat 13 Oct 2012, 02:07
Location: The other Mr. 305

#14 Post by slavvo67 »

This is a huge pet! You'll want to make a puninstall.sh file for those that want to remove it via PPM. Or maybe make it as an sfs file?

User avatar
rockedge
Posts: 1864
Joined: Wed 11 Apr 2012, 13:32
Location: Connecticut, United States
Contact:

#15 Post by rockedge »

there was a difference between installing the pet when tahr is booted and is totally in RAM with no save folder and when there was a save folder present.

The increase in the sleep pause in between some steps of the script seems to have fixed the differences and now the PET installs and the pinstall.sh is executing to the end. So far I tested 4 times 2 with a save folder present and 2x just booted from HDD loaded the PET and that works also.

There already is an SFS version for download.....problem there is to keep the original functions of PPLOG and the personal blog in puppy working with zoneminder, the sfs needs to replace some files...which on SFS load doesn't happen. So work arounds and database installation script must be run from menu or manually. The PET does all this on install automatically.

Usually ZoneMinder is run on a dedicated machine due to it's need for /dev/shm when running extremely high def cameras at high resolutions or multiple local cameras (USB webcams, analog CCTV cards etc.)

best to scrap the entire system and start fresh to remove....there are many libs and PERL mods involved and the uninstall could be quite involved.

This system can compete with the "Big Boys and Girls". A commercial system that does this could cost thousands of dollars/Euros....I am giving it to you for free (power to the people) This system with Puppy Linux is able to run on older hardware that does not have more then 1-4 Gigs of RAM....so that old desktop or laptop can be a key component in a home or office camera security system that can handle an unlimited amount of network cameras.

The tahr 6.0.5 - zoneminder 1.30.2 remaster I released earlier I believe is one of only 2 LiveCD or USB flash drive ready systems of this kind in the world. An entire CCTV with motion detection on a USB thumb drive? Yes it can.
Last edited by rockedge on Tue 02 May 2017, 11:55, edited 5 times in total.

User avatar
rockedge
Posts: 1864
Joined: Wed 11 Apr 2012, 13:32
Location: Connecticut, United States
Contact:

#16 Post by rockedge »

The size is as small as it gets for the zoneminder hiawatha mysql PHP5 PERL that it takes to get zoneminder to fully function. It is a resource hungry system if one is running 100-400 network cameras with ZM. For home use most people have far less cameras. But this is a professional grade system that running on Puppy, the OS is still under 500 M....compared to Ubuntu or Centos or the other distros able to run such a system which hang around in the Gigabyte sizes. So far the performance of ZoneMinder running on Tahrpup can compete with any system!

The puninstall.sh is a must and I am working on that script as well and will be included in the the versions released.

User avatar
bigpup
Posts: 13886
Joined: Sun 11 Oct 2009, 18:15
Location: S.C. USA

#17 Post by bigpup »

rockedge,

Thanks for this and keep tweaking!!!

This kind of shows why I have no security cameras at home.
Attachments
imat-work-right-nowand-decided-to-check-up-on-my-19046882.png
(156.53 KiB) Downloaded 38 times
The things they do not tell you, are usually the clue to solving the problem.
When I was a kid I wanted to be older.... This is not what I expected :shock:
YaPI(any iso installer)

Post Reply