code/install
This commit is contained in:
parent
60ccba2fd5
commit
e57b963f25
2 changed files with 37 additions and 37 deletions
37
sh/code.sh
37
sh/code.sh
|
@ -19,6 +19,43 @@ _rwx_code_functions=""
|
||||||
# cache for code variables
|
# cache for code variables
|
||||||
_rwx_code_variables=""
|
_rwx_code_variables=""
|
||||||
|
|
||||||
|
# ╭──────┬─────────╮
|
||||||
|
# │ code │ install │
|
||||||
|
# ╰──────┴─────────╯
|
||||||
|
|
||||||
|
#= rwx_install
|
||||||
|
rwx_code_install() {
|
||||||
|
local target="${1}"
|
||||||
|
local command file name root
|
||||||
|
# code
|
||||||
|
if [ -n "${target}" ]; then
|
||||||
|
root="${target}${RWX_ROOT_SYSTEM}"
|
||||||
|
rwx_remove "${root}"
|
||||||
|
cp --recursive "${RWX_ROOT_SYSTEM}" "${root}"
|
||||||
|
fi
|
||||||
|
# commands
|
||||||
|
root="${target}/usr/local/bin"
|
||||||
|
name="${RWX_SELF_NAME}.sh"
|
||||||
|
file="${root}/${name}"
|
||||||
|
rwx_remove "${file}"
|
||||||
|
rwx_link "${file}" "${RWX_MAIN_PATH}"
|
||||||
|
for command in $(rwx_self_commands); do
|
||||||
|
file="${root}/${command}"
|
||||||
|
rwx_remove "${file}"
|
||||||
|
rwx_link "${file}" "${name}"
|
||||||
|
done
|
||||||
|
# sh
|
||||||
|
file="${target}/etc/profile.d/${RWX_SELF_NAME}.sh"
|
||||||
|
rwx_remove "${file}"
|
||||||
|
rwx_file_write "${file}" "\
|
||||||
|
export ENV=\"${RWX_MAIN_PATH}\"
|
||||||
|
"
|
||||||
|
# bash
|
||||||
|
file="${target}/etc/bash.bashrc"
|
||||||
|
rwx_remove "${file}"
|
||||||
|
rwx_link "${file}" "${RWX_MAIN_PATH}"
|
||||||
|
}
|
||||||
|
|
||||||
# ╭──────┬───────╮
|
# ╭──────┬───────╮
|
||||||
# │ code │ parts │
|
# │ code │ parts │
|
||||||
# ╰──────┴───────╯
|
# ╰──────┴───────╯
|
||||||
|
|
37
sh/self.sh
37
sh/self.sh
|
@ -27,43 +27,6 @@ rwx_self_init() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# ╭──────┬─────────╮
|
|
||||||
# │ self │ install │
|
|
||||||
# ╰──────┴─────────╯
|
|
||||||
|
|
||||||
#= rwx_install
|
|
||||||
rwx_code_install() {
|
|
||||||
local target="${1}"
|
|
||||||
local command file name root
|
|
||||||
# code
|
|
||||||
if [ -n "${target}" ]; then
|
|
||||||
root="${target}${RWX_ROOT_SYSTEM}"
|
|
||||||
rwx_remove "${root}"
|
|
||||||
cp --recursive "${RWX_ROOT_SYSTEM}" "${root}"
|
|
||||||
fi
|
|
||||||
# commands
|
|
||||||
root="${target}/usr/local/bin"
|
|
||||||
name="${RWX_SELF_NAME}.sh"
|
|
||||||
file="${root}/${name}"
|
|
||||||
rwx_remove "${file}"
|
|
||||||
rwx_link "${file}" "${RWX_MAIN_PATH}"
|
|
||||||
for command in $(rwx_self_commands); do
|
|
||||||
file="${root}/${command}"
|
|
||||||
rwx_remove "${file}"
|
|
||||||
rwx_link "${file}" "${name}"
|
|
||||||
done
|
|
||||||
# sh
|
|
||||||
file="${target}/etc/profile.d/${RWX_SELF_NAME}.sh"
|
|
||||||
rwx_remove "${file}"
|
|
||||||
rwx_file_write "${file}" "\
|
|
||||||
export ENV=\"${RWX_MAIN_PATH}\"
|
|
||||||
"
|
|
||||||
# bash
|
|
||||||
file="${target}/etc/bash.bashrc"
|
|
||||||
rwx_remove "${file}"
|
|
||||||
rwx_link "${file}" "${RWX_MAIN_PATH}"
|
|
||||||
}
|
|
||||||
|
|
||||||
# ╭──────┬────────╮
|
# ╭──────┬────────╮
|
||||||
# │ self │ subset │
|
# │ self │ subset │
|
||||||
# ╰──────┴────────╯
|
# ╰──────┴────────╯
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue