Install Optware IPKG: Difference between revisions

From QNAPedia
Jump to navigation Jump to search
m 1 revision imported
 
Describe Optware as withdrawn.
 
Line 1: Line 1:
By installing [[Optware IPKG]], you open the door to installing many other software packages by many different developers. [[QNAP]] supplies [[Ipkg]] as a [[QPKG]] plugin on many of their products. This is probably the easiest way to install for most. We also give instructions on manual install.


== Simplified installation using QPKG ==
OBSELETE: as of January 2019, Optware is no longer listed in the QNAP "App Center". It appears that QNAP withdrew it sometime in 2015 or 2016. [[Entware|Entware]] is a non-QNAP QPKG which serves the same purpose of giving access to many command-line software tools used on a wide range of NAS systems.


This is the simplified installation method using the [[QPKG]] update system firmware page with an <tt>Optware_Ipkg.qpkg</tt> file.  
The following content is preserved for history. Some of the wording has been changed to make it clear Optware is withdrawn.


#First update your firmware to the latest build.
----
#In the device's [[Administration interface]], select ''''App Center''''. In the App Center window, search for "Optware" using the search box at the top left, or click on the "Developer Tools" item in the left pane. An icon "Optware IPKG" appears. Click on the icon, and the App Center will install it.


=== Installation in firmware 3.2x  ===
By installing [[Optware_IPKG|Optware IPKG]], you [used to be able to] open the door to installing many other software packages by many different developers. [[QNAP|QNAP]] supplies [[Ipkg|Ipkg]] as a [[QPKG|QPKG]] plugin on many of their products. This is probably the easiest way to install for most. We also give instructions on manual install.


If you are using Firmware before version 4.x, your Administration Interface might not have an 'App Center'. The following instructions are appropriate for firmware 3.2.x, and may be appropriate for firmware as late as 3.8.x. (No editor of this article has checked on 3.6.x through 3.8.x yet.)
== Simplified installation using QPKG [for 3.2x, now obselete] ==


#*For firmware version 3.2x, select the ''''System Tools'''' -&gt; ''''QPKG'''' page, click on ''''Get QPKG'''' button.  
This [was] the simplified installation method using the [[QPKG|QPKG]] update system firmware page with an <tt>Optware_Ipkg.qpkg</tt> file.
#*If nothing is listed you must get the package from the appropriate download page on the QNAP website.  
 
#First update your firmware to the latest build [applies to 3.2x, not 4.3x].
#In the device's [[Administration_interface|Administration interface]], select ''''App Center''''. In the App Center window, search for "Optware" using the search box at the top left, or click on the "Developer Tools" item in the left pane. An icon "Optware IPKG" appears. Click on the icon, and the App Center will install it.
 
=== Installation in firmware 3.2x ===
 
If you are using Firmware before version 4.x, your Administration Interface might not have an 'App Center'. The following instructions are appropriate for firmware 3.2.x, and may be appropriate for firmware as late as 3.8.x. (No editor of this article has checked on 3.6.x through 3.8.x yet.)
 
#
#*For firmware version 3.2x, select the ''''System Tools'''' -> ''''QPKG'''' page, click on ''''Get QPKG'''' button.  
#*If nothing is listed you must get the package from the appropriate download page on the QNAP website.  
#Download ''''Optware IPKG'''' package that matches your model.  
#Download ''''Optware IPKG'''' package that matches your model.  
#If the archive ends with a <tt>.zip</tt> extension, then unzip the downloaded archive to get a file with a <tt>.qpkg</tt> extension.  
#If the archive ends with a <tt>.zip</tt> extension, then unzip the downloaded archive to get a file with a <tt>.qpkg</tt> extension.  
#If you're behind a proxy, put this in the <tt>/root/.wgetrc</tt> or in the <tt>/etc/wgetrc</tt> or in both:
#If you're behind a proxy, put this in the <tt>/root/.wgetrc</tt> or in the <tt>/etc/wgetrc</tt> or in both:  


