mirror of
https://github.com/KevinMidboe/mktxp-no-cli.git
synced 2025-10-29 17:50:23 +00:00
Merge pull request #58 from 0x4D616E75/freebsd-support
Add support for FreeBSD
This commit is contained in:
57
README.md
57
README.md
@@ -219,6 +219,63 @@ Let's save and then start the service as well as check on its' status:
|
||||
```
|
||||
|
||||
|
||||
## Setting up MKTXP to run as a FreeBSD Service
|
||||
If you've installed MKTXP on a FreeBSD system, you can run it with system boot via adding a service. \
|
||||
Let's start with:
|
||||
|
||||
|
||||
```
|
||||
❯ nano /usr/local/etc/rc.d/mktxp
|
||||
```
|
||||
|
||||
Now copy and paste the following:
|
||||
|
||||
```
|
||||
#!/bin/sh
|
||||
|
||||
# PROVIDE: mktxp
|
||||
# REQUIRE: DAEMON NETWORKING
|
||||
# BEFORE: LOGIN
|
||||
# KEYWORD: shutdown
|
||||
|
||||
# Add the following lines to /etc/rc.conf to enable mktxp:
|
||||
# mktxp_enable="YES"
|
||||
#
|
||||
# mktxp_enable (bool): Set to YES to enable mktxp
|
||||
# Default: NO
|
||||
# mktxp_user (str): mktxp daemon user
|
||||
# Default: root
|
||||
|
||||
. /etc/rc.subr
|
||||
|
||||
name=mktxp
|
||||
rcvar=mktxp_enable
|
||||
|
||||
: ${mktxp_enable:="NO"}
|
||||
: ${mktxp_user:="root"}
|
||||
|
||||
# daemon
|
||||
pidfile="/var/run/${name}.pid"
|
||||
command="/usr/sbin/daemon"
|
||||
mktxp_command="/usr/local/bin/mktxp export"
|
||||
procname="daemon"
|
||||
command_args=" -c -f -P ${pidfile} ${mktxp_command}"
|
||||
|
||||
load_rc_config $name
|
||||
run_rc_command "$1"
|
||||
```
|
||||
|
||||
Let's save and then start the service as well as check on its' status:
|
||||
```
|
||||
❯ sudo sysrc mktxp_enable="YES"
|
||||
❯ service mktxp start
|
||||
❯ service mktxp status
|
||||
|
||||
❯ service mktxp status
|
||||
mktxp is running as pid 36704
|
||||
```
|
||||
|
||||
|
||||
## Description of CLI Commands
|
||||
### mktxp commands
|
||||
. MKTXP commands:
|
||||
|
||||
@@ -135,6 +135,8 @@ class OSConfig(metaclass = ABCMeta):
|
||||
return LinuxConfig()
|
||||
elif sys.platform == 'darwin':
|
||||
return OSXConfig()
|
||||
elif sys.platform.startswith('freebsd'):
|
||||
return FreeBSDConfig()
|
||||
else:
|
||||
print(f'Non-supported platform: {sys.platform}')
|
||||
return None
|
||||
@@ -145,6 +147,14 @@ class OSConfig(metaclass = ABCMeta):
|
||||
pass
|
||||
|
||||
|
||||
class FreeBSDConfig(OSConfig):
|
||||
''' FreeBSD-related config
|
||||
'''
|
||||
@property
|
||||
def mktxp_user_dir_path(self):
|
||||
return FSHelper.full_path('~/mktxp')
|
||||
|
||||
|
||||
class OSXConfig(OSConfig):
|
||||
''' OSX-related config
|
||||
'''
|
||||
|
||||
1
setup.py
1
setup.py
@@ -69,6 +69,7 @@ setup(
|
||||
'Intended Audience :: System Administrators',
|
||||
'Intended Audience :: Information Technology',
|
||||
'Operating System :: MacOS',
|
||||
'Operating System :: POSIX :: BSD :: FreeBSD',
|
||||
'Operating System :: POSIX :: Linux',
|
||||
'Topic :: System',
|
||||
'Topic :: System :: Systems Administration',
|
||||
|
||||
Reference in New Issue
Block a user