<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<atom:link href="https://dev1galaxy.org/extern.php?action=feed&amp;tid=4993&amp;type=rss" rel="self" type="application/rss+xml" />
		<title><![CDATA[Dev1 Galaxy Forum / [SOLVED] Script $PATH question]]></title>
		<link>https://dev1galaxy.org/viewtopic.php?id=4993</link>
		<description><![CDATA[The most recent posts in [SOLVED] Script $PATH question.]]></description>
		<lastBuildDate>Tue, 19 Apr 2022 14:22:02 +0000</lastBuildDate>
		<generator>FluxBB</generator>
		<item>
			<title><![CDATA[Re: [SOLVED] Script $PATH question]]></title>
			<link>https://dev1galaxy.org/viewtopic.php?pid=35688#p35688</link>
			<description><![CDATA[<p>Hello:</p><div class="quotebox"><cite>Head_on_a_Stick wrote:</cite><blockquote><div><p>/usr/local/bin/ is not in your user&#039;s PATH ...</p></div></blockquote></div><p>Yes. v</p><div class="quotebox"><cite>Altoid wrote:</cite><blockquote><div><p>I did not want to get into fussing with PATH.<br />I still have to find where it is set ...&#160; 8^|</p></div></blockquote></div><div class="quotebox"><cite>Head_on_a_Stick wrote:</cite><blockquote><div><p>No idea ...</p></div></blockquote></div><p>It is not in the <span class="bbc">*.img</span> and editing <span class="bbc">/etc/*preinit</span> did not work.<br />You have to create <span class="bbc">/etc/profile.d</span> and populate it accordingly. </p><p>Thanks for your input.</p><p>Best,</p><p>A.</p>]]></description>
			<author><![CDATA[dummy@example.com (Altoid)]]></author>
			<pubDate>Tue, 19 Apr 2022 14:22:02 +0000</pubDate>
			<guid>https://dev1galaxy.org/viewtopic.php?pid=35688#p35688</guid>
		</item>
		<item>
			<title><![CDATA[Re: [SOLVED] Script $PATH question]]></title>
			<link>https://dev1galaxy.org/viewtopic.php?pid=35686#p35686</link>
			<description><![CDATA[<div class="quotebox"><cite>Altoid wrote:</cite><blockquote><div><p>Originally I had it in /usr/local/bin.<br />As I could not get it to work unless I used <span class="bbc">./</span>, I moved it.</p></div></blockquote></div><p>/usr/local/bin/ is not in your user&#039;s PATH so any executables placed there will not be found unless the full path is given.</p><p>No idea where OpenWRT sets PATH though, perhaps ask on <a href="https://forum.openwrt.org/" rel="nofollow">their forums</a> instead? You would probably get a better response there. Failing that check /etc/profile &amp; /etc/profile.d/*.</p>]]></description>
			<author><![CDATA[dummy@example.com (Head_on_a_Stick)]]></author>
			<pubDate>Tue, 19 Apr 2022 13:54:51 +0000</pubDate>
			<guid>https://dev1galaxy.org/viewtopic.php?pid=35686#p35686</guid>
		</item>
		<item>
			<title><![CDATA[Re: [SOLVED] Script $PATH question]]></title>
			<link>https://dev1galaxy.org/viewtopic.php?pid=35680#p35680</link>
			<description><![CDATA[<p>Hello:</p><div class="quotebox"><cite>hevidevi wrote:</cite><blockquote><div><p>Thanks ...</p></div></blockquote></div><p>You&#039;re welcome.</p><div class="quotebox"><cite>hevidevi wrote:</cite><blockquote><div><p>... a try myself.</p></div></blockquote></div><p>Obviously, the use you can give it depends on the hardware you run it on.<br />eg: I use a MyBook Live which has a SATA HD instead of firmware.</p><p>As this would be OT/non Devuan, feel free to contact me.</p><p>Best,</p><p>A.</p>]]></description>
			<author><![CDATA[dummy@example.com (Altoid)]]></author>
			<pubDate>Tue, 19 Apr 2022 10:15:38 +0000</pubDate>
			<guid>https://dev1galaxy.org/viewtopic.php?pid=35680#p35680</guid>
		</item>
		<item>
			<title><![CDATA[Re: [SOLVED] Script $PATH question]]></title>
			<link>https://dev1galaxy.org/viewtopic.php?pid=35679#p35679</link>
			<description><![CDATA[<p>Thanks for the info Altoid, think of giving this a try myself.</p>]]></description>
			<author><![CDATA[dummy@example.com (hevidevi)]]></author>
			<pubDate>Tue, 19 Apr 2022 10:03:24 +0000</pubDate>
			<guid>https://dev1galaxy.org/viewtopic.php?pid=35679#p35679</guid>
		</item>
		<item>
			<title><![CDATA[Re: [SOLVED] Script $PATH question]]></title>
			<link>https://dev1galaxy.org/viewtopic.php?pid=35676#p35676</link>
			<description><![CDATA[<p>Hello:</p><div class="quotebox"><cite>hevidevi wrote:</cite><blockquote><div><p>... a way to create a regular user on this OpenWrt ...</p></div></blockquote></div><p>Yes. </p><p>It is not as straight forward as in a regular distribution because the tools are not installed by default.<br />In these router <em>firmwares</em> such as OpenWRT (an OS by any other name), space is at a premium.</p><p>So if it is not needed, it is not in the image to install.<br />And if you need it, make sure it is not in BusyBox before you install it.</p><p>That said, first you have to install at least these files from the OpenWRT repository:</p><p>To manage groups in your system. </p><p><span class="bbc">shadow-groups</span><br /><span class="bbc">shadow-groupadd</span><br /><span class="bbc">shadow-groupdel</span></p><p>To manage users in your system:</p><p><span class="bbc">shadow-useradd</span><br /><span class="bbc">shadow-userdel</span><br /><span class="bbc">shadow-usermod</span></p><p>You may also want to install <span class="bbc">sudo</span> to put your user in <span class="bbc">/etc/sudoers.d/</span> with strict premissions for specific tasks that require elevated privileges. </p><p>You then proceed more or less as would be usual in a regular distributions.<br />Some things you&#039;ll have to do by hand.</p><p>There are quite a few more shadow-* files available but I still have to see what they are about.<br />eg: shadow-login, shadow-logout.d, shadow-passwd, etc.&#160; </p><p>Unfortunately, the wiki pages about OpenWRT packages are all but empty.</p><p>Check this page: <a href="https://openwrt.org/docs/guide-user/base-system/users" rel="nofollow">https://openwrt.org/docs/guide-user/base-system/users</a></p><div class="codebox"><pre><code>groucho@OpenWrt:~$ whoami
groucho
groucho@OpenWrt:~$</code></pre></div><div class="codebox"><pre><code>groucho@OpenWrt:~$ groups
adm ftp users network ntp groucho
groucho@OpenWrt:~$ </code></pre></div><p><span class="bbu">Edit:</span> keep in mind that a regular user ie: not root can only log in via ssh.</p><p>I <em>think</em> there may be a file in the repository that would add something to the UI to be able to add another user.<br />Can&#039;t recall if it was OpenWRT or the WD software.</p><p>If you find anything interesting, please let let me know. </p><p>Best,</p><p>A.</p>]]></description>
			<author><![CDATA[dummy@example.com (Altoid)]]></author>
			<pubDate>Mon, 18 Apr 2022 17:13:18 +0000</pubDate>
			<guid>https://dev1galaxy.org/viewtopic.php?pid=35676#p35676</guid>
		</item>
		<item>
			<title><![CDATA[Re: [SOLVED] Script $PATH question]]></title>
			<link>https://dev1galaxy.org/viewtopic.php?pid=35675#p35675</link>
			<description><![CDATA[<p>Hello:</p><div class="quotebox"><cite>Head_on_a_Stick wrote:</cite><blockquote><div><p>... could have moved /root/shutdown to /usr/bin/ ...</p></div></blockquote></div><p>Originally I had it in /usr/local/bin.<br />As I could not get it to work unless I used <span class="bbc">./</span>, I moved it.<br />I did not want to get into fussing with PATH.<br />I still have to find where it is set ...&#160; 8^|</p><div class="quotebox"><cite>Head_on_a_Stick wrote:</cite><blockquote><div><p>... could have added /root/ to PATH ...</p></div></blockquote></div><p>Hmm ...<br />I may have a thing for abusing <span class="bbc">cat</span> ...<br />But I <em>do</em> know that is not a thing to do.</p><div class="quotebox"><cite>Head_on_a_Stick wrote:</cite><blockquote><div><p>... placing the actual script itself at /usr/bin/shutdown seems more sensible.</p></div></blockquote></div><p>OK.<br />It works well as it is but I&#039;ll move it to its proper place later today.</p><p>Thanks for your input.</p><p>Best,</p><p>A.</p>]]></description>
			<author><![CDATA[dummy@example.com (Altoid)]]></author>
			<pubDate>Mon, 18 Apr 2022 16:36:38 +0000</pubDate>
			<guid>https://dev1galaxy.org/viewtopic.php?pid=35675#p35675</guid>
		</item>
		<item>
			<title><![CDATA[Re: [SOLVED] Script $PATH question]]></title>
			<link>https://dev1galaxy.org/viewtopic.php?pid=35670#p35670</link>
			<description><![CDATA[<p>have you found a way to create a regular user on this OpenWrt drive?</p>]]></description>
			<author><![CDATA[dummy@example.com (hevidevi)]]></author>
			<pubDate>Mon, 18 Apr 2022 12:42:25 +0000</pubDate>
			<guid>https://dev1galaxy.org/viewtopic.php?pid=35670#p35670</guid>
		</item>
		<item>
			<title><![CDATA[Re: [SOLVED] Script $PATH question]]></title>
			<link>https://dev1galaxy.org/viewtopic.php?pid=35668#p35668</link>
			<description><![CDATA[<p>You could have moved /root/shutdown to /usr/bin/ instead or you could have added /root/ to PATH (which is a fantastically bad idea) but just placing the actual script itself at /usr/bin/shutdown seems more sensible. Strictly speaking non-packaged executables should go under /usr/local/bin/ but whatever.</p>]]></description>
			<author><![CDATA[dummy@example.com (Head_on_a_Stick)]]></author>
			<pubDate>Mon, 18 Apr 2022 12:22:58 +0000</pubDate>
			<guid>https://dev1galaxy.org/viewtopic.php?pid=35668#p35668</guid>
		</item>
		<item>
			<title><![CDATA[Re: [SOLVED] Script $PATH question]]></title>
			<link>https://dev1galaxy.org/viewtopic.php?pid=35658#p35658</link>
			<description><![CDATA[<p>Hello:</p><div class="quotebox"><cite>Head_on_a_Stick wrote:</cite><blockquote><div><div class="codebox"><pre><code># mv /usr/bin/closebook.sh /usr/bin/shutdown</code></pre></div></div></blockquote></div><p>Perfect.&#160; 8^)<br />Thank you very much.</p><p>Could you tell me what I was doing wrong?<br />Was it having script to call another one?</p><p>Thanks in advance,</p><p>A.</p>]]></description>
			<author><![CDATA[dummy@example.com (Altoid)]]></author>
			<pubDate>Sun, 17 Apr 2022 20:21:16 +0000</pubDate>
			<guid>https://dev1galaxy.org/viewtopic.php?pid=35658#p35658</guid>
		</item>
		<item>
			<title><![CDATA[Re: [SOLVED] Script $PATH question]]></title>
			<link>https://dev1galaxy.org/viewtopic.php?pid=35651#p35651</link>
			<description><![CDATA[<div class="codebox"><pre><code># mv /usr/bin/closebook.sh /usr/bin/shutdown</code></pre></div>]]></description>
			<author><![CDATA[dummy@example.com (Head_on_a_Stick)]]></author>
			<pubDate>Sun, 17 Apr 2022 19:03:25 +0000</pubDate>
			<guid>https://dev1galaxy.org/viewtopic.php?pid=35651#p35651</guid>
		</item>
		<item>
			<title><![CDATA[Re: [SOLVED] Script $PATH question]]></title>
			<link>https://dev1galaxy.org/viewtopic.php?pid=35650#p35650</link>
			<description><![CDATA[<p>Hello:</p><div class="quotebox"><cite>hevidevi wrote:</cite><blockquote><div><p>... maybe in your closebook.sh script you should not declare the <strong>PATH=/bin:/sbin</strong> ...</p></div></blockquote></div><p>I put it in just in case the system path has some issue.<br />Belt and suspenders thing.</p><p>But that would not seem to be the problem because the script <em>is</em> found and the executables in it <span class="bbc">are</span> run properly.</p><p>What is <em>not</em> being found is the script that calls <span class="bbc">closebook.sh</span> unless I run it as <span class="bbc">./shutdown</span>.</p><p>I just realised that the <span class="bbc">/root</span> folder is not in the system <span class="bbc">PATH</span> variable:</p><div class="codebox"><pre><code>root@OpenWrt:~# $PATH
-ash: /usr/sbin:/usr/bin:/sbin:/bin: not found
root@OpenWrt:~# </code></pre></div><p>This one:</p><div class="codebox"><pre><code>root@OpenWrt:~# ls
shutdown
root@OpenWrt:~# </code></pre></div><p>Which you can see here:</p><div class="codebox"><pre><code>root@OpenWrt:/# ls
bin         dev         lib         mnt         proc        # root #        srv         tmp         var
boot        etc         lost+found  overlay     rom         sbin        sys         usr         www
root@OpenWrt:/# </code></pre></div><p>No idea as to how to follow up.<br />Surely it is not a good idea to have the <span class="bbc">root</span> folder in the path.</p><p>Thanks for your input.</p><p>Best,</p><p>A.</p>]]></description>
			<author><![CDATA[dummy@example.com (Altoid)]]></author>
			<pubDate>Sun, 17 Apr 2022 16:56:08 +0000</pubDate>
			<guid>https://dev1galaxy.org/viewtopic.php?pid=35650#p35650</guid>
		</item>
		<item>
			<title><![CDATA[Re: [SOLVED] Script $PATH question]]></title>
			<link>https://dev1galaxy.org/viewtopic.php?pid=35646#p35646</link>
			<description><![CDATA[<p>not sure here bit maybe in your closebook.sh script you should not declare the <strong>PATH=/bin:/sbin</strong> if you are going to call closebook.sh from another script that is not on its path.</p><p>You shouldnt need to export/declare a path in the script at all if your shell env/path is setup properly.</p>]]></description>
			<author><![CDATA[dummy@example.com (hevidevi)]]></author>
			<pubDate>Sun, 17 Apr 2022 14:34:19 +0000</pubDate>
			<guid>https://dev1galaxy.org/viewtopic.php?pid=35646#p35646</guid>
		</item>
		<item>
			<title><![CDATA[[SOLVED] Script $PATH question]]></title>
			<link>https://dev1galaxy.org/viewtopic.php?pid=35645#p35645</link>
			<description><![CDATA[<p>Hello:</p><p>Still playing around with my new My Book Live thingy, trying to set up a solution to the lack of a <span class="bbc">shutdown</span> command in this PowerPC 44x processor.<br />This is the OpenWRT installed on the unit:</p><div class="codebox"><pre><code>~# uname -a
Linux_book 5.4.179 #0 Wed Feb 16 20:29:10 2022 ppc GNU/Linux
~# </code></pre></div><p>I wrote a script to shut down the board gracefully:</p><div class="codebox"><pre><code>root@OpenWrt:/usr/bin# cat closebook.sh
#!/bin/sh
# script to stop drive and shut down MBL
# gives ~15s from blue led &lt;on&gt; to unplug unit
PATH=/bin:/sbin

sync &amp;&amp; wait &amp;&amp; hdparm -Y /dev/sda &amp;&amp; wait &amp;&amp; halt
root@OpenWrt:/usr/bin# </code></pre></div><p>The script is executable:</p><div class="codebox"><pre><code>root@OpenWrt:~# ls -l /usr/bin/closebook.sh
-rwxr-xr-x    1 root     root           166 Apr 17 08:40 /usr/bin/closebook.sh
root@OpenWrt:~# </code></pre></div><p>Once the front LED goes from <span class="bbc">green</span> to <span class="bbc">blue</span>, you have to physically disconnect power to the board within ~15s, otherwise a watchdog will sense the new situation and proceed to reboot the board.</p><p>For the time being, I call the <span class="bbc">/usr/bin/closebook.sh</span> from <span class="bbc">~/</span> with another script:</p><div class="codebox"><pre><code>root@OpenWrt:~# cat shutdown 
#!/bin/sh
sh -c &#039;/usr/bin/closebook.sh&#039;
root@OpenWrt:~# </code></pre></div><p>The script is executable:</p><div class="codebox"><pre><code>root@OpenWrt:~# ls -l shutdown
-rwxr--r--    1 root     root            40 Apr 17 10:07 shutdown
root@OpenWrt:~# </code></pre></div><p>It works as intended and have not had an instance where the plug was pulled late or where the watchdog reboot caused any issues.<br />Unsurprisingly, not shutting down in this manner will always cause <span class="bbc">dmesg</span> to print this:</p><div class="codebox"><pre><code>[    0.907630] EXT4-fs (sda2): warning: mounting unchecked fs, running e2fsck is recommended
[    5.802598] EXT4-fs (sda1): warning: mounting unchecked fs, running e2fsck is recommended</code></pre></div><p>The main problem is that while <span class="bbc">/dev/sda1</span> but can be unmounted to run <span class="bbc">e2fsck</span>, <span class="bbc">/dev/sda2</span> holds the <span class="bbc">rootfs</span> and cannot be unmounted:</p><div class="codebox"><pre><code>root@OpenWrt:~# blkid
--- snip ---
/dev/sda2: LABEL=&quot;rootfs&quot; UUID=&quot;ff313567-e9f1-5a5d-9895-3ba130b4a864&quot; BLOCK_SIZE=&quot;4096&quot; TYPE=&quot;ext4&quot; PARTUUID=&quot;228c756a-02&quot;
--- snip ---
root@OpenWrt:~# </code></pre></div><p>But I digress ...</p><p>The thing is that to run the script I have to do it with <span class="bbc">./</span>, otherwise it is not found:</p><div class="codebox"><pre><code>root@OpenWrt:~# shutdown
-ash: shutdown: not found
root@OpenWrt:~# </code></pre></div><p>This even though I am running it as <span class="bbc">root</span> and it is located in what would be <span class="bbc">home</span> directory:</p><div class="codebox"><pre><code>root@OpenWrt:~# ls
shutdown
root@OpenWrt:~# </code></pre></div><p>The system&#039;s $PATH:</p><div class="codebox"><pre><code>root@OpenWrt:~# $PATH
-ash: /usr/sbin:/usr/bin:/sbin:/bin: not found
root@OpenWrt:~# </code></pre></div><p>I&#039;m sure it is a $PATH issue ...</p><p>What am I doing wrong?</p><p>Thanks in advance,</p><p>A.</p>]]></description>
			<author><![CDATA[dummy@example.com (Altoid)]]></author>
			<pubDate>Sun, 17 Apr 2022 14:17:58 +0000</pubDate>
			<guid>https://dev1galaxy.org/viewtopic.php?pid=35645#p35645</guid>
		</item>
	</channel>
</rss>