:http_proxy = http://proxy.domain.com:3128  
:http_proxy = [http://proxy.domain.com:3128 http://proxy.domain.com:3128]
:use_proxy = on
:use_proxy = on  


The install will fail if you don't do that.  
The install will fail if you don't do that.


#Now install the qpkg file. Go to the ''''Installation'''' tab. Click the '''Browse''' button, and select the qpkg file. Click the OK button. A progress bar appears, then a confirmation dialog that the installation was successful.  
#Now install the qpkg file. Go to the ''''Installation'''' tab. Click the '''Browse''' button, and select the qpkg file. Click the OK button. A progress bar appears, then a confirmation dialog that the installation was successful.  
#*Alternative: install it (.qpkg file) via the ''''System Update'''' under your ''''System Tools'''' page.  
#*Alternative: install it (.qpkg file) via the ''''System Update'''' under your ''''System Tools'''' page.  
#If you get this error (check your mails!):
#If you get this error (check your mails!):  


Optware 0.99.163 installation failed. /share/MD0_DATA/optware existed. Please remove it first.  
Optware 0.99.163 installation failed. /share/MD0_DATA/optware existed. Please remove it first.


ssh on the NAS and issue this command (use with care!!):  
ssh on the NAS and issue this command (use with care!!):


  rm -rf /share/MD0_DATA/.qpkg/Optware
  rm -rf /share/MD0_DATA/.qpkg/Optware
Line 36: Line 44:
#Click the Optware icon or caption. A dialog "QPKG Plugins - QPKG - Optware" appears. At the bottom, it has buttons "Enable", "Disable", and "Remove".  
#Click the Optware icon or caption. A dialog "QPKG Plugins - QPKG - Optware" appears. At the bottom, it has buttons "Enable", "Disable", and "Remove".  
#Click the "Enable" button. There is a pause, then the device gives you an alert box to confirm IPKG is enabled.  
#Click the "Enable" button. There is a pause, then the device gives you an alert box to confirm IPKG is enabled.  
#Now [[Ssh]] into the admin account on your NAS device.  
#Now [[Ssh|Ssh]] into the admin account on your NAS device.  
#As of April 2010, [[TS-219P]] [[Firmware]] 3.2.5 build 0409T has two bugs which require you to patch an initialisation file, <tt>/etc/init.d/Optware.sh</tt>. Follow the instructions in sections '''[[#Running_.2Fopt.2Fetc.2Finit.d.2F.2A_on_startup]]''' and '''[[#Fix_the_.24PATH_in_.2Fetc.2Fprofile]]''' below.  
#As of April 2010, [[TS-219P|TS-219P]] [[Firmware|Firmware]] 3.2.5 build 0409T has two bugs which require you to patch an initialisation file, <tt>/etc/init.d/Optware.sh</tt>. Follow the instructions in sections '''[[#Running_.2Fopt.2Fetc.2Finit.d.2F.2A_on_startup|#Running_.2Fopt.2Fetc.2Finit.d.2F.2A_on_startup]]''' and '''[[#Fix_the_.24PATH_in_.2Fetc.2Fprofile|#Fix_the_.24PATH_in_.2Fetc.2Fprofile]]''' below.  
#Log out, and restart the NAS device to get the patches enforced.  
#Log out, and restart the NAS device to get the patches enforced.  
#Confirm that ipkg is available. Ssh in again, and type: <tt># ipkg --version</tt>. A message like <tt>ipkg version 0.99.163</tt> appears. ipkg is now installed.
#Confirm that ipkg is available. Ssh in again, and type: <tt># ipkg --version</tt>. A message like <tt>ipkg version 0.99.163</tt> appears. ipkg is now installed.  


Continue to the article [[Using IPKG]] for instructions on what to do next.  
Continue to the article [[Using_IPKG|Using IPKG]] for instructions on what to do next.


<br>
&nbsp;


=== Running /opt/etc/init.d/* on startup ===
=== Running /opt/etc/init.d/* on startup ===


Some, but not all, ipkg packages install startup scripts into <tt>/opt/etc/init.d/</tt>. These are to be run as part of system startup. As of April 2010, [[TS-219P]] [[Firmware]] 3.2.5 build 0409T does not run the scripts in this directory. This section explains how to patch the firmware to add this startup action.  
Some, but not all, ipkg packages install startup scripts into <tt>/opt/etc/init.d/</tt>. These are to be run as part of system startup. As of April 2010, [[TS-219P|TS-219P]] [[Firmware|Firmware]] 3.2.5 build 0409T does not run the scripts in this directory. This section explains how to patch the firmware to add this startup action.


The Optware [[QPKG]] creates an initialisation script and stores it in a QPKG Optware directory on your main data share. When the QNAP NAS device starts up, it adds a link to this script from <tt>/etc/rcS.d/</tt>. The name of this link is something like <tt>QS100Optware</tt>, where 100 is a sequence number that depends on how many QPKG packages you installed and in what order. This is what these files look like in [[TS-219P]] [[Firmware]] 3.2.5 build 0409T:  
The Optware [[QPKG|QPKG]] creates an initialisation script and stores it in a QPKG Optware directory on your main data share. When the QNAP NAS device starts up, it adds a link to this script from <tt>/etc/rcS.d/</tt>. The name of this link is something like <tt>QS100Optware</tt>, where 100 is a sequence number that depends on how many QPKG packages you installed and in what order. This is what these files look like in [[TS-219P|TS-219P]] [[Firmware|Firmware]] 3.2.5 build 0409T:
<pre># ls -lFh /etc/init.d/*Optware* /etc/rcS.d/*Optware* /share/MD0_DATA/.qpkg/Optware/*Optware*
<pre># ls -lFh /etc/init.d/*Optware* /etc/rcS.d/*Optware* /share/MD0_DATA/.qpkg/Optware/*Optware*
lrwxrwxrwx    1 admin    administ      40 Apr 19 16:02 /etc/init.d/Optware.sh -&gt; /share/MD0_DATA/.qpkg/Optware/Optware.sh*
lrwxrwxrwx    1 admin    administ      40 Apr 19 16:02 /etc/init.d/Optware.sh -&gt; /share/MD0_DATA/.qpkg/Optware/Optware.sh*
lrwxrwxrwx    1 admin    administ      40 Apr 19 16:02 /etc/rcS.d/QS100Optware -&gt; /share/MD0_DATA/.qpkg/Optware/Optware.sh*
lrwxrwxrwx    1 admin    administ      40 Apr 19 16:02 /etc/rcS.d/QS100Optware -&gt; /share/MD0_DATA/.qpkg/Optware/Optware.sh*
-rwxr-xr-x    1 admin    administ    1.9k Feb 21 21:10 /share/MD0_DATA/.qpkg/Optware/Optware.sh*
-rwxr-xr-x    1 admin    administ    1.9k Feb 21 21:10 /share/MD0_DATA/.qpkg/Optware/Optware.sh*
</pre>  
</pre>
Edit the install script. It's fine to get to it via one of its [[Symlink]]s:  
 
Edit the install script. It's fine to get to it via one of its [[Symlink|Symlinks]]:


  vi /etc/init.d/Optware.sh
  vi /etc/init.d/Optware.sh


Look towards the end of the file for content like this:  
Look towards the end of the file for content like this:
<pre>case "$1" in
<pre>case "$1" in
   start)
   start)
Line 70: Line 79:
   stop)
   stop)
               ...[elided]...
               ...[elided]...
</pre>  
</pre>
We will add a block of code just before the <tt>;; stop)</tt> lines. The portion of the file now looks like the following:  
 
We will add a block of code just before the <tt>;; stop)</tt> lines. The portion of the file now looks like the following:
<pre>case "$1" in
<pre>case "$1" in
   start)
   start)
Line 110: Line 120:
   stop)
   stop)
               ...[elided]...
               ...[elided]...
</pre>  
</pre>
Save the file and quit the editor.  
 
Save the file and quit the editor.


Now, restart the [[QNAP]] [[NAS]] device. All Optware packages which need to run at startup time, should run automatically.  
Now, restart the [[QNAP|QNAP]] [[NAS|NAS]] device. All Optware packages which need to run at startup time, should run automatically.


Because this code runs whatever scripts are in the <tt>/opt/etc/init.d/</tt> directory, you do not need to modify it when you add or remove Optware packages. However, there's a likelihood that future QNAP firmware releases may overwrite Optware.sh. This would require you to reapply this patch.  
Because this code runs whatever scripts are in the <tt>/opt/etc/init.d/</tt> directory, you do not need to modify it when you add or remove Optware packages. However, there's a likelihood that future QNAP firmware releases may overwrite Optware.sh. This would require you to reapply this patch.


For further information:  
For further information:


*[http://forum.qnap.com/viewtopic.php?f=85&t=18977 Forum post "[EXPLAIN) autorun.sh and Optware ipkg server prog."] (Sept-Dec 2009)
*[http://forum.qnap.com/viewtopic.php?f=85&t=18977 Forum post "[EXPLAIN) autorun.sh and Optware ipkg server prog."] (Sept-Dec 2009)  


=== Fix the $PATH in /etc/profile ===
=== Fix the $PATH in /etc/profile ===


The code that sets up the Optware environment should extend the $PATH environment variable, adding the Optware bin directories to the head of the path where they can preempt any equivalents that come with the QNAP firmware. It should also preserve the original path, with any modifications which other software made. As of April 2010, [[TS-219P]] [[Firmware]] 3.2.5 build 0409T does not do this correctly.  
The code that sets up the Optware environment should extend the $PATH environment variable, adding the Optware bin directories to the head of the path where they can preempt any equivalents that come with the QNAP firmware. It should also preserve the original path, with any modifications which other software made. As of April 2010, [[TS-219P|TS-219P]] [[Firmware|Firmware]] 3.2.5 build 0409T does not do this correctly.


[note] In July 2010, firmware 3.4.3, we do not need to modify the "Optware.sh" as below.  
[note] In July 2010, firmware 3.4.3, we do not need to modify the "Optware.sh" as below.


There is a simple fix, to the same Optware.sh file we edited in the previous section.  
There is a simple fix, to the same Optware.sh file we edited in the previous section.


Edit the file:  
Edit the file:


  vi /etc/init.d/Optware.sh
  vi /etc/init.d/Optware.sh


Look for the section of code which mentions <tt>/opt/bin</tt>. Replace it so that this part of the file looks like:  
Look for the section of code which mentions <tt>/opt/bin</tt>. Replace it so that this part of the file looks like:
<pre> # adding Ipkg apps into system path ...
<pre> # adding Ipkg apps into system path ...
/bin/cat /etc/profile | /bin/grep "PATH" | /bin/grep "/opt/bin" 1&gt;&gt;/dev/null 2&gt;&gt;/dev/null
/bin/cat /etc/profile | /bin/grep "PATH" | /bin/grep "/opt/bin" 1&gt;&gt;/dev/null 2&gt;&gt;/dev/null
Line 139: Line 150:
# was [ $? -ne 0 ] &amp;&amp; /bin/echo "export PATH=$PATH":/opt/bin:/opt/sbin &gt;&gt; /etc/profile
# was [ $? -ne 0 ] &amp;&amp; /bin/echo "export PATH=$PATH":/opt/bin:/opt/sbin &gt;&gt; /etc/profile
[ $? -ne 0 ] &amp;&amp; /bin/echo "export PATH=/opt/bin:/opt/sbin:\$PATH" &gt;&gt; /etc/profile
[ $? -ne 0 ] &amp;&amp; /bin/echo "export PATH=/opt/bin:/opt/sbin:\$PATH" &gt;&gt; /etc/profile
</pre>  
</pre>
Save the file and quit the editor.  
 
Save the file and quit the editor.


Now, restart the [[QNAP]] [[NAS]] device. In the admin shell, check the $PATH environment variable. /opt/bin and /opt/sbin should come before /bin and /usr/bin. For instance:  
Now, restart the [[QNAP|QNAP]] [[NAS|NAS]] device. In the admin shell, check the $PATH environment variable. /opt/bin and /opt/sbin should come before /bin and /usr/bin. For instance:
<pre># echo $PATH
<pre># echo $PATH
/opt/bin:/opt/sbin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/bin/X11:/usr/local/sbin
/opt/bin:/opt/sbin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/bin/X11:/usr/local/sbin
</pre>  
</pre>
For further information:  
 
For further information:


*[http://forum.qnap.com/viewtopic.php?f=124&t=15663 Forum thread "[REQUEST) IPKG paths must come first in $PATH"] (June-Dec 2009) mentions both the problem with the order of path elements and the missing "\" before "$PATH".  
*[http://forum.qnap.com/viewtopic.php?f=124&t=15663 Forum thread "[REQUEST) IPKG paths must come first in $PATH"] (June-Dec 2009) mentions both the problem with the order of path elements and the missing "\" before "$PATH".  
*[http://forum.qnap.com/viewtopic.php?f=85&t=23284&start=0 Forum thread "[FIX) Optware.sh PATH Bug...."] (Dec 2009-April 2010) Another report of the missing "\" before "$PATH".
*[http://forum.qnap.com/viewtopic.php?f=85&t=23284&start=0 Forum thread "[FIX) Optware.sh PATH Bug...."] (Dec 2009-April 2010) Another report of the missing "\" before "$PATH".  


=== Troubleshooting ===
=== Troubleshooting ===


*Installing the package requires that the target device has internet access otherwise the installation will fail about 60% of the way through.  
*Installing the package requires that the target device has internet access otherwise the installation will fail about 60% of the way through.  
*After a failed install you will not be able to reattempt the installation until you manually delete the <tt>Optware</tt> directory under <tt>/share/MD0_DATA/.qpkg</tt>. Failure to do this will result in an error message in the system log stating the package is already installed.  
*After a failed install you will not be able to reattempt the installation until you manually delete the <tt>Optware</tt> directory under <tt>/share/MD0_DATA/.qpkg</tt>. Failure to do this will result in an error message in the system log stating the package is already installed.  
*If you perform an installation through QPKG, get an installation successful alert, but ipkg doesn't appear in the ''''QPKG Installed'''' tab, check to see if you installed a file with a <tt>.zip</tt> extension. QPKG cannot install ZIP archives. You must unzip the archive, and there should be a file with a <tt>.qpkg</tt> installation inside. You must install this .qpkg file.  
*If you perform an installation through QPKG, get an installation successful alert, but ipkg doesn't appear in the ''''QPKG Installed'''' tab, check to see if you installed a file with a <tt>.zip</tt> extension. QPKG cannot install ZIP archives. You must unzip the archive, and there should be a file with a <tt>.qpkg</tt> installation inside. You must install this .qpkg file.  
*If you install an Optware package, and it runs right after installation but fails to restart automatically when the server restarts, then check to see that the patch in [[#Running_.2Fopt.2Fetc.2Finit.d.2F.2A_on_startup]] above has been completed correctly.
*If you install an Optware package, and it runs right after installation but fails to restart automatically when the server restarts, then check to see that the patch in [[#Running_.2Fopt.2Fetc.2Finit.d.2F.2A_on_startup|#Running_.2Fopt.2Fetc.2Finit.d.2F.2A_on_startup]] above has been completed correctly.  


== Migrating from the previous installation (either automatic script or manual) ==
== Migrating from the previous installation (either automatic script or manual) ==


For migration from previous install (automatic/manual)&nbsp;to the QPKG'ed install, please see below:  
For migration from previous install (automatic/manual)&nbsp;to the QPKG'ed install, please see below:


<br>
&nbsp;


*umount all the mounts for your original IPKG install
*umount all the mounts for your original IPKG install  
<pre># umount /share/MD0_DATA/optware/dev
<pre># umount /share/MD0_DATA/optware/dev
# umount /share/MD0_DATA/optware/proc
# umount /share/MD0_DATA/optware/proc
Line 172: Line 185:
# umount /share/MD0_DATA/optware/mnt/ext/Qweb
# umount /share/MD0_DATA/optware/mnt/ext/Qweb
# umount /share/MD0_DATA/optware/mnt/ext/Qusb
# umount /share/MD0_DATA/optware/mnt/ext/Qusb
# umount /share/MD0_DATA/optware/mnt/ext/Public</pre>  
# umount /share/MD0_DATA/optware/mnt/ext/Public</pre>
*remove all the Ipkg-related entries in autorun.sh
 
*remove all the Ipkg-related entries in autorun.sh  
<pre># mount /dev/mtdblock5 /tmp/config
<pre># mount /dev/mtdblock5 /tmp/config
# vi /tmp/config/autorun.sh</pre>  
# vi /tmp/config/autorun.sh</pre>
*remove these entries:
 
*remove these entries:  
<pre># Internet access...  
<pre># Internet access...  
cp /etc/resolv.conf /share/MD0_DATA/optware/etc
cp /etc/resolv.conf /share/MD0_DATA/optware/etc
Line 197: Line 212:
mount -o bind /share/MD0_DATA/Qmultimedia /share/MD0_DATA/optware/mnt/ext/Public
mount -o bind /share/MD0_DATA/Qmultimedia /share/MD0_DATA/optware/mnt/ext/Public
# adding Ipkg apps into system path ...
# adding Ipkg apps into system path ...
export PATH=/opt/bin:/opt/sbin:$PATH </pre>  
export PATH=/opt/bin:/opt/sbin:$PATH </pre>
*save then close


&nbsp;
*save then close


*rename /share/MD0_DATA/optware
&nbsp;
<pre>mv /share/MD0_DATA/optware /share/MD0_DATA/optware.foo</pre>
*Install QPKGed IPKG according to the guide&nbsp;''''Automatic installation via QPKG'''' above (but do not enable it yet, or disable it if it was enabled after the install)


&nbsp;
*rename /share/MD0_DATA/optware
<pre>mv /share/MD0_DATA/optware /share/MD0_DATA/optware.foo</pre>


*copy the IPKG start script to the old IPKG directory
*Install QPKGed IPKG according to the guide&nbsp;''''Automatic installation via QPKG'''' above (but do not enable it yet, or disable it if it was enabled after the install)
<pre># cp -af /share/MD0_DATA/optware/Optware-ipkg.sh /share/MD0_DATA/optware.foo/Optware-ipkg.sh</pre>
*Now remove the optware directory you've just install (Warning! make sure Optware_Ipkg is not enabled! or no mounts is present on any of the directories under the newly installed ipkg location, eg, /share/MD0_DATA/optware/mnt/ext/Public or /share/MD0_DATA/optware/share/Public, etc... Failed to do so will wipe all your data under /share/Public, /share/Qdownload, /share/Qmultimedia, /share/Qusb and /share/Qweb on your hard drive. you can check this by 'df' and see if any mount points are made under these locations.)
<pre># rm -rf /share/MD0_DATA/optware</pre>
*Rename the old IPKG folder name back
<pre># mv /share/MD0_DATA/optware.foo /share/MD0_DATA/optware </pre>
*Now you may enable/disable your previous ipkg install from your QPKG admin page and use them as normal.


<br><br>
&nbsp;


== Manual installation<br> ==
*copy the IPKG start script to the old IPKG directory
<pre># cp -af /share/MD0_DATA/optware/Optware-ipkg.sh /share/MD0_DATA/optware.foo/Optware-ipkg.sh</pre>


This is the manual installation method.<br>  
*Now remove the optware directory you've just install (Warning! make sure Optware_Ipkg is not enabled! or no mounts is present on any of the directories under the newly installed ipkg location, eg, /share/MD0_DATA/optware/mnt/ext/Public or /share/MD0_DATA/optware/share/Public, etc... Failed to do so will wipe all your data under /share/Public, /share/Qdownload, /share/Qmultimedia, /share/Qusb and /share/Qweb on your hard drive. you can check this by 'df' and see if any mount points are made under these locations.)
<pre># rm -rf /share/MD0_DATA/optware</pre>


<br>  
*Rename the old IPKG folder name back
<pre># mv /share/MD0_DATA/optware.foo /share/MD0_DATA/optware </pre>


==== Create the required directories on the NAS<br>  ====
*Now you may enable/disable your previous ipkg install from your QPKG admin page and use them as normal.
 
<br/> &nbsp;
 
== Manual installation ==
 
This is the manual installation method.
 
&nbsp;
 
==== Create the required directories on the NAS ====


----
----
<pre># mkdir -p /share/MD0_DATA/optware/opt</pre><pre># mkdir /share/MD0_DATA/optware/ipkglib
<pre># mkdir -p /share/MD0_DATA/optware/opt</pre>
</pre>  
<pre># mkdir /share/MD0_DATA/optware/ipkglib
<br>
</pre>
 
&nbsp;
 
Note:


Note:<br>  
*For NAS running RAID (2 disks or above)
<pre># cd /; ln -sf /share/MD0_DATA/optware/ipkglib /usr/lib/ipkg</pre>


*For NAS running RAID (2 disks or above)<br>
*For NAS running single disk (1 disk only)  
<pre># cd /; ln -sf /share/MD0_DATA/optware/ipkglib /usr/lib/ipkg</pre>
<pre># cd /; ln -sf /share/HDA_DATA/optware/ipkglib /usr/lib/ipkg</pre>
*For NAS running single disk (1 disk only)<br>
<pre># cd /; ln -sf /share/HDA_DATA/optware/ipkglib /usr/lib/ipkg</pre>
<br>  


==== Create a symbolic link to /opt<br>  ====
&nbsp;
 
==== Create a symbolic link to /opt ====


----
----


<br>Create a symbolic link to the Optware installation directory<br>
<br/> Create a symbolic link to the Optware installation directory
<pre># rm -rf /opt</pre><pre># cd /; ln -sf /share/MD0_DATA/optware/opt /opt</pre>
<pre># rm -rf /opt</pre>
<br>  
<pre># cd /; ln -sf /share/MD0_DATA/optware/opt /opt</pre>


Check if /opt is symlinked to /share/MD0_DATA/optware/opt (or /share/HDA_DATA/optware/opt)<br>
&nbsp;
 
Check if /opt is symlinked to /share/MD0_DATA/optware/opt (or /share/HDA_DATA/optware/opt)
<pre># cd /
<pre># cd /
# ls -la</pre>  
# ls -la</pre>
<br>You should see&nbsp;:  
 
<br/> You should see&nbsp;:
<pre>opt -&gt; /share/MD0_DATA/optware/opt/  
<pre>opt -&gt; /share/MD0_DATA/optware/opt/  
</pre>  
</pre>
or<br>
 
or
<pre>opt -&gt; /share/HDA_DATA/optware/opt/
<pre>opt -&gt; /share/HDA_DATA/optware/opt/
</pre>
</pre>
<br>  


==== <br>Download and the ipkg file package ====
&nbsp;
 
==== <br/> Download and the ipkg file package ====


----
----


<br>
&nbsp;


First, go to optware installation directory to avoid messing up free space on root partition then downloading the package<br>
First, go to optware installation directory to avoid messing up free space on root partition then downloading the package
<pre># cd /share/MD0_DATA/big-disk  
<pre># cd /share/MD0_DATA/big-disk  
# wget http://ipkg.nslu2-linux.org/feeds/optware/cs05q3armel/cross/unstable/ipkg-opt_0.99.163-10_arm.ipk  
# wget http://ipkg.nslu2-linux.org/feeds/optware/cs05q3armel/cross/unstable/ipkg-opt_0.99.163-10_arm.ipk  
# tar -xOvzf ipkg-opt_*_arm.ipk ./data.tar.gz | tar -C / -xzvf -</pre>  
# tar -xOvzf ipkg-opt_*_arm.ipk ./data.tar.gz | tar -C / -xzvf -</pre>
<u>'''Note'''</u>  
 
<u>'''Note'''</u>
 
For PowerPC based devices (TS101/201) you should use
<nowiki>http://ipkg.nslu2-linux.org/feeds/optware/ts101/cross/unstable/ipkg-opt_0.99.163-10_powerpc.ipk</nowiki>
 
instead.
 
*For QNAP TS-459 Pro+ you should use this path for wget -&nbsp;[http://ipkg.nslu2-linux.org/feeds/optware/ts509/cross/unstable/ http://ipkg.nslu2-linux.org/feeds/optware/ts509/cross/unstable/]


For PowerPC based devices (TS101/201) you should use <nowiki>http://ipkg.nslu2-linux.org/feeds/optware/ts101/cross/unstable/ipkg-opt_0.99.163-10_powerpc.ipk</nowiki> instead.  
Replace the filename for the ipkg file as appropriate in the command.


*For QNAP TS-459 Pro+ you should use this path for wget -&nbsp;[http://ipkg.nslu2-linux.org/feeds/optware/ts509/cross/unstable/ http://ipkg.nslu2-linux.org/feeds/optware/ts509/cross/unstable/]
<br/> Edit /opt/etc/ipkg.conf
<pre># vi /opt/etc/ipkg.conf</pre>


Replace the filename for the ipkg file as appropriate in the command.  
Add the line
<pre>src cs05q3armel http://ipkg.nslu2-linux.org/feeds/optware/cs05q3armel/cross/stable</pre>


<br>Edit /opt/etc/ipkg.conf<br>
Save and close with ESC and&nbsp;:wq and enter<br/> <br/> Update the package list&nbsp;:
<pre># vi /opt/etc/ipkg.conf</pre>
<pre># /opt/bin/ipkg update</pre>
Add the line<br>
 
<pre>src cs05q3armel http://ipkg.nslu2-linux.org/feeds/optware/cs05q3armel/cross/stable</pre>
<br/> You should see&nbsp;:
Save and close with ESC and&nbsp;:wq and enter<br><br>Update the package list&nbsp;:  
<pre># /opt/bin/ipkg update</pre>  
<br>You should see&nbsp;:  
<pre>[/] # /opt/bin/ipkg update  
<pre>[/] # /opt/bin/ipkg update  
Downloading http://ipkg.nslu2-linux.org/feeds/optware/cs05q3armel/cross/stable/Packages  
Downloading http://ipkg.nslu2-linux.org/feeds/optware/cs05q3armel/cross/stable/Packages  
Updated list of available packages in /opt/lib/ipkg/lists/cs05q3armel  
Updated list of available packages in /opt/lib/ipkg/lists/cs05q3armel  
Successfully terminated.</pre>  
Successfully terminated.</pre>
<br>If there are errors or you do not see Downloading info that means that either you did not edit ipkg.conf mentioned before or hm.


<br>  
<br/> If there are errors or you do not see Downloading info that means that either you did not edit ipkg.conf mentioned before or hm.


==== Install applications (mc in this example) ====
&nbsp;
 
==== Install applications (mc in this example) ====


----
----


<br>
&nbsp;


Change to optware directory cause this ipkg left some strange files which makes / partition to small, i dont know if its an error or something  
Change to optware directory cause this ipkg left some strange files which makes / partition to small, i dont know if its an error or something
<pre># cd /share/MD0_DATA/optware  
<pre># cd /share/MD0_DATA/optware  
# /opt/bin/ipkg update  
# /opt/bin/ipkg update  
# /opt/bin/ipkg install slang  
# /opt/bin/ipkg install slang  
# /opt/bin/ipkg install mc --tmp-dir=/share/MD0_DATA/</pre>
# /opt/bin/ipkg install mc --tmp-dir=/share/MD0_DATA/</pre>
<br>  


And then to run mc
&nbsp;
<pre>/opt/bin/mc</pre>
<br>


==== Preserve the configurations on reboot ====
And then to run mc
<pre>/opt/bin/mc</pre>
 
&nbsp;
 
==== Preserve the configurations on reboot ====


----
----


<br>
&nbsp;


Create the autorun.sh file  
Create the autorun.sh file
<pre># mount /dev/mtdblock5 -t ext2 /tmp/config  
<pre># mount /dev/mtdblock5 -t ext2 /tmp/config  
# cd /tmp/config  
# cd /tmp/config  
# vi autorun.sh</pre>  
# vi autorun.sh</pre>
<br>Add to the following lines to the file then save and close  
 
<br/> Add to the following lines to the file then save and close
<pre>rm -rf /opt
<pre>rm -rf /opt
ln -sf /share/MD0_DATA/optware/opt /opt
ln -sf /share/MD0_DATA/optware/opt /opt
echo "export PATH=$PATH:/opt/bin:/opt/sbin" &gt;&gt; /etc/profile</pre>  
echo "export PATH=$PATH:/opt/bin:/opt/sbin" &gt;&gt; /etc/profile</pre>
<br>
 
&nbsp;


Make autorun.sh executable and do not forget to unmount&nbsp;!<br>
Make autorun.sh executable and do not forget to unmount&nbsp;!
<pre># chmod +x autorun.sh
<pre># chmod +x autorun.sh
# cd /
# cd /
# umount /dev/mtdblock5
# umount /dev/mtdblock5


</pre>  
</pre>
'''Note''', for TS101/201 users, you should use '''/dev/mtdblock4''' instead of '''/dev/mtdblock5'''.<br>
 
'''Note''', for TS101/201 users, you should use '''/dev/mtdblock4''' instead of '''/dev/mtdblock5'''.


<br>
&nbsp;


== Scripted Manual Installation ==
== Scripted Manual Installation ==


'''Note''', this script is a starting point for your own scripts, but thought it might be useful. YMMV, please modify it to your liking and send me an email telling me about your cool improvements.<br> '''Note''', Currently supports arm systems with RAID only, installs coreutils ipkg  
'''Note''', this script is a starting point for your own scripts, but thought it might be useful. YMMV, please modify it to your liking and send me an email telling me about your cool improvements.<br/> '''Note''', Currently supports arm systems with RAID only, installs coreutils ipkg


'''qnap_install_coreutils.sh'''  
'''qnap_install_coreutils.sh'''
<pre>#!/bin/bash
<pre>#!/bin/bash
clear
clear
Line 453: Line 495:
   
   


</pre>  
</pre>
<br>
 
&nbsp;


[[Category:QPKG]] [[Category:Optware_IPKG|Optware_IPKG]]
[[Category:QPKG]] [[Category:Optware IPKG|Optware_IPKG]]

Latest revision as of 13:52, 28 January 2019

OBSELETE: as of January 2019, Optware is no longer listed in the QNAP "App Center". It appears that QNAP withdrew it sometime in 2015 or 2016. Entware is a non-QNAP QPKG which serves the same purpose of giving access to many command-line software tools used on a wide range of NAS systems.

The following content is preserved for history. Some of the wording has been changed to make it clear Optware is withdrawn.


By installing Optware IPKG, you [used to be able to] open the door to installing many other software packages by many different developers. QNAP supplies Ipkg as a QPKG plugin on many of their products. This is probably the easiest way to install for most. We also give instructions on manual install.

Simplified installation using QPKG [for 3.2x, now obselete]

This [was] the simplified installation method using the QPKG update system firmware page with an Optware_Ipkg.qpkg file.

  1. First update your firmware to the latest build [applies to 3.2x, not 4.3x].
  2. In the device's Administration interface, select 'App Center'. In the App Center window, search for "Optware" using the search box at the top left, or click on the "Developer Tools" item in the left pane. An icon "Optware IPKG" appears. Click on the icon, and the App Center will install it.

Installation in firmware 3.2x

If you are using Firmware before version 4.x, your Administration Interface might not have an 'App Center'. The following instructions are appropriate for firmware 3.2.x, and may be appropriate for firmware as late as 3.8.x. (No editor of this article has checked on 3.6.x through 3.8.x yet.)

    • For firmware version 3.2x, select the 'System Tools' -> 'QPKG' page, click on 'Get QPKG' button.
    • If nothing is listed you must get the package from the appropriate download page on the QNAP website.
  1. Download 'Optware IPKG' package that matches your model.
  2. If the archive ends with a .zip extension, then unzip the downloaded archive to get a file with a .qpkg extension.
  3. If you're behind a proxy, put this in the /root/.wgetrc or in the /etc/wgetrc or in both:
http_proxy = http://proxy.domain.com:3128
use_proxy = on

The install will fail if you don't do that.

  1. Now install the qpkg file. Go to the 'Installation' tab. Click the Browse button, and select the qpkg file. Click the OK button. A progress bar appears, then a confirmation dialog that the installation was successful.
    • Alternative: install it (.qpkg file) via the 'System Update' under your 'System Tools' page.
  2. If you get this error (check your mails!):

Optware 0.99.163 installation failed. /share/MD0_DATA/optware existed. Please remove it first.

ssh on the NAS and issue this command (use with care!!):

rm -rf /share/MD0_DATA/.qpkg/Optware
  1. Return to the 'QPKG Installed' tab. An icon with a penguin, and caption "Optware", should now be visible.
  2. Click the Optware icon or caption. A dialog "QPKG Plugins - QPKG - Optware" appears. At the bottom, it has buttons "Enable", "Disable", and "Remove".
  3. Click the "Enable" button. There is a pause, then the device gives you an alert box to confirm IPKG is enabled.
  4. Now Ssh into the admin account on your NAS device.
  5. As of April 2010, TS-219P Firmware 3.2.5 build 0409T has two bugs which require you to patch an initialisation file, /etc/init.d/Optware.sh. Follow the instructions in sections #Running_.2Fopt.2Fetc.2Finit.d.2F.2A_on_startup and #Fix_the_.24PATH_in_.2Fetc.2Fprofile below.
  6. Log out, and restart the NAS device to get the patches enforced.
  7. Confirm that ipkg is available. Ssh in again, and type: # ipkg --version. A message like ipkg version 0.99.163 appears. ipkg is now installed.

Continue to the article Using IPKG for instructions on what to do next.

 

Running /opt/etc/init.d/* on startup

Some, but not all, ipkg packages install startup scripts into /opt/etc/init.d/. These are to be run as part of system startup. As of April 2010, TS-219P Firmware 3.2.5 build 0409T does not run the scripts in this directory. This section explains how to patch the firmware to add this startup action.

The Optware QPKG creates an initialisation script and stores it in a QPKG Optware directory on your main data share. When the QNAP NAS device starts up, it adds a link to this script from /etc/rcS.d/. The name of this link is something like QS100Optware, where 100 is a sequence number that depends on how many QPKG packages you installed and in what order. This is what these files look like in TS-219P Firmware 3.2.5 build 0409T:

# ls -lFh /etc/init.d/*Optware* /etc/rcS.d/*Optware* /share/MD0_DATA/.qpkg/Optware/*Optware*
lrwxrwxrwx    1 admin    administ       40 Apr 19 16:02 /etc/init.d/Optware.sh -> /share/MD0_DATA/.qpkg/Optware/Optware.sh*
lrwxrwxrwx    1 admin    administ       40 Apr 19 16:02 /etc/rcS.d/QS100Optware -> /share/MD0_DATA/.qpkg/Optware/Optware.sh*
-rwxr-xr-x    1 admin    administ     1.9k Feb 21 21:10 /share/MD0_DATA/.qpkg/Optware/Optware.sh*

Edit the install script. It's fine to get to it via one of its Symlinks:

vi /etc/init.d/Optware.sh

Look towards the end of the file for content like this:

case "$1" in
  start)
               ...[elided]...
	# adding Ipkg apps into system path ...
	/bin/cat /etc/profile | /bin/grep "PATH" | /bin/grep "/opt/bin" 1>>/dev/null 2>>/dev/null
        [ $? -ne 0 ] && /bin/echo "export PATH=$PATH":/opt/bin:/opt/sbin >> /etc/profile

	;;
  stop)
               ...[elided]...

We will add a block of code just before the ;; stop) lines. The portion of the file now looks like the following:

case "$1" in
  start)
               ...[elided]...
	# adding Ipkg apps into system path ...
	/bin/cat /etc/profile | /bin/grep "PATH" | /bin/grep "/opt/bin" 1>>/dev/null 2>>/dev/null
        [ $? -ne 0 ] && /bin/echo "export PATH=$PATH":/opt/bin:/opt/sbin >> /etc/profile

  # Patch per http://wiki.qnap.com/wiki/Install_Optware_IPKG
  /bin/echo "Run Optware/ipkg /opt/etc/init.d/*"
  	source /etc/profile
        # Start all init scripts in /opt/etc/init.d
	# executing them in numerical order.
	# 11-May-2015 edit: added semi-colon to for-do statement otherwise script throws an error
        #
	for i in /opt/etc/init.d/S??*; do
	    # Ignore dangling symlinks (if any).
    	    #[ ! -f "$i" ] && continue

            case "$i" in
                *.sh)
	            # Source shell script for speed.
	            (
		        trap - INT QUIT TSTP
			set start
		        . $i
	    	    )
	        ;;
	        *)
	    	    # No sh extension, so fork subprocess.
	    	    $i start
                ;;          
            esac            
        done                
# End patch

	;;
  stop)
               ...[elided]...

Save the file and quit the editor.

Now, restart the QNAP NAS device. All Optware packages which need to run at startup time, should run automatically.

Because this code runs whatever scripts are in the /opt/etc/init.d/ directory, you do not need to modify it when you add or remove Optware packages. However, there's a likelihood that future QNAP firmware releases may overwrite Optware.sh. This would require you to reapply this patch.

For further information:

Fix the $PATH in /etc/profile

The code that sets up the Optware environment should extend the $PATH environment variable, adding the Optware bin directories to the head of the path where they can preempt any equivalents that come with the QNAP firmware. It should also preserve the original path, with any modifications which other software made. As of April 2010, TS-219P Firmware 3.2.5 build 0409T does not do this correctly.

[note] In July 2010, firmware 3.4.3, we do not need to modify the "Optware.sh" as below.

There is a simple fix, to the same Optware.sh file we edited in the previous section.

Edit the file:

vi /etc/init.d/Optware.sh

Look for the section of code which mentions /opt/bin. Replace it so that this part of the file looks like:

	# adding Ipkg apps into system path ...
	/bin/cat /etc/profile | /bin/grep "PATH" | /bin/grep "/opt/bin" 1>>/dev/null 2>>/dev/null
        # Bug fix for following: put IPKG first, per http://forum.qnap.com/viewtopic.php?f=124&t=15663
	# was [ $? -ne 0 ] && /bin/echo "export PATH=$PATH":/opt/bin:/opt/sbin >> /etc/profile
	[ $? -ne 0 ] && /bin/echo "export PATH=/opt/bin:/opt/sbin:\$PATH" >> /etc/profile

Save the file and quit the editor.

Now, restart the QNAP NAS device. In the admin shell, check the $PATH environment variable. /opt/bin and /opt/sbin should come before /bin and /usr/bin. For instance:

# echo $PATH
/opt/bin:/opt/sbin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/bin/X11:/usr/local/sbin

For further information:

Troubleshooting

  • Installing the package requires that the target device has internet access otherwise the installation will fail about 60% of the way through.
  • After a failed install you will not be able to reattempt the installation until you manually delete the Optware directory under /share/MD0_DATA/.qpkg. Failure to do this will result in an error message in the system log stating the package is already installed.
  • If you perform an installation through QPKG, get an installation successful alert, but ipkg doesn't appear in the 'QPKG Installed' tab, check to see if you installed a file with a .zip extension. QPKG cannot install ZIP archives. You must unzip the archive, and there should be a file with a .qpkg installation inside. You must install this .qpkg file.
  • If you install an Optware package, and it runs right after installation but fails to restart automatically when the server restarts, then check to see that the patch in #Running_.2Fopt.2Fetc.2Finit.d.2F.2A_on_startup above has been completed correctly.

Migrating from the previous installation (either automatic script or manual)

For migration from previous install (automatic/manual) to the QPKG'ed install, please see below:

 

  • umount all the mounts for your original IPKG install
# umount /share/MD0_DATA/optware/dev
# umount /share/MD0_DATA/optware/proc
# umount /share/MD0_DATA/optware/proc/bus/usb
# umount /share/MD0_DATA/optware/mnt/ext/Qmultimedia
# umount /share/MD0_DATA/optware/mnt/ext/Qdownload
# umount /share/MD0_DATA/optware/mnt/ext/Qweb
# umount /share/MD0_DATA/optware/mnt/ext/Qusb
# umount /share/MD0_DATA/optware/mnt/ext/Public
  • remove all the Ipkg-related entries in autorun.sh
# mount /dev/mtdblock5 /tmp/config
# vi /tmp/config/autorun.sh
  • remove these entries:
# Internet access... 
cp /etc/resolv.conf /share/MD0_DATA/optware/etc
cp /etc/hostname /share/MD0_DATA/optware/etc
# Timezone... 
cp /etc/TZ /share/MD0_DATA/optware/etc
# User/Group management... 
cp /etc/config/passwd /etc/config/group /etc/config/shadow /share/MD0_DATA/optware/etc
# sym-link /share/MD0_DATA/optware/opt to /opt
rm -rf /opt
ln -sf /share/MD0_DATA/optware/opt /opt
# Mount directories into chroot
mount -o bind /dev /share/MD0_DATA/optware/dev
mount -o bind /proc /share/MD0_DATA/optware/proc
mount -o bind /proc/bus/usb /share/MD0_DATA/optware/proc/bus/usb
mount -o bind /share/MD0_DATA/Qmultimedia /share/MD0_DATA/optware/mnt/ext/Qmultimedia
mount -o bind /share/MD0_DATA/Qmultimedia /share/MD0_DATA/optware/mnt/ext/Qdownload
mount -o bind /share/MD0_DATA/Qmultimedia /share/MD0_DATA/optware/mnt/ext/Qusb
mount -o bind /share/MD0_DATA/Qmultimedia /share/MD0_DATA/optware/mnt/ext/Qweb
mount -o bind /share/MD0_DATA/Qmultimedia /share/MD0_DATA/optware/mnt/ext/Public
# adding Ipkg apps into system path ...
export PATH=/opt/bin:/opt/sbin:$PATH 
  • save then close

 

  • rename /share/MD0_DATA/optware
mv /share/MD0_DATA/optware /share/MD0_DATA/optware.foo
  • Install QPKGed IPKG according to the guide 'Automatic installation via QPKG' above (but do not enable it yet, or disable it if it was enabled after the install)

 

  • copy the IPKG start script to the old IPKG directory
# cp -af /share/MD0_DATA/optware/Optware-ipkg.sh /share/MD0_DATA/optware.foo/Optware-ipkg.sh
  • Now remove the optware directory you've just install (Warning! make sure Optware_Ipkg is not enabled! or no mounts is present on any of the directories under the newly installed ipkg location, eg, /share/MD0_DATA/optware/mnt/ext/Public or /share/MD0_DATA/optware/share/Public, etc... Failed to do so will wipe all your data under /share/Public, /share/Qdownload, /share/Qmultimedia, /share/Qusb and /share/Qweb on your hard drive. you can check this by 'df' and see if any mount points are made under these locations.)
# rm -rf /share/MD0_DATA/optware
  • Rename the old IPKG folder name back
# mv /share/MD0_DATA/optware.foo /share/MD0_DATA/optware 
  • Now you may enable/disable your previous ipkg install from your QPKG admin page and use them as normal.


 

Manual installation

This is the manual installation method.

 

Create the required directories on the NAS


# mkdir -p /share/MD0_DATA/optware/opt
# mkdir /share/MD0_DATA/optware/ipkglib

 

Note:

  • For NAS running RAID (2 disks or above)
# cd /; ln -sf /share/MD0_DATA/optware/ipkglib /usr/lib/ipkg
  • For NAS running single disk (1 disk only)
# cd /; ln -sf /share/HDA_DATA/optware/ipkglib /usr/lib/ipkg

 

Create a symbolic link to /opt



Create a symbolic link to the Optware installation directory

# rm -rf /opt
# cd /; ln -sf /share/MD0_DATA/optware/opt /opt

 

Check if /opt is symlinked to /share/MD0_DATA/optware/opt (or /share/HDA_DATA/optware/opt)

# cd /
# ls -la


You should see :

opt -> /share/MD0_DATA/optware/opt/ 

or

opt -> /share/HDA_DATA/optware/opt/

 


Download and the ipkg file package


 

First, go to optware installation directory to avoid messing up free space on root partition then downloading the package

# cd /share/MD0_DATA/big-disk 
# wget http://ipkg.nslu2-linux.org/feeds/optware/cs05q3armel/cross/unstable/ipkg-opt_0.99.163-10_arm.ipk 
# tar -xOvzf ipkg-opt_*_arm.ipk ./data.tar.gz | tar -C / -xzvf -

Note

For PowerPC based devices (TS101/201) you should use http://ipkg.nslu2-linux.org/feeds/optware/ts101/cross/unstable/ipkg-opt_0.99.163-10_powerpc.ipk

instead.

Replace the filename for the ipkg file as appropriate in the command.


Edit /opt/etc/ipkg.conf

# vi /opt/etc/ipkg.conf

Add the line

src cs05q3armel http://ipkg.nslu2-linux.org/feeds/optware/cs05q3armel/cross/stable

Save and close with ESC and :wq and enter

Update the package list :

# /opt/bin/ipkg update


You should see :

[/] # /opt/bin/ipkg update 
Downloading http://ipkg.nslu2-linux.org/feeds/optware/cs05q3armel/cross/stable/Packages 
Updated list of available packages in /opt/lib/ipkg/lists/cs05q3armel 
Successfully terminated.


If there are errors or you do not see Downloading info that means that either you did not edit ipkg.conf mentioned before or hm.

 

Install applications (mc in this example)


 

Change to optware directory cause this ipkg left some strange files which makes / partition to small, i dont know if its an error or something

# cd /share/MD0_DATA/optware 
# /opt/bin/ipkg update 
# /opt/bin/ipkg install slang 
# /opt/bin/ipkg install mc --tmp-dir=/share/MD0_DATA/

 

And then to run mc

/opt/bin/mc

 

Preserve the configurations on reboot


 

Create the autorun.sh file

# mount /dev/mtdblock5 -t ext2 /tmp/config 
# cd /tmp/config 
# vi autorun.sh


Add to the following lines to the file then save and close

rm -rf /opt
ln -sf /share/MD0_DATA/optware/opt /opt
echo "export PATH=$PATH:/opt/bin:/opt/sbin" >> /etc/profile

 

Make autorun.sh executable and do not forget to unmount !

# chmod +x autorun.sh
# cd /
# umount /dev/mtdblock5

Note, for TS101/201 users, you should use /dev/mtdblock4 instead of /dev/mtdblock5.

 

Scripted Manual Installation

Note, this script is a starting point for your own scripts, but thought it might be useful. YMMV, please modify it to your liking and send me an email telling me about your cool improvements.
Note, Currently supports arm systems with RAID only, installs coreutils ipkg

qnap_install_coreutils.sh

#!/bin/bash
clear
echo "Coreutils setup script"
echo "by Jim Barstow <barstow@dynedge.com>"
echo
start_time=`date "+%F %r"`
echo "Coreutils setup started at ${start_time}"

echo -n "Checking for RAID mount point... "
if [ ! -d "/share/MD0_DATA/" ]; then
  echo "FAIL: RAID mount point not found."
  exit 1
else
  opt_mountpoint="/share/MD0_DATA"
  echo "OK"
fi

echo -n "Creating required directories... "
if [ ! -d "${opt_mountpoint}/optware/opt" ]; then
  mkdir -p ${opt_mountpoint}/optware/opt
fi
if [ ! -d "${opt_mountpoint}/optware/ipkglib" ]; then
  mkdir ${opt_mountpoint}/optware/ipkglib
fi
if [ -d "${opt_mountpoint}/optware/opt/" -a -d "${opt_mountpoint}/optware/ipkglib" ]; then
  echo "OK"
else
  echo "FAIL: required directories could not be created."
  exit 1
fi

echo -n "Symlinking ipkg to /usr/lib/ipkg... "
cd /; ln -sf ${opt_mountpoint}/optware/ipkglib /usr/lib/ipkg
echo "OK"

echo -n "Symlinking /opt... "
if [ -d "/opt" ]; then
  mv /opt /opt.bak
  rm -rf /opt
fi
cd /; ln -sf ${opt_mountpoint}/optware/opt /opt
echo "OK"

echo -n "Updating path to include /opt/bin... "
export PATH=/opt/bin:$PATH
echo "OK"

echo -n "Verifying/Creating sources location... "
if [ ! -d "${opt_mountpoint}/opt_sources/" ]; then
  mkdir ${opt_mountpoint}/opt_sources
fi
if [ ! -d "${opt_mountpoint}/opt_sources/" ]; then
  echo "FAIL: sources location could not be created."
  exit 1
else
  echo "OK"
fi

echo -n "Verifying system type is ARM... "
sys_type=`uname -m`
if [[ "${sys_type}"=="armv5tel" ]]; then
  echo "OK"
else
  echo "FAIL: got system type ${sys_type}."
  exit 1
fi

echo -n "Downloading ipkg source... "
cd ${opt_mountpoint}/opt_sources/
wget -q http://ipkg.nslu2-linux.org/feeds/optware/cs05q3armel/cross/unstable/ipkg-opt_0.99.163-10_arm.ipk
if [ -f "${opt_mountpoint}/opt_sources/ipkg-opt_0.99.163-10_arm.ipk" ]; then
  echo "OK"
else
  echo "FAIL: could not download ipkg source."
  exit 1
fi

echo -n "Extracting ipkg source... "
tar -xOzf ipkg-opt_*_arm.ipk ./data.tar.gz | tar -C / -xzf -
echo "OK"

echo -n "Configuring ipkg... "
ipkg_src=`cat /opt/etc/ipkg.conf | grep "src cs05q3armel"`
if [ -z "$ipkg_src" ]; then
  echo "src cs05q3armel http://ipkg.nslu2-linux.org/feeds/optware/cs05q3armel/cross/stable" >>/opt/etc/ipkg.conf
  echo "OK"
else
  echo "OK"
fi

echo -n "Updating ipkg... "
/opt/bin/ipkg update -V0
echo "OK"

echo -n "Installing coreutils... "
cd ${opt_mountpoint}/optware
/opt/bin/ipkg update -V0
/opt/bin/ipkg install -V0 coreutils
echo "OK"

echo -n "Symlinking coreutils-nohup to /usr/bin/nohup... "
ln -sf /opt/bin/coreutils-nohup /usr/bin/nohup
if [ -f "/usr/bin/nohup" ]; then
  echo "OK"
else
  echo "FAIL: could not symlink /usr/bin/nohup."
  exit 1
fi

end_time=`date "+%F %r"`
echo "Coreutils setup completed at ${end_time}"