{"id":1073,"date":"2020-01-03T13:12:31","date_gmt":"2020-01-03T22:12:31","guid":{"rendered":"\/blog\/?p=1073"},"modified":"2023-09-21T09:26:43","modified_gmt":"2023-09-21T00:26:43","slug":"armbian-os-%ec%b5%9c%ec%a0%81%ed%99%94-%ec%8a%a4%ed%81%ac%eb%a6%bd%ed%8a%b8","status":"publish","type":"post","link":"https:\/\/hasu0707.duckdns.org\/blog\/?p=1073","title":{"rendered":"Armbian OS \ucd5c\uc801\ud654 \uc2a4\ud06c\ub9bd\ud2b8"},"content":{"rendered":"\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\" data-enlighter-theme=\"droide\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">#!\/bin\/bash\n###########################################################\n#\n# Armbian \ucd5c\uc801\ud654 \uc2a4\ud06c\ub9bd\ud2b8 - https:\/\/www.armbian.com\/\n# Release 2023.05.01.\n#\n# \uc774 \uc2a4\ud06c\ub9bd\ud2b8\ub294 \ubc18\ub4dc\uc2dc \uc778\ud130\ub137\uc774 \uac00\ub2a5\ud55c \uc0c1\ud0dc\uc5d0\uc11c\n# root\/1234 \uacc4\uc815\uc73c\ub85c SSH \ub85c\uadf8\uc778\ud558\uc5ec \uc2e4\ud589\ud574\uc57c \ud55c\ub2e4.\n#\n###########################################################\nCURRENT_DIR=$(pwd)\nTIMESTAMP=$(date \"+%Y%m%d_%H%M%S\")\nAPTCMD=\"apt\"\n\n# Let's encrypt\nLETSENCRYPT_DOMAIN=\"hasu0707.duckdns.org\"\n\n# https:\/\/download.pydio.com\/pub\/core\/archives\/\nPYDIO_VERSION=\"8.2.5\"\nPYDIO_DB_PW=\"pydio\"\n\n# http:\/\/extplorer.net\/projects\/extplorer\/files\nEXTPLORER_VERSION=\"2.1.15\"\n\n# \uc124\uce58 \uc2a4\uc704\uce58\nNEW_USER=\"armbian\"\nNEW_GROUP=\"${NEW_USER}\"\nNEW_USER_HOME=\"\/home\/${NEW_USER}\"\nSTORAGE_MOUNT_DIR=\"\/mnt\/usbdisk\"\nAUTOFS_DIR=\"\/mnt\/usbdisk\"\nWWW_DIR=\"\/var\/www\"\nSET_NETWORK_CONFIG=1\nUSE_APACHE2=1\nUSE_WEBDAV=1\nUSE_MARIADB=1\nUSE_PHP=1\nUSE_PYDIO=0\nUSE_EXTPLORER=0\nUSE_SAMBA=1\nUSE_TRANSMISSION=0\nUSE_XWINDOW=1\nUSE_VSFTPD=1\nUSE_NFS_SERVER=1\nUSE_XRDP=1\nUSE_VNC_SERVER=0\nUSE_BT_AUDIO=0\nUSE_PLEXMEDIASERVER=0\nUSE_LETSENCRYPT=0\nUSE_DOCKER=1\nUSE_BITWARDEN=0\n# LXDE or XFCE or GNOME\nDESKTOP_ENVIRONMENT=\"LXDE\"\nHANGUL_IME=\"ibus\"\nDOCKER_ARCH=\"armhf\"\nHTTP_PORT=80\nWEBDAV_PORT=5005\nWIFI_ENABLE=1\n\nsetup_opizero() {\n  echo \"###########################################################\"\n  echo \"#\"\n  echo \"# Orange PI Zero LTS\"\n  echo \"#\"\n  echo \"###########################################################\"\n\n  BOARD_NAME=\"Orange Pi Zero\"\n  BOARD_NAME_SHORT=\"opizero\"\n  USE_BT_AUDIO=1\n\n  ETH0_IP=10.10.10.106\n  ETH0_NM=255.255.255.0\n  GATEWAY=10.10.10.254\n  WIFI_SSID=\"eSecuVali\"\n  WIFI_PW=\"20271095\"\n\n  #ETH0_IP=192.168.1.22\n  #ETH0_NM=255.255.255.0\n  #GATEWAY=192.168.1.1\n  #WIFI_SSID=\"IEEE_802.11_BGN\"\n  #WIFI_PW=\"01086023358\"\n\n  MY_SITE=${BOARD_NAME_SHORT}\n  DNS_SERVER1=\"8.8.8.8\"\n  DNS_SERVER2=\"8.8.4.4\"\n}\n\nsetup_opizero2() {\n  echo \"###########################################################\"\n  echo \"#\"\n  echo \"# Orange PI Zero2\"\n  echo \"#\"\n  echo \"###########################################################\"\n\n  DOCKER_ARCH=\"arm64\"\n\n  BOARD_NAME=\"Orange Pi Zero2\"\n  BOARD_NAME_SHORT=\"opizero2\"\n\n  USE_XRDP=0\n  USE_VNC_SERVER=1\n\n  ETH0_IP=10.10.10.108\n  ETH0_NM=255.255.255.0\n  GATEWAY=10.10.10.254\n  WIFI_SSID=\"eSecuVali_5G\"\n  WIFI_PW=\"20271095\"\n\n  #ETH0_IP=192.168.1.20\n  #ETH0_NM=255.255.255.0\n  #GATEWAY=192.168.1.1\n  #WIFI_SSID=\"IEEE_802.11_NAC\"\n  #WIFI_PW=\"01086023358\"\n\n  MY_SITE=${BOARD_NAME_SHORT}\n  DNS_SERVER1=\"8.8.8.8\"\n  DNS_SERVER2=\"8.8.4.4\"\n\n  # \uc774 \ud328\ud0a4\uc9c0\ub97c \uc5c5\ub370\uc774\ud2b8\ud558\uba74 \ubd80\ud305 \ubd88\uac00\ud558\uc5ec \uc5c5\ub370\uc774\ud2b8\uc5d0\uc11c \uc81c\uc678\ud55c\ub2e4.\n  apt-mark hold armbian-bsp-cli-orangepizero2\n}\n\nsetup_odroidhc2() {\n  echo \"###########################################################\"\n  echo \"#\"\n  echo \"# Odroid HC2 \uc124\uce58 \uc900\ube44\"\n  echo \"#\"\n  echo \"###########################################################\"\n\n  STORAGE_MOUNT_DIR=\"\/mnt\/sata\"\n  USE_LETSENCRYPT=1\n  USE_BITWARDEN=1\n  BOARD_NAME=\"ODROID HC2\"\n  BOARD_NAME_SHORT=\"odroid_hc2\"\n  WIFI_ENABLE=0\n  ETH0_IP=192.168.1.10\n  ETH0_NM=255.255.255.0\n  GATEWAY=192.168.1.1\n  WIFI_SSID=\"IEEE_802.11_BGN\"\n  WIFI_PW=\"01086023358\"\n  MY_SITE=${BOARD_NAME_SHORT}\n  DNS_SERVER1=\"8.8.8.8\"\n  DNS_SERVER2=\"8.8.4.4\"\n}\n\ncheck_board_name() {\n  echo \"###########################################################\"\n  echo \"#\"\n  echo \"# \uc5b4\ub5a4 \ubcf4\ub4dc\uc778\uc9c0 \uccb4\ud06c\ud55c\ub2e4.\"\n  echo \"#\"\n  echo \"###########################################################\"\n\n  RELEASE_FILE=\"\/etc\/armbian-release\"\n\n  grep \"Orange Pi Zero2\" ${RELEASE_FILE} > \/dev\/null\n  if [ $? -eq 0 ]\n  then\n    echo \"This board is Orange Pi Zero 2\"\n    setup_opizero2\n    return\n  fi\n\n  grep \"Orange Pi Zero\" ${RELEASE_FILE} > \/dev\/null\n  if [ $? -eq 0 ]\n  then\n    echo \"This board is Orange Pi Zero LTS\"\n    setup_opizero\n    return\n  fi\n\n  grep \"Odroid XU4\" ${RELEASE_FILE} > \/dev\/null\n  if [ $? -eq 0 ]\n  then\n    echo \"This board is ODROID HC2\"\n    setup_odroidhc2\n    return\n  else\n    echo \"ERROR: Unknown board.\"\n    exit 1\n  fi\n}\n\nget_system_ip_addr() {\n  echo \"###########################################################\"\n  echo \"# \uc2dc\uc2a4\ud15c IP\uc8fc\uc18c \uc54c\uc544\ub0b4\uae30\"\n  echo \"###########################################################\"\n  SYSTEM_IP_ADDR=$(hostname -I | awk '{print $1}')\n  if [ -z ${SYSTEM_IP_ADDR} ]\n  then\n    echo \"ERROR: Unknown IP Address.\"\n    exit\n  fi\n  echo \"ip addr: ${SYSTEM_IP_ADDR}\"\n}\n\nget_system_if_name() {\n  echo \"###########################################################\"\n  echo \"# \uc2dc\uc2a4\ud15c \uc778\ud130\ud398\uc774\uc2a4\uba85 \uc54c\uc544\ub0b4\uae30\"\n  echo \"###########################################################\"\n  SYSTEM_IF_NAME=$(ls -1 \/sys\/class\/net\/ | awk '{ if ( $1 != \"lo\" &amp;&amp; $1 != \"docker0\") print $1 }' | head -n 1)\n  if [ -z ${SYSTEM_IF_NAME} ]\n  then\n    echo \"ERROR: Unknown interface name.\"\n    exit\n  fi\n  echo \"if name: ${SYSTEM_IF_NAME}\"\n}\n\ndeb_clean() {\n  echo \"###########################################################\"\n  echo \"#\"\n  echo \"# apt\uc758 \ubd88\ud544\uc694\ud55c \ud328\ud0a4\uc9c0 \uc815\ub9ac \ubc0f \ub514\uc2a4\ud06c \uacf5\uac04 \ud655\ubcf4\"\n  echo \"#\"\n  echo \"###########################################################\"\n\n  sync\n  ${APTCMD} -y clean\n  ${APTCMD} -y -f autoremove --purge\n  ${APTCMD} -y autoclean\n  sync\n}\n\ndpkg_init() {\n  echo \"###########################################################\"\n  echo \"#\"\n  echo \"# dpkg \ud328\ud0a4\uc9c0 \uad00\ub9ac\uc790 \ucd08\uae30\ud654\"\n  echo \"#\"\n  echo \"###########################################################\"\n\n  cd ${CURRENT_DIR}\n  rm -f \/var\/lib\/dpkg\/lock\n  dpkg --configure -a\n}\n\nset_ubuntu_repo() {\n  echo \"###########################################################\"\n  echo \"#\"\n  echo \"# Ubuntu \ub808\ud3ec\uc9c0\ud130\ub9ac \ubcc0\uacbd\"\n  echo \"#\"\n  echo \"###########################################################\"\n\n  cd ${CURRENT_DIR}\n  cp -f \/etc\/apt\/sources.list \/etc\/apt\/sources.list.${TIMESTAMP}\n  sed -i \"s\/http:\\\/\\\/mirrors.tuna.tsinghua.edu.cn\\\/ubuntu-ports\/http:\\\/\\\/ports.ubuntu.com\/g\" \/etc\/apt\/sources.list\n}\n\nset_locale() {\n  echo \"###########################################################\"\n  echo \"#\"\n  echo \"# \ub85c\ucf00\uc77c \uc124\uc815\"\n  echo \"#\"\n  echo \"###########################################################\"\n\n  cd ${CURRENT_DIR}\n  localedef -v -c -i ko_KR -f UTF-8 ko_KR.UTF-8\n  locale-gen \"ko_KR.UTF-8\"\n  update-locale LC_ALL=\"ko_KR.UTF-8\" LANG=\"ko_KR.UTF-8\" LANGUAGE=\"ko_KR:ko:en_US:en\" LC_MESSAGES=\"POSIX\"\n  sed -i \"s\/# set convert-meta off\/set convert-meta off\/g\" \/etc\/inputrc\n}\n\ninit_sdcard() {\n  echo \"###########################################################\"\n  echo \"#\"\n  echo \"# sdcard \ucd08\uae30\ud654\"\n  echo \"# \/dev\/mmcblk0 : sdcard\"\n  echo \"# dd if=\/dev\/zero of=\/dev\/mmcblk1 bs=512 count=1\"\n  echo \"#\"\n  echo \"###########################################################\"\n\n  dd if=\/dev\/zero of=\/dev\/mmcblk0 bs=4096 count=1\n}\n\nset_timezone() {\n  echo \"###########################################################\"\n  echo \"#\"\n  echo \"# \ud0c0\uc784\uc874 \uc14b\ud305\"\n  echo \"#\"\n  echo \"###########################################################\"\n\n  cd ${CURRENT_DIR}\n  echo \"Asia\/Seoul\" > \/etc\/timezone\n}\n\nset_default_user_account() {\n  echo \"###########################################################\"\n  echo \"#\"\n  echo \"# \uc0ac\uc6a9\uc790 \ub514\ub809\ud1a0\ub9ac \ubcc0\uacbd \ubc0f \/home\/${NEW_USER} \uc0ad\uc81c\"\n  echo \"#\"\n  echo \"###########################################################\"\n\n  cd ${CURRENT_DIR}\n  if [[ ${NEW_USER_HOME} != \"\/home\/${NEW_USER}\" ]]\n  then\n    mkdir -p ${NEW_USER_HOME}\n    usermod -d ${NEW_USER_HOME} ${NEW_USER}\n    cp -f \/home\/${NEW_USER}\/.bash_logout ${NEW_USER_HOME}\n    cp -f \/home\/${NEW_USER}\/.bashrc ${NEW_USER_HOME}\n    cp -f \/home\/${NEW_USER}\/.profile ${NEW_USER_HOME}\n    chown -R ${NEW_USER}:${NEW_GROUP} ${NEW_USER_HOME}\n    rm -rf \/home\/${NEW_USER}\n  fi\n}\n\ncopy_skel_profile() {\n  echo \"###########################################################\"\n  echo \"#\"\n  echo \"# root \ud504\ub85c\ud30c\uc77c \ubcf5\uc0ac (\uc77c\ubd80 \uc5c6\ub294 \uacbd\uc6b0\ub9cc \ud574\ub2f9)\"\n  echo \"#\"\n  echo \"###########################################################\"\n\n  cp -fv \/etc\/skel\/.profile \/root\/\n}\n\nset_network() {\n  if [ ${SET_NETWORK_CONFIG} = 1 ]\n  then\n    echo \"###########################################################\"\n    echo \"#\"\n    echo \"# \ub124\ud2b8\uc6cc\ud06c \uc14b\ud305 (IP\uc8fc\uc18c \uc218\uc815 \ud6c4 \uc2e4\ud589)\"\n    echo \"#\"\n    echo \"# Wifi\uc640 Ethernet\uc740 \ud55c\uac00\uc9c0\ub9cc \uc0ac\uc6a9\uac00\ub2a5\ud558\uba70,\"\n    echo \"# \ub9cc\uc77c Wifi\ub97c \uc0ac\uc6a9\ud558\uae30 \uc704\ud574\uc11c\ub294 \\\"auto eth0\\\"\ub97c \uc0ad\uc81c\ud55c\ub2e4.\"\n    echo \"#\"\n    echo \"###########################################################\"\n\n    echo \"# Ethernet\" > \/etc\/network\/interfaces.d\/eth0\n    echo \"auto eth0\" >> \/etc\/network\/interfaces.d\/eth0\n    echo \"allow-hotplug eth0\" >> \/etc\/network\/interfaces.d\/eth0\n    echo \"no-auto-down eth0\" >> \/etc\/network\/interfaces.d\/eth0\n    echo \"# Wifi\ub97c \uc8fc \ub124\ud2b8\uc6cc\ud06c\ub85c \uc0ac\uc6a9\ud560 \uacbd\uc6b0 eth0\uc758 inet\uc744 manual\ub85c \uc124\uc815\ud55c\ub2e4.\" >> \/etc\/network\/interfaces.d\/eth0\n    echo \"iface eth0 inet static\" >> \/etc\/network\/interfaces.d\/eth0\n    echo \"#iface eth0 inet dhcp\" >> \/etc\/network\/interfaces.d\/eth0\n    echo \"address ${ETH0_IP}\" >> \/etc\/network\/interfaces.d\/eth0\n    echo \"netmask ${ETH0_NM}\" >> \/etc\/network\/interfaces.d\/eth0\n    echo \"gateway ${GATEWAY}\" >> \/etc\/network\/interfaces.d\/eth0\n    echo \"dns-nameservers ${DNS_SERVER1} ${DNS_SERVER2}\" >> \/etc\/network\/interfaces.d\/eth0\n\n    echo \"# WiFi\" > \/etc\/network\/interfaces.d\/wlan0\n    echo \"auto wlan0\" >> \/etc\/network\/interfaces.d\/wlan0\n    echo \"allow-hotplug wlan0\" >> \/etc\/network\/interfaces.d\/wlan0\n\n    if [ ${WIFI_ENABLE} = 1 ]\n    then\n      echo \"iface wlan0 inet dhcp\" >> \/etc\/network\/interfaces.d\/wlan0\n      echo \"#iface wlan0 inet manual\" >> \/etc\/network\/interfaces.d\/wlan0\n      systemctl enable wpa_supplicant.service\n    else\n      echo \"#iface wlan0 inet dhcp\" >> \/etc\/network\/interfaces.d\/wlan0\n      echo \"iface wlan0 inet manual\" >> \/etc\/network\/interfaces.d\/wlan0\n      systemctl disable wpa_supplicant.service\n    fi\n\n    echo \"wireless-mode Managed\" >> \/etc\/network\/interfaces.d\/wlan0\n    echo \"wpa-conf \/etc\/wpa_supplicant\/wpa_supplicant.conf\" >> \/etc\/network\/interfaces.d\/wlan0\n\n    echo \"ctrl_interface=DIR=\/var\/run\/wpa_supplicant GROUP=netdev\" > \/etc\/wpa_supplicant\/wpa_supplicant.conf\n    echo \"update_config=1\" >> \/etc\/wpa_supplicant\/wpa_supplicant.conf\n    echo \"\" >> \/etc\/wpa_supplicant\/wpa_supplicant.conf\n    echo \"network={\" >> \/etc\/wpa_supplicant\/wpa_supplicant.conf\n    echo \"  ssid=\\\"${WIFI_SSID}\\\"\" >> \/etc\/wpa_supplicant\/wpa_supplicant.conf\n    echo \"  psk=\\\"${WIFI_PW}\\\"\" >> \/etc\/wpa_supplicant\/wpa_supplicant.conf\n    echo \"  key_mgmt=WPA-PSK\" >> \/etc\/wpa_supplicant\/wpa_supplicant.conf\n    echo \"  priority=99\" >> \/etc\/wpa_supplicant\/wpa_supplicant.conf\n    echo \"}\" >> \/etc\/wpa_supplicant\/wpa_supplicant.conf\n\n    sed -i \"s\/iface eth0 inet dhcp\/#iface eth0 inet dhcp\/g\" \/etc\/network\/interfaces\n    chmod 644 \/etc\/network\/interfaces.d\/eth0\n    chmod 644 \/etc\/network\/interfaces.d\/lo\n    chmod 644 \/etc\/network\/interfaces.d\/wlan0\n    chmod 644 \/etc\/wpa_supplicant\/wpa_supplicant.conf\n    #nmcli radio wifi off\n\n    echo \"\" >> \/etc\/sysctl.conf\n    echo \"###########################################################\" >> \/etc\/sysctl.conf\n    echo \"#\" >> \/etc\/sysctl.conf\n    echo \"# Disable IPv6\" >> \/etc\/sysctl.conf\n    echo \"#\" >> \/etc\/sysctl.conf\n    echo \"###########################################################\" >> \/etc\/sysctl.conf\n    echo \"net.ipv6.conf.all.disable_ipv6=1\" >> \/etc\/sysctl.conf\n    echo \"net.ipv6.conf.default.disable_ipv6=1\" >> \/etc\/sysctl.conf\n  fi\n}\n\nset_dns() {\n  echo \"###########################################################\"\n  echo \"#\"\n  echo \"# \ub124\ud2b8\uc6cc\ud06c \uc14b\ud305 (DNS)\"\n  echo \"#\"\n  echo \"###########################################################\"\n\n  chmod 666 \/etc\/resolv.conf\n  echo \"nameserver ${DNS_SERVER1}\" >> \/etc\/resolv.conf\n  echo \"nameserver ${DNS_SERVER2}\" >> \/etc\/resolv.conf\n  chmod 644 \/etc\/resolv.conf\n}\n\nupdate_os() {\n  echo \"###########################################################\"\n  echo \"#\"\n  echo \"# \uc804\uccb4 \ud328\ud0a4\uc9c0 \uc5c5\ub370\uc774\ud2b8\"\n  echo \"#\"\n  echo \"###########################################################\"\n\n  ${APTCMD} update -y\n  ${APTCMD} upgrade -y\n  ${APTCMD} dist-upgrade -y\n\n  deb_clean\n}\n\ninstall_additional_repo() {\n  echo \"###########################################################\"\n  echo \"#\"\n  echo \"# apt repository \uad00\ub9ac\uc790 \uc124\uce58\"\n  echo \"#\"\n  echo \"###########################################################\"\n\n  ${APTCMD} -y install software-properties-common\n  ${APTCMD} -y install python-software-properties\n}\n\ninstall_apt_get_pkgs() {\n  echo \"###########################################################\"\n  echo \"#\"\n  echo \"# \ud544\uc694\ud55c \ud328\ud0a4\uc9c0 \uc124\uce58\"\n  echo \"# (\uc124\uce58\uac00 \uc548\ub420 \uc218 \uc788\uc73c\ub2c8 \ub9ac\ubd80\ud305 \ud6c4 \ud655\uc778 \uc694\ub9dd)\"\n  echo \"#\"\n  echo \"###########################################################\"\n\n  sync\n  ${APTCMD} -y install at\n  ${APTCMD} -y install python\n  ${APTCMD} -y install lrzsz\n  ${APTCMD} -y install vim\n  ${APTCMD} -y install telnet\n  ${APTCMD} -y install ntp\n  ${APTCMD} -y install ntpdate\n  ${APTCMD} -y install lshw\n  ${APTCMD} -y install autofs\n  ${APTCMD} -y install screen\n  ${APTCMD} -y install wireless-tools wpasupplicant hostapd\n  ${APTCMD} -y install expect\n  ${APTCMD} -y install gzip bzip2 tar unrar arj p7zip-full minicom mc ftp lsof\n  ${APTCMD} -y install zip unzip zlib1g-dev\n  ${APTCMD} -y install iptables ipset bridge-utils isc-dhcp-server iperf\n  ${APTCMD} -y install conntrack\n  ${APTCMD} -y install ntfs-3g\n  ${APTCMD} -y install exfat-fuse exfat-utils\n  ${APTCMD} -y install lftp\n  ${APTCMD} -y install git\n  ${APTCMD} -y install subversion subversion-tools\n  ${APTCMD} -y install ffmpeg\n  ${APTCMD} -y install cifs-utils\n  ${APTCMD} -y install tcpdump netcat\n  ${APTCMD} -y install mediainfo sox\n  ${APTCMD} -y install livemedia-utils\n  ${APTCMD} -y install nfs-common\n  ${APTCMD} -y install whois\n  ${APTCMD} -y install net-tools\n  ${APTCMD} -y install wakeonlan\n  ${APTCMD} -y install wget\n  ${APTCMD} -y install cmake\n  ${APTCMD} -y install apt-transport-https ca-certificates curl gnupg lsb-release\n  ${APTCMD} -y install ${NEW_USER}-config\n  ${APTCMD} -y install rpimonitor\n  ${APTCMD} -y install hdparm\n  ${APTCMD} -y install lm_sensors hddtemp\n  ${APTCMD} -y install build-essential\n  ${APTCMD} -y install libtool\n  ${APTCMD} -y install pkg-config\n  sensors-detect --auto\n\n  # orange pi zero2\ub294 xrdp,xorgxrdp\ub97c \ucef4\ud30c\uc77c\ud558\uc5ec \uc218\ub3d9\uc124\uce58\n  if [[ ${BOARD_NAME_SHORT} = \"opizero2\" ]]\n  then\n    ${APTCMD} -y install xserver-xorg-dev\n    ${APTCMD} -y install libpam0g-dev\n    ${APTCMD} -y install libjpeg-dev\n    ${APTCMD} -y install libfuse-dev\n    ${APTCMD} -y install libmp3lame-dev\n    ${APTCMD} -y install libxfixes-dev\n    ${APTCMD} -y install libxrandr-dev\n  fi\n\n  # python3\n  ${APTCMD} -y upgrade python3\n  ${APTCMD} -y upgrade python3-pip\n  pip install --upgrade pip\n  ${APTCMD} -y upgrade python3-dev\n\n  # yt_dlp\n  wget https:\/\/github.com\/yt-dlp\/yt-dlp\/releases\/latest\/download\/yt-dlp -O \/usr\/local\/bin\/yt-dlp\n  chmod a+rx \/usr\/local\/bin\/yt-dlp\n  \/usr\/local\/bin\/yt-dlp -U\n}\n\ninstall_rclone() {\n  echo \"###########################################################\"\n  echo \"#\"\n  echo \"# rclone \uc124\uce58 (https:\/\/rclone.org\/downloads\/)\"\n  echo \"#\"\n  echo \"###########################################################\"\n\n  mkdir -p \/tmp\/rclone\n  wget --no-check-certificate \"https:\/\/downloads.rclone.org\/rclone-current-linux-arm.zip\" -O \/tmp\/rclone\/rclone.zip\n  unzip \/tmp\/rclone\/rclone.zip -d \/tmp\/rclone\n  cp -fv \/tmp\/rclone\/rclone-*\/rclone \/usr\/bin\n  chmod 755 \/usr\/bin\/rclone\n  rm -rf \/tmp\/rclone\n}\n\ninstall_docker() {\n  echo \"###########################################################\"\n  echo \"#\"\n  echo \"# docker \uc124\uce58\"\n  echo \"#\"\n  echo \"###########################################################\"\n\n  if [ ${USE_DOCKER} = 1 ]\n  then\n    ${APTCMD} -y install docker\n    ${APTCMD} -y install docker.io\n    ${APTCMD} -y install docker-compose\n\n    #rm -f \/usr\/share\/keyrings\/docker-archive-keyring.gpg \/etc\/apt\/sources.list.d\/docker.list*\n    #curl -fsSL \"https:\/\/download.docker.com\/linux\/ubuntu\/gpg\" | gpg --dearmor -o \/usr\/share\/keyrings\/docker-archive-keyring.gpg\n    #echo \"deb [arch=${DOCKER_ARCH} signed-by=\/usr\/share\/keyrings\/docker-archive-keyring.gpg] https:\/\/download.docker.com\/linux\/ubuntu $(lsb_release -cs) stable\" | tee \/etc\/apt\/sources.list.d\/docker.list > \/dev\/null\n    #add-apt-repository \"deb [arch=${DOCKER_ARCH}] https:\/\/download.docker.com\/linux\/ubuntu $(lsb_release -cs) stable\"\n    #${APTCMD} -y update\n    #${APTCMD} -y install docker-ce docker-ce-cli containerd.io\n\n    # docker-compose\n    #pip3 install docker-compose\n  fi\n}\n\ninstall_nfs_server() {\n  echo \"###########################################################\"\n  echo \"#\"\n  echo \"# NFS Server \uc124\uc815\"\n  echo \"#\"\n  echo \"###########################################################\"\n  if [ ${USE_NFS_SERVER} = 1 ]\n  then\n    ${APTCMD} -y install nfs-kernel-server\n    ${APTCMD} -y install rpcbind\n    sync\n\n    sed -i \"s\/STATDOPTS=\/STATDOPTS=\\\"--port 4000\\\"\/g\" \/etc\/default\/nfs-common\n    sed -i \"s\/RPCMOUNTDOPTS=\\\"--manage-gids\\\"\/RPCMOUNTDOPTS=\\\"--manage-gids -p 4002\\\"\/g\" \/etc\/default\/nfs-kernel-server\n\n    echo \"${STORAGE_MOUNT_DIR} *(rw,sync,no_subtree_check,all_squash,anonuid=1000,anongid=1000)\" >> \/etc\/exports\n\n    echo \"\" >> \/etc\/sysctl.conf\n    echo \"###########################################################\" >> \/etc\/sysctl.conf\n    echo \"#\" >> \/etc\/sysctl.conf\n    echo \"# NFS nlockmgr port\" >> \/etc\/sysctl.conf\n    echo \"#\" >> \/etc\/sysctl.conf\n    echo \"###########################################################\" >> \/etc\/sysctl.conf\n    echo \"fs.nfs.nlm_tcpport=4001\" >> \/etc\/sysctl.conf\n    echo \"fs.nfs.nlm_udpport=4001\" >> \/etc\/sysctl.conf\n\n    exportfs -a\n    systemctl daemon-reload\n    systemctl restart nfs-kernel-server\n    systemctl enable nfs-kernel-server\n    systemctl enable rpcbind.service\n    rpcinfo -p\n  else\n    systemctl daemon-reload\n    systemctl stop nfs-kernel-server\n    systemctl disable nfs-kernel-server\n    systemctl disable rpcbind.service\n  fi\n}\n\nset_vim() {\n  echo \"###########################################################\"\n  echo \"#\"\n  echo \"# vim \uc124\uc815\"\n  echo \"#\"\n  echo \"###########################################################\"\n\n  echo \"set encoding=utf-8\" >> \/etc\/vim\/vimrc\n  echo \"set fencs=utf-8,euc-kr\" >> \/etc\/vim\/vimrc\n  echo \"set fileencodings=utf-8,euc-kr\" >> \/etc\/vim\/vimrc\n  echo \"set indentexpr=\" >> \/etc\/vim\/vimrc\n  echo \"set noautoindent\" >> \/etc\/vim\/vimrc\n  echo \"set nocindent\" >> \/etc\/vim\/vimrc\n  echo \"set nosmartindent\" >> \/etc\/vim\/vimrc\n  echo \"set paste\" >> \/etc\/vim\/vimrc\n}\n\ninstall_apache2() {\n  echo \"###########################################################\"\n  echo \"#\"\n  echo \"# apache2 \ud328\ud0a4\uc9c0 \uc124\uce58\"\n  echo \"#\"\n  echo \"###########################################################\"\n\n  if [ ${USE_APACHE2} = 1 ]\n  then\n    ${APTCMD} -y install apache2\n    ${APTCMD} -y install apache2-utils\n    ${APTCMD} -y install libapache2-mod-fcgid\n    ${APTCMD} -y install libapache2-mod-svn\n    ${APTCMD} -y install libcgi-session-perl\n\n    rm -rf ${WWW_DIR}\/*\n    chown -R www-data:www-data ${WWW_DIR}\n    systemctl daemon-reload\n\n    a2enmod rewrite\n    a2enmod dav\n    a2enmod dav_fs\n    a2enmod dav_svn\n    a2enmod auth_digest\n    a2enmod ssl\n    a2enmod proxy_wstunnel\n    a2enmod proxy_http\n    a2enmod headers\n    a2enmod env\n    a2enmod alias\n    a2enmod fcgid\n\n    cp -fv \/etc\/apache2\/apache2.conf \/etc\/apache2\/apache2.conf.${TIMESTAMP}\n    cp -fv \/etc\/apache2\/ports.conf \/etc\/apache2\/ports.conf.${TIMESTAMP}\n    cp -fv \/etc\/apache2\/envvars \/etc\/apache2\/envvars.${TIMESTAMP}\n  fi\n}\n\ninstall_mariadb() {\n  echo \"###########################################################\"\n  echo \"#\"\n  echo \"# mariaDB \ud328\ud0a4\uc9c0 \uc124\uce58\"\n  echo \"#\"\n  echo \"###########################################################\"\n\n  if [ ${USE_MARIADB} = 1 ]\n  then\n    ${APTCMD} -y install mariadb-server\n    sed -i \"s\/127.0.0.1\/0.0.0.0\/g\" \/etc\/mysql\/my.cnf\n    sed -i \"s\/127.0.0.1\/0.0.0.0\/g\" \/etc\/mysql\/mariadb.conf.d\/50-server.cnf\n    systemctl stop mysql.service\n    rm -rf \/var\/lib\/mysql\/*\n    \/usr\/bin\/mysql_install_db\n\n    systemctl daemon-reload\n    systemctl enable mysql.service\n  fi\n}\n\ninstall_php() {\n  echo \"###########################################################\"\n  echo \"#\"\n  echo \"# php \ud328\ud0a4\uc9c0 \uc124\uce58\"\n  echo \"#\"\n  echo \"###########################################################\"\n\n  if [ ${USE_PHP} = 1 ]\n  then\n    ${APTCMD} -y install php\n    ${APTCMD} -y install libapache2-mod-php\n    ${APTCMD} -y install php-cli\n    ${APTCMD} -y install php-curl\n    ${APTCMD} -y install php-gd\n    ${APTCMD} -y install php-gmp\n    ${APTCMD} -y install php-imagick\n    ${APTCMD} -y install php-intl\n    ${APTCMD} -y install php-json\n    ${APTCMD} -y install php-mbstring\n    ${APTCMD} -y install php-mysql\n    ${APTCMD} -y install php-pear\n    ${APTCMD} -y install php-xml\n    ${APTCMD} -y install php-xmlrpc\n    ${APTCMD} -y install php-zip\n\n    PHP_VER=$(php --version | head -n 1 | cut -d \" \" -f 2 | cut -c 1-3)\n    cp -fv \/etc\/php\/${PHP_VER}\/apache2\/php.ini \/etc\/php\/${PHP_VER}\/apache2\/php.ini.${TIMESTAMP}\n  fi\n}\n\ninstall_letsencrypt() {\n  echo \"###########################################################\"\n  echo \"#\"\n  echo \"# Let's encrypt \uc124\uce58\"\n  echo \"#\"\n  echo \"###########################################################\"\n\n  if [ ${USE_LETSENCRYPT} = 1 ]\n  then\n    ${APTCMD} -y install letsencrypt\n    ${APTCMD} -y install python3-certbot-apache\n  fi\n}\n\ninstall_vsftpd() {\n  echo \"###########################################################\"\n  echo \"#\"\n  echo \"# vsftpd \ud328\ud0a4\uc9c0 \uc124\uce58\"\n  echo \"#\"\n  echo \"###########################################################\"\n\n  if [ ${USE_VSFTPD} = 1 ]\n  then\n    ${APTCMD} -y install vsftpd\n    cp -fv \/etc\/vsftpd.conf \/etc\/vsftpd.conf.${TIMESTAMP}\n  fi\n}\n\ninstall_samba() {\n  echo \"###########################################################\"\n  echo \"#\"\n  echo \"# samba \ud328\ud0a4\uc9c0 \uc124\uce58\"\n  echo \"#\"\n  echo \"###########################################################\"\n\n  if [ ${USE_SAMBA} = 1 ]\n  then\n    echo \"samba-common samba-common\/workgroup string  WORKGROUP\" | sudo debconf-set-selections\n    echo \"samba-common samba-common\/dhcp boolean true\" | sudo debconf-set-selections\n    echo \"samba-common samba-common\/do_debconf boolean true\" | sudo debconf-set-selections\n    ${APTCMD} -y install samba\n    ${APTCMD} -y install samba-common-bin\n    ${APTCMD} -y install cifs-utils\n    ${APTCMD} -y install smbclient\n    cp -fv \/etc\/samba\/smb.conf \/etc\/samba\/smb.conf.${TIMESTAMP}\n  fi\n}\n\ninstall_plexmediaserver() {\n  echo \"###########################################################\"\n  echo \"#\"\n  echo \"# plex media server \uc124\uce58\"\n  echo \"#\"\n  echo \"###########################################################\"\n\n  if [ ${USE_PLEXMEDIASERVER} = 1 ]\n  then\n    ${APTCMD} -y install apt-transport-https\n    curl https:\/\/downloads.plex.tv\/plex-keys\/PlexSign.key | apt-key add -\n    echo deb https:\/\/downloads.plex.tv\/repo\/deb public main | tee \/etc\/apt\/sources.list.d\/plexmediaserver.list\n    ${APTCMD} update\n    ${APTCMD} -y install plexmediaserver\n    sed -i \"s\/User=plex\/User=${NEW_USER}\/g\" \/lib\/systemd\/system\/plexmediaserver.service\n    sed -i \"s\/Group=plex\/Group=${NEW_USER}\/g\" \/lib\/systemd\/system\/plexmediaserver.service\n    chown -R ${NEW_USER}:${NEW_GROUP} \/var\/lib\/plexmediaserver\n    systemctl daemon-reload\n    systemctl stop plexmediaserver\n\n    ##########################################################################\n    #\n    # \uc544\ub798 \uc8fc\uc18c\ub85c \uc811\uc18d \ud14c\uc2a4\ud2b8\n    # http:\/\/192.168.1.20:32400\/web\/\n    #\n    ##########################################################################\n\n    ##########################################################################\n    #\n    # \uce90\uc26c \ud074\ub9ac\uc5b4\n    #\n    ##########################################################################\n    rm -rf \"\/var\/lib\/plexmediaserver\/Library\/Application Support\/Plex Media Server\/Cache\"\n    rm -rf \"\/var\/lib\/plexmediaserver\/Library\/Application Support\/Plex Media Server\/Logs\"\n    rm -rf \"\/var\/lib\/plexmediaserver\/Library\/Application Support\/Plex Media Server\/Media\"\n    mkdir -p \"\/var\/lib\/plexmediaserver\/Library\/Application Support\/Plex Media Server\/Cache\"\n    mkdir -p \"\/var\/lib\/plexmediaserver\/Library\/Application Support\/Plex Media Server\/Logs\"\n    mkdir -p \"\/var\/lib\/plexmediaserver\/Library\/Application Support\/Plex Media Server\/Media\"\n    chown -R ${NEW_USER}:${NEW_GROUP} \/var\/lib\/plexmediaserver\n    systemctl enable plexmediaserver\n  fi\n}\n\ninstall_xwindow() {\n  echo \"###########################################################\"\n  echo \"#\"\n  echo \"# X-Window &amp; LXDE \uc124\uce58\"\n  echo \"#\"\n  echo \"# \uc124\uce58 \ud6c4 im-config \ub97c \uc2e4\ud589\ud558\uc5ec \ud55c\uae00\uc785\ub825 \ud658\uacbd\uc744 \uc124\uc815\ud55c\ub2e4.\"\n  echo \"#\"\n  echo \"###########################################################\"\n\n  if [ ${USE_XWINDOW} = 1 ]\n  then\n    ${APTCMD} -y install xorg\n    ${APTCMD} -y install xfonts-base\n    ${APTCMD} -y install xserver-xorg-video-dummy\n    ${APTCMD} -y install policykit-1\n\n    if [ ${DESKTOP_ENVIRONMENT} = \"LXDE\" ]\n    then\n      ${APTCMD} -y install lxde\n      ${APTCMD} -y install lxterminal\n      ${APTCMD} -y install lxde-icon-theme\n      ${APTCMD} -y install lxmusic\n    fi\n\n    if [ ${DESKTOP_ENVIRONMENT} = \"XFCE\" ]\n    then\n      ${APTCMD} -y install xfce4\n      ${APTCMD} -y install xfce4-goodies\n    fi\n\n    if [ ${DESKTOP_ENVIRONMENT} = \"GNOME\" ]\n    then\n      ${APTCMD} -y install gnome-session\n      ${APTCMD} -y install gdm3\n      ${APTCMD} -y install gnome-panel\n      ${APTCMD} -y install metacity\n      ${APTCMD} -y install light-themes\n    fi\n\n    if [[ ${BOARD_NAME_SHORT} = \"opizero2\" ]]\n    then\n      echo \"Section \\\"Device\\\"\" > \/etc\/X11\/xorg.conf.d\/99-fbdev.conf\n      echo \"  Identifier \\\"myfb\\\"\" >> \/etc\/X11\/xorg.conf.d\/99-fbdev.conf\n      echo \"  Driver \\\"fbdev\\\"\" >> \/etc\/X11\/xorg.conf.d\/99-fbdev.conf\n      echo \"  Option \\\"fbdev\\\" \\\"\/dev\/fb1\\\"\" >> \/etc\/X11\/xorg.conf.d\/99-fbdev.conf\n      echo \"EndSection\" >> \/etc\/X11\/xorg.conf.d\/99-fbdev.conf\n    fi\n\n    ${APTCMD} -y install wpagui\n    ${APTCMD} -y install language-pack-ko\n    ${APTCMD} -y install korean*\n    ${APTCMD} -y install ubuntu-wallpapers\n    ${APTCMD} -y install xfonts-cyrillic\n    ${APTCMD} -y install xfonts-100dpi\n    ${APTCMD} -y install xfonts-75dpi\n    ${APTCMD} -y install xfonts-tipa\n    ${APTCMD} -y install fonts-unfonts-core fonts-unfonts-extra\n    ${APTCMD} -y install xfonts-baekmuk fonts-baekmuk\n    ${APTCMD} -y install fonts-nanum fonts-nanum-coding fonts-nanum-extra\n    ${APTCMD} -y install fonts-noto-color-emoji\n    ${APTCMD} -y install atril\n    ${APTCMD} -y install filezilla\n    #${APTCMD} -y install chromium-browser\n    ${APTCMD} -y install galculator\n    ${APTCMD} -y install gedit\n    ${APTCMD} -y install gpicview\n    ${APTCMD} -y install putty\n    ${APTCMD} -y install remmina\n    ${APTCMD} -y install remmina-plugin-rdp\n    ${APTCMD} -y install remmina-plugin-secret\n    ${APTCMD} -y install vlc\n    ${APTCMD} -y install thunderbird\n    ${APTCMD} -y install thunderbird-locale-ko\n    ${APTCMD} -y install libreoffice\n    ${APTCMD} -y install libreoffice-l10n-ko\n    ${APTCMD} -y install libreoffice-help-ko\n    update-icon-caches \/usr\/share\/icons\/*\n\n    if [ ${DESKTOP_ENVIRONMENT} = \"LXDE\" ]\n    then\n      echo \"lxsession -s LXDE -e LXDE\" > \/root\/.xsession\n      echo \"lxsession -s LXDE -e LXDE\" > ${NEW_USER_HOME}\/.xsession\n    fi\n\n    if [ ${DESKTOP_ENVIRONMENT} = \"XFCE\" ]\n    then\n      echo \"xfce4-session\" > \/root\/.xsession\n      echo \"xfce4-session\" > ${NEW_USER_HOME}\/.xsession\n    fi\n\n    if [ ${DESKTOP_ENVIRONMENT} = \"GNOME\" ]\n    then\n      echo \"gnome-session\" > \/root\/.xsession\n      echo \"gnome-session\" > ${NEW_USER_HOME}\/.xsession\n    fi\n\n    echo \"Section \\\"ServerFlags\\\"\" > \/etc\/X11\/xorg.conf.d\/xorg.conf\n    echo \" Option   \\\"BlankTime\\\"   \\\"0\\\"\" >> \/etc\/X11\/xorg.conf.d\/xorg.conf\n    echo \" Option   \\\"StandbyTime\\\" \\\"0\\\"\" >> \/etc\/X11\/xorg.conf.d\/xorg.conf\n    echo \" Option   \\\"SuspendTime\\\" \\\"0\\\"\" >> \/etc\/X11\/xorg.conf.d\/xorg.conf\n    echo \" Option   \\\"OffTime\\\"     \\\"0\\\"\" >> \/etc\/X11\/xorg.conf.d\/xorg.conf\n    echo \"EndSection\" >> \/etc\/X11\/xorg.conf.d\/xorg.conf\n    echo \"Section \\\"Device\\\"\" >> \/etc\/X11\/xorg.conf.d\/xorg.conf\n    echo \"    Identifier \\\"Configured Video Device\\\"\" >> \/etc\/X11\/xorg.conf.d\/xorg.conf\n    echo \"    Driver \\\"dummy\\\"\" >> \/etc\/X11\/xorg.conf.d\/xorg.conf\n    echo \"EndSection\" >> \/etc\/X11\/xorg.conf.d\/xorg.conf\n    echo \"Section \\\"Monitor\\\"\" >> \/etc\/X11\/xorg.conf.d\/xorg.conf\n    echo \"    Identifier  \\\"Configured Monitor\\\"\" >> \/etc\/X11\/xorg.conf.d\/xorg.conf\n    echo \"    HorizSync   31.5-48.5\" >> \/etc\/X11\/xorg.conf.d\/xorg.conf\n    echo \"    VertRefresh 50-70\" >> \/etc\/X11\/xorg.conf.d\/xorg.conf\n    echo \"    Option      \\\"DPMS\\\" \\\"false\\\"\" >> \/etc\/X11\/xorg.conf.d\/xorg.conf\n    echo \"EndSection\" >> \/etc\/X11\/xorg.conf.d\/xorg.conf\n    echo \"Section \\\"Screen\\\"\" >> \/etc\/X11\/xorg.conf.d\/xorg.conf\n    echo \"    Identifier  \\\"Default Screen\\\"\" >> \/etc\/X11\/xorg.conf.d\/xorg.conf\n    echo \"    Monitor     \\\"Configured Monitor\\\"\" >> \/etc\/X11\/xorg.conf.d\/xorg.conf\n    echo \"    Device      \\\"Configured Video Device\\\"\" >> \/etc\/X11\/xorg.conf.d\/xorg.conf\n    echo \"    DefaultDepth 24\" >> \/etc\/X11\/xorg.conf.d\/xorg.conf\n    echo \"    SubSection \\\"Display\\\"\" >> \/etc\/X11\/xorg.conf.d\/xorg.conf\n    echo \"        Depth    24\" >> \/etc\/X11\/xorg.conf.d\/xorg.conf\n    echo \"        Modes    \\\"1024x800\\\"\" >> \/etc\/X11\/xorg.conf.d\/xorg.conf\n    echo \"    EndSubSection\" >> \/etc\/X11\/xorg.conf.d\/xorg.conf\n    echo \"EndSection\" >> \/etc\/X11\/xorg.conf.d\/xorg.conf\n  fi\n}\n\ninstall_xrdp() {\n  echo \"###########################################################\"\n  echo \"#\"\n  echo \"# xrdp \uc124\uce58\"\n  echo \"#\"\n  echo \"###########################################################\"\n\n  if [ ${USE_XRDP} = 1 ]\n  then\n    ${APTCMD} -y install xrdp\n    ${APTCMD} -y install xorgxrdp\n\n    cp -f \/etc\/X11\/xrdp\/xorg.conf \/etc\/X11\/xrdp\/xorg.conf.${TIMESTAMP}\n    cp -f \/etc\/xrdp\/pulse\/default.pa \/etc\/xrdp\/pulse\/default.pa.${TIMESTAMP}\n    cp -f \/etc\/xrdp\/sesman.ini \/etc\/xrdp\/sesman.ini.${TIMESTAMP}\n    cp -f \/etc\/xrdp\/startwm.sh \/etc\/xrdp\/startwm.sh.${TIMESTAMP}\n    cp -f \/etc\/xrdp\/xrdp.ini \/etc\/xrdp\/xrdp.ini.${TIMESTAMP}\n    cp -f \/etc\/xrdp\/xrdp_keyboard.ini \/etc\/xrdp\/xrdp_keyboard.ini.${TIMESTAMP}\n\n    sed -i \"s\/^test -x\/#test -x\/g\" \/etc\/xrdp\/startwm.sh\n    sed -i \"s\/^exec \\\/bin\\\/sh\/#exec \\\/bin\\\/sh\/g\" \/etc\/xrdp\/startwm.sh\n\n    if [ ${DESKTOP_ENVIRONMENT} = \"LXDE\" ]\n    then\n      echo \"lxsession -s LXDE -e LXDE\" >> \/etc\/xrdp\/startwm.sh\n    fi\n\n    if [ ${DESKTOP_ENVIRONMENT} = \"XFCE\" ]\n    then\n      echo \"xfce4-session\" >> \/etc\/xrdp\/startwm.sh\n    fi\n\n    if [ ${DESKTOP_ENVIRONMENT} = \"GNOME\" ]\n    then\n      echo \"gnome-session\" >> \/etc\/xrdp\/startwm.sh\n    fi\n\n    systemctl daemon-reload\n    systemctl enable xrdp.service\n\n    rm -f \/var\/log\/xrdp*\n    touch \/var\/log\/xrdp.log\n    chown xrdp:adm \/var\/log\/xrdp.log\n    chmod 640 \/var\/log\/xrdp.log\n  fi\n}\n\ninstall_hangul_ime() {\n  echo \"###########################################################\"\n  echo \"#\"\n  echo \"# \ud55c\uae00 \uc785\ub825\uae30 \uc124\uce58\"\n  echo \"#\"\n  echo \"###########################################################\"\n\n  # \ud55c\uae00 \uc785\ub825\uae30 fcitx\n  if [ ${HANGUL_IME} = \"fcitx\" ]\n  then\n    ${APTCMD} -y install fcitx-bin\n    ${APTCMD} -y install fcitx-frontend-gtk2\n    ${APTCMD} -y install fcitx-frontend-gtk3\n    ${APTCMD} -y install fcitx-frontend-qt5\n    ${APTCMD} -y install fcitx-hangul\n    ${APTCMD} -y install fcitx-ui-classic\n    ${APTCMD} -y install fonts-noto-cjk\n    ${APTCMD} -y install fonts-noto-cjk-extra\n    ${APTCMD} -y install hunspell-ko\n    ${APTCMD} -y install language-pack-gnome-ko\n  fi\n\n  # \ud55c\uae00 \uc785\ub825\uae30 ibus\n  if [ ${HANGUL_IME} = \"ibus\" ]\n  then\n    ${APTCMD} -y install ibus\n    ${APTCMD} -y install ibus-hangul\n    echo \"export GTK_IM_MODULE=ibus\" >> ${NEW_USER_HOME}\/.bashrc\n    echo \"export QT_IM_MODULE=ibus\" >> ${NEW_USER_HOME}\/.bashrc\n    echo \"export XMODIFIERS=@im=ibus\" >> ${NEW_USER_HOME}\/.bashrc\n    echo \"export GTK_IM_MODULE=ibus\" >> \/root\/.bashrc\n    echo \"export QT_IM_MODULE=ibus\" >> \/root\/.bashrc\n    echo \"export XMODIFIERS=@im=ibus\" >> \/root\/.bashrc\n    echo \"@ibus-daemon -d\" >> \/etc\/xdg\/lxsession\/LXDE\/autostart\n  fi\n\n  # \ud55c\uae00 \uc785\ub825\uae30 uim-byeoru\n  if [ ${HANGUL_IME} = \"uim\" ]\n  then\n    ${APTCMD} -y --install-recommends install uim uim-byeoru\n    ${APTCMD} -y install lxhotkey-plugin-openbox\n    ${APTCMD} -y install im-config\n  fi\n}\n\ninstall_vncserver() {\n  echo \"###########################################################\"\n  echo \"#\"\n  echo \"# vncserver\uc124\uce58\"\n  echo \"#\"\n  echo \"###########################################################\"\n\n  if [ ${USE_VNC_SERVER} = 1 ]\n  then\n    ${APTCMD} -y install tigervnc-common\n    ${APTCMD} -y install tightvncserver\n\n    mkdir -p ${NEW_USER_HOME}\/.vnc\n    echo '#!\/bin\/sh' > ${NEW_USER_HOME}\/.vnc\/xstartup\n    echo \"\" >> ${NEW_USER_HOME}\/.vnc\/xstartup\n    echo \"# Uncomment the following two lines for normal desktop:\" >> ${NEW_USER_HOME}\/.vnc\/xstartup\n    echo \"# unset SESSION_MANAGER\" >> ${NEW_USER_HOME}\/.vnc\/xstartup\n    echo \"# exec \/etc\/X11\/xinit\/xinitrc\" >> ${NEW_USER_HOME}\/.vnc\/xstartup\n    echo \"\" >> ${NEW_USER_HOME}\/.vnc\/xstartup\n    echo \"[ -x \/etc\/vnc\/xstartup ] &amp;&amp; exec \/etc\/vnc\/xstartup\" >> ${NEW_USER_HOME}\/.vnc\/xstartup\n    echo \"[ -r \\$HOME\/.Xresources ] &amp;&amp; xrdb \\$HOME\/.Xresources\" >> ${NEW_USER_HOME}\/.vnc\/xstartup\n    echo \"xsetroot -solid grey -cursor_name left_ptr\" >> ${NEW_USER_HOME}\/.vnc\/xstartup\n    echo \"xrdb \\$HOME\/.Xresources\" >> ${NEW_USER_HOME}\/.vnc\/xstartup\n\n    if [ ${DESKTOP_ENVIRONMENT} = \"LXDE\" ]\n    then\n      echo \"startlxde &amp;\" >> ${NEW_USER_HOME}\/.vnc\/xstartup\n    fi\n\n    if [ ${DESKTOP_ENVIRONMENT} = \"XFCE\" ]\n    then\n      echo \"startxfce4 &amp;\" >> ${NEW_USER_HOME}\/.vnc\/xstartup\n    fi\n\n    if [ ${DESKTOP_ENVIRONMENT} = \"GNOME\" ]\n    then\n      echo \"gnome-session --builtin --session=gnome-flashback-metacity --disable-acceleration-check --debug &amp;\" >> ${NEW_USER_HOME}\/.vnc\/xstartup\n      echo \"nautilus &amp;\" >> ${NEW_USER_HOME}\/.vnc\/xstartup\n      echo \"gnome-terminal &amp;\" >> ${NEW_USER_HOME}\/.vnc\/xstartup\n    fi\n\n    chmod 755 ${NEW_USER_HOME}\/.vnc\/xstartup\n\n    echo \"[Unit]\" >  \/lib\/systemd\/system\/vncserver.service\n    echo \"Description=Tight VNC Server\" >>  \/lib\/systemd\/system\/vncserver.service\n    echo \"\" >>  \/lib\/systemd\/system\/vncserver.service\n    echo \"[Service]\" >>  \/lib\/systemd\/system\/vncserver.service\n    echo \"Type=forking\" >>  \/lib\/systemd\/system\/vncserver.service\n    echo \"User=${NEW_USER}\" >>  \/lib\/systemd\/system\/vncserver.service\n    echo \"ExecStart=\/usr\/bin\/vncserver :1 -deferglyphs all -geometry 1024x768\" >>  \/lib\/systemd\/system\/vncserver.service\n    echo \"ExecStop=\/usr\/bin\/vncserver -kill :1\" >>  \/lib\/systemd\/system\/vncserver.service\n    echo \"\" >>  \/lib\/systemd\/system\/vncserver.service\n    echo \"[Install]\" >>  \/lib\/systemd\/system\/vncserver.service\n    echo \"WantedBy=multi-user.target\" >>  \/lib\/systemd\/system\/vncserver.service\n\n    chown -R ${NEW_USER}:${NEW_GROUP} ${NEW_USER_HOME}\n    chown -R ${NEW_USER}:${NEW_GROUP} ${NEW_USER_HOME}\/.vnc\n    systemctl daemon-reload\n    systemctl enable vncserver.service\n  fi\n}\n\ninstall_transmission_daemon() {\n  echo \"###########################################################\"\n  echo \"#\"\n  echo \"# transmission-daemon \uc124\uce58\"\n  echo \"#\"\n  echo \"###########################################################\"\n\n  cd ${CURRENT_DIR}\n  if [ ${USE_TRANSMISSION} = 1 ]\n  then\n    ${APTCMD} -y install transmission-daemon\n    cp -fv \/etc\/transmission-daemon\/settings.json \/etc\/transmission-daemon\/settings.json.${TIMESTAMP}\n    sed -i \"s\/\\\"rpc-username\\\": \\\"transmission\\\",\/\\\"rpc-username\\\": \\\"${NEW_USER}\\\",\/g\" \/etc\/transmission-daemon\/settings.json\n    sed -i \"s\/\\\"incomplete-dir\\\": \\\"\\\/var\\\/lib\\\/transmission-daemon\\\/Downloads\\\",\/\\\"incomplete-dir\\\": \\\"\\\\${STORAGE_MOUNT_DIR}\\\/transmission-daemon\\\/incomplete\\\",\/g\" \/etc\/transmission-daemon\/settings.json\n    sed -i \"s\/\\\"download-dir\\\": \\\"\\\/var\\\/lib\\\/transmission-daemon\\\/downloads\\\",\/\\\"download-dir\\\": \\\"\\\\${STORAGE_MOUNT_DIR}\\\/transmission-daemon\\\/downloads\\\",\/g\" \/etc\/transmission-daemon\/settings.json\n    sed -i \"s\/\\\"rpc-whitelist-enabled\\\": true,\/\\\"rpc-whitelist-enabled\\\": false,\/g\" \/etc\/transmission-daemon\/settings.json\n    invoke-rc.d transmission-daemon reload\n    sed -i \"s\/USER=debian-transmission\/USER=${NEW_USER}\/g\" \/etc\/init.d\/transmission-daemon\n    sed -i \"s\/User=debian-transmission\/User=${NEW_USER}\/g\" \/lib\/systemd\/system\/transmission-daemon.service\n    mkdir -p ${NEW_USER_HOME}\/.config\/transmission-daemon\n    cp -fv \/etc\/transmission-daemon\/settings.json ${NEW_USER_HOME}\/.config\/transmission-daemon\/\n    invoke-rc.d transmission-daemon reload\n\n    mkdir -p ${STORAGE_MOUNT_DIR}\/transmission-daemon\/incomplete\n    mkdir -p ${STORAGE_MOUNT_DIR}\/transmission-daemon\/downloads\n    chown -R ${NEW_USER}:${NEW_GROUP} \/etc\/transmission-daemon\n    chown -R ${NEW_USER}:${NEW_GROUP} \/var\/lib\/transmission-daemon\n    chown -R ${NEW_USER}:${NEW_GROUP} ${STORAGE_MOUNT_DIR}\/transmission-daemon\n    chmod 777 ${STORAGE_MOUNT_DIR}\/transmission-daemon\/downloads\n\n    systemctl daemon-reload\n    systemctl enable transmission-daemon.service\n  fi\n}\n\ninstall_audio() {\n  echo \"###########################################################\"\n  echo \"#\"\n  echo \"# Install Audio\"\n  echo \"# TEST)\"\n  echo \"#   aplay -l\"\n  echo \"#   speaker-test\"\n  echo \"#   mpg123 test.mp3\"\n  echo \"#\"\n  echo \"###########################################################\"\n\n  cd ${CURRENT_DIR}\n  if [ ${USE_BT_AUDIO} = 1 ]\n  then\n    # \ube14\ub8e8\ud22c\uc2a4 \ud328\ud0a4\uc9c0 \uc124\uce58\n    ${APTCMD} -y install bluetooth\n    ${APTCMD} -y install bluez\n    ${APTCMD} -y install bluez-tools\n    ${APTCMD} -y install rfkill\n    ${APTCMD} -y install blueman\n\n    # \uc624\ub514\uc624 \ud328\ud0a4\uc9c0 \uc124\uce58\n    ${APTCMD} -y install python-gobject python-gobject-2\n    ${APTCMD} -y install alsa-base\n    ${APTCMD} -y install alsa-utils\n    ${APTCMD} -y install autoconf\n    ${APTCMD} -y install libasound2\n    ${APTCMD} -y install libasound2-dev\n    ${APTCMD} -y install libbluetooth-dev\n    ${APTCMD} -y install libdbus-1-dev\n    ${APTCMD} -y install libglib2.0-dev\n    ${APTCMD} -y install libsbc-dev\n    ${APTCMD} -y install libtool\n    ${APTCMD} -y install linux-sound-base\n    ${APTCMD} -y install pavucontrol\n    ${APTCMD} -y install pulseaudio\n    ${APTCMD} -y install mpg123\n    ${APTCMD} -y install pulseaudio-module-bluetooth\n\n    echo 'pcm.!default {' > \/etc\/asound.conf\n    echo '  type hw' >> \/etc\/asound.conf\n    echo '  card 0' >> \/etc\/asound.conf\n    echo '  device 0' >> \/etc\/asound.conf\n    echo '}' >> \/etc\/asound.conf\n    echo 'ctl.!default {' >> \/etc\/asound.conf\n    echo '  type hw' >> \/etc\/asound.conf\n    echo '  card 0' >> \/etc\/asound.conf\n    echo '}' >> \/etc\/asound.conf\n\n    echo \"###########################################################\"\n    echo \"#\"\n    echo \"# Install Sound-Build bluealsa\"\n    echo \"#\"\n    echo \"###########################################################\"\n    wget --no-check-certificate -P \/tmp \"https:\/\/github.com\/Arkq\/bluez-alsa\/archive\/master.zip\"\n    cd \/tmp\n    unzip master.zip\n    cd bluez-alsa-master\/\n    autoreconf --install\n    mkdir build &amp;&amp; cd build\n    ..\/configure\n    make -j4\n    make install\n    rm -rf \/tmp\/master.zip \/tmp\/bluez-alsa-master\n\n    echo '[Unit]' > \/lib\/systemd\/system\/bluealsa.service\n    echo 'Description=Bluealsa daemon' >> \/lib\/systemd\/system\/bluealsa.service\n    echo 'Documentation=https:\/\/github.com\/Arkq\/bluez-alsa\/' >> \/lib\/systemd\/system\/bluealsa.service\n    echo 'After=dbus-org.bluez.service' >> \/lib\/systemd\/system\/bluealsa.service\n    echo 'Requires=dbus-org.bluez.service' >> \/lib\/systemd\/system\/bluealsa.service\n    echo '' >> \/lib\/systemd\/system\/bluealsa.service\n    echo '[Service]' >> \/lib\/systemd\/system\/bluealsa.service\n    echo 'Type=dbus' >> \/lib\/systemd\/system\/bluealsa.service\n    echo 'BusName=org.bluealsa' >> \/lib\/systemd\/system\/bluealsa.service\n    echo 'EnvironmentFile=-\/etc\/default\/bluealsa' >> \/lib\/systemd\/system\/bluealsa.service\n    echo 'ExecStart=\/usr\/bin\/bluealsa $OPTIONS' >> \/lib\/systemd\/system\/bluealsa.service\n    echo 'Restart=on-failure' >> \/lib\/systemd\/system\/bluealsa.service\n    echo 'ProtectSystem=strict' >> \/lib\/systemd\/system\/bluealsa.service\n    echo 'ProtectHome=true' >> \/lib\/systemd\/system\/bluealsa.service\n    echo 'PrivateTmp=true' >> \/lib\/systemd\/system\/bluealsa.service\n    echo 'PrivateDevices=true' >> \/lib\/systemd\/system\/bluealsa.service\n    echo 'RemoveIPC=true' >> \/lib\/systemd\/system\/bluealsa.service\n    echo 'RestrictAddressFamilies=AF_UNIX AF_BLUETOOTH' >> \/lib\/systemd\/system\/bluealsa.service\n    echo '; Also non-privileged can user be used' >> \/lib\/systemd\/system\/bluealsa.service\n    echo '; this example assumes a user and group called 'bluealsa' exist' >> \/lib\/systemd\/system\/bluealsa.service\n    echo ';User=bluealsa' >> \/lib\/systemd\/system\/bluealsa.service\n    echo ';Group=bluealsa' >> \/lib\/systemd\/system\/bluealsa.service\n    echo ';NoNewPrivileges=true' >> \/lib\/systemd\/system\/bluealsa.service\n    echo '' >> \/lib\/systemd\/system\/bluealsa.service\n    echo '[Install]' >> \/lib\/systemd\/system\/bluealsa.service\n    echo 'WantedBy=bluetooth.target' >> \/lib\/systemd\/system\/bluealsa.service\n    systemctl daemon-reload\n    systemctl enable bluealsa.service\n    systemctl start bluealsa.service\n\n    echo '#!\/bin\/bash' > ~\/bluetooth_autoconnect.sh\n    echo 'MACADDR1=\"1c:52:16:6d:0a:7b\"' >> ~\/bluetooth_autoconnect.sh\n    echo 'bluetoothctl &lt;&lt; EOF' >> ~\/bluetooth_autoconnect.sh\n    echo 'connect ${MACADDR1}' >> ~\/bluetooth_autoconnect.sh\n    echo 'EOF' >> ~\/bluetooth_autoconnect.sh\n    chmod 755 ~\/bluetooth_autoconnect.sh\n\n    # \uc624\ub514\uc624 \ub514\ubc14\uc774\uc2a4 \ud65c\uc131\ud654\n    armbian-config main=System selection=Hardware selection=analog-codec\n  fi\n\n  #bluetoothctl\n  #[bluetooth]# scan on\n  #...\n  #[bluetooth]# scan off\n  #[bluetooth]# pair 1c:52:16:6d:0a:7b\n  #[bluetooth]# connect 1c:52:16:6d:0a:7b\n  #[bluetooth]# quit\n  #aplay -D bluealsa:DEV=1c:52:16:6d:0a:7b,PROFILE=a2dp test.wav\n}\n\nget_pydiouser_pw() {\n  echo \"###########################################################\"\n  echo \"#\"\n  echo \"# pydio DB \ube44\ubc00\ubc88\ud638 \uc124\uc815\"\n  echo \"#\"\n  echo \"###########################################################\"\n\n  if [ ${USE_PYDIO} = 1 ]\n  then\n    echo -n \">> Input 'pydiouser' DB Password: \"\n    read PYDIO_DB_PW\n    echo \"'pydiouser' DB Password: ${PYDIO_DB_PW}\"\n    echo \"\"\n  fi\n}\n\nsetup_pydio_db() {\n  echo \"###########################################################\"\n  echo \"#\"\n  echo \"# pydio DB \uc124\uc815\"\n  echo \"#\"\n  echo \"###########################################################\"\n\n  if [ ${USE_PYDIO} = 1 ]\n  then\n    cd ${CURRENT_DIR}\n    systemctl restart mysql\n    echo \"DROP DATABASE IF EXISTS pydio;\" > _pydio_tmp_\n    echo \"DROP USER IF EXISTS 'pydiouser'@'localhost';\" >> _pydio_tmp_\n    echo \"DROP USER IF EXISTS 'pydiouser'@'%';\" >> _pydio_tmp_\n    echo \"CREATE DATABASE pydio CHARACTER SET utf8 COLLATE utf8_bin;\" >> _pydio_tmp_\n    echo \"GRANT ALL PRIVILEGES ON pydio.* TO 'pydiouser'@'localhost' IDENTIFIED BY '${PYDIO_DB_PW}' WITH GRANT OPTION;\" >> _pydio_tmp_\n    echo \"GRANT ALL PRIVILEGES ON pydio.* TO 'pydiouser'@'%' IDENTIFIED BY '${PYDIO_DB_PW}' WITH GRANT OPTION;\" >> _pydio_tmp_\n    echo \"FLUSH PRIVILEGES;\" >> _pydio_tmp_\n    mysql -u root &lt; _pydio_tmp_\n    rm -f _pydio_tmp_\n  fi\n}\n\ninstall_pydio() {\n  echo \"###########################################################\"\n  echo \"#\"\n  echo \"# pydio \uc124\uce58\"\n  echo \"#\"\n  echo \"###########################################################\"\n\n  if [ ${USE_PYDIO} = 1 ]\n  then\n    cd ${CURRENT_DIR}\n    wget --no-check-certificate \"https:\/\/download.pydio.com\/pub\/core\/archives\/pydio-core-${PYDIO_VERSION}.tar.gz\"\n    tar -C ${WWW_DIR} -xzf pydio-core-${PYDIO_VERSION}.tar.gz\n    mv ${WWW_DIR}\/pydio-core-${PYDIO_VERSION} ${WWW_DIR}\/pydio\n    rm -f pydio-core-${PYDIO_VERSION}.tar.gz\n\n    # php.ini \uc218\uc815\n    PHP_VER=$(php --version | head -n 1 | cut -d \" \" -f 2 | cut -c 1-3)\n    cp -f \/etc\/php\/${PHP_VER}\/apache2\/php.ini \/etc\/php\/${PHP_VER}\/apache2\/php.ini.${TIMESTAMP}\n    sed -i \"s\/^output_buffering = 4096\/output_buffering = off\/g\" \/etc\/php\/${PHP_VER}\/apache2\/php.ini\n\n    # Session \uacbd\ub85c \uc124\uc815\n    cp -f ${WWW_DIR}\/pydio\/conf\/bootstrap_conf.php ${WWW_DIR}\/pydio\/conf\/bootstrap_conf.php.${TIMESTAMP}\n    sed -i \"s\/^\\\/\\\/\\$AJXP_INISET\\[\\\"session\\.save_path\\\"\\] = AJXP_DATA_PATH\\.\\\"\\\/tmp\\\/sessions\\\"\/\\$AJXP_INISET\\[\\\"session\\.save_path\\\"\\] = \\\"\\\/tmp\\\"\/g\" ${WWW_DIR}\/pydio\/conf\/bootstrap_conf.php\n\n    # \ucf54\ub4dc\uc14b \uc124\uc815\n    sed -i \"s\/^\\\/\\\/define(\\\"AJXP_LOCALE\\\", \\\"en_EN\\.UTF-8\\\")\/define(\\\"AJXP_LOCALE\\\", \\\"ko_KR\\.UTF-8\\\")\/g\" ${WWW_DIR}\/pydio\/conf\/bootstrap_conf.php\n\n    # \"Deprecated: Function get_magic_quotes_gpc() in PHP 7.4\" \uc624\ub958 \uc218\uc815\n    sync\n    cp -f ${WWW_DIR}\/pydio\/core\/src\/pydio\/Tests\/PHP_magic_quotes.php ${WWW_DIR}\/pydio\/core\/src\/pydio\/Tests\/PHP_magic_quotes.php.${TIMESTAMP}\n    cp -f ${WWW_DIR}\/pydio\/core\/src\/pydio\/Core\/Utils\/Vars\/InputFilter.php ${WWW_DIR}\/pydio\/core\/src\/pydio\/Core\/Utils\/Vars\/InputFilter.php.${TIMESTAMP}\n    sed -i \"s\/get_magic_quotes_gpc()\/false\/g\" ${WWW_DIR}\/pydio\/core\/src\/pydio\/Tests\/PHP_magic_quotes.php\n    sed -i \"s\/get_magic_quotes_gpc()\/false\/g\" ${WWW_DIR}\/pydio\/core\/src\/pydio\/Core\/Utils\/Vars\/InputFilter.php\n\n    # \uacf5\uc6a9\ud30c\uc77c \ub514\ub809\ud1a0\ub9ac \ub9c1\ud06c\n    rm -rf ${WWW_DIR}\/pydio\/data\/files\n    ln -sf ${STORAGE_MOUNT_DIR} ${WWW_DIR}\/pydio\/data\/files\n\n    chown -R www-data:www-data ${WWW_DIR}\n  fi\n}\n\ninstall_vaultwarden() {\n  echo \"###########################################################\"\n  echo \"#\"\n  echo \"# vaultwarden(bitwarden unofficial \ubc84\uc804) \uc124\uce58\"\n  echo \"# https:\/\/github.com\/dani-garcia\/vaultwarden\"\n  echo \"#\"\n  echo \"###########################################################\"\n\n  if [ ${USE_BITWARDEN} = 1 ]\n  then\n    # docker \uc774\ubbf8\uc9c0 \uc815\ub9ac \ubc0f \uc81c\uac70\n    docker stop $(docker ps -a -q)\n    docker rm -f $(docker ps -a -q)\n    docker rmi -f $(docker images -a -q)\n\n    # vaultwarden \uc124\uce58 \uc774\ubbf8\uc9c0 \uc815\ub9ac\n    docker pull vaultwarden\/server:latest\n    mkdir -p \/var\/lib\/vaultwarden\n    rm -rf \/var\/lib\/vaultwarden\/*\n\n    # Let's encrypt \uc778\uc99d\uc11c\ub97c \uc0ac\uc6a9\ud558\uc5ec 5443\ud3ec\ud2b8\ub85c \uc2e4\ud589\ud55c\ub2e4.\n    # Let's encrypt \uc0ac\uc6a9\uc2dc cert.pem\uc740 fullchain.pem\uc73c\ub85c \uad50\uccb4\ud558\uc5ec \uc0ac\uc6a9\n    docker run -d --name vaultwarden -e ROCKET_TLS=\"{certs=\\\"\/ssl\/live\/hasu0707.duckdns.org\/cert.pem\\\",key=\\\"\/ssl\/live\/hasu0707.duckdns.org\/privkey.pem\\\"}\" -v \/etc\/letsencrypt\/:\/ssl\/ -v \/var\/lib\/vaultwarden\/:\/data\/ -p 5443:80 vaultwarden\/server:latest\n\n    # systemd \uc11c\ube44\uc2a4 \ub4f1\ub85d\n    echo \"[Unit]\" > \/lib\/systemd\/system\/docker-vaultwarden.service\n    echo \"Wants=docker.service\" >> \/lib\/systemd\/system\/docker-vaultwarden.service\n    echo \"After=docker.service\" >> \/lib\/systemd\/system\/docker-vaultwarden.service\n    echo \"\" >> \/lib\/systemd\/system\/docker-vaultwarden.service\n    echo \"[Service]\" >> \/lib\/systemd\/system\/docker-vaultwarden.service\n    echo \"RemainAfterExit=yes\" >> \/lib\/systemd\/system\/docker-vaultwarden.service\n    echo \"ExecStart=\/usr\/bin\/docker start vaultwarden\" >> \/lib\/systemd\/system\/docker-vaultwarden.service\n    echo \"ExecStop=\/usr\/bin\/docker stop vaultwarden\" >> \/lib\/systemd\/system\/docker-vaultwarden.service\n    echo \"\" >> \/lib\/systemd\/system\/docker-vaultwarden.service\n    echo \"[Install]\" >> \/lib\/systemd\/system\/docker-vaultwarden.service\n    echo \"WantedBy=multi-user.target\" >> \/lib\/systemd\/system\/docker-vaultwarden.service\n    ln -sf \/lib\/systemd\/system\/docker-vaultwarden.service \/etc\/systemd\/system\/docker-vaultwarden.service\n    systemctl daemon-reload\n    systemctl enable docker-vaultwarden.service\n  fi\n}\n\ninstall_extplorer() {\n  echo \"###########################################################\"\n  echo \"#\"\n  echo \"# eXtplorer \uc124\uce58\"\n  echo \"#\"\n  echo \"###########################################################\"\n\n  if [ ${USE_EXTPLORER} = 1 ]\n  then\n    cd ${CURRENT_DIR}\n    wget \"http:\/\/extplorer.net\/attachments\/download\/94\/eXtplorer_${EXTPLORER_VERSION}.zip\"\n    mkdir -p ${WWW_DIR}\/extplorer\n    unzip -d ${WWW_DIR}\/extplorer eXtplorer_${EXTPLORER_VERSION}.zip\n    rm -f eXtplorer_${EXTPLORER_VERSION}.zip\n    tar -C ${WWW_DIR}\/extplorer -xzf ${WWW_DIR}\/extplorer\/scripts.tar.gz\n    chown -R www-data:www-data ${WWW_DIR}\n  fi\n}\n\nsetup_apache2_index() {\n  echo \"###########################################################\"\n  echo \"#\"\n  echo \"# index.html, phpinfo.php \uc791\uc131\"\n  echo \"#\"\n  echo \"###########################################################\"\n\n  echo '&lt;!DOCTYPE html>' > ${WWW_DIR}\/index.php\n  echo \"&lt;html lang=\\\"ko\\\">\" >> ${WWW_DIR}\/index.php\n  echo \" &lt;head>\" >> ${WWW_DIR}\/index.php\n  echo \"  &lt;meta charset=\\\"UTF-8\\\">\" >> ${WWW_DIR}\/index.php\n  echo \"  &lt;title>${BOARD_NAME}&lt;\/title>\" >> ${WWW_DIR}\/index.php\n  echo \" &lt;\/head>\" >> ${WWW_DIR}\/index.php\n  echo \" &lt;body>&lt;ul>\" >> ${WWW_DIR}\/index.php\n\n  if [ ${USE_PYDIO} = 1 ]\n  then\n    echo \"   &lt;li>&lt;a href=\\\"\/pydio\/\\\" target=\\\"_blank\\\">Pydio - Enterprise File Sharing &amp;amp; Sync Platform&lt;\/a>&lt;\/li>\" >> ${WWW_DIR}\/index.php\n  fi\n\n  if [ ${USE_EXTPLORER} = 1 ]\n  then\n    echo \"   &lt;li>&lt;a href=\\\"\/extplorer\/\\\" target=\\\"_blank\\\">eXtplorer - a PHP-based File Manager&lt;\/a>&lt;\/li>\" >> ${WWW_DIR}\/index.php\n  fi\n\n  echo \" &lt;\/ul>&lt;\/body>\" >> ${WWW_DIR}\/index.php\n  echo \"&lt;\/html>\" >> ${WWW_DIR}\/index.php\n\n  if [ ${USE_PHP} = 1 ]\n  then\n    echo '&lt;?php phpinfo(); ?>' > ${WWW_DIR}\/phpinfo.php\n  fi\n}\n\nmake_working_dir() {\n  echo \"###########################################################\"\n  echo \"#\"\n  echo \"# \ub514\ud3f4\ud2b8 \uc678\uc7a5\ud558\ub4dc \ub9c8\uc6b4\ud2b8 \ub514\ub809\ud1a0\ub9ac \uc0dd\uc131\"\n  echo \"#\"\n  echo \"###########################################################\"\n\n  mkdir -p ${NEW_USER_HOME}\n  chmod 755 ${NEW_USER_HOME}\n  chown -R ${NEW_USER}:${NEW_GROUP} ${NEW_USER_HOME}\n\n  mkdir -p ${STORAGE_MOUNT_DIR}\n  chmod 755 ${STORAGE_MOUNT_DIR}\n  chown -R ${NEW_USER}:${NEW_GROUP} ${STORAGE_MOUNT_DIR}\n  mkdir ${AUTOFS_DIR}\n}\n\nset_fstab() {\n  echo \"###########################################################\"\n  echo \"#\"\n  echo \"# \uc678\uc7a5 \ud558\ub4dc\ub514\uc2a4\ud06c \ub9c8\uc6b4\ud2b8 \ub4f1\ub85d\"\n  echo \"#\"\n  echo \"###########################################################\"\n\n  mkdir -p ${STORAGE_MOUNT_DIR}\n  echo \"\" >> \/etc\/fstab\n  echo \"# Storage\" >> \/etc\/fstab\n  echo \"#\/dev\/disk\/by-id\/ata-ST4000DM004-2CV104_WFN5L8WV-part1 ${STORAGE_MOUNT_DIR} ntfs-3g defaults 0 5\" >> \/etc\/fstab\n  echo \"#\/dev\/sda1 ${STORAGE_MOUNT_DIR} ntfs-3g defaults 0 5\" >> \/etc\/fstab\n  echo \"#\/dev\/sda1 ${STORAGE_MOUNT_DIR} ext4 defaults 0 6\" >> \/etc\/fstab\n  echo \"\" >> \/etc\/fstab\n  echo \"# samba CIFS\" >> \/etc\/fstab\n  echo \"#\/\/192.168.1.10\/odroid_hc2 ${STORAGE_MOUNT_DIR} cifs _netdev,username=armbian,password=MYPASSWD,uid=1000,gid=1000,rw,iocharset=utf8 0 0\" >> \/etc\/fstab\n  echo \"#\/\/10.10.10.1\/hasu0707 ${STORAGE_MOUNT_DIR}\/hasu0707@www.esvali.com cifs _netdev,username=hasu0707,password=MYPASSWD,uid=1000,gid=1000,rw,iocharset=utf8,vers=1.0 0 0\" >> \/etc\/fstab\n  echo \"#\/\/10.10.10.2\/share ${STORAGE_MOUNT_DIR}\/share@nas.esvali.com cifs _netdev,username=share,password=MYPASSWD,uid=1000,gid=1000,rw,iocharset=utf8,vers=1.0 0 0\" >> \/etc\/fstab\n  echo \"\" >> \/etc\/fstab\n  echo \"# NFS\" >> \/etc\/fstab\n  echo \"#hasu0707.duckdns.org:${STORAGE_MOUNT_DIR} ${STORAGE_MOUNT_DIR}\/armbian@hasu0707.duckdns.org nfs defaults,_netdev 0 0\" >> \/etc\/fstab\n}\n\nset_default_mount_dir() {\n  echo \"###########################################################\"\n  echo \"#\"\n  echo \"# \uc678\uc7a5 \ud558\ub4dc\ub514\uc2a4\ud06c \uae30\ubcf8 \ub9c8\uc6b4\ud2b8 \ub514\ub809\ud1a0\ub9ac \uc0dd\uc131\"\n  echo \"#\"\n  echo \"###########################################################\"\n\n  if [ ! -d ${STORAGE_MOUNT_DIR}\/0_tmp ]\n  then\n    mkdir -p ${STORAGE_MOUNT_DIR}\n    #mkdir -p \"${STORAGE_MOUNT_DIR}\/armbian@hasu0707.duckdns.org\"\n    #mkdir -p \"${STORAGE_MOUNT_DIR}\/hasu0707@www.esvali.com\"\n    #mkdir -p \"${STORAGE_MOUNT_DIR}\/share@nas.esvali.com\"\n    chown -R ${NEW_USER}:${NEW_GROUP} ${STORAGE_MOUNT_DIR}\n  fi\n}\n\nset_samba() {\n  echo \"###########################################################\"\n  echo \"#\"\n  echo \"# samba \uc124\uc815\"\n  echo \"#\"\n  echo \"###########################################################\"\n\n  sync\n  if [ ${USE_SAMBA} = 1 ]\n  then\n    echo \"\" >> \/etc\/samba\/smb.conf\n    echo \"[global]\" >> \/etc\/samba\/smb.conf\n    echo \"netbios name = ${BOARD_NAME_SHORT}\" >> \/etc\/samba\/smb.conf\n    echo \"workgroup = WORKGROUP\" >> \/etc\/samba\/smb.conf\n    echo \"hosts allow = 127. 10.10.10. 192.168.1.\" >> \/etc\/samba\/smb.conf\n    echo \"#socket options = IPTOS_LOWDELAY SO_RCVBUF=131072 SO_SNDBUF=131072 TCP_NODELAY\" >> \/etc\/samba\/smb.conf\n    echo \"#max xmit = 16644\" >> \/etc\/samba\/smb.conf\n    echo \"#read raw = no\" >> \/etc\/samba\/smb.conf\n    echo \"#write raw = no\" >> \/etc\/samba\/smb.conf\n    echo \"log level = 0\" >> \/etc\/samba\/smb.conf\n    echo \"\" >> \/etc\/samba\/smb.conf\n    echo \"client ipc min protocol = NT1\" >> \/etc\/samba\/smb.conf\n    echo \"client ipc max protocol = SMB3\" >> \/etc\/samba\/smb.conf\n    echo \"client min protocol = NT1\" >> \/etc\/samba\/smb.conf\n    echo \"client max protocol = SMB3\" >> \/etc\/samba\/smb.conf\n    echo \"server min protocol = NT1\" >> \/etc\/samba\/smb.conf\n    echo \"server max protocol = SMB3\" >> \/etc\/samba\/smb.conf\n    echo \"\" >> \/etc\/samba\/smb.conf\n    echo \"[homes]\" >> \/etc\/samba\/smb.conf\n    echo \"   comment = Home Directories\" >> \/etc\/samba\/smb.conf\n    echo \"   browseable = no\" >> \/etc\/samba\/smb.conf\n    echo \"   writable = yes\" >> \/etc\/samba\/smb.conf\n    echo \"\" >> \/etc\/samba\/smb.conf\n    echo \"[${BOARD_NAME_SHORT}]\" >> \/etc\/samba\/smb.conf\n    echo \"   comment = ${BOARD_NAME}\" >> \/etc\/samba\/smb.conf\n    echo \"   path = ${STORAGE_MOUNT_DIR}\" >> \/etc\/samba\/smb.conf\n    echo \"   browseble = yes\" >> \/etc\/samba\/smb.conf\n    echo \"   writable = yes\" >> \/etc\/samba\/smb.conf\n    echo \"   share modes = yes\" >> \/etc\/samba\/smb.conf\n    echo \"   valid users = ${NEW_USER}\" >> \/etc\/samba\/smb.conf\n    echo \"   read only = no\" >> \/etc\/samba\/smb.conf\n    echo \"   create mode = 0660\" >> \/etc\/samba\/smb.conf\n    echo \"   directory mode = 0770\" >> \/etc\/samba\/smb.conf\n    echo \"   guest ok = no\" >> \/etc\/samba\/smb.conf\n    echo \"\" >> \/etc\/samba\/smb.conf\n    echo \"[media]\" >> \/etc\/samba\/smb.conf\n    echo \"   comment = \/media directory\" >> \/etc\/samba\/smb.conf\n    echo \"   path = \/media\" >> \/etc\/samba\/smb.conf\n    echo \"   browseble = yes\" >> \/etc\/samba\/smb.conf\n    echo \"   writable = yes\" >> \/etc\/samba\/smb.conf\n    echo \"   share modes = yes\" >> \/etc\/samba\/smb.conf\n    echo \"   valid users = ${NEW_USER}\" >> \/etc\/samba\/smb.conf\n    echo \"   read only = no\" >> \/etc\/samba\/smb.conf\n    echo \"   create mode = 0660\" >> \/etc\/samba\/smb.conf\n    echo \"   directory mode = 0770\" >> \/etc\/samba\/smb.conf\n    echo \"   guest ok = no\" >> \/etc\/samba\/smb.conf\n\n    sed -i 's\/read only = yes\/read only = no\/g' \/etc\/samba\/smb.conf\n    sed -i 's\/create mask = 0700\/create mask = 0755\/g' \/etc\/samba\/smb.conf\n    sed -i 's\/directory mask = 0700\/directory mask = 0755\/g' \/etc\/samba\/smb.conf\n    sed -i 's\/# This might need tweaking when using external authentication schemes\/   writable = yes\/g' \/etc\/samba\/smb.conf\n    mkdir -p ${STORAGE_MOUNT_DIR}\n    chown -R ${NEW_USER}:${NEW_GROUP} ${STORAGE_MOUNT_DIR}\n    chown -R ${NEW_USER}:${NEW_GROUP} \/media\n    chmod 755 ${STORAGE_MOUNT_DIR}\n    chmod 755 \/media\n\n    systemctl daemon-reload\n    systemctl enable nmbd.service\n    systemctl enable smbd.service\n  fi\n}\n\nset_dhcpd() {\n  echo \"###########################################################\"\n  echo \"#\"\n  echo \"# dhcpd \uc124\uc815\"\n  echo \"#\"\n  echo \"###########################################################\"\n\n  sync\n  echo \"ddns-update-style none;\" > \/etc\/dhcp\/dhcpd.conf\n  echo \"default-lease-time 86400;\" >> \/etc\/dhcp\/dhcpd.conf\n  echo \"max-lease-time 172800;\" >> \/etc\/dhcp\/dhcpd.conf\n  echo \"\" >> \/etc\/dhcp\/dhcpd.conf\n  echo \"subnet 192.168.1.0 netmask 255.255.255.248 {\" >> \/etc\/dhcp\/dhcpd.conf\n  echo \"  range 192.168.1.2 192.168.1.6;\" >> \/etc\/dhcp\/dhcpd.conf\n  echo \"  option domain-name \\\"local\\\";\" >> \/etc\/dhcp\/dhcpd.conf\n  echo \"  option domain-name-servers ${DNS_SERVER1}, ${DNS_SERVER2};\" >> \/etc\/dhcp\/dhcpd.conf\n  echo \"  option subnet-mask 255.255.255.248;\" >> \/etc\/dhcp\/dhcpd.conf\n  echo \"  option routers 192.168.1.1;\" >> \/etc\/dhcp\/dhcpd.conf\n  echo \"  option broadcast-address 192.168.1.7;\" >> \/etc\/dhcp\/dhcpd.conf\n  echo \"  default-lease-time 86400;\" >> \/etc\/dhcp\/dhcpd.conf\n  echo \"  max-lease-time 172800;\" >> \/etc\/dhcp\/dhcpd.conf\n  echo \"}\" >> \/etc\/dhcp\/dhcpd.conf\n}\n\nset_vsftpd() {\n  echo \"###########################################################\"\n  echo \"#\"\n  echo \"# vsftpd \uc124\uc815\"\n  echo \"#\"\n  echo \"###########################################################\"\n\n  if [ ${USE_VSFTPD} = 1 ]\n  then\n    echo \"allow_writeable_chroot=YES\" >> \/etc\/vsftpd.conf\n    echo \"anon_mkdir_write_enable=NO\" >> \/etc\/vsftpd.conf\n    echo \"anon_upload_enable=NO\" >> \/etc\/vsftpd.conf\n    echo \"anonymous_enable=NO\" >> \/etc\/vsftpd.conf\n    echo \"chroot_local_user=YES\" >> \/etc\/vsftpd.conf\n    echo \"file_open_mode=0644\" >> \/etc\/vsftpd.conf\n    echo \"force_dot_files=NO\" >> \/etc\/vsftpd.conf\n    echo \"listen=YES\" >> \/etc\/vsftpd.conf\n    echo \"listen_ipv6=NO\" >> \/etc\/vsftpd.conf\n    echo \"local_enable=YES\" >> \/etc\/vsftpd.conf\n    echo \"local_umask=0002\" >> \/etc\/vsftpd.conf\n    echo \"write_enable=YES\" >> \/etc\/vsftpd.conf\n    echo  >> \/etc\/vsftpd.conf\n    echo \"# Passive Mode\" >> \/etc\/vsftpd.conf\n    echo \"pasv_enable=YES\" >> \/etc\/vsftpd.conf\n    echo \"pasv_min_port=5500\" >> \/etc\/vsftpd.conf\n    echo \"pasv_max_port=5532\" >> \/etc\/vsftpd.conf\n    echo  >> \/etc\/vsftpd.conf\n    echo \"# Setup the virtual users config folder\" >> \/etc\/vsftpd.conf\n    echo \"user_config_dir=\/etc\/vsftpd\/user_config_dir\/\" >> \/etc\/vsftpd.conf\n    mkdir -p \/etc\/vsftpd\/user_config_dir\n    echo \"local_root=${STORAGE_MOUNT_DIR}\" > \/etc\/vsftpd\/user_config_dir\/${NEW_USER}\n    echo \"write_enable=YES\" >> \/etc\/vsftpd\/user_config_dir\/${NEW_USER}\n    systemctl daemon-reload\n    systemctl enable vsftpd.service\n    echo \"nf_conntrack_ftp\" >> \/etc\/modules\n  fi\n}\n\nset_apache2() {\n  echo \"###########################################################\"\n  echo \"#\"\n  echo \"# apache2 \uc124\uc815\"\n  echo \"#\"\n  echo \"###########################################################\"\n\n  if [ ${USE_APACHE2} = 1 ]\n  then\n    echo \"\" >> \/etc\/apache2\/apache2.conf\n    echo \"IndexOptions IgnoreCase FancyIndexing FoldersFirst NameWidth=* DescriptionWidth=* SuppressHTMLPreamble\" >> \/etc\/apache2\/apache2.conf\n    echo \"# opizero2\uc5d0\uc11c Mutex \uc635\uc158\uc774 \uc5c6\uc73c\uba74 \uc791\ub3d9\ud558\uc9c0 \uc54a\ub294\ub2e4.\" >> \/etc\/apache2\/apache2.conf\n    echo \"Mutex posixsem\" >> \/etc\/apache2\/apache2.conf\n\n    # \ud3ec\ud2b8 \ubcc0\uacbd \ubc0f \ucd94\uac00\n    sed -i \"s\/Listen 80\/Listen ${HTTP_PORT}\/g\" \/etc\/apache2\/ports.conf\n    if [ ${USE_WEBDAV} = 1 ]\n    then\n      echo \"Listen ${WEBDAV_PORT}\" >> \/etc\/apache2\/ports.conf\n    fi\n\n    # \/etc\/apache2\/sites-available\/${MY_SITE}-webdav.conf\n    if [ ${USE_WEBDAV} = 1 ]\n    then\n      echo \"DavLockDB ${NEW_USER_HOME}\/DavLock\" > \/etc\/apache2\/sites-available\/${MY_SITE}-webdav.conf\n      echo \"&lt;VirtualHost _default_:${WEBDAV_PORT}>\" >> \/etc\/apache2\/sites-available\/${MY_SITE}-webdav.conf\n      echo \"  ServerAdmin ${NEW_USER}@localhost\" >> \/etc\/apache2\/sites-available\/${MY_SITE}-webdav.conf\n      echo \"  DocumentRoot \\\"${STORAGE_MOUNT_DIR}\\\"\" >> \/etc\/apache2\/sites-available\/${MY_SITE}-webdav.conf\n      echo \"  ErrorLog \\${APACHE_LOG_DIR}\/webdav_error.log\" >> \/etc\/apache2\/sites-available\/${MY_SITE}-webdav.conf\n      echo \"  CustomLog \\${APACHE_LOG_DIR}\/webdav_access.log combined\" >> \/etc\/apache2\/sites-available\/${MY_SITE}-webdav.conf\n      echo \"  Alias \/webdav ${STORAGE_MOUNT_DIR}\" >> \/etc\/apache2\/sites-available\/${MY_SITE}-webdav.conf\n      echo \"  &lt;Directory \\\"${STORAGE_MOUNT_DIR}\\\">\" >> \/etc\/apache2\/sites-available\/${MY_SITE}-webdav.conf\n      echo \"    DAV On\" >> \/etc\/apache2\/sites-available\/${MY_SITE}-webdav.conf\n      echo \"    Options Indexes FollowSymLinks MultiViews\" >> \/etc\/apache2\/sites-available\/${MY_SITE}-webdav.conf\n      echo \"    AuthType Digest\" >> \/etc\/apache2\/sites-available\/${MY_SITE}-webdav.conf\n      echo \"    AuthName webdav\" >> \/etc\/apache2\/sites-available\/${MY_SITE}-webdav.conf\n      echo \"    AuthUserFile \/etc\/apache2\/users.password\" >> \/etc\/apache2\/sites-available\/${MY_SITE}-webdav.conf\n      echo \"    Require valid-user\" >> \/etc\/apache2\/sites-available\/${MY_SITE}-webdav.conf\n      echo \"  &lt;\/Directory>\" >> \/etc\/apache2\/sites-available\/${MY_SITE}-webdav.conf\n      echo \"  # SSL\" >> \/etc\/apache2\/sites-available\/${MY_SITE}-webdav.conf\n      echo \"  SSLEngine on\" >> \/etc\/apache2\/sites-available\/${MY_SITE}-webdav.conf\n\n      if [ ${USE_LETSENCRYPT} = 1 ]\n      then\n        echo \"  SSLCertificateFile \/etc\/letsencrypt\/live\/${LETSENCRYPT_DOMAIN}\/cert.pem\" >> \/etc\/apache2\/sites-available\/${MY_SITE}-webdav.conf\n        echo \"  SSLCertificateKeyFile \/etc\/letsencrypt\/live\/${LETSENCRYPT_DOMAIN}\/privkey.pem\" >> \/etc\/apache2\/sites-available\/${MY_SITE}-webdav.conf\n        echo \"  SSLCertificateChainFile \/etc\/letsencrypt\/live\/${LETSENCRYPT_DOMAIN}\/chain.pem\" >> \/etc\/apache2\/sites-available\/${MY_SITE}-webdav.conf\n      else\n        echo \"  SSLCertificateFile  \/etc\/apache2\/ssl\/certs\/ssl-cert-${MY_SITE}.crt\" >> \/etc\/apache2\/sites-available\/${MY_SITE}-webdav.conf\n        echo \"  SSLCertificateKeyFile \/etc\/apache2\/ssl\/private\/ssl-cert-${MY_SITE}.key\" >> \/etc\/apache2\/sites-available\/${MY_SITE}-webdav.conf\n      fi\n\n      echo \"  SSLOptions +FakeBasicAuth +ExportCertData +StrictRequire\" >> \/etc\/apache2\/sites-available\/${MY_SITE}-webdav.conf\n      echo \"  &lt;FilesMatch \\\"\\\\.(cgi|shtml|phtml|php)\\$\\\">\" >> \/etc\/apache2\/sites-available\/${MY_SITE}-webdav.conf\n      echo \"    SSLOptions +StdEnvVars\" >> \/etc\/apache2\/sites-available\/${MY_SITE}-webdav.conf\n      echo \"  &lt;\/FilesMatch>\" >> \/etc\/apache2\/sites-available\/${MY_SITE}-webdav.conf\n      echo \"  &lt;Directory \/usr\/lib\/cgi-bin>\" >> \/etc\/apache2\/sites-available\/${MY_SITE}-webdav.conf\n      echo \"    SSLOptions +StdEnvVars\" >> \/etc\/apache2\/sites-available\/${MY_SITE}-webdav.conf\n      echo \"  &lt;\/Directory>\" >> \/etc\/apache2\/sites-available\/${MY_SITE}-webdav.conf\n      echo \"&lt;\/VirtualHost>\" >> \/etc\/apache2\/sites-available\/${MY_SITE}-webdav.conf\n      a2ensite ${MY_SITE}-webdav\n    fi\n\n    # \/etc\/apache2\/sites-available\/${MY_SITE}-http.conf\n    echo \"&lt;VirtualHost _default_:80>\" > \/etc\/apache2\/sites-available\/${MY_SITE}-http.conf\n    echo \"  ServerAdmin ${NEW_USER}@localhost\" >> \/etc\/apache2\/sites-available\/${MY_SITE}-http.conf\n    echo \"  DocumentRoot \\\"${WWW_DIR}\\\"\" >> \/etc\/apache2\/sites-available\/${MY_SITE}-http.conf\n    echo \"  ErrorLog \\${APACHE_LOG_DIR}\/error.log\" >> \/etc\/apache2\/sites-available\/${MY_SITE}-http.conf\n    echo \"  CustomLog \\${APACHE_LOG_DIR}\/access.log combined\" >> \/etc\/apache2\/sites-available\/${MY_SITE}-http.conf\n    echo \"  &lt;Directory \\\"${WWW_DIR}\\\">\" >> \/etc\/apache2\/sites-available\/${MY_SITE}-http.conf\n    echo \"    Options Indexes FollowSymLinks MultiViews ExecCGI\" >> \/etc\/apache2\/sites-available\/${MY_SITE}-http.conf\n    echo \"    AllowOverride FileInfo AuthConfig Limit\" >> \/etc\/apache2\/sites-available\/${MY_SITE}-http.conf\n    echo \"    Order Deny,Allow\" >> \/etc\/apache2\/sites-available\/${MY_SITE}-http.conf\n    echo \"    Allow from all\" >> \/etc\/apache2\/sites-available\/${MY_SITE}-http.conf\n    echo \"    Require all granted\" >> \/etc\/apache2\/sites-available\/${MY_SITE}-http.conf\n    echo \"  &lt;\/Directory>\" >> \/etc\/apache2\/sites-available\/${MY_SITE}-http.conf\n    echo \"&lt;\/VirtualHost>\" >> \/etc\/apache2\/sites-available\/${MY_SITE}-http.conf\n    a2dissite 000-default\n    a2ensite ${MY_SITE}-http\n\n    # \/etc\/apache2\/sites-available\/${MY_SITE}-https.conf\n    echo \"&lt;IfModule mod_ssl.c>\" > \/etc\/apache2\/sites-available\/${MY_SITE}-https.conf\n    echo \"  &lt;VirtualHost _default_:443>\" >> \/etc\/apache2\/sites-available\/${MY_SITE}-https.conf\n    echo \"    ServerAdmin ${NEW_USER}@localhost\" >> \/etc\/apache2\/sites-available\/${MY_SITE}-https.conf\n    echo \"    DocumentRoot \\\"${WWW_DIR}\\\"\" >> \/etc\/apache2\/sites-available\/${MY_SITE}-https.conf\n    echo \"    ErrorLog \\${APACHE_LOG_DIR}\/error.log\" >> \/etc\/apache2\/sites-available\/${MY_SITE}-https.conf\n    echo \"    CustomLog \\${APACHE_LOG_DIR}\/access.log combined\" >> \/etc\/apache2\/sites-available\/${MY_SITE}-https.conf\n    echo \"    &lt;Directory \\\"${WWW_DIR}\\\">\" >> \/etc\/apache2\/sites-available\/${MY_SITE}-https.conf\n    echo \"      Options Indexes FollowSymLinks MultiViews ExecCGI\" >> \/etc\/apache2\/sites-available\/${MY_SITE}-https.conf\n    echo \"      AllowOverride FileInfo AuthConfig Limit\" >> \/etc\/apache2\/sites-available\/${MY_SITE}-https.conf\n    echo \"      Order Deny,Allow\" >> \/etc\/apache2\/sites-available\/${MY_SITE}-https.conf\n    echo \"      Allow from all\" >> \/etc\/apache2\/sites-available\/${MY_SITE}-https.conf\n    echo \"      Require all granted\" >> \/etc\/apache2\/sites-available\/${MY_SITE}-https.conf\n    echo \"    &lt;\/Directory>\" >> \/etc\/apache2\/sites-available\/${MY_SITE}-https.conf\n    echo \"    SSLEngine on\" >> \/etc\/apache2\/sites-available\/${MY_SITE}-https.conf\n    if [ ${USE_LETSENCRYPT} = 1 ]\n    then\n      echo \"    SSLCertificateFile \/etc\/letsencrypt\/live\/${LETSENCRYPT_DOMAIN}\/cert.pem\" >> \/etc\/apache2\/sites-available\/${MY_SITE}-https.conf\n      echo \"    SSLCertificateKeyFile \/etc\/letsencrypt\/live\/${LETSENCRYPT_DOMAIN}\/privkey.pem\" >> \/etc\/apache2\/sites-available\/${MY_SITE}-https.conf\n      echo \"    SSLCertificateChainFile \/etc\/letsencrypt\/live\/${LETSENCRYPT_DOMAIN}\/chain.pem\" >> \/etc\/apache2\/sites-available\/${MY_SITE}-https.conf\n    else\n      echo \"    SSLCertificateFile  \/etc\/apache2\/ssl\/certs\/ssl-cert-${MY_SITE}.crt\" >> \/etc\/apache2\/sites-available\/${MY_SITE}-https.conf\n      echo \"    SSLCertificateKeyFile \/etc\/apache2\/ssl\/private\/ssl-cert-${MY_SITE}.key\" >> \/etc\/apache2\/sites-available\/${MY_SITE}-https.conf\n    fi\n    echo \"    &lt;FilesMatch \\\"\\\\.(cgi|shtml|phtml|php)\\$\\\">\" >> \/etc\/apache2\/sites-available\/${MY_SITE}-https.conf\n    echo \"      SSLOptions +StdEnvVars\" >> \/etc\/apache2\/sites-available\/${MY_SITE}-https.conf\n    echo \"    &lt;\/FilesMatch>\" >> \/etc\/apache2\/sites-available\/${MY_SITE}-https.conf\n    echo \"    &lt;Directory \/usr\/lib\/cgi-bin>\" >> \/etc\/apache2\/sites-available\/${MY_SITE}-https.conf\n    echo \"      SSLOptions +StdEnvVars\" >> \/etc\/apache2\/sites-available\/${MY_SITE}-https.conf\n    echo \"    &lt;\/Directory>\" >> \/etc\/apache2\/sites-available\/${MY_SITE}-https.conf\n    echo \"  &lt;\/VirtualHost>\" >> \/etc\/apache2\/sites-available\/${MY_SITE}-https.conf\n    echo \"&lt;\/IfModule>\" >> \/etc\/apache2\/sites-available\/${MY_SITE}-https.conf\n    a2dissite default-ssl\n    a2ensite ${MY_SITE}-https\n\n    sed -i \"s\/ServerName\/#ServerName\/g\" \/etc\/apache2\/apache2.conf\n    echo \"\" >> \/etc\/apache2\/apache2.conf\n    if [ ${USE_LETSENCRYPT} = 1 ]\n    then\n      echo \"ServerName ${LETSENCRYPT_DOMAIN}\" >> \/etc\/apache2\/apache2.conf\n    else\n      echo \"ServerName localhost\" >> \/etc\/apache2\/apache2.conf\n    fi\n\n    chown -R www-data:www-data ${WWW_DIR}\n    chown www-data:www-data \/etc\/apache2\/users.password\n  fi\n}\n\nset_letsencrypt() {\n  echo \"###########################################################\"\n  echo \"#\"\n  echo \"# Let's encrypt \uc124\uc815\ud30c\uc77c \uc0dd\uc131\"\n  echo \"#\"\n  echo \"###########################################################\"\n\n  if [ ${USE_LETSENCRYPT} = 1 ]\n  then\n    echo \"archive_dir = \/etc\/letsencrypt\/archive\/${LETSENCRYPT_DOMAIN}\" > \/etc\/letsencrypt\/renewal\/${LETSENCRYPT_DOMAIN}.conf\n    echo \"cert = \/etc\/letsencrypt\/live\/${LETSENCRYPT_DOMAIN}\/cert.pem\" >> \/etc\/letsencrypt\/renewal\/${LETSENCRYPT_DOMAIN}.conf\n    echo \"privkey = \/etc\/letsencrypt\/live\/${LETSENCRYPT_DOMAIN}\/privkey.pem\" >> \/etc\/letsencrypt\/renewal\/${LETSENCRYPT_DOMAIN}.conf\n    echo \"chain = \/etc\/letsencrypt\/live\/${LETSENCRYPT_DOMAIN}\/chain.pem\" >> \/etc\/letsencrypt\/renewal\/${LETSENCRYPT_DOMAIN}.conf\n    echo \"fullchain = \/etc\/letsencrypt\/live\/${LETSENCRYPT_DOMAIN}\/fullchain.pem\" >> \/etc\/letsencrypt\/renewal\/${LETSENCRYPT_DOMAIN}.conf\n  fi\n}\n\nset_timezone_locale() {\n  echo \"###########################################################\"\n  echo \"#\"\n  echo \"# timezone &amp; locale\"\n  echo \"#\"\n  echo \"###########################################################\"\n\n  ${APTCMD} -y install language-pack-ko\n  locale-gen ko_KR.UTF-8\n  update-locale LC_ALL=\"ko_KR.UTF-8\" LANG=\"ko_KR.UTF-8\" LANGUAGE=\"ko_KR:ko:en_US:en\" LC_MESSAGES=\"POSIX\"\n  timedatectl set-timezone \"Asia\/Seoul\"\n}\n\nset_sshd() {\n  echo \"###########################################################\"\n  echo \"#\"\n  echo \"# \/etc\/ssh\/sshd_config \uc218\uc815\"\n  echo \"#\"\n  echo \"###########################################################\"\n\n  sed -i \"s\/PermitRootLogin without-password\/PermitRootLogin yes\/g\" \/etc\/ssh\/sshd_config\n}\n\nset_os_default_systemd() {\n  echo \"###########################################################\"\n  echo \"#\"\n  echo \"# \ubd88\ud544\uc694\ud55c \uc11c\ube44\uc2a4 \uc81c\uac70\"\n  echo \"#\"\n  echo \"# enable \ub418\uc5b4\uc788\ub294 \uc11c\ube44\uc2a4 \ubcf4\uae30\"\n  echo \"# ls -1 \/etc\/rc\\$(runlevel| cut -d\\\" \\\" -f2).d\/S* | awk -F'[0-9][0-9]' '{print \\\"Startup :-> \\\" \\$2}'\"\n  echo \"# systemctl -t service -a\"\n  echo \"# systemctl list-unit-files\"\n  echo \"#\"\n  echo \"###########################################################\"\n\n  cd ${CURRENT_DIR}\n\n  # rc.local \ud65c\uc131\ud654\n  echo \"\" >> \/lib\/systemd\/system\/rc-local.service\n  echo \"[Install]\" >> \/lib\/systemd\/system\/rc-local.service\n  echo \"WantedBy=multi-user.target\" >> \/lib\/systemd\/system\/rc-local.service\n\n  systemctl daemon-reload\n  systemctl disable acpid.service\n  systemctl disable alsa-utils.service\n  systemctl disable ${NEW_USER}-hardware-monitor.service\n  systemctl disable ${NEW_USER}-ramlog.service\n  systemctl disable avahi-daemon.service\n  systemctl disable bluetooth.service\n  systemctl disable hddtemp.service\n  systemctl disable hostapd.service\n  systemctl disable isc-dhcp-server.service\n  systemctl disable isc-dhcp-server6.service\n  systemctl disable pppd-dns.service\n  systemctl disable rsync.service\n  systemctl disable samba-ad-dc.service\n  systemctl disable sysstat.service\n  systemctl disable udhcpd.service\n  systemctl disable ureadahead.service\n  systemctl enable  cron.service\n  systemctl enable  dbus.service\n  systemctl enable  rc-local.service\n  systemctl enable  resolvconf.service\n  systemctl enable  rsyslog.service\n  systemctl enable  ssh.service\n  systemctl daemon-reload\n}\n\nset_ntpd() {\n  echo \"###########################################################\"\n  echo \"#\"\n  echo \"# ntp \uc11c\ube44\uc2a4 \uc124\uc815\"\n  echo \"#\"\n  echo \"###########################################################\"\n\n  sed -i \"s\/0.ubuntu.pool.ntp.org\/3.kr.pool.ntp.org\/g\" \/etc\/ntp.conf\n  sed -i \"s\/1.ubuntu.pool.ntp.org\/0.asia.pool.ntp.org\/g\" \/etc\/ntp.conf\n  sed -i \"s\/2.ubuntu.pool.ntp.org\/3.asia.pool.ntp.org\/g\" \/etc\/ntp.conf\n  sed -i \"s\/3.ubuntu.pool.ntp.org\/1.kr.pool.ntp.org\/g\" \/etc\/ntp.conf\n  systemctl daemon-reload\n  systemctl enable ntp.service\n}\n\nset_eth0_device_name() {\n  echo \"###########################################################\"\n  echo \"#\"\n  echo \"# \uc774\ub354\ub137 \uc778\ud130\ud398\uc774\uc2a4 \uba85\uc744 eth0\ub85c \ubc14\uafbc\ub2e4.\"\n  echo \"#\"\n  echo \"###########################################################\"\n\n  # ODROID-HC2 (enx*602)\n  if [[ ${BOARD_NAME_SHORT} = \"odroid_hc2\" ]]\n  then\n    echo \"SUBSYSTEM==\\\"net\\\", ACTION==\\\"add\\\", DRIVERS==\\\"?*\\\", ATTR{dev_id}==\\\"0x0\\\", ATTR{type}==\\\"1\\\", KERNEL==\\\"eth*|enx*\\\", NAME=\\\"eth0\\\"\" >  \/lib\/udev\/rules.d\/70-persistent-net.rules\n  fi\n}\n\nset_board_name() {\n  echo \"###########################################################\"\n  echo \"#\"\n  echo \"# Login ASCII Art\ub97c \ubcc0\uacbd\ud558\uae30 \uc704\ud574 \ubcf4\ub4dc\uba85\uc744 \uc218\uc815\ud55c\ub2e4.\"\n  echo \"#\"\n  echo \"###########################################################\"\n\n  sed -i \"s\/BOARD_NAME=\/#BOARD_NAME=\/g\" \/etc\/${NEW_USER}-release\n  echo \"BOARD_NAME=\\\"${BOARD_NAME}\\\"\" >> \/etc\/${NEW_USER}-release\n}\n\nset_usb_device_name() {\n  echo \"###########################################################\"\n  echo \"#\"\n  echo \"# USB \ub124\ud2b8\uc6cc\ud06c \uc778\ud130\ud398\uc774\uc2a4 \uc774\ub984\ubcc0\uacbd \uae08\uc9c0\"\n  echo \"#\"\n  echo \"###########################################################\"\n\n  mv \/lib\/udev\/rules.d\/73-usb-net-by-mac.rules \/lib\/udev\/rules.d\/73-usb-net-by-mac.rules.no_run\n}\n\nset_hostname() {\n  echo \"###########################################################\"\n  echo \"#\"\n  echo \"# \ud638\uc2a4\ud2b8\uba85 \uc124\uc815\"\n  echo \"#\"\n  echo \"###########################################################\"\n\n  echo \"${BOARD_NAME_SHORT}\" >  \/etc\/hostname\n}\n\nset_insserv() {\n  echo \"###########################################################\"\n  echo \"#\"\n  echo \"# insserv\ub97c \/usr\/bin\uc73c\ub85c \ubcf5\uc0ac\"\n  echo \"#\"\n  echo \"###########################################################\"\n\n  cp -f \/usr\/lib\/insserv\/insserv \/usr\/bin\n}\n\nset_mount_opt() {\n  echo \"###########################################################\"\n  echo \"#\"\n  echo \"# \ub9c8\uc6b4\ud2b8 \uc635\uc158 \ubcc0\uacbd\"\n  echo \"#\"\n  echo \"###########################################################\"\n\n  sed -i \"s\/noatime,nodiratime,commit=600,\/sync,dirsync,\/g\" \/etc\/fstab\n}\n\nresize_partition() {\n  echo \"###########################################################\"\n  echo \"#\"\n  echo \"# Resize Partition\"\n  echo \"#\"\n  echo \"###########################################################\"\n\n  cd ${CURRENT_DIR}\n  systemctl enable resize2fs\n  update-rc.d resize2fs defaults\n}\n\nclean_tmps() {\n  cd ${CURRENT_DIR}\n  echo \"###########################################################\"\n  echo \"#\"\n  echo \"# \ubd88\ud544\uc694\ud55c \ud30c\uc77c\ub4e4 \uc0ad\uc81c\"\n  echo \"#\"\n  echo \"###########################################################\"\n\n  deb_clean\n  rm -f \/var\/log\/*.gz\n  rm -f \/var\/log\/*.log.*\n  rm -f \/var\/log\/*log\n  rm -f \/var\/log\/syslog\n  rm -f \/var\/swap\n  rm -rf \/tmp\/*\n\n  rm -f \/var\/log\/xrdp*\n  touch \/var\/log\/xrdp.log\n  chown xrdp:adm \/var\/log\/xrdp.log\n  chmod 640 \/var\/log\/xrdp.log\n  sync\n}\n\nset_inittab() {\n  echo \"###########################################################\"\n  echo \"#\"\n  echo \"# \ucd08\uae30 \ubd80\ud305\ubaa8\ub4dc \uc124\uc815 (inittab 3 or 5 ?)\"\n  echo \"#\"\n  echo \"###########################################################\"\n\n  cd ${CURRENT_DIR}\n  systemctl disable lightdm.service\n  systemctl set-default multi-user.target\n}\n\nset_rclocal() {\n  echo \"###########################################################\"\n  echo \"#\"\n  echo \"# rc.local \uc14b\ud305\"\n  echo \"#\"\n  echo \"###########################################################\"\n\n  cd ${CURRENT_DIR}\n  grep \"firewall_${BOARD_NAME_SHORT}.sh\" \/etc\/rc.local > \/dev\/null\n  if [ $? -ne 0 ]\n  then\n    sed -i \"\/exit 0\/d\" \/etc\/rc.local\n\n    echo \"###########################################################\" >> \/etc\/rc.local\n    echo \"#\" >> \/etc\/rc.local\n    echo \"# Run Firewall Script\" >> \/etc\/rc.local\n    echo \"#\" >> \/etc\/rc.local\n    echo \"###########################################################\" >> \/etc\/rc.local\n    echo \"if [ -f \/root\/scripts\/firewall_${BOARD_NAME_SHORT}.sh ]; then\" >> \/etc\/rc.local\n    echo \"  \/root\/scripts\/firewall_${BOARD_NAME_SHORT}.sh start\" >> \/etc\/rc.local\n    echo \"fi\" >> \/etc\/rc.local\n    echo \"\" >> \/etc\/rc.local\n    echo \"# Enable Wifi Device\" >> \/etc\/rc.local\n    echo \"#\/usr\/sbin\/rfkill unblock all\" >> \/etc\/rc.local\n    echo \"#\/usr\/sbin\/ifup wlan0\" >> \/etc\/rc.local\n    echo \"\" >> \/etc\/rc.local\n    echo \"exit 0\" >> \/etc\/rc.local\n  else\n    echo \"\uc774\ubbf8 \ud3b8\uc9d1 \ub418\uc5c8\uc2b5\ub2c8\ub2e4.\"\n  fi\n}\n\nset_apache2_ssl() {\n  cd ${CURRENT_DIR}\n\n  echo \"###########################################################\"\n  echo \"#\"\n  echo \"# apache2\uc758 80\ud3ec\ud2b8\ub97c disable \ud558\uace0 SSL\uc744 \uc801\uc6a9\ud55c\ub2e4.\"\n  echo \"#\"\n  echo \"###########################################################\"\n\n  echo \"######################################################################\"\n  echo \"# apache SSL \ucd08\uae30\ud654\"\n  echo \"######################################################################\"\n  rm -rf \/etc\/apache2\/ssl\/*\n\n  echo \"######################################################################\"\n  echo \"# ntpdate \uc2dc\uac04 \ub3d9\uae30\ud654\"\n  echo \"######################################################################\"\n  ntpdate -v kr.pool.ntp.org\n\n  echo \"######################################################################\"\n  echo \"# 32\ubc14\uc774\ud2b8\uc9dc\ub9ac \ub79c\ub364 \ud30c\uc77c \uc0dd\uc131\"\n  echo \"######################################################################\"\n  head -c 32 &lt; \/dev\/random > ~\/.rnd\n\n  echo \"######################################################################\"\n  echo \"# \uac1c\uc778\ud0a4\ub97c \uc0dd\uc131\ud55c\ub2e4.\"\n  echo \"# (\uc0dd\uc131 \uc2dc \ud574\ub2f9 \ud0a4\uc758 \ube44\ubc00\ubc88\ud638\ub97c 2\ubc88 \uc785\ub825\ud574 \uc900\ub2e4)\"\n  echo \"######################################################################\"\n  openssl genrsa -des3 -out ssl-cert-${MY_SITE}.key 2048\n\n  echo \"######################################################################\"\n  echo \"# \uc11c\ubc84 \uc778\uc99d\uc11c \ubc1c\uae09\uc744 \uc704\ud55c \uc694\uccad \ud30c\uc77c\uc778\"\n  echo \"# CSR(Certificate Sinning Request-\uc778\uc99d\uc11c \uc11c\uba85 \uc694\uccad)\uc744 \uc0dd\uc131\"\n  echo \"# (\uac1c\uc778\ud0a4\uc758 \ube44\ubc00\ubc88\ud638\ub97c \uc785\ub825\ud55c\ub2e4)\"\n  echo \"######################################################################\"\n  openssl req -new -days 18250 -key ssl-cert-${MY_SITE}.key -out ssl-cert-${MY_SITE}.csr -subj \"\/C=KR\/ST=Seoul\/L=Guro-gu\/O=My Office\/OU=Web Server\/CN=${MY_SITE}\"\n\n  echo \"######################################################################\"\n  echo \"# \ud3b8\uc758\ub97c \uc704\ud574 \uac1c\uc778\ud0a4 \uc554\ud638 \uc81c\uac70\"\n  echo \"# (\uac1c\uc778\ud0a4\uc758 \ube44\ubc00\ubc88\ud638\ub97c \uc785\ub825\ud55c\ub2e4)\"\n  echo \"######################################################################\"\n  cp -fv ssl-cert-${MY_SITE}.key ssl-cert-${MY_SITE}.key.orig\n  openssl rsa -in ssl-cert-${MY_SITE}.key.orig -out ssl-cert-${MY_SITE}.key\n\n  echo \"######################################################################\"\n  echo \"# \uc11c\ubc84 \uac1c\uc778\ud0a4\uc640 CSR\uc744 \uc0ac\uc6a9\ud574\uc11c \uc778\uc99d\uc11c\uc5d0 \uc11c\uba85\"\n  echo \"######################################################################\"\n  openssl x509 -req -days 18250 -in ssl-cert-${MY_SITE}.csr -signkey ssl-cert-${MY_SITE}.key -out ssl-cert-${MY_SITE}.crt\n\n  mkdir -p \/etc\/apache2\/ssl\/private\n  mkdir -p \/etc\/apache2\/ssl\/certs\n  mv -fv ${CURRENT_DIR}\/ssl-cert-${MY_SITE}.key* \/etc\/apache2\/ssl\/private\/\n  mv -fv ${CURRENT_DIR}\/ssl-cert-${MY_SITE}.crt \/etc\/apache2\/ssl\/certs\/\n  mv -fv ${CURRENT_DIR}\/ssl-cert-${MY_SITE}.csr \/etc\/apache2\/ssl\/certs\/\n}\n\nset_sshd_ciphers() {\n  clear\n  cd ${CURRENT_DIR}\n  echo \"###########################################################\"\n  echo \"#\"\n  echo \"# sshd \uc554\ud638\ud654 \uc54c\uace0\ub9ac\uc998 \ub0ae\uc740 \ubcf4\uc548\uc218\uc900\uc73c\ub85c \ubcc0\uacbd\"\n  echo \"#\"\n  echo \"###########################################################\"\n  echo \"HostKeyAlgorithms ssh-dss,ssh-rsa\" > \/etc\/ssh\/sshd_config.d\/lowlevel_ciphers.conf\n  echo \"KexAlgorithms diffie-hellman-group-exchange-sha1,diffie-hellman-group1-sha1\" >> \/etc\/ssh\/sshd_config.d\/lowlevel_ciphers.conf\n}\n\nset_passwords() {\n  clear\n  cd ${CURRENT_DIR}\n  echo \"###########################################################\"\n  echo \"#\"\n  echo \"# \ud328\uc2a4\uc6cc\ub4dc \uc124\uc815\"\n  echo \"#\"\n  echo \"###########################################################\"\n\n  rm -f \/etc\/apache2\/users.password\n  if [ ${USE_WEBDAV} = 1 ]\n  then\n    echo \"###########################################################\"\n    echo \"#\"\n    echo \"# ENTER WEBDAV PASSWORD (USER:${NEW_USER})\"\n    echo \"#\"\n    echo \"###########################################################\"\n    htdigest -c \/etc\/apache2\/users.password webdav ${NEW_USER}\n    chown www-data:www-data \/etc\/apache2\/users.password\n  fi\n\n  if [ ${USE_SAMBA} = 1 ]\n  then\n    echo \"###########################################################\"\n    echo \"#\"\n    echo \"# ENTER SAMBA PASSWORD (USER:${NEW_USER})\"\n    echo \"#\"\n    echo \"###########################################################\"\n    smbpasswd -a ${NEW_USER}\n  fi\n\n  if [ ${USE_VNC_SERVER} = 1 ]\n  then\n    echo \"###########################################################\"\n    echo \"#\"\n    echo \"# ENTER vncserver PASSWORD (vncserver :1)\"\n    echo \"#\"\n    echo \"###########################################################\"\n    su - -c \/usr\/bin\/vncpasswd ${NEW_USER}\n  fi\n\n  if [ ${USE_TRANSMISSION} = 1 ]\n  then\n    systemctl stop transmission-daemon\n    echo \"###########################################################\"\n    echo \"#\"\n    echo \"# ENTER transmission-daemon PASSWORD\"\n    echo \"# ${NEW_USER_HOME}\/.config\/transmission-daemon\/settings.json\"\n    echo \"#\"\n    echo \"###########################################################\"\n    echo -n \"NEW PASSWORD: \"\n    read TRANSMISSIONPW\n    sed -i '\/\\\"rpc-password\\\":\/d' ${NEW_USER_HOME}\/.config\/transmission-daemon\/settings.json\n    sed -i \"s\/}\/    ,\\\"rpc-password\\\": \\\"${TRANSMISSIONPW}\\\"\\n}\/g\" ${NEW_USER_HOME}\/.config\/transmission-daemon\/settings.json\n  fi\n\n  mkdir -p \/var\/log\/apache2\n  chown ${NEW_USER}:${NEW_GROUP} \/var\/log\/apache2\n}\n\nset_keyboard_layout() {\n  echo \"###########################################################\"\n  echo \"#\"\n  echo \"# \ud0a4\ubcf4\ub4dc \ub808\uc774\uc544\uc6c3 \uc124\uc815\"\n  echo \"#\"\n  echo \"###########################################################\"\n\n  sed -i \"s\/XKBMODEL\/#XKBMODEL\/g\" \/etc\/default\/keyboard\n  sed -i \"s\/XKBLAYOUT\/#XKBLAYOUT\/g\" \/etc\/default\/keyboard\n  sed -i \"s\/XKBVARIANT\/#XKBVARIANT\/g\" \/etc\/default\/keyboard\n  sed -i \"s\/XKBOPTIONS\/#XKBOPTIONS\/g\" \/etc\/default\/keyboard\n  sed -i \"s\/BACKSPACE\/#BACKSPACE\/g\" \/etc\/default\/keyboard\n  echo \"\" >> \/etc\/default\/keyboard\n  echo 'XKBMODEL=\"pc105\"' >> \/etc\/default\/keyboard\n  echo 'XKBLAYOUT=\"kr(kr104)\"' >> \/etc\/default\/keyboard\n  echo 'XKBVARIANT=\"\"' >> \/etc\/default\/keyboard\n  echo 'XKBOPTIONS=\"\"' >> \/etc\/default\/keyboard\n\n  dpkg-reconfigure keyboard-configuration\n}\n\nset_optimize_systemd() {\n  echo \"###########################################################\"\n  echo \"#\"\n  echo \"# \ubcf4\ub4dc \uc6a9\ub3c4\uc5d0 \ub9de\uac8c systemd \uc11c\ube44\uc2a4 \uc14b\ud305\"\n  echo \"#\"\n  echo \"###########################################################\"\n\n  cd ${CURRENT_DIR}\n\n  systemctl daemon-reload\n  case ${BOARD_NAME_SHORT} in\n    \"opizero\")\n      echo \"\uc774 \ubcf4\ub4dc\ub294 opizero \uc785\ub2c8\ub2e4.\"\n      systemctl disable autofs.service\n      systemctl disable bluetooth.service\n      systemctl enable apache2.service\n      systemctl enable mysql.service\n      systemctl disable nfs-kernel-server\n      systemctl disable nmbd.service\n      systemctl disable rpcbind.service\n      systemctl disable smbd.service\n      systemctl disable vsftpd.service\n      systemctl disable transmission-daemon.service\n      systemctl disable docker\n      systemctl disable plexmediaserver\n      systemctl disable rpimonitor\n      ;;\n    \"opizero2\")\n      echo \"\uc774 \ubcf4\ub4dc\ub294 opizero2 \uc785\ub2c8\ub2e4.\"\n      systemctl disable autofs.service\n      systemctl disable bluetooth.service\n      systemctl enable apache2.service\n      systemctl enable mysql.service\n      systemctl disable nfs-kernel-server\n      systemctl enable nmbd.service\n      systemctl disable rpcbind.service\n      systemctl enable smbd.service\n      systemctl disable vsftpd.service\n      systemctl enable transmission-daemon.service\n      systemctl disable docker\n      systemctl disable plexmediaserver\n      systemctl disable rpimonitor\n      ;;\n    \"odroid_hc2\")\n      echo \"\uc774 \ubcf4\ub4dc\ub294 odroid_hc2 \uc785\ub2c8\ub2e4.\"\n      systemctl disable autofs.service\n      systemctl disable bluetooth.service\n      systemctl enable apache2.service\n      systemctl enable mysql.service\n      systemctl enable nfs-kernel-server\n      systemctl enable nmbd.service\n      systemctl enable rpcbind.service\n      systemctl enable smbd.service\n      systemctl disable transmission-daemon.service\n      systemctl enable vsftpd.service\n      systemctl enable docker\n      systemctl disable plexmediaserver\n      systemctl disable rpimonitor\n      ;;\n    *)\n      echo \"ERROR: Unknown board name.\"\n      ;;\n  esac\n  systemctl daemon-reload\n}\n\nset_min_systemd() {\n  echo \"###########################################################\"\n  echo \"#\"\n  echo \"# \uc124\uce58\ub41c \uc911\uc694 \uc11c\ube44\uc2a4\uc758 \uc2e4\ud589\uc744 disable \ud558\uc5ec \uc11c\ube44\uc2a4 \ucd5c\uc18c\ud654\"\n  echo \"#\"\n  echo \"###########################################################\"\n\n  cd ${CURRENT_DIR}\n  systemctl daemon-reload\n  systemctl disable autofs.service\n  systemctl disable apache2.service\n  systemctl disable mysql.service\n  systemctl disable transmission-daemon.service\n  systemctl disable nmbd.service\n  systemctl disable smbd.service\n  systemctl disable bluetooth.service\n  systemctl disable nfs-kernel-server\n  systemctl disable rpcbind.service\n  systemctl disable vsftpd.service\n  systemctl disable docker.service\n  systemctl disable vncserver.service\n  systemctl disable rpimonitor.service\n  systemctl daemon-reload\n}\n\nset_max_systemd() {\n  echo \"###########################################################\"\n  echo \"#\"\n  echo \"# \uc124\uce58\ub41c \uc911\uc694 \uc11c\ube44\uc2a4\uc758 \uc2e4\ud589\uc744 enable \ud558\uc5ec \uc11c\ube44\uc2a4 \ucd5c\ub300\ud654\"\n  echo \"#\"\n  echo \"###########################################################\"\n\n  cd ${CURRENT_DIR}\n  systemctl daemon-reload\n  systemctl disable autofs.service\n  systemctl enable apache2.service\n  systemctl enable mysql.service\n  systemctl enable transmission-daemon.service\n  systemctl enable nmbd.service\n  systemctl enable smbd.service\n  systemctl enable bluetooth.service\n  systemctl enable nfs-kernel-server\n  systemctl enable rpcbind.service\n  systemctl enable vsftpd.service\n  systemctl enable docker\n  systemctl daemon-reload\n}\n\nrun_install() {\n  echo \"###########################################################\"\n  echo \"#\"\n  echo \"# Install\"\n  echo \"#\"\n  echo \"###########################################################\"\n\n  get_pydiouser_pw\n  set_ubuntu_repo\n  dpkg_init\n  update_os\n  install_additional_repo\n  install_apt_get_pkgs\n  set_locale\n  set_timezone\n  set_default_user_account\n  set_network\n  set_eth0_device_name\n  set_dns\n  set_vim\n  install_rclone\n  install_apache2\n  install_mariadb\n  install_php\n  install_letsencrypt\n  install_vsftpd\n  install_samba\n  install_transmission_daemon\n  install_nfs_server\n  install_xwindow\n  install_vncserver\n  install_xrdp\n  install_hangul_ime\n  install_audio\n  setup_pydio_db\n  install_pydio\n  install_extplorer\n  install_docker\n  setup_apache2_index\n  make_working_dir\n  set_fstab\n  set_samba\n  set_dhcpd\n  set_vsftpd\n  set_apache2\n  set_timezone_locale\n  set_sshd\n  set_os_default_systemd\n  set_ntpd\n  set_usb_device_name\n  set_hostname\n  set_insserv\n  set_mount_opt\n  set_board_name\n  set_rclocal\n  set_sshd_ciphers\n  set_letsencrypt\n  update_os\n  set_keyboard_layout\n  resize_partition\n  set_inittab\n  set_default_mount_dir\n  install_plexmediaserver\n  install_vaultwarden\n  apt purge unattended-upgrades -y\n  clean_tmps\n  copy_skel_profile\n  sync\n\n  if [ ${USE_APACHE2} = 1 ]\n  then\n    set_apache2_ssl\n  fi\n\n  set_passwords\n\n  # iptables \uc120\ud0dd (iptables-legacy\ub85c \uc120\ud0dd\ud55c\ub2e4)\n  update-alternatives --config iptables\n}\n\necho \"###########################################################\"\necho \"#\"\necho \"# Single Board Computer \ucd5c\uc801\ud654 \uc2a4\ud06c\ub9bd\ud2b8 \uc2dc\uc791\"\necho \"#\"\necho \"###########################################################\"\n\ncheck_board_name\n\ncase \"$1\" in\n  install)\n    run_install\n    set_optimize_systemd\n    ;;\n  min)\n    set_min_systemd\n    ;;\n  max)\n    set_max_systemd\n    ;;\n  systemd)\n    set_optimize_systemd\n    ;;\n  ssl)\n    set_apache2_ssl\n    ;;\n  update)\n    update_os\n    ;;\n  test)\n    # \ud568\uc218 \ud14c\uc2a4\ud2b8\ub294 \uc544\ub798\ub97c \uc218\uc815\ud55c\ub2e4.\n    systemctl restart apache2\n    ;;\n  *)\n    echo \"Usage: $0 install|min|max|systemd|ssl|update\" >&amp;2\n    exit 1\n    ;;\nesac\nsync\nsync\n<\/pre>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_import_markdown_pro_load_document_selector":0,"_import_markdown_pro_submit_text_textarea":"","site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[13],"tags":[],"class_list":["post-1073","post","type-post","status-publish","format-standard","hentry","category-computing_singleboardcomputer"],"_links":{"self":[{"href":"https:\/\/hasu0707.duckdns.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1073","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hasu0707.duckdns.org\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hasu0707.duckdns.org\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hasu0707.duckdns.org\/blog\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/hasu0707.duckdns.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1073"}],"version-history":[{"count":0,"href":"https:\/\/hasu0707.duckdns.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1073\/revisions"}],"wp:attachment":[{"href":"https:\/\/hasu0707.duckdns.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1073"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hasu0707.duckdns.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1073"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hasu0707.duckdns.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1073"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}