SampleApplicaton: Change schroot data mapping to desktop

1.Use desktop profie to repalce the default profile.
2.Change the flask images path as a absolute path.
3.Add the ssh config function to enable the ssh.

Tracked-On: #7820
Signed-off-by: Liu Long long.liu@linux.intel.com
This commit is contained in:
Liu Long 2022-08-24 22:57:24 +08:00 committed by acrnsi-robot
parent 0ac5ccd3f1
commit ea596cd08c
3 changed files with 13 additions and 4 deletions

View File

@ -146,7 +146,8 @@ profile=desktop
personality=linux
preserve-environment=true
EOF
sudo sed -i -e '3,9 s/^/#/' /etc/schroot/default/nssdatabases
sudo sed -ie "/passwd/d;/shadow/d;/group/d;/gshadow/d" \
/etc/schroot/desktop/nssdatabases && \
sudo mv ${temp_file} /etc/schroot/chroot.d/acrn-guest && \
sudo chown root:root /etc/schroot/chroot.d/acrn-guest
}

View File

@ -41,7 +41,6 @@ function add_normal_user() {
function enable_services() {
services=(ssh.service isc-dhcp-server)
sudo ssh-keygen -A
for service in ${services[*]}
do
systemctl enable ${service}
@ -49,6 +48,14 @@ function enable_services() {
done
}
function config_ssh() {
sudo sed -ie 's/PasswordAuthentication no/PasswordAuthentication yes/g' \
/etc/ssh/sshd_config
sudo ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key
sudo ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key
}
# Change current working directory to the root to avoid "target is busy" errors
# on unmounting.
cd /
@ -60,3 +67,4 @@ try_step "Installing GNOME desktop" install_desktop
try_step "Changing the password of the root user" change_root_password
try_step "Enable root user login" enable_root_login
try_step "Adding the normal user acrn" add_normal_user
try_step "Configure the ssh service" config_ssh

View File

@ -26,7 +26,7 @@ def histapp():
create_hist()
#Send the histogram as a webpage to the user
return send_file("hist.png", mimetype='image/png')
return send_file("/root/hist.png", mimetype='image/png')
#Creates the user histogram and saves to hist.png
def create_hist():
@ -52,7 +52,7 @@ def create_hist():
plt.title("ACRN Sample Application cyclictest display (unoptimized)")
plt.xlabel("Latency Value (microseconds)")
plt.ylabel("Count Percentage " + f"{count:,}")
plt.savefig("hist.png")
plt.savefig("/root/hist.png")
return figure