[Porteus 5.0's USM replacement] getmod: A wrapper for slapt-get to build modules

New features which should be implemented in Porteus; suggestions are welcome. All questions or problems with testing releases (alpha, beta, or rc) should go in their relevant thread here, rather than the Bug Reports section.
User avatar
babam
Warlord
Warlord
Posts: 526
Joined: 16 Nov 2016, 10:30
Distribution: Porteus 5.0rc3 Xfce K6.1.1
Location: Rainy city

Porteus 5.0's USM replacement: slapt-get, getmod

Post#106 by babam » 07 Oct 2022, 08:28

Rava,
You can change the ROOTDIR and WORKDIR variables in the getmod, see lines 17 and 58.
Sorry, my English is bad.

User avatar
Rava
Contributor
Contributor
Posts: 5401
Joined: 11 Jan 2011, 02:46
Distribution: XFCE 5.01 x86_64 + 4.0 i586
Location: Forests of Germany

Porteus 5.0's USM replacement: slapt-get, getmod

Post#107 by Rava » 07 Oct 2022, 10:14

babam wrote:
07 Oct 2022, 08:28
You can change the ROOTDIR and WORKDIR variables in the getmod, see lines 17 and 58.
Thanks for that.

Added in 7 minutes 11 seconds:
For those curious, this is line 17

Code: Select all

    ROOTDIR=/tmp/$PKG.$$
and this is line 58

Code: Select all

WORKDIR=/tmp/getmod
Cheers!
Yours Rava

User avatar
babam
Warlord
Warlord
Posts: 526
Joined: 16 Nov 2016, 10:30
Distribution: Porteus 5.0rc3 Xfce K6.1.1
Location: Rainy city

Porteus 5.0's USM replacement: slapt-get, getmod

Post#108 by babam » 07 Oct 2022, 10:23

Rava wrote:
07 Oct 2022, 10:21
Thanks for that. I presume you are the author of getmod?

Added in 7 minutes 11 seconds:
For those curious, this is line 17

Code: Select all

    ROOTDIR=/tmp/$PKG.$$
and this is line 58

Code: Select all

WORKDIR=/tmp/getmod
You are free to modify the getmod.
Sorry, my English is bad.

User avatar
Ed_P
Contributor
Contributor
Posts: 8343
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 5.01 ISO
Location: Western NY, USA

Porteus 5.0's USM replacement: slapt-get, getmod

Post#109 by Ed_P » 07 Oct 2022, 14:14

babam wrote:
07 Oct 2022, 10:23
You are free to modify the getmod.
:o Are you too busy to modify the code or are you giving up on maintaining it? :%)
Ed

User avatar
Rava
Contributor
Contributor
Posts: 5401
Joined: 11 Jan 2011, 02:46
Distribution: XFCE 5.01 x86_64 + 4.0 i586
Location: Forests of Germany

Porteus 5.0's USM replacement: slapt-get, getmod

Post#110 by Rava » 07 Oct 2022, 15:05

Ed_P wrote:
07 Oct 2022, 14:14
:o Are you too busy to modify the code or are you giving up on maintaining it? :%)
Or the 3rd option: he wants it to be a Porteus collaboration of several people - in the true spirit of free and open software. :)
___________________________________________
babam wrote:
07 Oct 2022, 10:23
You are free to modify the getmod.
If you are okay with it I think of adding a -D option for choosing different working directories overwriting both ROOTDIR and WORKDIR if -D option is used by the user.

I will name you as the original author of getmod and me as a contributor that added a small thingy to it. Hope you are okay with that?

Of course all instances of ROOTDIR and WORKDIR and variables that rely on these, e.g. WORKINGDIR must now be encased in " since now a path can have whitespace.

E.g. like this

Code: Select all

# when setting -D path then variable DIRUSER is set, if not, $DIRUSER is empty
if [ "${DIRUSER}"x == x ]; then
	# $DIRUSER empty, using default path
	ROOTDIR=/tmp/$PKG.$$
