self/subset,write
This commit is contained in:
parent
ce872d4ecb
commit
7dbf581191
1 changed files with 31 additions and 0 deletions
31
sh/self.sh
31
sh/self.sh
|
@ -45,3 +45,34 @@ rwx_self_install() {
|
||||||
rwx_remove "${file}"
|
rwx_remove "${file}"
|
||||||
rwx_link "${file}" "${RWX_MAIN_PATH}"
|
rwx_link "${file}" "${RWX_MAIN_PATH}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rwx_self_subset() {
|
||||||
|
local argument path
|
||||||
|
for argument in "${@}"; do
|
||||||
|
path="${RWX_ROOT_SYSTEM}/${argument}"
|
||||||
|
if [ -d "${path}" ]; then
|
||||||
|
rwx_find_shell "${path}"
|
||||||
|
elif [ -f "${path}" ]; then
|
||||||
|
echo "${argument}"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
rwx_self_write() {
|
||||||
|
local target="${1}"
|
||||||
|
if [ -n "${target}" ]; then
|
||||||
|
shift
|
||||||
|
local file text
|
||||||
|
text="#! /usr/bin/env sh
|
||||||
|
"
|
||||||
|
rwx_ifs_set
|
||||||
|
for file in $(rwx_self_subset "${@}"); do
|
||||||
|
text="${text}
|
||||||
|
# ${file}
|
||||||
|
|
||||||
|
$(cat "${RWX_ROOT_SYSTEM}/${file}")"
|
||||||
|
done
|
||||||
|
rwx_ifs_unset
|
||||||
|
rwx_file_write "${target}" "${text}"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue