Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support system wide / user installation #189

Closed
blshkv opened this issue Jul 3, 2022 · 15 comments
Closed

support system wide / user installation #189

blshkv opened this issue Jul 3, 2022 · 15 comments
Labels
priority: medium medium priority issue or feature solved bugs that have been solved status: in progress the solution is in progress type: enhancement New feature or request

Comments

@blshkv
Copy link
Contributor

blshkv commented Jul 3, 2022

Basically, revert b082f0d. That commit broke it.

This is a common problem that many tools which we want to distribute do not support system wide installation. Some of these tools provide their own "install.sh" or "setup.sh" with a distro specific commands (sudo apt-install) to install dependencies instead of a proper setup.py/pyproject.toml (PEP 517).
With a proper setup.py script, an end user can install it using the following single command:
python3 setup.py install --user. It also a distro friendly and makes life for maintainers easier.

The end result, a FHS compliant directory structure should be created.
In case if software produce any output, a local user directory should be used, such as ~./<software>/

There are some custom cases (installing non-python packages, data files etc) which have been resolved in other packages. Bellow, are reference points on such bug reports with solutions (patches)
pentoo/pentoo-overlay#596

 * ACCESS DENIED:  mkdir:         /usr/share/wifipumpkin3
Traceback (most recent call last):
  File "/var/tmp/portage/net-wireless/wifipumpkin3-1.1.3_p1/work/wifipumpkin3-1.1.3-R1/setup.py", line 51, in <module>
    create_user_dir_config()
  File "/var/tmp/portage/net-wireless/wifipumpkin3-1.1.3_p1/work/wifipumpkin3-1.1.3-R1/setup.py", line 44, in create_user_dir_config
    os.makedirs(user_config_dir, exist_ok=True)
  File "/usr/lib/python3.9/os.py", line 225, in makedirs
    mkdir(name, mode)
PermissionError: [Errno 13] Permission denied: '/usr/share/wifipumpkin3'
 * ERROR: net-wireless/wifipumpkin3-1.1.3_p1::pentoo failed (compile phase):

@blshkv
Copy link
Contributor Author

blshkv commented Jul 3, 2022

also:

 * QA Notice: setuptools warnings detected:
 * 
 *          Installing 'wifipumpkin3.plugins.pumpkinproxy.tmp' as data is deprecated, please list it in `packages`.
 *          Installing 'wifipumpkin3.plugins.pumpkinproxy.tmp.doc' as data is deprecated, please list it in `packages`.
 *          Installing 'wifipumpkin3.plugins.pumpkinproxy.tmp.exe' as data is deprecated, please list it in `packages`.
 *          Installing 'wifipumpkin3.plugins.pumpkinproxy.tmp.pdf' as data is deprecated, please list it in `packages`.
 *          Installing 'wifipumpkin3.plugins.pumpkinproxy.tmp.xls' as data is deprecated, please list it in `packages`.

@mh4x0f
Copy link
Member

mh4x0f commented Jul 3, 2022

This settings is required because the wp3 not should be installed using --user mode because when do this the wp3 will be create a folder on {user}/.config but wp3 require run as super user this change the config to {root}/.config this is a problem for me. make a debian package need to be create a folder on /usr/share/wifipumpkin3 with all files for settings of wp3. as you can see on installation page of wp3 i recommended to install as super user because because wp require super user for run. I can't revert it this is solve make problem with installation of new plugins and solve problem to create a debian package.

@mh4x0f
Copy link
Member

mh4x0f commented Jul 3, 2022

my recommendation for you is create a fork of wp3 and do your settings for your system because i only support the debian, i'm only test on debian.

@blshkv
Copy link
Contributor Author

blshkv commented Jul 3, 2022

you are doing it wrong even for debian. NO tools should write anything into system folders such as /usr/share, read up on FHS.

What is the problem with using root/.config?

@blshkv
Copy link
Contributor Author

blshkv commented Jul 3, 2022

I guess for configs and plugins you can use a standard setuptools mechanism:
mschwager/fierce#25 (comment)
package_dir and packages
mschwager/fierce@cf0e41e

@blshkv
Copy link
Contributor Author

blshkv commented Jul 3, 2022