else
	# $DIRUSER set, using it
	ROOTDIR="${DIRUSER}/$PKG.$$"
fi

# […]

if [ "${DIRUSER}"x == x ]; then
	# $DIRUSER empty, using default path
	WORKDIR=/tmp/getmod
else
	# $DIRUSER set, using it
	WORKDIR="${DIRUSER}/getmod"
fi

WORKINGDIR="$WORKDIR/$PKG"
Sorry for my slow approach, I like to test my code bit by bit.

/tmp/test.sh without $DIRUSER being set:

Code: Select all

#!/bin/sh
# when setting -D path then variable DIRUSER is set, if not, $DIRUSER is empty
if [ "${DIRUSER}"x == x ]; then
	# $DIRUSER empty, using default path
	ROOTDIR=/tmp/$PKG.$$
else
	# $DIRUSER set, using it
	ROOTDIR="${DIRUSER}/$PKG.$$"
fi

# […]

if [ "${DIRUSER}"x == x ]; then
	# $DIRUSER empty, using default path
	WORKDIR=/tmp/getmod
else
	# $DIRUSER set, using it
	WORKDIR="${DIRUSER}/getmod"
fi

WORKINGDIR="$WORKDIR/$PKG"

echo DEBUG
echo '${DIRUSER}='"${DIRUSER}"
echo '$ROOTDIR='"$ROOTDIR"
echo '$WORKDIR='"$WORKDIR"
echo '$WORKINGDIR='"$WORKINGDIR"
Output:

Code: Select all

guest@porteus:~$ /tmp/test.sh 
DEBUG
${DIRUSER}=
$ROOTDIR=/tmp/.3577
$WORKDIR=/tmp/getmod
$WORKINGDIR=/tmp/getmod/
Example 2 - /tmp/test2.sh with $DIRUSER being set:

Code: Select all

#!/bin/sh
# when setting -D path then variable DIRUSER is set, if not, $DIRUSER is empty
DIRUSER="/path/with whitespace/"
if [ "${DIRUSER}"x == x ]; then
	# $DIRUSER empty, using default path
	ROOTDIR=/tmp/$PKG.$$
else
	# $DIRUSER set, using it
	ROOTDIR="${DIRUSER}/$PKG.$$"
fi

# […]

if [ "${DIRUSER}"x == x ]; then
	# $DIRUSER empty, using default path
	WORKDIR=/tmp/getmod
else
	# # $DIRUSER set, using it
	WORKDIR="${DIRUSER}/getmod"
fi

WORKINGDIR="$WORKDIR/$PKG"

echo DEBUG
echo '${DIRUSER}='"${DIRUSER}"
echo '$ROOTDIR='"$ROOTDIR"
echo '$WORKDIR='"$WORKDIR"
echo '$WORKINGDIR='"$WORKINGDIR"
Output:

Code: Select all

guest@porteus:~$ /tmp/test2.sh 
DEBUG
${DIRUSER}=/path/with whitespace/
$ROOTDIR=/path/with whitespace//.3623
$WORKDIR=/path/with whitespace//getmod
$WORKINGDIR=/path/with whitespace//getmod/
A double slash in a path is no issue.
"/path/with whitespace//getmod/" is the same for the shell as "/path/with whitespace/getmod/" .

Added in 11 minutes 49 seconds:
I forgot to add to the test script.
By making this assumption foolproof

Code: Select all

# when setting -D path then variable DIRUSER is set, if not, $DIRUSER is empty
you have to initialize DIRUSER as empty string:

Code: Select all

DIRUSER=""
Why? Because, against all odds, a user could have created a global variable also called DIRUSER and then the script would "think" the -D parameter was given and the contents of DIRUSER is the DIRectory the USER wants to be used - when it's an unrelated variable that only happens to be of the same name.
Cheers!
Yours Rava

User avatar
francois
Contributor
Contributor
Posts: 6434
Joined: 28 Dec 2010, 14:25
Distribution: xfce plank porteus nemesis
Location: Le printemps, le printemps, le printemps... ... l'hiver s'essoufle.

Porteus 5.0's USM replacement: slapt-get, getmod

Post#111 by francois » 07 Oct 2022, 17:38

It is one of the porteus dev, the one who is knowledgeable in terms of wrappers. He sure works on maintaining nemesis where he looked in brokenman`s wrapper. He told us about pmod depmod:

ncmprhnsbl is the Big dev. :)
Prendre son temps, profiter de celui qui passe.

User avatar
Rava
Contributor
Contributor
Posts: 5401
Joined: 11 Jan 2011, 02:46
Distribution: XFCE 5.01 x86_64 + 4.0 i586
Location: Forests of Germany

Porteus 5.0's USM replacement: slapt-get, getmod

Post#112 by Rava » 07 Oct 2022, 18:38

I tried creating signal-desktop

Code: Select all

root@porteus:/mnt/live/memory/images# getmod -m signal-desktop
Reading Package Lists...Done
The following NEW packages will be installed:
  signal-desktop 
0 upgraded, 0 reinstalled, 1 newly installed, 0 to remove, 0 not upgraded.
Need to get 109.9MB of archives.
Do you want to continue? [y/N] y
1/1 Get http://slackware.uk/salix/x86_64/extra-15.0/ signal-desktop 5.45.0-x86_64-1salix15.0 [109.9MB]... 79%
^C
I tweaked getmod manually so that it downloads to a ext3 folder of the harddisk.
Unfortunately after 79% it stopped downloading.

After stopping it via Ctrl+C I would like to resume the download, but getmod doesn't tell us the URL it downloads from… and searching https://slakfinder.org/index.php?act=se ... e=#results gives no salix hits, but only one for SBOmt and one for SlackOnly

Is it possible to tell slapt-get to display the download URL so that partially downloaded files can be resumed?

It is possible to figure out the URL by going into http://slackware.uk/salix/x86_64/extra-15.0/ and navigating around, ending with http://slackware.uk/salix/x86_64/extra- ... ix15.0.txz

Added in 1 minute 27 seconds:
Manually resuming download:

Code: Select all

root@porteus:/mnt/sdb4/tmp/getmod/signal-desktop/salix/network# wget -c http://slackware.uk/salix/x86_64/extra-15.0/salix/network/signal-desktop-5.45.0-x86_64-1salix15.0.txz
--2022-10-07 20:38:37--  http://slackware.uk/salix/x86_64/extra-15.0/salix/network/signal-desktop-5.45.0-x86_64-1salix15.0.txz
Resolving slackware.uk (slackware.uk)... 216.119.155.61, 2a02:2498:e004:2a::a861
Connecting to slackware.uk (slackware.uk)|216.119.155.61|:80... connected.
HTTP request sent, awaiting response... 206 Partial Content
Length: 115224860 (110M), 23236892 (22M) remaining [application/octet-stream]
Saving to: ‘signal-desktop-5.45.0-x86_64-1salix15.0.txz’

salix15.0.txz        82%[+++++++++++++++>    ]  90.90M   201KB/s    eta 71s    
:)

Added in 3 minutes 25 seconds:
I had to restart the download more than once but the md5sum checks out:

Code: Select all

root@porteus:/mnt/sdb4/tmp/getmod/signal-desktop/salix/network# md5sum signal-desktop-5.45.0-x86_64-1salix15.0.txz 
44453a28acaf027642a5b2bcf553d035  signal-desktop-5.45.0-x86_64-1salix15.0.txz
Now creating the module - and then the real fun starts actually trying to get the messenger to run.
Cheers!
Yours Rava

User avatar
Rava
Contributor
Contributor
Posts: 5401
Joined: 11 Jan 2011, 02:46
Distribution: XFCE 5.01 x86_64 + 4.0 i586
Location: Forests of Germany

Porteus 5.0's USM replacement: slapt-get, getmod

Post#113 by Rava » 07 Oct 2022, 18:48

^

badam did not provide a new URL for the updated module.
__________________________________________

For now module creation fails because txz2xzm insists on installing it into /tmp and not into the current directory, which is an ext3 and with enough free space.

Code: Select all

root@porteus:/mnt/sdb4/tmp/getmod/signal-desktop/salix/network# txz2xzm signal-desktop-5.45.0-x86_64-1salix15.0.txz signal-desktop-5.45.0-x86_64-1salix15.0.xzm
Verifying package signal-desktop-5.45.0-x86_64-1salix15.0.txz.
Installing package signal-desktop-5.45.0-x86_64-1salix15.0.txz:
PACKAGE DESCRIPTION:
# signal-desktop (Signal for Desktop)
#
# Signal is an encrypted instant messaging and voice calling
# application for Android, iOS, and the desktop. It uses the Internet
# to send one-to-one and group messages, which can include images
# and video messages, and make one-to-one voice/video calls.
#
# This is a repackaging of the official binary .deb file
# distributed by Open Whipser Systems.
#
Executing install script for signal-desktop-5.45.0-x86_64-1salix15.0.txz.
cp: error copying '/tmp/txz2xzm6139/installpkg-860be3a6d72f3c8044d10ae4c990ed3f/doinst.sh' to '/tmp/txz2xzm6139/var/lib/pkgtools/scripts/signal-desktop-5.45.0-x86_64-1salix15.0': No space left on device
Package signal-desktop-5.45.0-x86_64-1salix15.0.txz installed.
Creating /mnt/sdb4/tmp/getmod/signal-desktop/salix/network/signal-desktop-5.45.0-x86_64-1salix15.0.xzm

^Cerror building compressed image
Seems I need to do a manual pseudo-install onto the ext3 partition of the harddisk and then a dir2xzm.
Cheers!
Yours Rava

User avatar
babam
Warlord
Warlord
Posts: 526
Joined: 16 Nov 2016, 10:30
Distribution: Porteus 5.0rc3 Xfce K6.1.1
Location: Rainy city

Porteus 5.0's USM replacement: slapt-get, getmod

Post#114 by babam » 07 Oct 2022, 18:52

Rava wrote:
07 Oct 2022, 07:39

Code: Select all

root@porteus:/Porteus_modules# getmod -m spek-0.8.3_07c13da27d-x86_64-1salix15.0Reading Package Lists...Done
Suggested packages:
  alsa-lib bzip2 elfutils eudev gcc libffi libjpeg-turbo libpng pcre xz zlib 
  brotli cairo cdparanoia elfutils fontconfig freetype fribidi graphite2 
  harfbuzz libX11 libXau libXdmcp libXext libXrender libXv libdrm libglvnd 
  libgudev libogg libtheora libunwind libvisual libvorbis libxcb libxml2 mesa 
  opus orc pixman wayland 
The following NEW packages will be installed:
  aspell hunspell enchant expat graphene gstreamer pango gst-plugins-base gtk+3 
  hyphen libmanette libwpe woff2 wpebackend-fdo webkit2gtk wxGTK3 spek 
0 upgraded, 0 reinstalled, 17 newly installed, 0 to remove, 0 not upgraded.
Need to get 43.0MB of archives.
Do you want to continue? [y/N] y
Just know that on /Porteus_modules there was enough free space, but getmod seems not to work like that, using the $PWD.
And in / aka the RAMdisk was not enough free space as we will see soon:
Write failed because No space left on device
FATAL ERROR: Failed to write to output filesystem

I suggest whoever coded getmod to add a "-D" option [as in Directory], and also, if possible to do checks on $? from the program just executed. When anything other than a 0 gets reported back, an error occurred and getmod should stop, and tell the user to look above what the error is. Usually the program that got executed will report what went wrong.
Now you can do with this (e.g. /mnt/sdb1/mydir):

Code: Select all

# TMP=/mnt/sdb1/mydir getmod -m spek
Last edited by babam on 07 Oct 2022, 18:59, edited 1 time in total.
Sorry, my English is bad.

User avatar
Rava
Contributor
Contributor
Posts: 5401
Joined: 11 Jan 2011, 02:46
Distribution: XFCE 5.01 x86_64 + 4.0 i586
Location: Forests of Germany

Porteus 5.0's USM replacement: slapt-get, getmod

Post#115 by Rava » 07 Oct 2022, 19:04

babam wrote:
07 Oct 2022, 18:56
You don't read PM?
It took me a while editing it and the notification about the PM was delayed. I replied to you via PM.

Added in 15 minutes 19 seconds:
[Porteus 5.0's USM replacement] getmod: A simple wrapper for slapt-get to build Porteus module
In between figuring out how to edit the initial post and editing the initial post, I also managed to manually installpkg signal-desktop and dir2xzm.

Like so:

Code: Select all

root@porteus:/mnt/sdb4/tmp/getmod/signal-desktop/salix/network# mkdir signal-desktop-5.45.0-x86_64-1salix15.0
root@porteus:/mnt/sdb4/tmp/getmod/signal-desktop/salix/network# ROOT=signal-desktop-5.45.0-x86_64-1salix15.0/ installpkg signal-desktop-5.45.0-x86_64-1salix15.0.txz 
Verifying package signal-desktop-5.45.0-x86_64-1salix15.0.txz.
Installing package signal-desktop-5.45.0-x86_64-1salix15.0.txz:
PACKAGE DESCRIPTION:
# signal-desktop (Signal for Desktop)
#
# Signal is an encrypted instant messaging and voice calling
# application for Android, iOS, and the desktop. It uses the Internet
# to send one-to-one and group messages, which can include images
# and video messages, and make one-to-one voice/video calls.
#
# This is a repackaging of the official binary .deb file
# distributed by Open Whipser Systems.
#
Executing install script for signal-desktop-5.45.0-x86_64-1salix15.0.txz.
Package signal-desktop-5.45.0-x86_64-1salix15.0.txz installed.
root@porteus:/mnt/sdb4/tmp/getmod/signal-desktop/salix/network# dir2xzm signal-desktop-5.45.0-x86_64-1salix15.0 signal-desktop-5.45.0-x86_64-1salix15.0.xzm
Parallel mksquashfs: Using 8 processors
Creating 4.0 filesystem on signal-desktop-5.45.0-x86_64-1salix15.0.xzm, block size 262144.
[=============================================================-] 1488/1488 100%

Exportable Squashfs 4.0 filesystem, xz compressed, data block size 262144
	compressed data, compressed metadata, compressed fragments,
	compressed xattrs, compressed ids
	duplicates are removed
Filesystem size 126331.12 Kbytes (123.37 Mbytes)
	34.70% of uncompressed filesystem size (364082.27 Kbytes)
Inode table size 4780 bytes (4.67 Kbytes)
	41.80% of uncompressed inode table size (11435 bytes)
Directory table size 1610 bytes (1.57 Kbytes)
	42.00% of uncompressed directory table size (3833 bytes)
Number of duplicate files found 20
Number of inodes 180
Number of files 113
Number of fragments 47
Number of symbolic links 4
Number of device nodes 0
Number of fifo nodes 0
Number of socket nodes 0
Number of directories 63
Number of ids (unique uids + gids) 1
Number of uids 1
	root (0)
Number of gids 1
	root (0)
root@porteus:/mnt/sdb4/tmp/getmod/signal-desktop/salix/network# ls -od *
drwxr-xr-x 5 root      4096 2022-10-07 21:16 signal-desktop-5.45.0-x86_64-1salix15.0
-rw-r--r-- 1 root 115224860 2022-06-11 14:56 signal-desktop-5.45.0-x86_64-1salix15.0.txz
-rw-r--r-- 1 root 129363968 2022-10-07 21:17 signal-desktop-5.45.0-x86_64-1salix15.0.xzm
:)
Cheers!
Yours Rava

User avatar
babam
Warlord
Warlord
Posts: 526
Joined: 16 Nov 2016, 10:30
Distribution: Porteus 5.0rc3 Xfce K6.1.1
Location: Rainy city

[Porteus 5.0's USM replacement] getmod: A simple wrapper for slapt-get to build Porteus module

Post#116 by babam » 07 Oct 2022, 19:28

Rava wrote:
07 Oct 2022, 18:43
I tried creating signal-desktop
Now you can do with this:

Code: Select all

# TMP=/mnt/sdb4 getmod -m signal-desktop
Sorry, my English is bad.

User avatar
Rava
Contributor
Contributor
Posts: 5401
Joined: 11 Jan 2011, 02:46
Distribution: XFCE 5.01 x86_64 + 4.0 i586
Location: Forests of Germany

[Porteus 5.0's USM replacement] getmod: A simple wrapper for slapt-get to build Porteus module

Post#117 by Rava » 07 Oct 2022, 19:37

babam wrote:
07 Oct 2022, 19:28
Rava wrote:
07 Oct 2022, 18:43
I tried creating signal-desktop
Now you can do with this:

Code: Select all

# TMP=/mnt/sdb4 getmod -m signal-desktop
I try this next time I want to build a larger module.
Thanks for the tip, and special thanks for getmod.

For now my manual approach using the hacked older version of getmod for the initial download (that not finished successfully) and manually resuming the download via wget and using

Code: Select all

mkdir signal-desktop-5.45.0-x86_64-1salix15.0
and

Code: Select all

ROOT=signal-desktop-5.45.0-x86_64-1salix15.0/ installpkg signal-desktop-5.45.0-x86_64-1salix15.0.txz 
did accomplish the module creation.

If the signal messenger will work without additional needed dependencies I will see tomorrow. Now I am too sleepy to continue without creating more mess than sense. Rava out.
Cheers!
Yours Rava

User avatar
Rava
Contributor
Contributor
Posts: 5401
Joined: 11 Jan 2011, 02:46
Distribution: XFCE 5.01 x86_64 + 4.0 i586
Location: Forests of Germany

[Porteus 5.0's USM replacement] getmod: A simple wrapper for slapt-get to build Porteus module

Post#118 by Rava » 08 Oct 2022, 00:09

Now I compared the two txz's and xzm's

My version of txz had the minor advantage that I was able to resume a partial download at 79%
I checked mine manually against its md5sum text, both md5sums check out as the same.

And looking into getmod I realized there are some fixes on the extracted via installpkg package prior the module creation.

EDIT - in the first version of this post I got the files wrong - too sleepy back then already I removed the erroneous content.
Added in 6 hours 1 minute 53 seconds:

As one can see by the date/time it was created and by the partition it is on, this one

Code: Select all

131059712 2022-10-07 23:31 signal-desktop-5.45.0-x86_64-1salix15.0.xzm
is the one as created by

Code: Select all

TMP=/mnt/sda7/tmp/ getmod -m signal-desktop
while the smaller one

Code: Select all

129363968 2022-10-07 21:17 signal-desktop-5.45.0-x86_64-1salix15.0.xzm
was created earlier and by
# ROOT=signal-desktop-5.45.0-x86_64-1salix15.0/ installpkg signal-desktop-5
.45.0-x86_64-1salix15.0.txz
# dir2xzm signal-desktop-5.45.0-x86_64-1salix15.0 signal-desktop-5.45.0-x86
_64-1salix15.0.xzm
Now doing a lsxzm on each and comparing the two results.

Added in 6 minutes 37 seconds:
Now I finally got the descriptive names of the symlinks to the two modules correct (unlike in the original version of this post as now deleted):

Code: Select all

root@porteus:/7/tmp# ls -Lo [gm][ea]*signal-desktop*.xzm| cut -c 20-
131059712 2022-10-07 23:31 getmod-signal-desktop-5.45.0-x86_64-1salix15.0.xzm
129363968 2022-10-07 21:17 manual-signal-desktop-5.45.0-x86_64-1salix15.0.xzm
Added in 13 minutes 57 seconds:
Creating the lsxzm output

Code: Select all

root@porteus:/7/tmp# lsxzm getmod-signal-desktop-5.45.0-x86_64-1salix15.0.xzm >getmod-signal.lsxzm
root@porteus:/7/tmp# lsxzm manual-signal-desktop-5.45.0-x86_64-1salix15.0.xzm >manual-signal.lsxzm
Sizes of the lsxzm outputs

Code: Select all

root@porteus:/7/tmp# ls -Lo *.lsxzm| cut -c 19-
6243 2022-10-08 08:21 getmod-signal.lsxzm
6529 2022-10-08 08:21 manual-signal.lsxzm
diff between the two lsxzm outputs

Code: Select all

root@porteus:/7/tmp# diff *.lsxzm
123a124,129
> /usr/doc
> /usr/doc/signal-desktop-5.45.0
> /usr/doc/signal-desktop-5.45.0/LICENSE.electron.txt
> /usr/doc/signal-desktop-5.45.0/LICENSES.chromium.html
> /usr/doc/signal-desktop-5.45.0/changelog.gz
> /usr/doc/signal-desktop-5.45.0/signal-desktop.SlackBuild
125a132
> /usr/share/applications/mimeinfo.cache
root@porteus:/7/tmp# grep mimeinfo.cache *.lsxzm
manual-signal.lsxzm:/usr/share/applications/mimeinfo.cache
Strange, so my manually created module contains more files (as seen above like /usr/doc/signal-desktop-5.45.0/LICENSE*) and the mimeinfo.cache and is still smaller than the one created by getmod…

Both creation methods must use different fine tunings for the actual creation of the xz compressed Squashfs filesystem…

Added in 8 minutes 55 seconds:
Also removed the usr/doc/signal-desktop-5.45.0 folder of my

Code: Select all

ROOT=signal-desktop-5.45.0-x86_64-1salix15.0/ installpkg signal-desktop-5.45.0-x86_64-1salix15.0.txz
created folder and created a new version of my manual module. But it differs not at all in its file size

Code: Select all

root@porteus:/7/tmp# ls -Lo [gm][ea]*signal-desktop*.xzm| cut -c 20-
131059712 2022-10-07 23:31 getmod-signal-desktop-5.45.0-x86_64-1salix15.0.xzm
129363968 2022-10-07 21:17 manual-signal-desktop-5.45.0-x86_64-1salix15.0.xzm
129363968 2022-10-08 08:36 manual-signal-desktop-5.45.0-x86_64-1salix15.0_without_doc_signal.xzm
Added in 2 minutes 43 seconds:
I keep the usr/share/applications/mimeinfo.cache for now, not knowing enough about it if I should keep it or always delete it when creating a module…
But I will create a 3rd variant of my manual-signal-desktop-5.45.0-x86_64-1salix15.0 module that also has the usr/share/applications/mimeinfo.cache removed and test what difference that makes when activated.

Added in 4 minutes :

Code: Select all

root@porteus:/mybin/signal-desktop-5.45.0-x86_64-1salix15.0# cat usr/share/applications/mimeinfo.cache 
[MIME Cache]
x-scheme-handler/sgnl=signal-desktop.desktop;
x-scheme-handler/signalcaptcha=signal-desktop.desktop;
Looks like it only lists the added .desktop file (when activated) - and the to be removed .desktop file (when deactivated)…
Am I correct on that assumption?

By that assumption I should keep the usr/share/applications/mimeinfo.cache in my module.
Cheers!
Yours Rava

User avatar
Ed_P
Contributor
Contributor
Posts: 8343
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 5.01 ISO
Location: Western NY, USA

[Porteus 5.0's USM replacement] getmod: A simple wrapper for slapt-get to build Porteus modules

Post#119 by Ed_P » 09 Oct 2022, 06:02

babam getmod requires root mode to run but currently doesn't test for it. Two suggestions to alert the user that getmod requires root mode.

1. Add this bash script named getmod to the /home/guest/ folder.

Code: Select all

#!/bin/sh
if [ `whoami` != "root" ]; then
   echo -e "getmod must be run in root mode"
fi
-or-

2. Add this code to the getmod file in 011-slapt-get-0.11.6-x86_64-2gv.xzm's /usr/sbin folder.

Code: Select all

if [ `whoami` != "root" ]; then
   echo -e "Enter root's password\033[1;31m"
   su -c "sh $0 $1 $2 $3"; exit
fi
echo -e "\033[0m"; echo -en "\033]0;getmod: A simple wrapper for slapt-get to build Porteus modules\a" 
After line 3 would be the best spot.
Ed

User avatar
Rava
Contributor
Contributor
Posts: 5401
Joined: 11 Jan 2011, 02:46
Distribution: XFCE 5.01 x86_64 + 4.0 i586
Location: Forests of Germany

[Porteus 5.0's USM replacement] getmod: A simple wrapper for slapt-get to build Porteus modules

Post#120 by Rava » 09 Oct 2022, 06:56

Ed_P wrote:
09 Oct 2022, 06:02
Three suggestions to alert the user that getmod requires root mode.
Fixed that for you. :D

By default /usr/sbin is not in user's PATH so users other than root could not execute files in there by just typing the command name:

Code: Select all

guest@porteus:~$ getmod
bash: getmod: command not found
Still, currently guest or any other non-root user could execute it by referencing it directly, like so

Code: Select all

guest@porteus:~$ /usr/sbin/getmod 

   getmod [-c] [-u] [-d|-m|-n PACKAGE_NAME] [-s PATTERN]

Options:
  -c: Purge cached packages
  -d: Download only
  -m: Download and build module
  -n: Download and build module without dependencies
  -s: Search package
  -u: Update database
  -h: This usage
The 3rd option to change the script for root's use only is simply changing access rights, no need to edit the script itself.

As root:

Code: Select all

root@porteus:~# cd /usr/sbin/
root@porteus:/usr/sbin# ls -o getmod 
-rwxr-xr-x 1 root 5514 2022-10-07 17:12 getmod
root@porteus:/usr/sbin# chmod og-x getmod 
root@porteus:/usr/sbin# ls -o getmod 
-rwxr--r-- 1 root 5514 2022-10-07 17:12 getmod
and back as guest. Now guest gets this:

Code: Select all

guest@porteus:~$ /usr/sbin/getmod 
bash: /usr/sbin/getmod: Permission denied
Added in 3 minutes 41 seconds:
chmod user and group references mean:
u user (aka "owner")
o other (NOT "owner")
g group
a all (=uog)

Added in 4 minutes 28 seconds:
I do tricks with access rights all the time, e.g. my make-99*sh script suite:

Code: Select all

root@porteus:/usr/local/bin# ls -o make-99*
-rwxr--r-- 1 root 2822 2021-11-16 03:39 make-991-usr_local_bin.sh
lrwxrwxrwx 1 root   25 2021-02-27 23:06 make-992-rootcopy.sh -> make-991-usr_local_bin.sh
Even when the location is in user's $PATH the non-root user still cannot execute any of these scripts:

Code: Select all

guest@porteus:~$ make-992-rootcopy.sh
bash: /usr/local/bin/make-992-rootcopy.sh: Permission denied
guest@porteus:~$ echo $?
126
Last edited by Rava on 09 Oct 2022, 07:06, edited 1 time in total.
Reason: typo
Cheers!
Yours Rava

Post Reply