MLOOP Issue: mloop http://domain.com/file.iso

Please reproduce your error on a second machine before posting, and check the error by running without saved changes or extra modules (See FAQ No. 13, "How to report a bug"). For unstable Porteus versions (alpha, beta, rc) please use the relevant thread in our "Development" section.
Bogomips
Full of knowledge
Full of knowledge
Posts: 2564
Joined: 25 Jun 2014, 15:21
Distribution: 3.2.2 Cinnamon & KDE5
Location: London

MLOOP Issue: mloop http://domain.com/file.iso

Post#1 by Bogomips » 20 Jul 2016, 23:54

  • First Time

    Code: Select all

    root@porteus:/home/guest# mloop http://slackware.uk/people/alien-slacklive/latest/slackware-live-xfce-14.2.iso
    using /dev/loop15
    
    Please wait while i gather some info ....
    
    Checking given link ...
    link is good
    Unmounting
    Unmounted
     Connecting to:   slackware-live-xfce-14.2.iso ...
    file name: 	slackware-live-xfce-14.2.iso
    host name: 	slackware.uk
    port number: 	80
    protocol: 	http
    request path: 	/people/alien-slacklive/latest/slackware-live-xfce-14.2.iso
    auth data: 	(null)
    file size: 	732954624
     Attemptingto mount:   slackware-live-xfce-14.2.iso ...
    
    
     #################################
     Your online file has been mounted at: 
    /mnt/http
    
    You can unmount it by typing: umount /mnt/http
    
    Here is a list of the files:
    boot  liveslak
    root@porteus:/home/guest# umount /mnt/http
    
  • Second Time: Catch 22

    Code: Select all

    root@porteus:/home/guest# mloop http://slackware.uk/people/alien-slacklive/latest/slackware-live-xfce-14.2.iso
    using /dev/loop15
    
    Please wait while i gather some info ....
    
    Checking given link ...
    link is good
    Unmounting
    umount: /mnt/http: not mounted
    Could not unmount
    
  • Workaround

    Code: Select all

    root@porteus:/home/guest# mkdir y
    root@porteus:/home/guest# mount --bind y /mnt/http
    
    root@porteus:/home/guest# mloop http://slackware.uk/people/alien-slacklive/latest/slackware-live-xfce-14.2.iso
    using /dev/loop15
    
    Please wait while i gather some info ....
    
    Checking given link ...
    link is good
    Unmounting
    Unmounted
     Connecting to:   slackware-live-xfce-14.2.iso ...
    file name: 	slackware-live-xfce-14.2.iso
    host name: 	slackware.uk
    port number: 	80
    protocol: 	http
    request path: 	/people/alien-slacklive/latest/slackware-live-xfce-14.2.iso
    auth data: 	(null)
    file size: 	732954624
     Attemptingto mount:   slackware-live-xfce-14.2.iso ...
    
    
     #################################
     Your online file has been mounted at: 
    /mnt/http
    
    You can unmount it by typing: umount /mnt/http
    
    Here is a list of the files:
    boot  liveslak
    
    root@porteus:/home/guest# umount /mnt/http
    
  • Suggested Fix
    • Code: Select all

      xhttpfs2() {
      xname=${xfile##*/}
      
      # Do quick net check
      echo "Checking given link ..."
      wget -q --spider --force-html --inet4-only $xfile >/dev/null 2>&1 && echo "link is good" || \
      { echo -e $txtred "This link was not found online. Sorry." $rst; exit; }
      
      # Make sure the mount points are ready
      if [ -d /mnt/http ]; then
      	# Avoid unmounting unmounted	Bogomips
      	if mountpoint -q /mnt/http; then
      		echo "Unmounting"
      		umount /mnt/http && sleep 1 || { echo "Could not unmount"; exit; }
      		echo "Unmounted"
      	fi
          rm -rf /mnt/http
      fi
      umount /mnt/loop >/dev/null 2>&1
      mkdir -p /mnt/http >/dev/null 2>&1
      
      echo -e $txtcyan "Connecting to: " $rst "$xname ..."
      httpfs2 $xfile $mpoint || { echo -e $txtred "There was a fatal error mounting: " $rst "$xname."; exit; }
      echo -e $txtcyan "Attemptingto mount: " $rst "$xname ..."
      mount $mpoint/$xname /mnt/http
      
      clear
      echo 
      echo -e $txtcyan "#################################"
      echo " Your online file has been mounted at:" $rst
      echo /mnt/http
      echo
      # More consistent from user standpoint.	Bogomips
      echo "You can unmount it by typing: uloop"
      echo
      echo "Here is a list of the files:"
      ls /mnt/http
      echo
      exit
      }
      
    • Code: Select all

      uloop() {
      cat > /opt/porteus-scripts/uloop << "EOF"
      #!/bin/bash
      
      if [ `whoami` != "root" ]; then
          su - -c "uloop"
          exit
      fi
      
      # Check for httpfs2		Bogomips	21.07.2016 01:35:00
      mountpoint -q /mnt/http  &&  umount /mnt/http
      [ -d /mnt/loop ] && mls=`grep /mnt/loop /proc/mounts | wc -l`
      
      if [ "$mls" -gt 0 ]; then
          umount /mnt/loop
          [ -b /dev/mapper/mloop-crypt ] && cryptsetup luksClose mloop-crypt
          echo
          echo "/mnt/loop has been unmounted"
          echo
      else
          echo
          echo "nothing is mounted in /mnt/loop"
          echo
      fi
      
      exit
      EOF
      chmod +x /opt/porteus-scripts/uloop
      }
      
Linux porteus 4.4.0-porteus #3 SMP PREEMPT Sat Jan 23 07:01:55 UTC 2016 i686 AMD Sempron(tm) 140 Processor AuthenticAMD GNU/Linux
NVIDIA Corporation C61 [GeForce 6150SE nForce 430] (rev a2) MemTotal: 901760 kB MemFree: 66752 kB

User avatar
brokenman
Site Admin
Site Admin
Posts: 6105
Joined: 27 Dec 2010, 03:50
Distribution: Porteus v4 all desktops
Location: Brazil

Re: MLOOP Issue: mloop http://domain.com/file.iso

Post#2 by brokenman » 25 Jul 2016, 01:39

Can you please create a diff file of your changes and the original in rc4?

Code: Select all

diff -au /opt/porteus-scripts/mloop /pth/to/your/mloop
How do i become super user?
Wear your underpants on the outside and put on a cape.

Bogomips
Full of knowledge
Full of knowledge
Posts: 2564
Joined: 25 Jun 2014, 15:21
Distribution: 3.2.2 Cinnamon & KDE5
Location: London

Re: MLOOP Issue: mloop http://domain.com/file.iso

Post#3 by Bogomips » 27 Jul 2016, 22:04

brokenman wrote:Can you please create a diff file of your changes and the original in rc4?

Code: Select all

diff -au /opt/porteus-scripts/mloop /pth/to/your/mloop
Suggested fixes now integrated into mloop and tested.
  • Tests

    Code: Select all

    root@porteus:/home/guest# mloop http://ftp.slackware.pl/pub/slackware-live/latest/slackware-live-xfce-current.iso
    using /dev/loop10
    
    Please wait while i gather some info ....
    
    Checking given link ...
    link is good
     Connecting to:   slackware-live-xfce-current.iso ...
    file name: 	slackware-live-xfce-current.iso
    host name: 	ftp.slackware.pl
    port number: 	80
    protocol: 	http
    request path: 	/pub/slackware-live/latest/slackware-live-xfce-current.iso
    auth data: 	(null)
    file size: 	735051776
     Attemptingto mount:   slackware-live-xfce-current.iso ...
    
    
     #################################
     Your online file has been mounted at:
    /mnt/http
    
    You can unmount it by typing: uloop
    
    Here is a list of the files:
    boot  liveslak
    
    root@porteus:/home/guest# ls -l /mnt/http/liveslak/
    total 8
    drwxr-xr-x 2 root root 2048 Jul 22 21:12 addons/
    drwxr-xr-x 2 root root 2048 Jul 22 21:12 optional/
    drwxr-xr-x 2 root root 2048 Jul 22 22:03 rootcopy/
    drwxr-xr-x 2 root root 2048 Jul 22 22:02 system/
    root@porteus:/home/guest# ls -l /mnt/http/liveslak/system/
    total 695984
    -rw-r--r-- 1 root root   4243456 Jul 22 22:03 0000-slackware_boot-current-i586.sxz
    -rw-r--r-- 1 root root 242688000 Jul 22 21:22 0020-slackware_min-current-i586.sxz
    -rw-r--r-- 1 root root 128266240 Jul 22 22:00 0020-slackware_xapbase-current-i586.sxz
    -rw-r--r-- 1 root root 320974848 Jul 22 21:55 0020-slackware_xbase-current-i586.sxz
    -rw-r--r-- 1 root root  11980800 Jul 22 22:01 0020-slackware_xfcebase-current-i586.sxz
    -rw-r--r-- 1 root root   4534272 Jul 22 22:02 0099-slackware_zzzconf-current-i586.sxz
    root@porteus:/home/guest# uloop
    
    /mnt/loop has been unmounted
    ______________________________________________________________________________
    
    root@porteus:/home/guest# mloop http://repo.ukdw.ac.id/slackware-live/latest/slackware-live-xfce-current.iso
    using /dev/loop10
    
    Please wait while i gather some info ....
    
    Checking given link ...
    link is good
     Connecting to:   slackware-live-xfce-current.iso ...
    file name: 	slackware-live-xfce-current.iso
    host name: 	repo.ukdw.ac.id
    port number: 	80
    protocol: 	http
    request path: 	/slackware-live/latest/slackware-live-xfce-current.iso
    auth data: 	(null)
    file size: 	735051776
     Attemptingto mount:   slackware-live-xfce-current.iso ...
    
    
     #################################
     Your online file has been mounted at:
    /mnt/http
    
    You can unmount it by typing: uloop
    
    Here is a list of the files:
    boot  liveslak
    
    root@porteus:/home/guest# tree -nd -L 2 /mnt/http
    /mnt/http
    ├── boot
    │   └── syslinux
    └── liveslak
        ├── addons
        ├── optional
        ├── rootcopy
        └── system
    
    7 directories
    root@porteus:/home/guest# uloop
    
    /mnt/loop has been unmounted
    ______________________________________________________________________________
    
    root@porteus:/home/guest# mloop http://slackware.uk/people/alien-slacklive/latest/slackware-live-xfce-current.iso
    using /dev/loop10
    
    Please wait while i gather some info ....
    
    Checking given link ...
    link is good
     Connecting to:   slackware-live-xfce-current.iso ...
    file name: 	slackware-live-xfce-current.iso
    host name: 	slackware.uk
    port number: 	80
    protocol: 	http
    request path: 	/people/alien-slacklive/latest/slackware-live-xfce-current.iso
    auth data: 	(null)
    file size: 	735051776
     Attemptingto mount:   slackware-live-xfce-current.iso ...
    
    
     #################################
     Your online file has been mounted at:
    /mnt/http
    
    You can unmount it by typing: uloop
    
    Here is a list of the files:
    boot  liveslak
    
    root@porteus:/home/guest# tree -n -L 2 /mnt/http
    /mnt/http
    ├── boot
    │   ├── generic
    │   ├── initrd.img
    │   ├── memtest
    │   └── syslinux
    └── liveslak
        ├── addons
        ├── optional
        ├── rootcopy
        └── system
    
    7 directories, 3 files
    root@porteus:/home/guest# tree -n -L 2 /mnt/http/liveslak/
    /mnt/http/liveslak/
    ├── addons
    ├── optional
    ├── rootcopy
    └── system
        ├── 0000-slackware_boot-current-i586.sxz
        ├── 0020-slackware_min-current-i586.sxz
        ├── 0020-slackware_xapbase-current-i586.sxz
        ├── 0020-slackware_xbase-current-i586.sxz
        ├── 0020-slackware_xfcebase-current-i586.sxz
        └── 0099-slackware_zzzconf-current-i586.sxz
    
    4 directories, 6 files
    root@porteus:/home/guest# uloop
    
    /mnt/loop has been unmounted
    
    
  • As requested, where mloop_0 is original rc4 mloop

    Code: Select all

    guest@porteus:~$ diff -au mloop_0 mloop_1
    --- mloop_0	2016-07-27 23:56:27.390961484 +0100
    +++ mloop_1	2016-07-27 23:56:35.741961436 +0100
    @@ -76,7 +76,7 @@
     echo
     echo "File given will be mounted on a loop at /mnt/loop"
     echo "You can use uloop to unmout loop."
    -echo 
    +echo
     echo
     }
     
    @@ -103,7 +103,7 @@
     xmodule() {
     mount -t auto -o loop $xfile $mpoint
     clear
    -echo 
    +echo
     echo -e $txtcyan "#################################"
     echo " Your module has been mounted at:" $rst
     echo $mpoint
    @@ -119,7 +119,7 @@
     xiso() {
     mount -t iso9660 -o loop $xfile $mpoint
     clear
    -echo 
    +echo
     echo -e $txtcyan "#################################"
     echo "Your image has been mounted at:" $rst
     echo $mpoint
    @@ -142,7 +142,7 @@
         mount -t auto -o loop $xfile $mpoint
     fi
     clear
    -echo 
    +echo
     echo -e $txtcyan "#################################"
     echo " Your data file has been mounted at:" $rst
     echo $mpoint
    @@ -158,7 +158,7 @@
     ximg() {
     mount -t auto -o loop $xfile $mpoint
     clear
    -echo 
    +echo
     echo -e $txtcyan "#################################"
     echo "Your .img file has been mounted at:" $rst
     echo $mpoint
    @@ -176,7 +176,7 @@
     echo
     echo -e $txtgreen "Backing up initrd ...." $rst
     
    -[ ! -d $tmp ] && mkdir $tmp || rm -rf $tmp/* 
    +[ ! -d $tmp ] && mkdir $tmp || rm -rf $tmp/*
     cp $real ${real}.bak
     echo $xfile > $tmp/initrd.txt
     
    @@ -185,7 +185,7 @@
     cd $tmp
     xz -d < $real | cpio -i
     cd - >/dev/null
    -echo 
    +echo
     echo "##################################################"
     echo "Your original initrd.xz is still intact"
     echo "and has been backed up as $xfile.bak"
    @@ -206,11 +206,11 @@
     # Make sure file is gzip
     file $real|grep -o "gzip" >/dev/null || { echo -e $txtcyan "This is not a valid gzip file!"; exit; }
     pkg=${real##*/}
    -pkgname=`sed -e 's@\.tar@@g' -e 's@\.gz@@g' <<<$pkg` 
    +pkgname=`sed -e 's@\.tar@@g' -e 's@\.gz@@g' <<<$pkg`
     
     archivemount $real $mpoint 2>/dev/null
     clear
    -echo 
    +echo
     echo -e $txtcyan "#################################"
     echo " Your gzip file has been mounted at:" $rst
     echo $mpoint
    @@ -231,7 +231,7 @@
     
     archivemount $real $mpoint 2>/dev/null
     clear
    -echo 
    +echo
     echo -e $txtcyan "#################################"
     echo " Your bzip file has been mounted at:" $rst
     echo $mpoint
    @@ -252,7 +252,7 @@
     
     archivemount $real $mpoint 2>/dev/null
     clear
    -echo 
    +echo
     echo -e $txtcyan "#################################"
     echo " Your tarball file has been mounted at:" $rst
     echo $mpoint
    @@ -275,9 +275,12 @@
     
     # Make sure the mount points are ready
     if [ -d /mnt/http ]; then
    -    echo "Unmounting"
    -    umount /mnt/http && sleep 1 || { echo "Could not unmount"; exit; }
    -    echo "Unmounted"
    +	# Avoid unmounting unmounted	Bogomips
    +	if mountpoint -q /mnt/http; then
    +		echo "Unmounting"
    +		umount /mnt/http && sleep 1 || { echo "Could not unmount"; exit; }
    +		echo "Unmounted"
    +	fi
         rm -rf /mnt/http
     fi
     umount /mnt/loop >/dev/null 2>&1
    @@ -289,12 +292,13 @@
     mount $mpoint/$xname /mnt/http
     
     clear
    -echo 
    +echo
     echo -e $txtcyan "#################################"
     echo " Your online file has been mounted at:" $rst
     echo /mnt/http
     echo
    -echo "You can unmount it by typing: umount /mnt/http"
    +# More consistent from user standpoint.	Bogomips
    +echo "You can unmount it by typing: uloop"
     echo
     echo "Here is a list of the files:"
     ls /mnt/http
    @@ -317,6 +321,8 @@
         exit
     fi
     
    +# Check for httpfs2		Bogomips	21.07.2016 01:35:00
    +mountpoint -q /mnt/http && umount /mnt/http
     [ -d /mnt/loop ] && mls=`grep /mnt/loop /proc/mounts | wc -l`
     
     if [ "$mls" -gt 0 ]; then
    guest@porteus:~$ 
    
Linux porteus 4.4.0-porteus #3 SMP PREEMPT Sat Jan 23 07:01:55 UTC 2016 i686 AMD Sempron(tm) 140 Processor AuthenticAMD GNU/Linux
NVIDIA Corporation C61 [GeForce 6150SE nForce 430] (rev a2) MemTotal: 901760 kB MemFree: 66752 kB

Bogomips
Full of knowledge
Full of knowledge
Posts: 2564
Joined: 25 Jun 2014, 15:21
Distribution: 3.2.2 Cinnamon & KDE5
Location: London

Re: MLOOP Issue: mloop http://domain.com/file.iso

Post#4 by Bogomips » 28 Jul 2016, 00:10

Apart for above, there is another issue arising out of an unhandled exception, Both with rc4 mloop http://forum.porteus.org/viewtopic.php? ... 069#p47320 (mloop entry) and amended mloop, mloop_1:

Code: Select all

root@porteus:/home/guest# mloop http://bear.alienbase.nl/mirrors/slackware-live/latest/slackware64-live-plasma5-current.iso
using /dev/loop10

Please wait while i gather some info ....

Checking given link ...
link is good
 Connecting to:   slackware64-live-plasma5-current.iso ...
file name: 	slackware64-live-plasma5-current.iso
host name: 	bear.alienbase.nl
port number: 	80
protocol: 	http
request path: 	/mirrors/slackware-live/latest/slackware64-live-plasma5-current.iso
auth data: 	(null)
file size: 	3275751424
 Attemptingto mount:   slackware64-live-plasma5-current.iso ...
ntfs-3g: Failed to access volume '/mnt/loop/slackware64-live-plasma5-current.iso': Transport endpoint is not connected

ntfs-3g 2016.2.22 integrated FUSE 27 - Third Generation NTFS Driver
		Configuration type 1, XATTRS are on, POSIX ACLS are off

Copyright (C) 2005-2007 Yura Pakhuchiy
Copyright (C) 2006-2009 Szabolcs Szakacsits
Copyright (C) 2007-2016 Jean-Pierre Andre
Copyright (C) 2009 Erik Larsson

Usage:    ntfs-3g [-o option[,...]] <device|image_file> <mount_point>

Options:  ro (read-only mount), windows_names, uid=, gid=,
          umask=, fmask=, dmask=, streams_interface=.
          Please see the details in the manual (type: man ntfs-3g).

Example: ntfs-3g /dev/sda1 /mnt/windows

News, support and information:  http://tuxera.com


 #################################
 Your online file has been mounted at:
/mnt/http

You can unmount it by typing: uloop

Here is a list of the files:
______________________________________________________________________________

root@porteus:/home/guest# mloop http://slackware.uk/people/alien-slacklive/latest/slackware64-live-plasma5-current.iso
using /dev/loop10
mkdir: cannot create directory ‘/mnt/loop’: File exists

Please wait while i gather some info ....

Checking given link ...
link is good
 Connecting to:   slackware64-live-plasma5-current.iso ...
file name: 	slackware64-live-plasma5-current.iso
host name: 	slackware.uk
port number: 	80
protocol: 	http
request path: 	/people/alien-slacklive/latest/slackware64-live-plasma5-current.iso
auth data: 	(null)
file size: 	3275751424
 Attemptingto mount:   slackware64-live-plasma5-current.iso ...
ntfs-3g: Failed to access volume '/mnt/loop/slackware64-live-plasma5-current.iso': Transport endpoint is not connected

ntfs-3g 2016.2.22 integrated FUSE 27 - Third Generation NTFS Driver
		Configuration type 1, XATTRS are on, POSIX ACLS are off

Copyright (C) 2005-2007 Yura Pakhuchiy
Copyright (C) 2006-2009 Szabolcs Szakacsits
Copyright (C) 2007-2016 Jean-Pierre Andre
Copyright (C) 2009 Erik Larsson

Usage:    ntfs-3g [-o option[,...]] <device|image_file> <mount_point>

Options:  ro (read-only mount), windows_names, uid=, gid=,
          umask=, fmask=, dmask=, streams_interface=.
          Please see the details in the manual (type: man ntfs-3g).

Example: ntfs-3g /dev/sda1 /mnt/windows

News, support and information:  http://tuxera.com


 #################################
 Your online file has been mounted at:
/mnt/http

You can unmount it by typing: uloop

Here is a list of the files:
______________________________________________________________________________

root@porteus:/home/guest# uloop
/usr/bin/uloop: line 12: [: : integer expression expected

nothing is mounted in /mnt/loop

root@porteus:/home/guest# mloop http://slackware.uk/people/alien-slacklive/latest/slackware64-live-plasma5-current.iso
using /dev/loop10
mkdir: cannot create directory ‘/mnt/loop’: File exists

Please wait while i gather some info ....

Checking given link ...
link is good
 Connecting to:   slackware64-live-plasma5-current.iso ...
file name: 	slackware64-live-plasma5-current.iso
host name: 	slackware.uk
port number: 	80
protocol: 	http
request path: 	/people/alien-slacklive/latest/slackware64-live-plasma5-current.iso
auth data: 	(null)
file size: 	3275751424
 Attemptingto mount:   slackware64-live-plasma5-current.iso ...
ntfs-3g: Failed to access volume '/mnt/loop/slackware64-live-plasma5-current.iso': Transport endpoint is not connected

ntfs-3g 2016.2.22 integrated FUSE 27 - Third Generation NTFS Driver
		Configuration type 1, XATTRS are on, POSIX ACLS are off

Copyright (C) 2005-2007 Yura Pakhuchiy
Copyright (C) 2006-2009 Szabolcs Szakacsits
Copyright (C) 2007-2016 Jean-Pierre Andre
Copyright (C) 2009 Erik Larsson

Usage:    ntfs-3g [-o option[,...]] <device|image_file> <mount_point>

Options:  ro (read-only mount), windows_names, uid=, gid=,
          umask=, fmask=, dmask=, streams_interface=.
          Please see the details in the manual (type: man ntfs-3g).

Example: ntfs-3g /dev/sda1 /mnt/windows

News, support and information:  http://tuxera.com


 #################################
 Your online file has been mounted at:
/mnt/http

You can unmount it by typing: uloop

Here is a list of the files:

root@porteus:/home/guest# umount /mnt/http
umount: /mnt/http: not mounted
Makeshift Exception Handling
  • xhttpfs2()

    Code: Select all

    xhttpfs2() {
    xname=${xfile##*/}
    
    # Do quick net check
    echo "Checking given link ..."
    wget -q --spider --force-html --inet4-only $xfile >/dev/null 2>&1 && echo "link is good" || \
    { echo -e $txtred "This link was not found online. Sorry." $rst; exit; }
    
    # Make sure the mount points are ready
    if [ -d /mnt/http ]; then
    	# Avoid unmounting unmounted	Bogomips
    	if mountpoint -q /mnt/http; then
    		echo "Unmounting"
    		umount /mnt/http && sleep 1 || { echo "Could not unmount"; exit; }
    		echo "Unmounted"
    	fi
        rm -rf /mnt/http
    fi
    umount /mnt/loop >/dev/null 2>&1
    mkdir -p /mnt/http >/dev/null 2>&1
    
    echo -e $txtcyan "Connecting to: " $rst "$xname ..."
    httpfs2 $xfile $mpoint || { echo -e $txtred "There was a fatal error mounting: " $rst "$xname."; exit; }
    echo -e $txtcyan "Attemptingto mount: " $rst "$xname ..."
    # Makeshift exception handling		Bogomips	27.07.2016 17:50:09
    # mount $mpoint/$xname /mnt/http
    readarray -t m < <(mount $mpoint/$xname /mnt/http 2>&1; echo $?);	# Passing return code any which way
    let r=m[${#m[*]}-1]; ((r)) && { echo $m; fusermount -u $mpoint || umount -f $mpoint; exit $r; }
    # Exception handling end			Bogomips	27.07.2016 17:50:09
    clear
    echo
    echo -e $txtcyan "#################################"
    echo " Your online file has been mounted at:" $rst
    echo /mnt/http
    echo
    # More consistent from user standpoint.	Bogomips
    echo "You can unmount it by typing: uloop"
    echo
    echo "Here is a list of the files:"
    ls /mnt/http
    echo
    exit
    }
    
  • Tested

    Code: Select all

    root@porteus:/home/guest# mloop http://izzle121.net/pub/slackware/slackware-14.2-iso/slackware-14.2-install-dvd.iso
    using /dev/loop11
    
    Please wait while i gather some info ....
    
    Checking given link ...
    link is good
     Connecting to:   slackware-14.2-install-dvd.iso ...
    file name: 	slackware-14.2-install-dvd.iso
    host name: 	izzle121.net
    port number: 	80
    protocol: 	http
    request path: 	/pub/slackware/slackware-14.2-iso/slackware-14.2-install-dvd.iso
    auth data: 	(null)
    file size: 	3127193600
     Attemptingto mount:   slackware-14.2-install-dvd.iso ...
    ntfs-3g: Failed to access volume '/mnt/loop/slackware-14.2-install-dvd.iso': Transport endpoint is not connected
    
    root@porteus:/home/guest# mountpoint /mnt/http/
    /mnt/http/ is not a mountpoint
    root@porteus:/home/guest# mountpoint /mnt/loop/
    /mnt/loop/ is not a mountpoint
    ______________________________________________________________________________
    
    root@porteus:/home/guest# mloop http://slackware.uk/people/alien-slacklive/latest/slackware-live-xfce-current.iso
    using /dev/loop11
    
    Please wait while i gather some info ....
    
    Checking given link ...
    link is good
     Connecting to:   slackware-live-xfce-current.iso ...
    file name: 	slackware-live-xfce-current.iso
    host name: 	slackware.uk
    port number: 	80
    protocol: 	http
    request path: 	/people/alien-slacklive/latest/slackware-live-xfce-current.iso
    auth data: 	(null)
    file size: 	735051776
     Attemptingto mount:   slackware-live-xfce-current.iso ...
    
    
     #################################
     Your online file has been mounted at:
    /mnt/http
    
    You can unmount it by typing: uloop
    
    Here is a list of the files:
    boot  liveslak
    
    root@porteus:/home/guest# tree -n -L 2 /mnt/http/
    /mnt/http/
    ├── boot
    │   ├── generic
    │   ├── initrd.img
    │   ├── memtest
    │   └── syslinux
    └── liveslak
        ├── addons
        ├── optional
        ├── rootcopy
        └── system
    
    7 directories, 3 files
    root@porteus:/home/guest# uloop
    
    /mnt/loop has been unmounted
    ______________________________________________________________________________
    
    root@porteus:/home/guest# mountpoint /mnt/http//mnt/http/ is not a mountpoint
    root@porteus:/home/guest# mountpoint /mnt/loop//mnt/loop/ is not a mountpoint
    ______________________________________________________________________________
    
    root@porteus:/home/guest# mloop  http://ftp.slackware.pl/pub/slackware-live/latest/slackware-live-xfce-current.iso
    using /dev/loop11
    
    Please wait while i gather some info ....
    
    Checking given link ...
    link is good
     Connecting to:   slackware-live-xfce-current.iso ...
    file name: 	slackware-live-xfce-current.iso
    host name: 	ftp.slackware.pl
    port number: 	80
    protocol: 	http
    request path: 	/pub/slackware-live/latest/slackware-live-xfce-current.iso
    auth data: 	(null)
    file size: 	735051776
     Attemptingto mount:   slackware-live-xfce-current.iso ...
    
    
     #################################
     Your online file has been mounted at:
    /mnt/http
    
    You can unmount it by typing: uloop
    
    Here is a list of the files:
    boot  liveslak
    
    root@porteus:/home/guest# ls -l /mnt/http/liveslak/system/
    total 695984
    -rw-r--r-- 1 root root   4243456 Jul 23 00:03 0000-slackware_boot-current-i586.sxz
    -rw-r--r-- 1 root root 242688000 Jul 22 23:22 0020-slackware_min-current-i586.sxz
    -rw-r--r-- 1 root root 128266240 Jul 23 00:00 0020-slackware_xapbase-current-i586.sxz
    -rw-r--r-- 1 root root 320974848 Jul 22 23:55 0020-slackware_xbase-current-i586.sxz
    -rw-r--r-- 1 root root  11980800 Jul 23 00:01 0020-slackware_xfcebase-current-i586.sxz
    -rw-r--r-- 1 root root   4534272 Jul 23 00:02 0099-slackware_zzzconf-current-i586.sxz
    root@porteus:/home/guest# tree -n -L 2 /mnt/http/
    /mnt/http/
    ├── boot
    │   ├── generic
    │   ├── initrd.img
    │   ├── memtest
    │   └── syslinux
    └── liveslak
        ├── addons
        ├── optional
        ├── rootcopy
        └── system
    
    7 directories, 3 files
    root@porteus:/home/guest# uloop
    
    /mnt/loop has been unmounted
    ______________________________________________________________________________
    
    root@porteus:/home/guest# mountpoint /mnt/http//mnt/http/ is not a mountpoint
    root@porteus:/home/guest# mountpoint /mnt/loop//mnt/loop/ is not a mountpoint
    ______________________________________________________________________________
    
    root@porteus:/home/guest# mloop http://bear.alienbase.nl/mirrors/slackware-live/latest/slackware64-live-plasma5-current.iso
    using /dev/loop11
    
    Please wait while i gather some info ....
    
    Checking given link ...
    link is good
     Connecting to:   slackware64-live-plasma5-current.iso ...
    file name: 	slackware64-live-plasma5-current.iso
    host name: 	bear.alienbase.nl
    port number: 	80
    protocol: 	http
    request path: 	/mirrors/slackware-live/latest/slackware64-live-plasma5-current.iso
    auth data: 	(null)
    file size: 	3275751424
     Attemptingto mount:   slackware64-live-plasma5-current.iso ...
    ntfs-3g: Failed to access volume '/mnt/loop/slackware64-live-plasma5-current.iso': Transport endpoint is not connected
    ______________________________________________________________________________
    
    root@porteus:/home/guest# mountpoint /mnt/http//mnt/http/ is not a mountpoint
    root@porteus:/home/guest# mountpoint /mnt/loop//mnt/loop/ is not a mountpoint
    ______________________________________________________________________________
    
    root@porteus:/home/guest# mloop  http://repo.ukdw.ac.id/slackware-live/latest/slackware-live-current.iso
    using /dev/loop11
    
    Please wait while i gather some info ....
    
    Checking given link ...
    link is good
     Connecting to:   slackware-live-current.iso ...
    file name: 	slackware-live-current.iso
    host name: 	repo.ukdw.ac.id
    port number: 	80
    protocol: 	http
    request path: 	/slackware-live/latest/slackware-live-current.iso
    auth data: 	(null)
    file size: 	2786066432
     Attemptingto mount:   slackware-live-current.iso ...
    ntfs-3g: Failed to access volume '/mnt/loop/slackware-live-current.iso': Transport endpoint is not connected
    
    root@porteus:/home/guest# echo $?
    11
    
    root@porteus:/home/guest# mountpoint /mnt/http//mnt/http/ is not a mountpoint
    root@porteus:/home/guest# mountpoint /mnt/loop//mnt/loop/ is not a mountpoint
    
  • Diff for Exception Handling as well, where mloop_0 is original rc4 mloop

    Code: Select all

    guest@porteus:~$ diff -au mloop_0 mloop_2
    --- mloop_0	2016-07-27 23:56:27.390961484 +0100
    +++ mloop_2	2016-07-27 23:09:40.341977823 +0100
    @@ -76,7 +76,7 @@
     echo
     echo "File given will be mounted on a loop at /mnt/loop"
     echo "You can use uloop to unmout loop."
    -echo 
    +echo
     echo
     }
     
    @@ -103,7 +103,7 @@
     xmodule() {
     mount -t auto -o loop $xfile $mpoint
     clear
    -echo 
    +echo
     echo -e $txtcyan "#################################"
     echo " Your module has been mounted at:" $rst
     echo $mpoint
    @@ -119,7 +119,7 @@
     xiso() {
     mount -t iso9660 -o loop $xfile $mpoint
     clear
    -echo 
    +echo
     echo -e $txtcyan "#################################"
     echo "Your image has been mounted at:" $rst
     echo $mpoint
    @@ -142,7 +142,7 @@
         mount -t auto -o loop $xfile $mpoint
     fi
     clear
    -echo 
    +echo
     echo -e $txtcyan "#################################"
     echo " Your data file has been mounted at:" $rst
     echo $mpoint
    @@ -158,7 +158,7 @@
     ximg() {
     mount -t auto -o loop $xfile $mpoint
     clear
    -echo 
    +echo
     echo -e $txtcyan "#################################"
     echo "Your .img file has been mounted at:" $rst
     echo $mpoint
    @@ -176,7 +176,7 @@
     echo
     echo -e $txtgreen "Backing up initrd ...." $rst
     
    -[ ! -d $tmp ] && mkdir $tmp || rm -rf $tmp/* 
    +[ ! -d $tmp ] && mkdir $tmp || rm -rf $tmp/*
     cp $real ${real}.bak
     echo $xfile > $tmp/initrd.txt
     
    @@ -185,7 +185,7 @@
     cd $tmp
     xz -d < $real | cpio -i
     cd - >/dev/null
    -echo 
    +echo
     echo "##################################################"
     echo "Your original initrd.xz is still intact"
     echo "and has been backed up as $xfile.bak"
    @@ -206,11 +206,11 @@
     # Make sure file is gzip
     file $real|grep -o "gzip" >/dev/null || { echo -e $txtcyan "This is not a valid gzip file!"; exit; }
     pkg=${real##*/}
    -pkgname=`sed -e 's@\.tar@@g' -e 's@\.gz@@g' <<<$pkg` 
    +pkgname=`sed -e 's@\.tar@@g' -e 's@\.gz@@g' <<<$pkg`
     
     archivemount $real $mpoint 2>/dev/null
     clear
    -echo 
    +echo
     echo -e $txtcyan "#################################"
     echo " Your gzip file has been mounted at:" $rst
     echo $mpoint
    @@ -231,7 +231,7 @@
     
     archivemount $real $mpoint 2>/dev/null
     clear
    -echo 
    +echo
     echo -e $txtcyan "#################################"
     echo " Your bzip file has been mounted at:" $rst
     echo $mpoint
    @@ -252,7 +252,7 @@
     
     archivemount $real $mpoint 2>/dev/null
     clear
    -echo 
    +echo
     echo -e $txtcyan "#################################"
     echo " Your tarball file has been mounted at:" $rst
     echo $mpoint
    @@ -275,9 +275,12 @@
     
     # Make sure the mount points are ready
     if [ -d /mnt/http ]; then
    -    echo "Unmounting"
    -    umount /mnt/http && sleep 1 || { echo "Could not unmount"; exit; }
    -    echo "Unmounted"
    +	# Avoid unmounting unmounted	Bogomips
    +	if mountpoint -q /mnt/http; then
    +		echo "Unmounting"
    +		umount /mnt/http && sleep 1 || { echo "Could not unmount"; exit; }
    +		echo "Unmounted"
    +	fi
         rm -rf /mnt/http
     fi
     umount /mnt/loop >/dev/null 2>&1
    @@ -286,15 +289,19 @@
     echo -e $txtcyan "Connecting to: " $rst "$xname ..."
     httpfs2 $xfile $mpoint || { echo -e $txtred "There was a fatal error mounting: " $rst "$xname."; exit; }
     echo -e $txtcyan "Attemptingto mount: " $rst "$xname ..."
    -mount $mpoint/$xname /mnt/http
    -
    +# Makeshift exception handling		Bogomips	27.07.2016 17:50:09
    +# mount $mpoint/$xname /mnt/http
    +readarray -t m < <(mount $mpoint/$xname /mnt/http 2>&1; echo $?);	# Passing return code any which way
    +let r=m[${#m[*]}-1]; ((r)) && { echo $m; fusermount -u $mpoint || umount -f $mpoint; exit $r; }
    +# Exception handling end			Bogomips	27.07.2016 17:50:09
     clear
    -echo 
    +echo
     echo -e $txtcyan "#################################"
     echo " Your online file has been mounted at:" $rst
     echo /mnt/http
     echo
    -echo "You can unmount it by typing: umount /mnt/http"
    +# More consistent from user standpoint.	Bogomips
    +echo "You can unmount it by typing: uloop"
     echo
     echo "Here is a list of the files:"
     ls /mnt/http
    @@ -317,6 +324,8 @@
         exit
     fi
     
    +# Check for httpfs2		Bogomips	21.07.2016 01:35:00
    +mountpoint -q /mnt/http && umount /mnt/http
     [ -d /mnt/loop ] && mls=`grep /mnt/loop /proc/mounts | wc -l`
     
     if [ "$mls" -gt 0 ]; then
    guest@porteus:~$ 
    
Linux porteus 4.4.0-porteus #3 SMP PREEMPT Sat Jan 23 07:01:55 UTC 2016 i686 AMD Sempron(tm) 140 Processor AuthenticAMD GNU/Linux
NVIDIA Corporation C61 [GeForce 6150SE nForce 430] (rev a2) MemTotal: 901760 kB MemFree: 66752 kB

User avatar
brokenman
Site Admin
Site Admin
Posts: 6105
Joined: 27 Dec 2010, 03:50
Distribution: Porteus v4 all desktops
Location: Brazil

Re: MLOOP Issue: mloop http://domain.com/file.iso

Post#5 by brokenman » 28 Jul 2016, 17:01

Thanks. Merged.
How do i become super user?
Wear your underpants on the outside and put on a cape.

Post Reply