Skip to content

Commit

Permalink
Rewrite in more structured Bash (#1)
Browse files Browse the repository at this point in the history
* Add .gitignore

* Update readme.md

* Begin rewrite

* Fix enablement control ops

* Change permissions on logfile
allows rwfus --status to log even when run as deck user

* I've taken entire classes about linux security
*Why* did I think $EUID would work for that? Jeez Louise.

* Systemd, please stop my units

* Remove description in overlay mounts

* Actually create work dirs (oops!)

* Disable systemd log in stat_units
if you want specific details, use `systemctl status <unit>`

* Colors and newlines

* Check for permissions
The actions will fail anyway without perms, but it's good to check

* Exit if arg parse failed

* Fix exit on invalid opt

* Allow executing as nonroot in TESTMODE

* Summarize systemctl status output with the power of grep

* Lazy-unmount the mountpoints
This allows /usr/ to actually be unmounted

* Stat units after enable/disable to prove status change

* Remove memes for release, mark helptext

* Turn off stat by default
unless an enablement control operation occurs

* Stat after install, for the fun of it
Don't log the stat, because it'll put a ton of terminal escapes in the logfile

* Move testmode text to version string line.
  • Loading branch information
ValShaped authored Jul 22, 2022
1 parent e39bd02 commit 23e750c
Show file tree
Hide file tree
Showing 8 changed files with 812 additions and 164 deletions.
262 changes: 262 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,262 @@
# ---> VisualStudioCode
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
*.code-workspace

# Local History for Visual Studio Code
.history/

# ---> Input files
*input*.txt

# ---> Log files
*.log

# ---> C
# Prerequisites
*.d
dep/

# Object files
*.o
*.ko
*.obj
*.elf
obj/

# Linker output
*.ilk
*.map
*.exp

# Precompiled Headers
*.gch
*.pch

# Libraries
*.lib
*.a
*.la
*.lo

# Shared objects (inc. Windows DLLs)
*.dll
*.so
*.so.*
*.dylib

# Executables
*.exe
*.out
*.app
*.i*86
*.x86_64
*.hex

# Debug files
*.dSYM/
*.su
*.idb
*.pdb

# Kernel Module Compile Results
*.mod*
*.cmd
.tmp_versions/
modules.order
Module.symvers
Mkfile.old
dkms.conf

# ---> C++
# Prerequisites
*.d

# Compiled Object files
*.slo
*.lo
*.o
*.obj

# Precompiled Headers
*.gch
*.pch

# Compiled Dynamic libraries
*.so
*.dylib
*.dll

# Fortran module files
*.mod
*.smod

# Compiled Static libraries
*.lai
*.la
*.a
*.lib

# Executables
*.exe
*.out
*.app

# ---> Python
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

# ---> Rust
# Generated by Cargo
# will have compiled files and executables
debug/
target/

# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
Cargo.lock

# These are backup files generated by rustfmt
**/*.rs.bk

# MSVC Windows builds of rustc generate these, which store debugging information
*.pdb
29 changes: 29 additions & 0 deletions include/lolg.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@

: ${Logfile:=default.log}

function Test {
${TESTMODE+echo test: } $@
}

function check_permissions {
[ "$EUID" -eq 0 ] || [[ $TESTMODE ]] || {
Log -p echo "This command must be performed as $(id -un -- 0)"
exit -2
}
}

function Log {
case "$1" in
--new)
truncate -s 0 -- "$Logfile"
return 0
;;
-p)
shift
$@ | tee -a $Logfile 2>&1
;;
*)
$@ >> $Logfile 2>&1
;;
esac
}
Loading

0 comments on commit 23e750c

Please sign in to comment.