diff --git a/applications/luci-app-ubuntu/Makefile b/applications/luci-app-ubuntu/Makefile index 1c066cc..6c3ee70 100644 --- a/applications/luci-app-ubuntu/Makefile +++ b/applications/luci-app-ubuntu/Makefile @@ -2,8 +2,8 @@ include $(TOPDIR)/rules.mk -PKG_VERSION:=1.0.1 -PKG_RELEASE:=2021224 +PKG_VERSION:=1.0.2 +PKG_RELEASE:=20220214 LUCI_TITLE:=LuCI support for ubuntu LUCI_PKGARCH:=all diff --git a/applications/luci-app-ubuntu/luasrc/controller/ubuntu.lua b/applications/luci-app-ubuntu/luasrc/controller/ubuntu.lua index a160969..845b22e 100755 --- a/applications/luci-app-ubuntu/luasrc/controller/ubuntu.lua +++ b/applications/luci-app-ubuntu/luasrc/controller/ubuntu.lua @@ -65,10 +65,12 @@ function install_container() local docker_on_disk = tonumber(util.exec("sh /usr/share/ubuntu/install.sh -c")) local password = luci.http.formvalue("password") local port = luci.http.formvalue("port") + local version = luci.http.formvalue("version") uci:tset(keyword, "@"..keyword.."[0]", { password = password or "password", port = port or "6901", + version = version or "stanard", }) uci:save(keyword) uci:commit(keyword) diff --git a/applications/luci-app-ubuntu/luasrc/view/ubuntu/ubuntu.htm b/applications/luci-app-ubuntu/luasrc/view/ubuntu/ubuntu.htm index 30315df..b4a30c5 100755 --- a/applications/luci-app-ubuntu/luasrc/view/ubuntu/ubuntu.htm +++ b/applications/luci-app-ubuntu/luasrc/view/ubuntu/ubuntu.htm @@ -30,6 +30,8 @@ tb.innerHTML += ("<div class=\"cbi-value\"><label class=\"cbi-value-title\" for=\"" + c.id + "\">" + c.label + "</label>" + "<div class=\"cbi-value-field\"><input type=\"text\" class=\"cbi-input-text\" id=\"" + c.id + "\" value=\"" + c.value + "\"/></div></div>"); }); + tb.innerHTML += ("<div class=\"cbi-value\"><label class=\"cbi-value-title\" for=\" version \"><%:Version%></label>" + + "<div class=\"cbi-value-form\"><form><select id=\"version\"><option value=\"standard\"><%:standard version%></option><option value=\"full\"><%:full version%></option></select></form></div></div>"); tb.innerHTML += ("<div class=\"cbi-value\"><label class=\"cbi-value-title\"></label>" + "<div class=\"cbi-value-field\"><input class=\"btn cbi-button cbi-button-apply\" type=\"button\" value=\" <%:install ubuntu%> \" onclick=\"install_container()\" /></div></div><br>"); } @@ -93,10 +95,10 @@ let password = document.getElementById('password').value let port = document.getElementById('port').value + let version = document.getElementById('version').value + // alert(" 安装容器'" + version + "' "); - - xhr_post(INSTALL_URL, {password: password, port: port}, (x, d) => { - // alert(" 删除容器'" + d.image_name + "' "); + xhr_post(INSTALL_URL, {password: password, port: port, version: version}, (x, d) => { location.reload() }); uci_confirm_docker(); diff --git a/applications/luci-app-ubuntu/po/zh-cn/ubuntu.po b/applications/luci-app-ubuntu/po/zh-cn/ubuntu.po index 6bfb107..5bde92f 100644 --- a/applications/luci-app-ubuntu/po/zh-cn/ubuntu.po +++ b/applications/luci-app-ubuntu/po/zh-cn/ubuntu.po @@ -33,3 +33,18 @@ msgstr "存储路径(建议插入U盘或硬盘,然后输入路径。例如 msgid "Storage path could not be empty!" msgstr "存储路径不能为空!" + +msgid "Version" +msgstr "系统版本" + +msgid "Port (optional)" +msgstr "端口" + +msgid "Password (optional)" +msgstr "密码" + +msgid "standard version" +msgstr "标准版本" + +msgid "full version" +msgstr "全量版本" \ No newline at end of file diff --git a/applications/luci-app-ubuntu/root/etc/config/ubuntu b/applications/luci-app-ubuntu/root/etc/config/ubuntu index 63eed92..35f15aa 100644 --- a/applications/luci-app-ubuntu/root/etc/config/ubuntu +++ b/applications/luci-app-ubuntu/root/etc/config/ubuntu @@ -2,3 +2,4 @@ config ubuntu option 'image' 'linkease/desktop-ubuntu-arm64:develop' option 'password' 'password' option 'port' '6901' + option 'version' 'standard' diff --git a/applications/luci-app-ubuntu/root/usr/share/ubuntu/install.sh b/applications/luci-app-ubuntu/root/usr/share/ubuntu/install.sh index 240d692..56ff193 100755 --- a/applications/luci-app-ubuntu/root/usr/share/ubuntu/install.sh +++ b/applications/luci-app-ubuntu/root/usr/share/ubuntu/install.sh @@ -1,7 +1,6 @@ #!/bin/sh image_name=`uci get ubuntu.@ubuntu[0].image 2>/dev/null` - # TODO auto detech platform # TODO option for full and standard # linkease/desktop-ubuntu-full-arm64:latest @@ -9,7 +8,7 @@ image_name=`uci get ubuntu.@ubuntu[0].image 2>/dev/null` # linkease/desktop-ubuntu-full-amd64:latest # linkease/desktop-ubuntu-standard-amd64:latest -[ -z "$image_name" ] && image_name="linkease/desktop-ubuntu-full-arm64:latest" +[ -z "$image_name" ] && image_name="linkease/desktop-ubuntu-standard-arm64:latest" DOCKERPATH=`uci get dockerman.local.daemon_data_root` result=`findmnt -T $DOCKERPATH | grep -c /dev/sd` @@ -17,23 +16,32 @@ result=`findmnt -T $DOCKERPATH | grep -c /dev/sd` install(){ local password=`uci get ubuntu.@ubuntu[0].password 2>/dev/null` local port=`uci get ubuntu.@ubuntu[0].port 2>/dev/null` + local version=`uci get ubuntu.@ubuntu[0].version 2>/dev/null` [ -z "$password" ] && password="password" [ -z "$port" ] && port=6901 + if [ "${version}" == "full"];then + image_name="linkease/desktop-ubuntu-full-arm64:latest" + fi + + if [ "${version}" == "standard"];then + image_name="linkease/desktop-ubuntu-standard-arm64:latest" + fi + docker network ls -f "name=docker-pcnet" | grep -q docker-pcnet || \ - docker network create -d bridge --subnet=10.10.100.0/24 --ip-range=10.10.100.0/24 --gateway=10.10.100.1 docker-pcnet - - docker run -d --name ubuntu \ - --dns=223.5.5.5 -u=0:0 \ - -v=/mnt:/mnt:rslave \ - --net="docker-pcnet" \ - --ip=10.10.100.9 \ - --shm-size=512m \ - -p $port:6901 \ - -e VNC_PW=$password \ - -e VNC_USE_HTTP=0 \ - --restart unless-stopped \ - $image_name + docker network create -d bridge --subnet=10.10.100.0/24 --ip-range=10.10.100.0/24 --gateway=10.10.100.1 docker-pcnet + + docker run -d --name ubuntu \ + --dns=223.5.5.5 -u=0:0 \ + -v=/mnt:/mnt:rslave \ + --net="docker-pcnet" \ + --ip=10.10.100.9 \ + --shm-size=512m \ + -p $port:6901 \ + -e VNC_PW=$password \ + -e VNC_USE_HTTP=0 \ + --restart unless-stopped \ + $image_name }