just to be clear, user_config_dir should stay as it was before, all output and user's data should be written there.
config_dir should be your packages=[] with system configs, plugins etc

@mh4x0f
Copy link
Member

mh4x0f commented Jul 3, 2022

okay, I 'm find a possible solution your problem is install on /usr/share/ and run python3 setup.py install --user correct ? and system-wide, read-only files in /usr

@mh4x0f
Copy link
Member

mh4x0f commented Jul 3, 2022

I pushed non draft-configdir a patch for solve this problem check out and send me the feedback.

@mh4x0f mh4x0f added type: enhancement New feature or request status: in progress the solution is in progress priority: medium medium priority issue or feature labels Jul 4, 2022
mh4x0f added a commit that referenced this issue Jul 4, 2022
fixed: support system wide / user installation #189
@mh4x0f mh4x0f added status: review needed review Needed and removed status: review needed review Needed labels Jul 4, 2022
@blshkv
Copy link
Contributor Author

blshkv commented Jul 4, 2022

ok, I'm testing 1.1.3 R2, and hit an unrelated bug:

 * QA Notice: The ebuild is installing to one or more unexpected paths:
 * 
 *   /usr/wifipumpkin3
 * 
 * Please fix the ebuild to use correct FHS/Gentoo policy paths.

update:
The bug should be 'data' related:
/usr/wifipumpkin3/data

@blshkv
Copy link
Contributor Author

blshkv commented Jul 4, 2022

#189 (comment)
That bug is still not fixed. Could you have a look since we are on it?

@blshkv
Copy link
Contributor Author

blshkv commented Jul 4, 2022

sudo -E wifipumpkin3 
/usr/lib/python3.10/site-packages/scapy/layers/ipsec.py:471: CryptographyDeprecationWarning: Blowfish has been deprecated
  cipher=algorithms.Blowfish,
/usr/lib/python3.10/site-packages/scapy/layers/ipsec.py:485: CryptographyDeprecationWarning: CAST5 has been deprecated
  cipher=algorithms.CAST5,
[*] creating config user dir on: /home/blshkv/.config/wifipumpkin3
[+] the user config has been create sucessfully, please restart the wp3!


bash$ sudo -E wifipumpkin3 
/usr/lib/python3.10/site-packages/scapy/layers/ipsec.py:471: CryptographyDeprecationWarning: Blowfish has been deprecated
  cipher=algorithms.Blowfish,
/usr/lib/python3.10/site-packages/scapy/layers/ipsec.py:485: CryptographyDeprecationWarning: CAST5 has been deprecated
  cipher=algorithms.CAST5,
Traceback (most recent call last):
  File "/usr/lib/python-exec/python3.10/wifipumpkin3", line 33, in <module>
    sys.exit(load_entry_point('wifipumpkin3==1.1.3', 'console_scripts', 'wifipumpkin3')())
  File "/usr/lib/python3.10/site-packages/wifipumpkin3/__main__.py", line 86, in main
    config.set("accesspoint", "status_ap", False)
  File "/usr/lib/python3.10/site-packages/wifipumpkin3/core/utility/collection.py", line 47, in set
    self.psettings.beginGroup(name_group)
AttributeError: 'SettingsINI' object has no attribute 'psettings'

it created .config/wifipumpkin3/ directory, but did not copy configs.
I copeid it manually from the system path /usr/share/wifipumkin/data/ and it started to work

@blshkv
Copy link
Contributor Author

blshkv commented Jul 4, 2022

ok, thanks for merging my pulls, seems working fine now.

@mh4x0f
Copy link
Member

mh4x0f commented Jul 4, 2022

no problem check if work fine now I 'll make a release after that

@blshkv
Copy link
Contributor Author

blshkv commented Jul 4, 2022

yeap, seems fixed. Thanks

@mh4x0f
Copy link
Member

mh4x0f commented Jul 4, 2022

great work brow, thanks for support

@mh4x0f mh4x0f added the solved bugs that have been solved label Jul 4, 2022
mh4x0f added a commit that referenced this issue Jul 4, 2022
fixed: check if copy_tree was sucessful
fixed: setuptools warnings detected unnecessary files
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: medium medium priority issue or feature solved bugs that have been solved status: in progress the solution is in progress type: enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants