deploy-busunit-interactive 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567
  1. #!/bin/bash
  2. #
  3. # Copyright (c) 2019 Clementine Computing LLC.
  4. #
  5. # This file is part of PopuFare.
  6. #
  7. # PopuFare is free software: you can redistribute it and/or modify
  8. # it under the terms of the GNU Affero General Public License as published by
  9. # the Free Software Foundation, either version 3 of the License, or
  10. # (at your option) any later version.
  11. #
  12. # PopuFare is distributed in the hope that it will be useful,
  13. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. # GNU Affero General Public License for more details.
  16. #
  17. # You should have received a copy of the GNU Affero General Public License
  18. # along with PopuFare. If not, see <https://www.gnu.org/licenses/>.
  19. #
  20. GITURL="https://tree.clementinecomputing.com/clementinecomputing/popufare"
  21. echo ""
  22. echo ' _____ __ '
  23. echo ' | __ \ / _| '
  24. echo ' | |__) |__ _ __ _ _| |_ __ _ _ __ ___ '
  25. echo ' | ___/ _ \| '"'"'_ \| | | | _/ _` | '"'"'__/ _ \'
  26. echo ' | | | (_) | |_) | |_| | || (_| | | | __/'
  27. echo ' |_| \___/| .__/ \__,_|_| \__,_|_| \___|'
  28. echo ' | | '
  29. echo ' |_| '
  30. echo ""
  31. echo "This script attempts to setup a default installation of Popufare on a busunit (a Raspberry Pi, say)"
  32. echo "by setting up and configuring the system."
  33. echo ""
  34. echo "THIS SCRIPT CHANGES SYSTEM WIDE PARAMETERS AND COULD HAVE SERIOUS CONSEQUENCES TO THE MACHINE IT'S RUN"
  35. echo "ON."
  36. echo ""
  37. echo "As such, this scripts needs root access (via sudo)."
  38. echo "This script is meant to be a 'helper' script and isn't meant to be all encompassing. Among other things,"
  39. echo "this script will:"
  40. echo ""
  41. echo " * setup a 'bus' user and group"
  42. echo " * add the 'pi' user to the 'bus' group"
  43. echo " * clone the Popufare repo, build it's binaries and install them in the '/home/bus' user directory"
  44. echo " * copy over appropriate config files to the appropriate locations in the '/hom/ebus' user directory"
  45. echo " * setup ssh keys and credentials"
  46. echo " * setup the PPP config files"
  47. echo " * alter /boot/config.txt and /etc/modules to enable serial and sound setup"
  48. echo " * setup a 'kiosk' service for the front end DIU"
  49. echo " * setup 'rc.local' to start and monitor bus Popufare services on startup"
  50. echo " * setup legacy data directories in '/mnt/data2'"
  51. echo ""
  52. echo "Most parameters have options to prompt the user for installation."
  53. echo ""
  54. echo "This script should be used with caution and as a helper for an installation rather than a 'turn key' soluation."
  55. echo "For example, the ssh keys default to the UNSECURE 'snakeoil' default keys provided the repo for easy setup and"
  56. echo "MUST BE CHANGED for a production installation."
  57. echo ""
  58. echo "In addition, the host and other config file options should be set on a per installation basis, as should the custom"
  59. echo "DIU interface, rules, drivers.txt entries, etc."
  60. echo ""
  61. echo "This script should help in getting a Raspberry Pi ready for use with Popufare but should be thought of also as a"
  62. echo "record of what relevant files there are to change and where to look."
  63. echo ""
  64. echo "As Popufare matures, this installation script or something similar can accomodate a more seamless installation but"
  65. echo "this is what is provided now."
  66. echo ""
  67. echo "Popufare is free software so please feel free to contribute at:"
  68. echo ""
  69. echo " https://tree.clementinecomputing.com/clementinecomputing/popufare"
  70. echo ""
  71. echo -n "Hit return to continue [ok]: "
  72. read hitreturn
  73. DATESTR=`date '+%Y%m%d%H%M%S'`
  74. ###### basic sanity checks to make sure we're installing on a Raspberry Pi
  75. ######
  76. if [[ ! -e /etc/os-release ]] ; then
  77. echo -n "Are you sure you want to install? '/etc/os-release' does not exist and this system might not be a Raspberry Pi. Continue? [y/N]: "
  78. read fnfok
  79. if [[ ! "$fnfok" =~ ^[yY]$ ]] ; then
  80. echo "cancelling installalation"
  81. echo ""
  82. exit
  83. else
  84. echo "ok, continuing installation..."
  85. fi
  86. else
  87. grep -P '^PRETTY_NAME="Raspbian' /etc/os-release 2>&1 > /dev/null
  88. r=$?
  89. if [[ $r != 0 ]] ; then
  90. echo -n "Raspbian not detected in '/etc/os-release'. This might not be Raspberry Pi. Continue with installation? [y/N]: "
  91. read okcontinue
  92. if [[ ! "$okcontinue" =~ ^[yY]$ ]] ; then
  93. echo "cancelling installation"
  94. echo ""
  95. exit
  96. else
  97. echo "ok, continuing installation..."
  98. fi
  99. fi
  100. fi
  101. echo ""
  102. ######
  103. ######
  104. echo -n "Create 'bus' user? [Y/n]: "
  105. read createbususer
  106. if [[ "$createbususer" =~ ^[yY]?$ ]]; then
  107. echo "... creating 'bus' user and group"
  108. sudo adduser bus
  109. sudo usermod -a -G dialout bus
  110. fi
  111. echo ""
  112. echo -n "Add 'pi' to 'bus' group? [Y/n]: "
  113. read addpibus
  114. if [[ "$addpibus" =~ ^[yY]$ ]]; then
  115. echo "... add 'pi' to 'bus' group"
  116. sudo usermod -a -G bus pi
  117. fi
  118. echo ""
  119. echo "Creating /home/bus/(bin|database|config) with group write permissions"
  120. sudo mkdir -p /home/bus/bin
  121. sudo mkdir -p /home/bus/database
  122. sudo mkdir -p /home/bus/config
  123. sudo chown -R bus:bus /home/bus/bin
  124. sudo chown -R bus:bus /home/bus/database
  125. sudo chown -R bus:bus /home/bus/config
  126. sudo chmod -R g+w /home/bus/bin
  127. sudo chmod -R g+w /home/bus/database
  128. sudo chmod -R g+w /home/bus/config
  129. echo ""
  130. echo -n "Repo path (hit return to automatically clone the repo and use that) []: "
  131. read repolocation
  132. tmpdir=""
  133. if [[ "$repolocation" == "" ]] ; then
  134. tmpdir=`mktemp -d`
  135. repolocation="$tmpdir/popufare"
  136. pushd $tmpdir
  137. git clone "$GITURL"
  138. popd
  139. fi
  140. echo "Setting up binaries..."
  141. bd=/home/bus/popufare/busunit
  142. d=/home/bus/popufare/busunit/bin/native
  143. diudir=/home/bus/popufare/busunit/DIUv2
  144. tc=/home/bus/popufare/busunit/testing/config
  145. sudo cp -R $repolocation /home/bus
  146. sudo chown -R bus:bus /home/bus/popufare
  147. sudo bash -c " su - bus -c ' cd /home/bus/popufare/busunit ; ./build_all.sh native ; ' "
  148. sudo bash -c " cd /home/bus/bin ; ln -sf $d/avls . ; ln -sf $d/billdb . ; ln -sf $d/client_supervisor . ; ln -sf $d/debug_client . ; ln -sf $d/diu_minder . ; ln -sf $d/ipc_server . "
  149. sudo bash -c " cd /home/bus/bin ; ln -sf $d/paddlemgr . ; ln -sf $d/passdb . ; ln -sf $d/piu_minder . ; ln -sf $d/send_billing_record . ; ln -sf $d/send_magstripe . "
  150. sudo bash -c " cd /home/bus/bin ; ln -sf $d/gps_minder . "
  151. sudo bash -c " cd /home/bus/bin ; ln -sf $bd/DIUv2/diu_kiosk . "
  152. sudo bash -c " cd /home/bus/bin ; ln -sf $bd/scripts/init_bus.sh . ; ln -sf $bd/scripts/update_loop.sh . ; ln -sf $bd/scripts/setup-serial.py . ; ln -sf $bd/scripts/get_net_ids.sh . "
  153. sudo bash -c " cd /home/bus/bin ; ln -sf $bd/scripts/connection_tether.sh . ; ln -sf $bd/scripts/reset-gps.py ./reset-gps "
  154. sudo bash -c " cd /home/bus/bin ; ln -sf $bd/scripts/apply_update.sh . ; ln -sf $bd/scripts/apply_update_legacy.sh . ; ln -sf $bd/scripts/apply_update_popufare.sh "
  155. sudo bash -c " cd /home/bus/bin ; ln -sf $bd/scripts/fix_pkg_perm.sh . "
  156. sudo bash -c " cd /home/bus/config ; ln -sf $diudir/html . ; "
  157. sudo bash -c " cd /home/bus/config ; cp $bd/passdb/init.scm . ; cp $bd/passdb/rfid_patterns.txt . ; cp $bd/avls/avls_freq.txt . "
  158. sudo bash -c " cd /home/bus/config ; cp $bd/passdb/init.scm . ; cp $bd/passdb/rfid_patterns.txt . ; cp $bd/avls/avls_freq.txt . "
  159. sudo bash -c " cd /home/bus/config ; cp $tc/equipnum.txt . ; cp $tc/serial.txt serial_num "
  160. sudo bash -c " rm -f /home/bus/bin/common_values.sh ; cp $bd/scripts/common_values.sh /home/bus/bin "
  161. ## server endpoint config files
  162. ##
  163. ## sync_server_desc, sync_target, server_list, syn_port
  164. sudo cp /home/bus/popufare/busunit/testing/config/config.tgz.checksum /home/bus/config/config.tgz.checksum
  165. sudo cp /home/bus/popufare/busunit/testing/config/config.tgz.version /home/bus/config/config.tgz.version
  166. sudo cp /home/bus/popufare/busunit/testing/config/firmware.tgz.checksum /home/bus/config/firmware.tgz.checksum
  167. sudo cp /home/bus/popufare/busunit/testing/config/firmware.tgz.version /home/bus/config/firmware.tgz.version
  168. sudo cp /home/bus/popufare/busunit/testing/config/package.tgz.checksum /home/bus/config/package.tgz.checksum
  169. sudo cp /home/bus/popufare/busunit/testing/config/package.tgz.version /home/bus/config/package.tgz.version
  170. sudo mkdir -p /home/bus/config/server
  171. echo ""
  172. ##### paddle setup
  173. #####
  174. echo -n "Setup paddles? [Y/n]: "
  175. read setuppaddles
  176. if [[ "$setuppaddles" =~ ^[yY]?$ ]] ; then
  177. echo -n "Paddle location? (blank for default testing paddles) []: "
  178. read paddlocation
  179. if [[ "$paddlelocation" == "" ]] ; then
  180. paddlelocation=$bd/busunit/testing
  181. fi
  182. echo "Using '$paddlelocation/*.paddle'..."
  183. sudo bash -c " cd /home/bus/config ; cp $bd/testing/*.paddle . "
  184. fi
  185. echo ""
  186. ##### rules setup
  187. #####
  188. echo -n "Setup rules? [Y/n]: "
  189. read setuprules
  190. if [[ "$setuprules" =~ ^[yY]?$ ]] ; then
  191. echo -n "Rule file? (blank for default testing rules) []: "
  192. read rulelocation
  193. if [[ "$rulelocation" == "" ]] ; then
  194. rulelocation=$bd/testing/rules-ORG.scm
  195. fi
  196. echo "Setting up rules from '$rulelocation'..."
  197. sudo bash -c " cd /home/bus/config ; cp $rulelocation rules.scm "
  198. fi
  199. echo ""
  200. ##### equipment number setup
  201. #####
  202. echo -n "Equipment number? [9999]: "
  203. read equipnum
  204. if [[ "$equipnum" == "" ]] ; then
  205. equipnum=9999
  206. fi
  207. echo "Setting equipment number to '$equipnum'..."
  208. sudo bash -c " echo $equipnum > /home/bus/config/equipnum.txt "
  209. echo ""
  210. ##### key setup
  211. #####
  212. echo -n "Setup secure communcation setup? [Y/n]: "
  213. read tunnelsetup
  214. if [[ "$tunnelsetup" =~ ^[yY]?$ ]] ; then
  215. echo -n " 'id_rsa' private key location? (default to snakeoil) []: "
  216. read keylocation
  217. if [[ "$keylocation" == "" ]] ; then
  218. keylocation=/home/bus/popufare/server/docker/snakeoil_id_rsa
  219. fi
  220. echo " Using '$keylocation' for private key..."
  221. sudo mkdir -p /home/bus/.ssh
  222. sudo chown -R bus:bus /home/bus/.ssh
  223. sudo cp $keylocation /home/bus/.ssh/id_rsa_bus
  224. sudo chown bus:bus /home/bus/.ssh/id_rsa_bus
  225. sudo chmod 400 /home/bus/.ssh/id_rsa_bus
  226. echo ""
  227. echo -n " Tunnel port? [6055]: "
  228. read tunnelport
  229. if [[ "$tunnelport" == "" ]] ; then
  230. tunnelport=6055
  231. fi
  232. echo ""
  233. echo -n " Tunnel user and host? [bus@example.com]: "
  234. read tunnelhost
  235. if [[ "$tunnelhost" == "" ]] ; then
  236. tunnelhost='bus@example.com'
  237. fi
  238. echo ""
  239. echo -n " Adding values to '/home/bus/bin/common_values.sh'..."
  240. sed -i 's;^SSH_DEFAULT_TARGET=;#SSH_DEFAULT_TARGET=;g' /home/bus/bin/common_values.sh
  241. sed -i 's;^SSH_DEFAULT_PORT=;#SSH_DEFAULT_PORT=;g' /home/bus/bin/common_values.sh
  242. sed -i 's;^SSH_DEFAULT_IDENTITY=;#SSH_DEFAULT_IDENTITY=;g' /home/bus/bin/common_values.sh
  243. sed -i 's;^SSH_TARGET=;#SSH_TARGET=;g' /home/bus/bin/common_values.sh
  244. sed -i 's;^SSH_PORT=;#SSH_PORT=;g' /home/bus/bin/common_values.sh
  245. sed -i 's;^SSH_IDENTITY=;#SSH_IDENTITY=;g' /home/bus/bin/common_values.sh
  246. echo 'SSH_DEFAULT_TARGET="'"$tunnelhost"'"' >> /home/bus/bin/common_values.sh
  247. echo 'SSH_DEFAULT_PORT="'"$tunnelport"'"' >> /home/bus/bin/common_values.sh
  248. echo 'SSH_DEFAULT_IDENTITY="/home/bus/.ssh/id_rsa_bus"' >> /home/bus/bin/common_values.sh
  249. echo '' >> /home/bus/bin/common_values.sh
  250. echo 'SSH_TARGET="$SSH_DEFAULT_TARGET"' >> /home/bus/bin/common_values.sh
  251. echo 'SSH_PORT="$SSH_DEFAULT_PORT"' >> /home/bus/bin/common_values.sh
  252. echo 'SSH_IDENTITY="$SSH_DEFAULT_IDENTITY"' >> /home/bus/bin/common_values.sh
  253. echo ""
  254. fi
  255. echo ""
  256. ##### drivers setup
  257. #####
  258. echo -n "'drivers.txt' location? (default to test) []: "
  259. read driverlocation
  260. if [[ "$driverlocation" == "" ]] ; then
  261. driverlocation=/home/bus/popufare/busunit/DIUv2/drivers.txt
  262. fi
  263. echo "Using '$driverlocation' for drivers.txt ..."
  264. sudo cp $driverlocation /home/bus/config
  265. echo ""
  266. ##### setup fona ppp
  267. #####
  268. echo -n "Setup FONA ppp files? [Y/n]: "
  269. read setupfona
  270. if [[ "$setupfona" =~ ^[yY]?$ ]] ; then
  271. echo " /home/bus/popufare/busunit/ppp-dialer/etc/ppp/peers/fona -> /etc/ppp/peers/gprs"
  272. echo " /home/bus/popufare/busunit/ppp-dialer/etc/chatscripts/gprs -> /etc/chatscripts/gprs"
  273. sudo cp /home/bus/popufare/busunit/ppp-dialer/etc/ppp/peers/fona /etc/ppp/peers/gprs
  274. sudo cp /home/bus/popufare/busunit/ppp-dialer/etc/chatscripts/gprs /etc/chatscripts/gprs
  275. echo ""
  276. fi
  277. #echo -n "Setup FONA to connect at startup? [Y/n]: "
  278. #read fonanetwork
  279. #
  280. #if [[ "$fonanetwork" =~ ^[yY]?$ ]] ; then
  281. # echo " Creating '/etc/network/interfaces.d/fona'..."
  282. # sudo echo 'auto fona' > /etc/network/interfaces.d/fona
  283. # sudo echo 'iface fona inet ppp' >> /etc/network/interfaces.d/fona
  284. # sudo echo ' provider fona' >> /etc/network/interfaces.d/fona
  285. #fi
  286. ##### Setup config.txt
  287. #####
  288. echo -n "Setup '/boot/config.txt'? (Note this could have serious consequences, use with caution) [y/N]: "
  289. read setupconfig
  290. if [[ "$setupconfig" =~ ^[yY]$ ]] ; then
  291. tmpfn=`mktemp`
  292. bfn=`basename $tmpfn`
  293. echo " Saving 'config.txt' to /root/$bfn"
  294. sudo cp /boot/config.txt $tmpfn
  295. sudo mv $tmpfn /root/$bfn
  296. echo " adding> enable_uart=1"
  297. sudo sed -i 's;^enable_uart=;#enable_uart=;g' /boot/config.txt
  298. sudo bash -c 'echo "enable_uart=1" >> /boot/config.txt'
  299. echo " adding> dtoverlay=pi3-disable-bt"
  300. sudo sed -i 's;^dtoverlay=pi3-disable-bt;#dtoverlay=pi3-disable-bt;g' /boot/config.txt
  301. sudo bash -c 'echo "dtoverlay=pi3-disable-bt" >> /boot/config.txt'
  302. echo " adding> dtoverlay=pi3-disable-wifi"
  303. sudo sed -i 's;^dtoverlay=pi3-disable-wifi;#dtoverlay=pi3-disable-wifi;g' /boot/config.txt
  304. sudo bash -c 'echo "dtoverlay=pi3-disable-wifi" >> /boot/config.txt'
  305. fi
  306. echo ""
  307. ##### Setup sound in modules file
  308. #####
  309. echo -n "Setup sound (alter '/etc/modules')? [y/N]: "
  310. read setupsound
  311. if [[ "$setupsound" =~ ^[yY]$ ]] ; then
  312. tmpfn=`mktemp`
  313. bfn=`basename $tmpfn`
  314. echo " Saving 'modules' to /root/$bfn"
  315. sudo cp /etc/modules $tmpfn
  316. sudo mv $tmpfn /root/$bfn
  317. sudo sed -i 's;^snd-bcm2835;#snd-bcm2835;g' /etc/modules
  318. echo ' adding> snd-bcm2835'
  319. sudo bash -c 'echo "snd-bcm2835" >> /etc/modules'
  320. # disabled for now. Force audio to go through 3.5mm jack from 'raspi-config'.
  321. #
  322. # ...
  323. # trying to mitigate the 'first two seconds cutoff of audio' problem
  324. # https://github.com/alexa-pi/AlexaPi/wiki/Devices#raspberry-pi
  325. #
  326. #tfn=`mktemp`
  327. #echo '@reboot vcgencmd force_audio hdmi 1' > $tfn
  328. #echo "adding `cat $tfn`"
  329. #sudo crontab $tfn
  330. #rm $tfn
  331. fi
  332. ##### Change hostname
  333. #####
  334. echo -n "Change hostname? [y/N]: "
  335. read changehostname
  336. if [[ "$changehostname" =~ ^[yY]$ ]] ; then
  337. echo -n " New hostname [popufaredev]: "
  338. read newhostname
  339. if [[ "$newhostname" == "" ]] ; then
  340. newhostname=popufaredev
  341. fi
  342. echo " Saving /etc/hostname to /root/hostname.$DATESTR"
  343. sudo cp /etc/hostname /root/hostname.$DATESTR
  344. sudo bash -c "echo '$newhostname' > /etc/hostname"
  345. tfn=`mktemp`
  346. echo -e '127.0.0.1\tlocalhost' > $tfn
  347. echo -e '::1\t\tlocalhost ip6-localhost ip6-loopback' >> $tfn
  348. echo -e 'ff02::1\t\tip6-allnodes' >> $tfn
  349. echo -e 'ff02::2\t\tip6-allrouters' >> $tfn
  350. echo '' >> $tfn
  351. echo -e '127.0.1.1\t'"$newhostname" >> $tfn
  352. echo " Saving /etc/hosts to /root/hosts.$DATESTR"
  353. sudo cp /etc/hosts /root/hosts.$DATESTR
  354. echo " Creating new /etc/hosts file"
  355. sudo mv $tfn /etc/hosts
  356. sudo chmod 644 /etc/hosts
  357. fi
  358. ##### Setup kiosk
  359. #####
  360. echo -n "Setup kiosk service? [Y/n]: "
  361. read setupkiosk
  362. if [[ "$setupkiosk" =~ ^[yY]?$ ]] ; then
  363. echo " /home/bus/popufare/busunit/scripts/kiosk.service -> /lib/systemd/system/kiosk.service"
  364. sudo cp /home/bus/popufare/busunit/scripts/kiosk.service /lib/systemd/system/kiosk.service
  365. echo " enabling kiosk.service ('systemctl enable kiosk.service')"
  366. sudo systemctl enable kiosk.service
  367. ## Changing hostname will screw up chromium if it's already been run under a different
  368. ## hostname. Remove the files that cause the problems so Chromium can run without
  369. ## issue.
  370. ##
  371. echo " removing chromium 'Singleton*' files"
  372. sudo rm -rf /home/bus/.config/chromium/Singleton*
  373. fi
  374. echo ""
  375. ##### Setup startup
  376. #####
  377. echo -n "Setup startup 'rc.local'? [Y/n]: "
  378. read setupstartup
  379. if [[ "$setupstartup" =~ ^[yY]?$ ]] ; then
  380. tmpfn=`mktemp`
  381. bfn=`basename $tmpfn`
  382. echo " saving /etc/rc.local to /root/$bfn"
  383. sudo cp /etc/rc.local $tmpfn
  384. sudo mv $tmpfn /root/$bfn
  385. echo " /home/bus/popufare/busunit/scripts/rc.local -> /etc/rc.local"
  386. sudo cp /home/bus/popufare/busunit/scripts/rc.local /etc/rc.local
  387. fi
  388. echo ""
  389. ##### setup legacy data directories
  390. #####
  391. echo -n "Setup legacy data directories? [y/N]: "
  392. read setuplegacy
  393. if [[ "$setuplegacy" =~ ^[yY]$ ]] ; then
  394. sudo mkdir -p /mnt/data
  395. sudo mkdir -p /mnt/data2
  396. sudo chown -R bus:bus /mnt/data
  397. sudo chown -R bus:bus /mnt/data2
  398. fi
  399. #####
  400. #####
  401. ##### final permissions setup
  402. #####
  403. echo "Setting up final permission for /home/bus/(bin|database|config)"
  404. sudo chown -R bus:bus /home/bus/bin
  405. sudo chown -R bus:bus /home/bus/database
  406. sudo chown -R bus:bus /home/bus/config
  407. echo ""
  408. if [[ "$tmpdir" != '' ]] ; then
  409. echo "... should remove $tmpdir"
  410. #rm -rf $tmdpri
  411. fi
  412. echo "done"