PDA

View Full Version : Script-Tools



sea
3rd July 2013, 10:20 AM
A collection of diffrent tools for the cli, written with BASH.
They (will) accomplish diffrent tasks in a wide area of diffrent topics.

Until 1.0.0, the main focus for features will be redistribution and ontop installation of minimal approaches and custom spins,
but just as well like some absolute non-focus scripts like the signature generator or the grub2 tweak section

Script-Tools is an attempt to make the terminal usable to people not familiar with it.
I am trying to make it as self-explainable as possible to/for me & you, while mainwhile expecting the smallest idea of what you are doing.
It also tries to support 'lazy mode', set variables once, reuse often, these custom values are saved in $HOME/.config/script-tools/includes

Current Status: BETA
Accomplished 20% until Stable; missing: "st dev prj build|kickstart" ; update "st set" from F15/16 to F20 ; re-focus samba ; sub script handler for projects

The scripts are written with best intention to help and support diffrent needs or tasks one my come along in daily linux usage.
I am a hobby coder half of my life (~16 years) but i deny any responsiblity for any possible harm that may occour while you have script-tools installed.
I would not share this if i would be using it everyday i power on my computers without any damage to my computers.

However, the closer you do tasks to the system, the bigger the results are of a wrong setting, regardless of the tools you use.


You dont like the terminal, but are aware of its benefits
You are too lazy to recall those 3 selinux commands?
Need help to tweak something?
You have diffrent NAS with several shares using diffrent passwords? (cifs)
Download the diffrent current Fedora iso files (Rawhide|Nightly: only if available)
Or a Youtube Video/Playlist using FOSS Codecs?
Or writing iso files to an usb?
Are tired to typing: chmod +x
Wonder about bash-colors?
Something that removes temporary & swap files?
If a file is empty?


You will see alot of lines looking like:
st set lm gdm bg [ DIR ]
Dont worry, you dont need to know all arguments after "st".
Simply type st in a terminal and browse through the menus and select possible options from the menu.
After starting "st" add each new selection that goes deeper to the arguments, this creates those lines.
I just prefer to provide those lines as they will appear below, as this gives you
1) direct access to functions
2) also works as guide if you use the menu

This is the complete user menu as of 2013.Aug.02

* st conf scripts
* st conf scripts new
* st conf scripts edit
* st conf scripts rm
* st conf ig
* st conf incl
* st conf incl edit
* st conf st
* st conf st others
* st conf st sys
* st conf st mods
* st sa kick
* st sa import-gpg-key
* st sa import-gpg-key fedora
* st sa import-gpg-key rhel
* st sa wipe
* st sa sel
* st sa cron
* st sa prompt-theme
* st sa kb
* st sa hostname
* st sa bk
* st sa bk conf
* st sa bk sync
* st sa virtfs
* st iso spin
* st iso usb
* st set keyb
* st set pkgs
* st set alias
* st set lm
* st set lm gdm
* st set lm gdm install
* st set lm gdm bg
* st set lm gdm rndbg
* st set lm activ
* st set lm slim
* st set lm slim def-usr-toggle
* st set lm slim install
* st set lm slim def-usr-name
* st set lm slim autologin-toggle
* st set lm slim edit-session
* st set lm deskfile
* st set lm lxdm
* st set lm lxdm install
* st set lm lxdm autologin-toggle
* st set lm lxdm bg-style
* st set lm lxdm autologin-name
* st set lm lxdm bg-image
* st set stage
* st set users
* st set up
* st tweak ffua
* st tweak services
* st tweak default-dirs
* st tweak gnome
* st tweak repo
* st tweak repo toggle
* st tweak grub2
* st tweak grub2 recover
* st tweak grub2 theme
* st tweak grub2 theme install
* st tweak grub2 theme import
* st tweak grub2 theme remove
* st tweak grub2 theme copy
* st tweak grub2 theme export
* st tweak grub2 theme change
* st tweak grub2 theme edit
* st tweak grub2 update
* st tweak grub2 gfx
* st tweak grub2 bg
* st tweak grub2 term
* st tweak grub2 submenu
* st tweak grub2 screen
* st tweak grub2 font
* st tweak grub2 uuid
* st tweak grub2 timeout
* st tweak grub2 edit
* st tweak siggen
* st tweak plymouth
* st dev genman
* st dev review
* st dev prj
* st dev prj ftp
* st dev prj ftp new
* st dev prj ftp edit
* st dev prj ftp upl
* st dev prj koji
* st dev prj koji make
* st dev prj koji new
* st dev prj koji edit
* st dev prj remove
* st dev prj rpm
* st dev prj rpm make
* st dev prj rpm new
* st dev prj rpm changelog
* st dev prj rpm edit
* st dev prj rpm spec
* st dev prj repo
* st dev prj repo new
* st dev prj repo edit
* st dev prj repo upl
* st dev prj new
* st dev prj sf
* st dev prj sf uplf
* st dev prj sf uplc
* st dev prj sf new
* st dev prj sf edit
* st dev prj edit
* st dev prj ssh
* st dev prj ssh make
* st dev prj ssh con
* st dev prj ssh new
* st dev prj ssh edit
* st dev prj build
* st dev release
* st net mgr
* st net nas
* st net dl-fed
* st net yt
* st ts login
* st ts login node
* st ts net
* st ts net hddinfo
* st ts net find-hw
-- non user menu ; straight in terminal --
* bash-colors
* blame
* chx
* isEmpty FILE [FILEB * ..]
* isLVM
* lxscreenshot FILENAME.jpg
* mem
* newScript FILENAME [-s]
* p (pings random some website for 1 ping, simple inet connectino verification)
* rmtf [/path/to/clean]
* upd
* yumreset
* yumresume

