Skip to content

Commit 42b8a2d

Browse files
committed
add reset & remove functions
1 parent 88d3127 commit 42b8a2d

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

scripts/udroid/udroid.sh

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,12 @@ _login() {
2626

2727
if is_installed $suite; then
2828
l_cache "$suite"
29+
30+
pulseaudio \
31+
--start \
32+
--load="module-native-protocol-tcp auth-ip-acl=127.0.0.1 auth-anonymous=1" \
33+
--exit-idle-time=-1 >> /dev/null
34+
2935
proot-distro login udroid \
3036
--bind /dev/null:/proc/sys/kernel/cap_last_cap \
3137
--shared-tmp \
@@ -67,6 +73,37 @@ _install() {
6773
shout "starting proot-distro"
6874
proot-distro install $final_suite
6975
}
76+
_reset() {
77+
case $1 in
78+
mate) SUITE="mate";;
79+
xfce|xfce4) SUITE="xfce4" ;;
80+
kde) SUITE="kde";;
81+
esac
82+
83+
suite="udroid-impish-$SUITE"
84+
85+
if is_installed "$suite"; then
86+
proot-distro reset $suite
87+
else
88+
lwarn "$SUITE is not installed."
89+
fi
90+
}
91+
92+
_remove() {
93+
case $1 in
94+
mate) SUITE="mate";;
95+
xfce|xfce4) SUITE="xfce4" ;;
96+
kde) SUITE="kde";;
97+
esac
98+
99+
suite="udroid-impish-$SUITE"
100+
101+
if is_installed "$suite"; then
102+
proot-distro remove $suite
103+
else
104+
lwarn "$SUITE is not installed."
105+
fi
106+
}
70107

71108
is_installed() {
72109
target_suite=$1
@@ -100,6 +137,8 @@ if [ $# -ge 0 ]; then
100137
case $1 in
101138
-l) shift; _login $* ;;
102139
-i|--install) shift;_install $1 ;;
140+
-re|--reset) shift ; _reset $1 ;;
141+
-r|--remove) shift ; _remove $1 ;;
103142
*) l_login $*;;
104143
esac
105144
fi

0 commit comments

Comments
 (0)