Skip to content

Commit 4cf00bd

Browse files
write login function [TEMP]
1 parent d070836 commit 4cf00bd

File tree

1 file changed

+36
-1
lines changed

1 file changed

+36
-1
lines changed

udroid/src/udroid.sh

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,42 @@ install() {
199199
}
200200

201201
login() {
202-
:
202+
203+
path=$DEFAULT_FS_INSTALL_DIR
204+
205+
while [[ $# -gt 0 ]]; do
206+
case $1 in
207+
-p | --path)
208+
209+
# Custom paths are set either to point a new directory instead of default
210+
# this is not-recommended cause managing installed filesystems becomes harder when they are outside of DEFAULT directories
211+
# operations like: remove, reset or analyzing filesystems
212+
# using custom path results in abonded installation -> script only cares when its path is supplied again
213+
#
214+
# possible solution is to cache the loaction every time a path is supplied and use that for operations
215+
local path=$2; shift 2
216+
LOG "(login) custom installation path set to $path"
217+
;;
218+
-*)
219+
echo "Unknown option: $1"
220+
exit 1
221+
;;
222+
*) distro=$1; shift; break ;;
223+
esac
224+
done
225+
226+
[[ -z $distro ]] && echo "ERROR: distro not specified" && exit 1
227+
228+
if [ -d $path/$distro ]; then
229+
LOG "login to $distro"
230+
p_login --path $path/$distro
231+
else
232+
ELOG "ERROR: $distro not found"
233+
echo "ERROR: $distro not found"
234+
# echo "use 'install' to install it"
235+
exit 1
236+
fi
237+
203238
}
204239

205240
list() {

0 commit comments

Comments
 (0)