Risks and known issues:
tweak GRUB2 currently doesnt support EFI environments

Interested to install?
Download the attached script, open a terminal and execute it:

cd ~/Downloads
sh inst-script-tools.sh (http://sourceforge.net/projects/script-tools/files/inst-script-tools.sh/download)
Or download the repo (http://sourceforge.net/projects/script-tools/files/script-tools.repo/download).
Place it in /etc/yum.repos.d/ (need to be root: sudo dolphin /etc/yum.repos.d $HOME/) and install it with sudo yum install script-tools.

Some youtube videos
Wipe a device: https://www.youtube.com/watch?v=tDYdxeFqZ08
Import gpg keys: https://www.youtube.com/watch?v=keJKirRkrG8
Developers: https://www.youtube.com/watch?v=d6u7xnbEoNw

Project: https://sourceforge.net/projects/script-tools/
For more images, please see the Album (http://forums.fedoraforum.org/album.php?albumid=252)

sea
3rd July 2013, 10:23 AM
Changelog

* Wed Jul 03 2013 - simon @ nc210.ocean - 0.7.7
- Added: find-hw in $SEA_CLI_DIR/ts/net
- Changed: man_cmd_list_gen.sh in $stDir/Script-Core
- Added a raw method to automaticly create a commandlist
- and basic manpages
- st gencmd (0.8)
- Usage: st gencmd [-i COMMANDLIST_SOURCE_DIR] \
- [-o COMMANDLIST_OUT_FILE] [MAN_INPUTDIR] \
- [MAN_OUTPUTDIR]
- -h This Help screen
- -i $DIR/AS/INPUT Defines other source than
- $SEA_INCLUDE_DIR
- -o /PATH/TO/OUTPUTFILE Defines other output than
- $SEA_DOC_DIR/CommandList
- /path/as/INPUTDIR Defines other inputdir to
- parse for default.info|help and $found_file -h
- $DIR/to/OUTPUTDIR Must be after MAN_INPUTDIR,
- defines where the generated manpages are saved.
- NOTE:
- For the man pages, my 'favorite' ones are those
- named after folders.
- These contain default.info, default.help \
- $(sh default.$foldername -h) in this order,
- and are then filled each found $(sh $file -h).
-
- For the commandlist, your function definitions
- 'should' look like this:
- function_name() { # ARGUMENTS
- # COMMENTLINE 1
- # COMMENTLINE 2
- Changed: Applied layout of the code so the CommandList looks better
- system.early, system.fs.partition, system.ANSI,
- module.dev.prh.ssh , system.CheckFunctions,
- system.status.cli,
- Changed: dl-fed in $SEA_CLI_DIR/net
- Changed: mgr in $SEA_CLI_DIR/net ! currently WIFI only !
- Default behaviour is now using nmcli
- It can be used as emergency NM,
- if the sevice is not running
- st net mgr (0.9)
- -h[help] This screen
- -import Imports Networksettings from NM to ST
- -nm NETORKMANAGERFILE [ -w WPAFILE ]
- -export Exports Networksettings from ST to NM
- -w WPAFILE [ -nm NETORKMANAGERFILE ]
- -b[rute] Disabled NM and use dconf, iw,
- and wpa_supplicant
- NOTE:
- For NETWORKMANGERFILE you just use either the device or
- the AP's name.
- NETWORKMANAGERFILE will be searched and written to
- /etc/sysconfig/network-scripts by default.
- If WPAFILE is not provided with a path, its been
- searched in /etc /home/simon/.config/script-tools/wifi
- If there is non found in any of these paths,
- it fails with 1
- Changed: Split up of splash[2] in $SEA_CLI_DIR/tweak/grub2 into
- bg, font, gfx, recover, screen, timeout and updated theme.
- Theme handler supports now:
- Change, remove, edit, copy and import|export of themes
- Changed: usb in $SEA_CLI_DIR/iso
- Added argument support.
- st iso usb [/dev/sdb] [/path/to/file]
- Fixed: Added --one-file-system to qbkup in $stDir/Scripts-in-bin
- Removed: module.dev.self-distribution
- No longer required
- Removed: module.youtube in $SEA_INCLUDE_DIR
- As its only variable left module.youtube in $SEA_VAR_DIR
- Renamed: man_cmd_list_gen.sh to genman
- And moved from $stDir/Script-Core to $SEA_CLI_DIR/dev
- Renamed: splash[2] in $SEA_CLI_DIR/tweak/grub2 to splash[2].old

glennzo
3rd July 2013, 11:04 AM
Constructive criticism. I downloaded the tar.gz file and copied it to Fedora 19 running in VirtualBox. This sent the file to /home/glenn. There I extracted the file. Now I have several files and sub-folders under /home/glenn. This is, to me, undesirable. I probably should have used the -C /somefolder switch but I didn't. All the same, what next?

Read the README file and decided to do ./st. That worked.

Trying it on a live Fedora 19 system now.

mkdir seatools
mv <tar file> seatools
cd seatools
tar -xf <tar file>
./st

sea
3rd July 2013, 03:55 PM
Thank you.
Thats exactly what i ment, i use it automaticly the 'designed' way.

I've added the code to it. (the tar -C option)
I actualy just forgot to add it, as the others do have code segments... :(


EDIT:
As it must do a symlink to /bim;/usr/bin, it requires root rights to do so.
Once the symlink exists, it doesnt require root rights, unless the task does.

sea
7th July 2013, 10:56 PM
Sorry for the delay of the 'hotfix', but we've had a 'state party' this weekend.
Added an installation script to the forum which will use sourceforge and repo bandwith rather then forum bandwith.
--
Changelog:

* Thu Jul 04 2013 - simon @ nc210.ocean - 0.7.8
- Added: st set keyb - Change keyboard layout
- Since manualy added languages for now it supports only:
- ch cz de es it ru us
- Changed: $stDir/Script-Core/collect_scripts
- Trying to provide update function using git
- Like: st update
- Changed: st tweak plymouth, also lets you reset plymouth settings
- and install (all) themes on request
- Unified the menu handling
- Fixed: Path-non-existing error caused by module.cron
- Fixed: Path-non-existing error caused by st net mgr
-

sea
19th July 2013, 06:49 AM
Changelog:

* Fri Jul 19 2013 - simon @ nc210.ocean - 0.7.9
- Added: st tweak ffua -h
- Adds or modifies the line "general.useragent.override" of
- todays used: ~/.mozilla/firefox/[0-9]<~>[a-z]<~>[0-9]/prefs.js
- Added: st tweak grub2 term
- Add Remove or Toggle GRUB_TERMINAL_OUTPUT in /etc/default/grub
- Added: st tweak grub2: uuid, submenu to toggle its values
- Changed: st tweak grub2 timeout
- Added 0 to selection list, so one can disable the timeout.
- Changed: st sa kick
- Added edit function
- Added: st sa hostname
- Shows current hostname and asks to change it, aborts if nonroot
- (thought) Probably the 'best' handling for root (system) related scripts
- Fixed: module.dev.prj.rpm.repo (rpm_toggle_repo, repofiles_status)
- Now checks for .repo extension, adds to $repo if missing
- Fixed: system.status.cli : ReportStatus
- Finaly returns diffrent status'
- Changed: st sa wipe
- * Improved speed by using bytesizes of randomly selected prime-
- numbers between 3 & 67 as megabytes
- * Reduced textual output
- * Suplying the device to wipe reduces interaction; overwrite=1
- Changed: st dev release ; module.dev.prj.ftp
- * ftp
- * repo
- * rpm
-

Notes:
Just installed F19 but your GRUB2 looks weird?

sudo st tweak grub2 term

Want to wipe that device (hd,usb) before reusing or give away?

sudo st sa wipe [sdz]

Want to show off your favorite distro as browser icon shown with your posts?

st tweak ffua
Note: It parses /etc/system-release and uses first string.
For more: st tweak ffua -h

sea
22nd July 2013, 02:53 AM
Fixit release
--
Changelog:

* Sun Jul 21 2013 - simon @ nc210.ocean - 0.7.10
- Changed: sMenu in system.interface.cli
- Now shows selected item
- Changed: newScript [-s]
- Prints only small header (author, created, changed, lisence)
- Fixed: st sa wipe & st iso usb: dd status=$dd_status
- Where $dd_status is "noxfer" for F18/below and "none" for F19+
- This is for less 'unformated' output
- Fixed: st sa wipe
- Using 20 to 200mb 'bytesizes' for DD seemed to be too hughe
- as there was no speed gain, using now primenumbers between
- 2000-4000 as kilobytes.. a bit better but not much...
- Any ideas?
- Fixed: st net dl-fed : Added missing check for "wget"
- Fixed: st net mgr : Should create tempdir properly
- Should now support wired connections :: i dont have wires left
- Fixed: st tweak plymouth
- Should now install everything (on menu selection) but hotdog
- Fixed: st tweak ffua : Temporary fixed "figure out" for last accessed
- $HOME/.mozilla/[randomalphanum].default/
- Fixed: st config
- Moved into a folder as it supports more flexible approaches
- Fixed: SF_Upload_Files in module.dev.prj.sf
- st dev release : trying rsync for repo
- Fixed: st tweak grub2 theme install
-

sea
30th July 2013, 04:04 PM
Added GDM 'support' and improved the configuration menu for script-tools
Kept promise to teraquad, added st set lm gdm rndbg for you :)
--
Changelog:

* Mon Jul 29 2013 - simon @ nc210.ocean - 0.7.11
- Added: BETA: st set lm activ [EXACTLOGINMANAGERNAME]
- (should) Activates selected login manager
- Added: st set lm gdm install
- Install GDM automaticly
- Added: st set lm gdm bg [/PATH/to/PNG]
- Change GDM background
- Added: st set lm gdm rnbdbg [/PATH/to/selectiondir]
- Change GDM background to random images of provided path
- Changed: header in $stDir/Script-Core/Templates
- Changed config file handling
- Changed: st dev release
- Uploading repo uses lftp instead of ftp now.
- Fixed: spec in $stDir/Script-Core
- Removed any local repo 'creation' as it destroys existing one
- Fixed: st net nas LABEL u|m
- Uses now sudo to un/mount, therefor no longer need to start
- the script with sudo
- Fixed: st conf ig
- To be used as first configuration, mainly the user's name
- That username may be diffrent than $USER as it will be reused
- for things like: newScript (author), st dev sf (loginname), etc
-

sea
30th July 2013, 11:38 PM
Finaly it can help you prepare an internet connection to wifi using existing NetworkManager.service (nmcli).
--
Changelog:

* Wed Jul 31 2013 - simon @ nc210.ocean - 0.7.12
- Changed: st dev release & module.dev.prj,sf,ssh
- Adding "Change release version", which will change
- all files listed in $SEA_DEV_DIR/$lbl/conf : prj_change_ver
- PRJ_New will ask you to fill it, providing a default entry in
- case you accidently pressed enter too often.
- Fixed: st net mgr
- Finaly connects to selected wifi spot
-

sea
2nd August 2013, 03:26 AM
Changed repositry host:
Download the new repo (http://sourceforge.net/projects/script-tools/files/script-tools.repo/download):

[script-tools]
name=Script-tools
baseurl=https://sourceforge.net/projects/script-tools/files/repo
enabled=1
gpgcheck=0

sea
2nd August 2013, 05:23 AM
Focused on developers needs
REPO for everyone, now supports F18-F20 if you use the new repo! (http://forums.fedoraforum.org/showpost.php?p=1663196&postcount=10), beeing a noarch tool, it runs on all archs.
--

* Fri Aug 02 2013 - simon @ nc210.ocean - 0.8.0
- Moved: "st dev build|ftp|prj|rpm|sf|ssh" to "st dev prj * "
- Give the commands some unified structure
- Changed: st dev prj
- split up file as a section with commands:
- new, edit, remove
- Changed: st dev prj ssh ; module.dev.ssh
- * split up file ssh as a section with commands:
- - new, edit, con, make
- * Simplified internal variable handling
- * small fixes
- Changed: st dev prj ftp ; module.dev.ftp
- split up file ftp as a section with commands:
- new, edit, upl
- Added: st tweak gnome
- Installs gnome-tweak-tool and gnome-shell-themes-*
- Changed: st dev prj rpm ; module.dev.prj.rpm
- split up file ftp as a section with commands:
- changelog, edit, make, new, spec
- Changed: st dev prj koji ; module.dev.prj.rpm.koji
- Builds and download the packages on and from koji
- split up file ftp as a section with commands:
- edit, make, new
- Fixed: st dev review [ LABEL ]
- Corrected improper argument handling of LABEL
- Works now smoothly with projects
- Fixed: st dev prj repo upl
- Fixed typo of function name
-
--

build ; planed ; Builds/Compiles projects using gcc
rpm ; done ; Creates tarball from folder, then packages to rpm and stores in specified folder
review ; done ; Reviews src.rpms from projects or from within $XDG_DOWNLOAD_DIR with rpmlint and rpm2cpio (review spec & extract tarball)
koji ; done ; Builds up package against koji for specified builds and downloads (http://forums.fedoraforum.org/album.php?albumid=252&pictureid=1750) packages to local folder!
sf ; beta ; Uploads code, (koji) built packages : interaction with branches(beta), commit
repo ; done ; Creates and uploads repositry (on SF for example - automated)

Paralell to that is ssh, which SF uses for example.

Only at the beginning of rpm it asks a few things, like changes in specfile or adding a changelog entry,
but afterwards it runs without the need for attention attention.
Sorry for this excoursion, just finished the koji and finaly automated sourceforge handling and am proud of it :)

Calling it:
st dev release LABEL

Well anyways, my question is, besides the yet undone (because unused by my as of now) 'build',
what else could probably be a good addition to: workorder="build rpm review koji ftp repo sf" ?
As a developer or packager, is there something you would miss?

Thank you

sea
7th August 2013, 01:28 AM
As long the 'st dev' section is not completly done, the "exectue releaseXY"-question will remain.
Once 'done', that question will be removed, but instead asked to edit config files, like currently done with rpm packages, but for all packages.

If you have a package, and add SF to your RPM Project, it lets you use SF as repositry!
However, i highly recomend to use SSH and KOJI in this combination, at least for the lazy ones ;)

'st dev prj ks' will now work smoothly within the rest of the release script.
However, for me the 'large' ones - using livemedia-creator - dont work, maybe you have better luck.
NOTE: For livemedia-creator you currently have to edit ~/.config/script-tools/projects/LABEL/kickstart and modify "bootimage=" to an existing fedora boot image of the release you want to build an iso of.
-
Changelog:

* Wed Aug 07 2013 - simon @ nc210.ocean - 0.8.1
- Changed: st set lm activ
- Shows now current selected display manager
- Moved: st sa kick -> st dev prj ks
- And split into new, edit, make
- Changed: st dev release ; module.dev.prj.ks
- Changing/Adding 'empty' livemedia.ks template for f19
- Changed: st dev prj *
- Automated/simplyfied project creation
- Changed: system.status.cli
- ReportStatus : checking if message is longer than $COLUMNS
- Changed: module.dev.prj
- Automated project creation
- Fixed: st sa cron ; module.sa.cron
- The module accidently created the configuration folder
- which skiped the copy of default config to custom folder.
- Changed: st conf ig
- Improved handling and using custom configuration files now
- Changed: $stDir/Configuration_Variables/* ; collect_scripts
- Reworked and cleaned default configurations
- Moved: st sa kb -> st set kb
- For the moment, use keyb instead.
-

sea
9th August 2013, 05:15 AM
Fixed TUI for nmcli, now connects automaticly to known adresses (if accidently broken)
Hopefully fixed issues caused on first use. (caused by root - creating user configs)
Project handling of sourceforge/git switched, sourceforge is now a submodule of git.

For non-developers and/or non-packagers this is not interesting at all.
Uploaded illustrating and 'explaining' version, instead of empty screen...
st dev release st -> http://youtu.be/CIeDLZgHpBM (with (silent) audio comments - tired)
-
Changelog:

* Fri Aug 09 2013 - simon @ nc210.ocean - 0.8.2
- Changed: st conf ig
- Fixed a user level issue, caused by calling it as root,
- which is required for the scripts in bin, now works two times,
- for root skiping and for user creating the defaults.
- Changed: module.dev.prj.sf.git
- Improved merge & change handling, sort of...
- seems to be working, at least if i'd have some examples...
- Renamed: module.dev.prj.sf.git -> module.dev.prj.git
- Renamed: module.dev.prj.sf -> module.dev.prj.git.sf
- Added: st dev prj git
- GIT_New asks for submodule, currently only SF, in plan: github
- Fixed: st net mgr
- Now selects automaticly already existing (saved) wifi spots.
- Fixed: st dev prj remove [LABEL] ; module.dev.prj
- Added: st set locks
- Toggles num-, caps- and scroll lock from terminal
- Changed: header in $stDir/Script-Core/Templates/ ; system.StringStuff
- Used and updated ConfigGet | ConfigSet in header
- Fixed: collect_scripts:63 in $stDir/Script-Core
- Added: script-tools.repo in $stDir/Script-Core
- It got lost somewhere while building the rpm package
- Fixed: spec in $stDir/Script-Core
- Fixed: script-tools.repo in $stDir/Script-Core
-

sea
13th August 2013, 07:39 PM
Not sure how long this existed, but this "fast release" is mainly because choosing "Back" from the menu didnt go Back.
There was a parsing error which is fixed now.

The repo provides now also a package for el6, however, grub2 and services tweaks probably wont work.
--

* Tue Aug 13 2013 - simon @ nc210.ocean - 0.8.3-beta
- Fixed: Cant go back using back
- system.interface.cli, system.status.cli, collect_scripts
- Changed: spec description
-
* Tue Aug 13 2013 - simon @ nc210.ocean - 0.8.3-beta
- Added: sourceforge.spec - template for sourceforge-rpm
- Changed: spec, added sudo requirement
- Added: module.dev.prj.git.gh
- Attemp to support github
- Changed: module.dev.prj.git.*
- Changed: system.early
- Updated (yet unused) function 'log' to use $SEA_CACHE_DIR
- Changed: system.interface.cli
- 'liner' to use $DIV_H
- Changed: system.CLI-GUI
- changed $TODO appearance for DE
- Changed: p in $stDir/Scripts-in-bin
- Now single pings provided argument, added more adresses
- Fixed: spec & changelog for package review
- Fixed:
-