aboutsummarylogtreecommitdiffstats
path: root/install.sh
blob: 72dba2e20337305c04c85c72986282d227598d64 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/bin/bash
# Copyright (c) 2023-2024 Ho Kim (ho.kim@ulagbulag.io). All rights reserved.
# Use of this source code is governed by The Unlicense license that can be
# found in the LICENSE file.

# Prehibit errors
set -e -o pipefail

###########################################################
#   Installer                                             #
###########################################################

function _install_local() {
    # Configure
    if [ "$(id -u)" = "0" ]; then
        pkgdir='/usr/local'
    else
        pkgdir="${HOME}/.local"
    fi
    srcdir=$(pwd)

    # Download terms
    curl -s 'https://www.kakaocorp.com/page/service/service/KakaoTalk' -o 'terms.html'

    # Local-install
    install -Dm755 -t "${pkgdir}/bin" "${srcdir}/kakaotalk"
    install -Dm644 -t "${pkgdir}/share/applications" "${srcdir}/kakaotalk.desktop"
    install -Dm644 -t "${pkgdir}/share/icons/hicolor/256x256/apps" "${srcdir}/kakaotalk.png"
    install -Dm644 -t "${pkgdir}/share/licenses/kakaotalk" "${srcdir}/terms.html"
}

# Execute main function
_install_local "$@"