Skip to content
View in the app

A better way to browse. Learn more.

Unraid

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Python script to manually install binaries

Featured Replies

I needed ack and prename installed in the system bin, along with some of my own. So I cleaned up the code and decided to share. This only requires vanilla python v3+.

 

What it does:

  1. For each item in the dictionary _scripts - If script is missing , or older than a week (can be changed on line 27), it will download it from the url defined in the dictionary item
  2. For each *.sh or *.pl file in the script's directory - Copies it to /usr/bin/ and enables execution permission

 

Python Script

import os
import subprocess

from datetime import datetime
from datetime import timedelta

def shell(cmd, check=False) -> str:
    res = subprocess.run(cmd, stdout=subprocess.PIPE, shell=True, check=check)
    return res.stdout.decode('utf-8').strip()


def curl(url, scriptName):
	shell(f'curl {url} -o {scriptName}')


_scripts = {
	#https://forums.unraid.net/topic/79490-rename-instead-of-rename-perl-instead-of-unix-util/
	'prename.pl': lambda k: curl('https://gist.githubusercontent.com/javiermon/3939556/raw/b9d0634f2c099b825a483d3d75cae1712fb9aa31/prename.pl', k),
	#https://beyondgrep.com/install/
	'ack.pl': lambda k: curl('https://beyondgrep.com/ack-v3.5.0', k)
}

_scriptExt = ['.sh', '.pl']
_bin = '/usr/bin/'

def run():
	oneWeekAgo = datetime.now() - timedelta(days=7)
	for k in _scripts.keys():
		sp = './' + k
		if not os.path.exists(sp) or datetime.fromtimestamp(os.path.getmtime(sp)) < oneWeekAgo:
			print(f'Updating: {k}')
			_scripts[k](k)

	for f in os.listdir(os.fsencode('./')):
		fn = os.fsdecode(f)
		fns = os.path.splitext(fn)
		if fns[1] in _scriptExt:
			print(f'Copying: {fn} -> {_bin}{fns[0]}')
			shell(f'cp {fn} {_bin}{fns[0]}')
			shell(f'chmod +x {_bin}{fns[0]}')

run()

 

Bash Script

  • I suggest adding to UserScripts with Schedule set to "At First Array Start Only"
  • Change "/mnt/user/projects/scripts" to wherever you save the python script
  • Change "installScripts.py" to whatever you name the python script
#!/bin/bash

cd /mnt/user/projects/scripts
python3 installScripts.py

 

Edited by c0d3m0nk3y
Typos

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.