Last active
February 14, 2019 02:57
-
-
Save khaije1/3442258 to your computer and use it in GitHub Desktop.
fun w/ drobo
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Hard Reset SVN working-copy back to checkout (records a diff first). | |
alias svn.HardReset='read -p "destroy ALL local changes?[y/N]" && [[ $REPLY =~ ^[yY] ]] && svn diff &> $(mktemp | tee -a "${HOME}/.svnReset.log") && svn revert -R . && rm -rf $(awk -f <(echo "/^?/{print $2}") <(svn status );)' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env SHELL | |
#from http://www.droboports.com/using-command-line-apps | |
droboapps_rootdir="/mnt/DroboFS/Shares/DroboApps" | |
if [[ ! "${droboapps_rootdir}/bash/bin/bash" == "$BASH" ]] ;then | |
exit 1 | |
fi | |
SHELL="$BASH" && export SHELL | |
declare -a EXEC_PATH_dirs=("." "bin" "sbin") | |
declare -a LIB_PATH_dirs=("lib" ) | |
for APP in ${droboapps_rootdir}/* ;do | |
for subdir in "${EXEC_PATH_dirs[@]}" ;do | |
currpath="${APP}/${subdir}" #&&echo "traversing $currpath for valid paths to append" | |
[[ 0 -eq $? ]] && [[ -d "$currpath" ]] #&& echo "valid(1): target is a valid fspath" | |
[[ 0 -eq $? ]] && [[ "$PATH" == "${PATH//$currpath/}" ]] #&& echo "valid(2): target is not already in PATH" | |
[[ 0 -eq $? ]] && [[ $(find "$currpath" -maxdepth 1 -type f -xdev -perm +111 | wc -l) -gt 0 ]] #&& echo "valid(3): target contains executable files" | |
[[ 0 -eq $? ]] && export PATH="${currpath}:${PATH}" | |
done | |
for subdir in "${LIB_PATH_dirs[@]}" ;do | |
currpath="${APP}/${subdir}" | |
[[ 0 -eq $? ]] && [[ -d "$currpath" ]] | |
[[ 0 -eq $? ]] && [[ "$LD_LIBRARY_PATH" == "${LD_LIBRARY_PATH//$currpath/}" ]] | |
[[ 0 -eq $? ]] && export LD_LIBRARY_PATH="${currpath}:${LD_LIBRARY_PATH}" | |
done | |
done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env SHELL | |
#from http://www.droboports.com/using-command-line-apps | |
droboapps_rootdir="/mnt/DroboFS/Shares/DroboApps" | |
bash_path="$droboapps_rootdir/bash/bin/bash" | |
[ ! "/bin/sh" == "$SHELL" ] && exit 1 | |
[ -f ~/.bashrc ] && source ~/.bashrc | |
#echo "executing ash-shell init" | |
echo "checking for bash at $bash_path" | |
if [ -x "${bash_path}" ] ;then | |
echo "bash found - adding to PATH" | |
[ 0 -eq $? ] && PATH="${bash_path}:$PATH" && export PATH | |
#[ 0 -eq $? ] && set SHELL="${bash_path}" && export SHELL | |
[ 0 -eq $? ] && "${bash_path}" --login | |
fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# http://stackoverflow.com/questions/7145337/bash-how-do-i-create-function-from-variable | |
# eval "someprefix_${bname}() { echo test; }" | |
# from http://stackoverflow.com/questions/1203583/how-do-i-rename-a-bash-function | |
# copies function named $1 to name $2 | |
copy_function() { | |
declare -F $1 > /dev/null || return 1 | |
eval "$(echo "${2}()"; declare -f ${1} | tail -n +2)" | |
} | |
# renamed function from $1 to $2 | |
# copies function named $1 to name $2 | |
rename_function() { | |
declare -F $1 > /dev/null || return 1 | |
eval "$(echo "${2}()"; declare -f ${1} | tail -n +2)" \ | |
&& unset -f $1 | |
} | |
# INPUT: list of regex to match for output | |
list_fns(){ | |
declare -a input_lst=( "${@}" ) | |
declare -a fn_lst=( $(declare -F |cut -d" " -f3) ) | |
declare -a output_lst | |
#+WIP | |
} | |
scope_all_fns(){ | |
# iterate over all file-local defined functions and prefix with $1 | |
#+WIP | |
# http://stackoverflow.com/questions/2625783/listing-defined-functions-in-bash | |
echo "" | |
} | |
# true if executed directly | |
start-main-p(){ [[ "${0}" == "${BASH_SOURCE[0]}" ]] ;} | |
if start-main-p ;then | |
main | |
else | |
scope_all_fns | |
fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
targetfile=".bash_profile" | |
logfile=$(mktemp) | |
locate_lst=( $(locate ${targetfile} ) ) | |
for i in seq 0 ${#locate_lst[@]} ;do | |
tmpdiffcmd="diff -Ns ${locate_lst[$i]} ${locate_lst[$(( $i + 1 ))]}" | |
echo $tmpdiffcmd | |
$tmpdiffcmd | tee -a $logfile | |
done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* synopsis | |
- title: Overview: sudo-1.8.5p3 | |
* advise | |
- Sudo has no dependencies. | |
- The fundamental block for proper security on the FS. | |
- Sudo should be used in conjunction with OpenSSH to ensure that your FS implements a sane access policy before exposing it to the internet. | |
- This is not a conventional DroboApp in the sense that once installed, it is ready for use. This one just makes the sudo executable available for further use, and does not attempt to change the DroboFS configuration in any way. A good start to make it easier to use can be found here. Upgrades do not overwrite previous configuration | |
* TODO | |
* subroutine | |
** howto, install package | |
- Download the TGZ file below and place it in you DroboApps share. If you do not have SSH access, reboot your Drobo. Otherwise, SSH in and type: | |
: /usr/bin/DroboApps.sh install | |
- Furthermore, it requires quite a bit of extra configuration before it can be used. | |
** howto, initialize configuration | |
there are five steps: (1) set uid on the sudo binary, (2) create a sudoer group, (3) create/add an user account to the sudoer group, (4) edit the sudoers files, and (5) test the deployment. | |
1) once the DroboApp is installed, enter this (as root): | |
: chmod 4111 /mnt/DroboFS/Shares/DroboApps/sudo/bin/sudo | |
2) (to use the well-known 'sudo' group), you want to create an user account 'john' and add it to the 'sudo' group (again, as root): | |
: addgroup sudo | |
3) add selected users to sudo group | |
: adduser john | |
: addgroup john sudo | |
4) using 'visudo' and uncomment the line that configures the sudo group, like this (again, as root): | |
: /mnt/DroboFS/Shares/DroboApps/sudo/sbin/visudo | |
- Scroll down until you see a line like this: | |
: # %sudo ALL=(ALL) ALL | |
- remove the '#' and save file | |
- test the deployment, by typing this | |
: sudo -s | |
- you'll get a prompt for the account's password, and if the authentication is successful, you'll be prompted with a root credentials challenge and be able to complete/pass through it successfully. | |
5) If everything was successful in prior steps, we'll persist these configuration to survive a reboot by typing, (as root): | |
: sudo cp -a /etc/passwd /etc/.passwd && sudo cp -a /etc/group /etc/.group #&& sudo rm /var/.passwd | |
: sudo cp -a /mnt/DroboFS/Shares/DroboApps/sudo/etc/sudoers.default /mnt/DroboFS/Shares/DroboApps/sudo/etc/sudoers | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
why would you call you're build-chain channel ##workingset ??? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# | |
# | |
#Purpose: add puppet user account, setup pubkey auth, disable password logins, setup password-less sudo | |
droboapps_path="" | |
curl_exe="" | |
curl_opts="" | |
curl_outfile="" | |
curl_outpath="" | |
curl --insecure --output puppet.tgz --location http://www.droboports.com/app-repository/puppet-2-7-19/puppet.tgz?attredirects=0&d=1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment